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

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

    +132

    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
    if instance_number(global.obj_childwindow) exit
    global.oid=id
    no_etazh=etazh
    no_x=x/16
    no_y=y/16
    no_name=name
    no_room=myroom
    global.param_window=chw_create(view_xview[0]+view_wview[0]/2-168,view_yview[0]+view_hview[0]/2-150,336,364,"Параметры объекта: Игрок")
    with global.param_window
    {
    step="editor_controller.selected=global.oid"
    draw="draw_set_font(font);draw_text_color(x+224,y+94,'Этаж:',0,0,0,0,1);draw_text_color(txtx.x+10,txtx.y-18,'Позиция',0,0,0,0,1);draw_text_color(txtx.x-14,txtx.y+2,'X',0,0,0,0,1);draw_text_color(txty.x-14,txty.y+2,'Y',0,0,0,0,1)"
    
    ok_btn=btn_create(16,308,80,24,"ОК","chw_destroy(parent_id);global.active=1",1)
    close_btn=btn_create(242,308,80,24,"Отмена","global.param_window.text_room=string(global.oid.no_room);global.param_window.text_name.text=global.oid.no_name;global.param_window.txtx.text=string(global.oid.no_x);global.param_window.txty.text=string(global.oid.no_y);global.param_window.floors.current_selected=global.oid.no_etazh;chw_destroy(parent_id);global.active=1",1)
    
    text_name=txt_create(80,14,112,"Название")
    with text_name {step="global.oid.name=text;with editor_controller.text_name txt_set_text(other.text)";txt_set_text(global.oid.name)}
    text_room=txt_create(80,46,112,"Комната")
    with text_room {step="if string_digits(text)!=text txt_set_text(string_digits(text));if real(text)<0 || real(text)>999 txt_set_text(string(max(min(real(text),999),0)));global.oid.myroom=real(text);with editor_controller.text_room txt_set_text(other.text)";txt_set_text(string(global.oid.myroom))}
    
    floors=list_create(176,96,144,128)
    with floors {list_copy(editor_controller.list,0,editor_controller.list.itemnmb);current_selected=editor_controller.list.current_selected;step="editor_controller.list.current_selected=current_selected;global.oid.etazh=editor_controller.list.current_selected"}
    txtx=txt_create(208,248,74)
    with txtx {txt_set_text(string(global.oid.x/16));step="if (text!=string_digits(text) || real(string_digits(text))<0 || real(string_digits(text))>(room_width-208)/16) txt_set_text(string(limit(real(string_digits(text)),0,(room_width-208)/16-1)));global.oid.x=real(text)*16"}
    txty=txt_create(208,280,74)
    with txty {txt_set_text(string(global.oid.y/16));step="if (text!=string_digits(text) || real(string_digits(text))<0 || real(string_digits(text))>(room_height-16)/16) txt_set_text(string(limit(real(string_digits(text)),0,(room_height-16)/16-1)));global.oid.y=real(text)*16"}
    }
    global.active=0

    Сам не могу поверить, что я такое мог написать.
    Это код моего редактора карт, написанный 2 года назад на Game Maker.

    gammaker, 22 Сентября 2011

    Комментарии (16)
  3. Assembler / Говнокод #7302

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    movq	(%rdi), %rdi	# this.11_6->_M_impl._M_start, D.49210
    	testq	%rdi, %rdi	# D.49210
    	je	.L1	#,
    	jmp	_ZdlPv	#
    	.p2align 5,,7
    	.p2align 3
    .L1:
    	rep
    	ret

    Говнокод от компилятора g++-4.5.2

    Почему нельзя было сделать так:
    movq (%rdi), %rdi # this.11_6->_M_impl._M_start, D.49210
    testq %rdi, %rdi # D.49210
    jne _ZdlPv #,
    rep
    ret

    Не понимаю...

    wecanstoptrain, 21 Июля 2011

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

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #                <connection id="ftp_cpe02">
    #                        <user value="*****" />
    #                        <password value="*****" />
    #                        <host value="*********" />
    #                        <passive value="true" />
    #                        <path value="/var/logs" />
    #                </connection>

    Новый опус от техподдержки.
    Раздел как бэ закомментирован

    SadKo, 19 Июля 2011

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

    +132

    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
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    open System.Net
    open System.Text.RegularExpressions
    open System.Text
    open System
    
    type userInfo = 
        { User : string;
          Rating : double;}
    
    let  mutable Users  = []
    
    (* Заполняем списки юзверей *)
    let getUsersInfo s = 
        let mutable  m = Regex.Match(s, @">(?<user>[^<]+)</a></td>\s+<td class=""strength"">[^<]+</td>\s+<td class=""rating""><strong>(?<rating>[^<]+)") //+ Оптимизировать регулярку. (Page 2)
        while(m.Success) do
            let info = {User = m.Groups.["user"].Value;  Rating =  m.Groups.["rating"].Value |> double}
            Users <- Users @ [info]
            m <- m.NextMatch()
        
    (* скачивание страницы по индексу *)
    let getSourceForUsers p = 
        let url = "http://freehabr.ru/people/good/page" + string(p)
        let wc = new WebClient();
        let s = wc.DownloadString(url);
        printfn "Разобрана %i страница" p
        getUsersInfo s
    
    (* получить индекс последней страницы *)    
    let getLastPage =  
        let wc = new WebClient()
        wc.Encoding <- Encoding.UTF8
        let s = wc.DownloadString "http://freehabr.ru/people/"
        Regex.Match(s,@"(?<=e)\d+(?=/"">п)").Value |> int
    
    let lastPage = getLastPage
    
    let printList a =
        a |> List.iter (fun x -> printfn "%s рейтинг - %.2f" x.User x.Rating)
        Console.ReadKey() |> ignore
     
    [<EntryPoint>]
    let main(args:string[]) =
      printfn "Парсер юзерей с положительным (или нулевым) рейтингом"
      printfn "%i -- Количество страниц" lastPage
      printfn "scan --XX - __ Cбор списка пользователей от первой страницы до XX"
      printfn "scan --YY --XX __ Сбор списка пользователей от YY страницы до XX. \nXX не может быть больше, чем максимальное количество страниц в списках юзеров с положительной кармой"
    
      let userInput = Console.ReadLine();
      match userInput with
      | _ when userInput.StartsWith "scan --" -> let a = Regex.Split(userInput,"--")
                                                 let dig = a.[1] |> int
                                                 if a.Length = 2 then  // для первого варианта                                               
                                                    [1 .. dig] 
                                                    |> List.iter getSourceForUsers
                                                 else // для второго
                                                    [ dig .. a.[2] |> int ] 
                                                    |> List.iter getSourceForUsers
                                                 printfn "~~~\nЮзеры посчитаны"
                                                    
                                              
      | _ -> printfn "Завершение приложения"
             exit(1) 
      
      printfn "~~~~\nОбработка списка\n~~~~"
      printfn "usersGreaterRate --XX __ Показать пользователей,\nу которых рейтинг больше или равен XX"
      printfn "usersLessRate --XX __ Показать пользователей,\nу которых рейтинг меньше или равен XX"
      printfn "usersWithNamesBegins --String __ Показать пользователей,\nу которых имя начинается со строки String"
      let usersOper = Console.ReadLine()
      let param = Regex.Split(usersOper," --").[1] 
      match usersOper with
      | _ when usersOper.StartsWith "usersGreaterRate --" -> Users 
                                                             |> List.filter (fun x -> x.Rating > (param |> double))
                                                             |> printList
      | _ when usersOper.StartsWith "usersLessRate --" -> Users
                                                          |> List.filter (fun x -> x.Rating < (param |> double))
                                                          |> printList
      | _ when usersOper.StartsWith "usersWithNamesBegins --" -> Users
                                                                    |> List.filter (fun x -> x.User.StartsWith param)
                                                                    |> printList
      | _ -> printfn "Завершение приложения"
             exit(1) 
      0

    qbasic, 12 Июля 2011

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

    +132

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <div class="su_mainText">
           <h2>
                    <p>Thank you for taking the time to provide us with your suggestion(s).</p>
                    <p>Out intent is to continually enhance our program and we are</p>
                    <p>looking to our customer for guidance.</p>
            </h2>
    </div>

    ....задаем стиль текста на странице

    _vinka, 06 Июля 2011

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

    +132

    1. 1
    for(dynamic o=0; o!=237; o++){

    Ох, что мне досталось поддерживать... dynamic почти везде... :( Кто это написал??? Хочу этого человека взять и @#$%^&... :(

    Говногость, 19 Июня 2011

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

    +132

    1. 1
    <span style="font-weight:bold"><span style="font-style:italic"><span style="text-decoration:underline"> Превед! </span></span></span>

    <b><i><u>? Не, не слышал

    jQuery, 04 Мая 2011

    Комментарии (11)
  9. Си / Говнокод #6543

    +132

    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
    static int
    find_entry (int store, int entry, int *buffer)
      {
        int
    	i,
    	next;
    
        if ((entry <= 0) || (entry > Headers[store].size))
          {
    	*buffer = EOL;
    	return (ST_NOENTRY);
          }
    
        if (entry < (Headers[store].size/2))
          {
    		/* search forwards through store */
    		next = Headers[store].first;
    		for (i=1; i<entry; i++)
    			next = Buffers[next].next;
    		*buffer = next;
          }
    	  else
          {
    		/* search backwards through store */
    		next = Headers[store].last;
    		for (i=Headers[store].size; i>entry; i--)
    			next = Buffers[next].prev;
    		*buffer = next;
          }
    
        return (SUCCESS);
      }

    древний и заведомо рабочий код. а ищем-то что?

    ilardm, 04 Мая 2011

    Комментарии (12)
  10. Си / Говнокод #6361

    +132

    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
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    int cont[15];
    bool stop_access = false;
    struct cel container[MAX_SIZE];
    struct termios savetty;
    struct termios tty;
    pthread_t thread[100];
    pthread_mutexattr_t muattr; 
    pthread_mutex_t count_mutex; 
    int icn=0;//Number elements in container
    static int x;
    static int y;
    void* stack;
      pthread_mutex_unlock(&count_mutex); 
      sleep(1);
    };
    return (void*)1;
    };
    
    void* main_thread(void *arg){
       while(true){
       sleep(1);
      char ic=getchar();
        if(ic=='\n'){
          printf("Thread\tnumber elements\n");
          for(int i=0;i<=x;i++)
          pthread_cancel(thread[i]);
          for(int i=0;i<=x;i++){
    	printf("%d ",i);
    	int cn=0;
    	for(int j=0;j<=icn;j++){
    	  if(container[j].thrnm==i){ cn++; };
    	  };
    	  printf("\t%d\n",cn);
    	};
    	printf("container number element %d\n",icn);
    	exit(0);
          };
     };
      
    };
    
    int main(int argc, char * argv[])
    {
      icn=0;
      
    if(argc<2){printf("1 arg n number of threads, 2 argument maximum number element in container");exit(0);};
    x=atoi(argv[1]);
    y=atoi(argv[2]);
    if(x>64){printf("Число потоков должно быть меньше 64\n");exit(0);}
    printf("x %d y %d\n",x,y);
    //mutex initialization
    int ret;
    ret = pthread_mutexattr_init(&muattr);
    
      //switch the keyboard to noncanonical mode
    pid_t pt=tcgetsid(0);
     // char *var=ctermid (NULL);
      printf("pid %d\n",pt);
    tcgetattr (0, &tty);
    savetty = tty;
    tty.c_lflag &= ~(ICANON);
    tty.c_cc[VMIN] = 1;
    tcsetattr (0, TCSAFLUSH, &tty);
    pthread_t mthr;
     pthread_attr_t mattr;
      pthread_attr_init(&mattr);
      pthread_attr_setdetachstate(&mattr,PTHREAD_CREATE_DETACHED);
    int mres = pthread_create(&mthr, &mattr, main_thread, NULL);
      if (mres == 0) {
        printf("Creating main thread\n");
        sleep(0.7);
      } else {
        perror("Creating the main first thread");
      return EXIT_FAILURE;
      }
      
      
    for(int i=0;i<=x;i++){
      int id1, id2, result;
      id1 = 1;
      pthread_attr_t attr;
      pthread_attr_init(&attr);
      // отсоединенный поток - не ждем его возврата
      pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
      result = pthread_create(&thread[i], &attr, thread_func, &i);
      if (result == 0) {
        printf("Creating thread %d\n",i);
        sleep(1);
      } else {
        perror("Creating the first thread");

    AliceGoth, 14 Апреля 2011

    Комментарии (5)
  11. Куча / Говнокод #6328

    +132

    1. 1
    2. 2
    3. 3
    <A\n <BR / href="http://www.site.ru" >Некий текст</A>
    <P Иванов id=Значение_без_кавычек_кирилицей><P>Некий текст</P>
    <SPAN><SPAN Л.И. Некий текст</SPAN>

    Вот несколько кривых кусков HTML кода с одного государственного портала

    BlackMonolit, 13 Апреля 2011

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