1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #11656

    +119

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    > Наша фирма разрабатывает серьезный софт на CL, Scheme и
    некоторых других языках. Но в последнее время в нашей продукции
    часто стали находить эксплоиты (что-бы не пугать наших клиентов -
    подробнее не скажу). Нам для LISP-подобных языков необходима
    DEP (Data Execution Prevention). Есть ли подобные наработки в этой области?
    Пока ничего побобного для языков этого семейства мы не находили и очень
    расстроены сложившимися обстоятельствами.

    Не мог ни запостить.

    HaskellGovno, 27 Августа 2012

    Комментарии (50)
  3. Java / Говнокод #11387

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    /**
     * Imbues the given {@link Font} with support for fallback fonts,
     * needed to display CJK characters in fonts that do not support them.
     * 
     * This is an ugly mess that depends on internal Sun APIs. Use sparingly!
     *
     * @param font the font
     * @return the composite font UI resource
     */
    public static FontUIResource getCompositeFontUIResource(final Font font) {
    	try {
    		Class<?> klass;
    		
    		try {
    			// Java 7
    			klass = Class.forName("sun.font.FontUtilities");
    		} catch (final ClassNotFoundException e) {
    			// Java 6
    			klass = Class.forName("sun.font.FontManager");
    		}
    		
    		// Invoke static method that wraps the font
    		val method = klass.getMethod("getCompositeFontUIResource", Font.class);
    		return (FontUIResource) method.invoke(null, font);
    	} catch (final ClassNotFoundException e) {
    		// Long block of catches that cannot happen on a Sun JRE
    		throw new AssertionError(e);
    	} catch (final IllegalAccessException e) {
    		throw new AssertionError(e);
    	} catch (final IllegalArgumentException e) {
    		throw new AssertionError(e);
    	} catch (final InvocationTargetException e) {
    		throw new AssertionError(e);
    	} catch (final NoSuchMethodException e) {
    		throw new AssertionError(e);
    	} catch (final SecurityException e) {
    		throw new AssertionError(e);
    	}
    }

    someone, 10 Июля 2012

    Комментарии (40)
  4. Куча / Говнокод #10861

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    Func Terminate() ; Функция выключения скрипта так как он работает в бесконечном цикле
    Exit 0
    EndFunc
    HotKeySet("{ESC}", "Terminate")  ; Привязывает функцию выключения к клавиши ESC
      
    FileChangeDir ("C:Program FilesQIPUsersXXXXXXXXXHistory"); Изменяет рабочую директорию 
      
    while 1 ; Начинает бесконечный цикл работы скрипта
    $Search=FileFindFirstFile("*.txt") ; Ищет txt-файлы в рабочей директории и возвращаемое значение поиска заносим в переменную $Search
    if $Search = -1 then ; Проверяет наличие файлов по содержимому переменной
    Sleep(1000) ; Если файлов не найдено, ждет секунду и запускает цикл сначала
    else ; Если найден txt-файл, то...
    $File=FileFindNextFile($Search) ; Заносит название файла в перменную $File
    $Log=FileRead ($File) ; Заносит содержимое файла в переменную $log
    $Log=StringSplit ($Log, @LF) ; Так как в QIP'е одно сообщение состоит из трех строк (пометка сообщения как входящее или исходящее, имя автора/дата/время отправки сообщения и само сообщение), то делает из переменной массив, в котором каждый элемент равен одной строке
    $Mess=$log[3] ; Само сообщение заносит в переменную $Mess
    FileDelete($File) ; Удаляет файл истории
    MsgBox ("0","", $Mess, 1) ; На секунду выводит на экран сообщение с командой, которую скрипт будет сейчас выполнять - это реализовано для отладки
    WinActivate ('[REGEXPCLASS:(?i){97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]') ; Делает активным окно Foobar'a, реализовал посредством обращения к классу, так как заголовок плеера меняется в зависимости от исполняемой композиции
    WinWaitActive ('[REGEXPCLASS:(?i){97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]') ; Ждет когда окно Foobar'a станет активным
      
    $Check=StringInStr($Mess, "local") ; Проверяет вхождение слова "local" в текст сообщения
    if $Check=1 then ; Если "local" находится в начале сообщения, то...
    Send("^f") ; Отправляет нажатие сочетания клавиш CTRL+F

    delay(500); //Ждет
    if ( q == 1 ) { //Сравнивает
    q += 2; } //Прибавляет

    Взято отсюда: habrahabr.ru/post/145550/

    ReckO, 09 Июня 2012

    Комментарии (19)
  5. Java / Говнокод #10394

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    /**
     * crane looks like this: ("----" - fork, "ssss" - stand, "xxx" - crane rail)
     * 
     * ----- .pos2 __/0/ ----- | sssss | sssss | xxx | ----- distance between stands .pos1 __|/distance/ ----- sssss
     * sssss xxx xxx xxx xxx xxx xxx
     * 
     * so if pos2 defined - it will be the second fork; BUT! if the flag "draw second stand" defined - that will draw or
     * not draw the stand for pos1...
     * 
     * if there is just one fork but two TUs to handle is possible:
     * 
     * xxx ________ .pos1 .pos2 ________ sssss sssss xxx xxx xxx
     */

    someone, 29 Мая 2012

    Комментарии (2)
  6. Куча / Говнокод #10330

    +119

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    s f g x = f x (g x)
    k x y   = x
    b f g x = f (g x)
    c f g x = f x g
    y f     = f (y f)
    cond p f g x = if p x then f x else g x
    fac  = y (b (cond ((==) 0) (k 1)) (b (s (*)) (c b pred)))

    HaskellGovno, 20 Мая 2012

    Комментарии (32)
  7. Куча / Говнокод #10328

    +119

    1. 1
    2. 2
    import Control.Monad.Reader
    head >>= (:)

    HaskellGovno, 20 Мая 2012

    Комментарии (3)
  8. Куча / Говнокод #10327

    +119

    1. 1
    foldr ((.) . (:)) id

    HaskellGovno, 20 Мая 2012

    Комментарии (29)
  9. C++ / Говнокод #9930

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    if(bCanPut)
    {
    	
    	m_RealTexts[nIndex].txtStartPt.x = ptStandard.x + (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtStartPt.y = ptStandard.y + (szStandard.cy-szTxtDC.cy)/2.0;
    	m_RealTexts[nIndex].txtSize = szTxtDC;
    	m_RealTexts[nIndex].txtMovePt.x = 0.0 - (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtMovePt.y = 0.0 - (szStandard.cy-szTxtDC.cy)/2.0;
    }
    else
    {
    	
    	m_RealTexts[nIndex].txtStartPt.x = ptStandard.x + (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtStartPt.y = ptStandard.y + (szStandard.cy-szTxtDC.cy)/2.0;
    	m_RealTexts[nIndex].txtSize = szTxtDC;
    	m_RealTexts[nIndex].txtMovePt.x = 0.0 - (szStandard.cx-szTxtDC.cx)/2.0;
    	m_RealTexts[nIndex].txtMovePt.y = 0.0 - (szStandard.cy-szTxtDC.cy)/2.0;
    }

    someone, 12 Апреля 2012

    Комментарии (8)
  10. C# / Говнокод #9887

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    using System;
    
    namespace IPGuard
    {
    	class Program
    	{
    		public static void Main(string[] args)
    		{
    			System.Net.IPAddress IPAdress = null;
    			System.Net.NetworkInformation.Ping Ping = null;
    			for (int IP1 = 1; IP1 < 255; IP1++)
    			{
    				for (int IP2 = 0; IP2 < 255; IP2++) 
    				{
    					for (int IP3 = 0; IP3 < 255; IP3++) 
    					{
    						for (int IP4 = 0; IP4 < 255; IP4++) 
    						{
    							IPAdress = System.Net.IPAddress.Parse(Convert.ToString(IP1) + "." + Convert.ToString(IP2) + "." + Convert.ToString(IP3) + "." + Convert.ToString(IP4));
    							Ping = new System.Net.NetworkInformation.Ping();
    							if (Ping.Send(IPAdress).Status == System.Net.NetworkInformation.IPStatus.Success) 
    							{
    								Console.WriteLine(IPAdress);
    							} 
    						}
    					}
    				}
    			}
    		}
    	}
    }

    Программа для поиска всех доступных IP адрессов.

    KusokGovna, 07 Апреля 2012

    Комментарии (21)
  11. C# / Говнокод #9796

    +119

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    string str;
            if (((str = path) != null) && (str != "basic"))
            {
                if (str == "contact")
                {
                    BindContact();
                    PageTitle = "Contact info";
                    editform.SetActiveView(vi_contact);
                    return;
                }
                if (str == "personal")
                {
                    PageTitle = "More about me";
                    BindPersonal();
                    editform.SetActiveView(vi_personal);
                    return;
                }
                if (str == "career")
                {
                    PageTitle = "Work info";
                    BindCareer();
                    editform.SetActiveView(vi_career);
                    return;
                }
                if (str == "tags")
                {
                    BindTags();
                    PageTitle = "Tags I Follow";
                    editform.SetActiveView(vi_tags);
                    return;
                }
                if (str == "biography")
                {
                    ph_page_title.Visible = false;
                    bind_biography();
                    editform.SetActiveView(vi_biography);
                    return;
                }
                if (str == "pp")
                {
                    ph_picpage_title.Visible = true;
                    ph_page_title.Visible = false;
                    PageTitle = "Edit profile photo";
                    BindProfilePhoto();
                    return;
                }
            }
    
            PageTitle = "Basic info";
            BindBasic();
            editform.SetActiveView(vi_basic);

    switch на диалекте хинди ;[ слава asp.net! убить Мартинса и Фаулера за чистокодную ересь!

    qwertylolman, 28 Марта 2012

    Комментарии (9)