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

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

    +138

    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
    uses crt;
    var c1,c2,c3,k,s:integer;
    begin
    clrscr;
    s:=0;
    for c1:=1 to 9 do
    for c2:=0 to 9 do
    for c3:=0 to 9 do
    k:=c1*100+c2*10+c3+k;
    if (k mod 5 =0) then writeln('LOADING...');
    else if (k mod 7 = 0) then writeln('LOADING...');
    else s:=s+k;
    writeln('Obshie symaя=',s);
    readln;
    end.

    Вот как можно посчитать количество всех трехзначных чисел, которые не делятся на 5 или 7.

    wiapsy, 29 Марта 2011

    Комментарии (13)
  3. Си / Говнокод #5980

    +138

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    int ftp_list (int sck, int verbose) {
    	/* ... */
    	list = fopen("LIST.txt", "w");
    
    	if (list == NULL) {
    		printf("Unable to open LIST file..\n");
    		free(buffer);
    		
    		return -1;
    	}
    	/* ... */
    }

    Функция получения списка файлов в директории с FTP-сервера.
    http://sourceforge.net/projects/libftp/

    EmbargEr, 14 Марта 2011

    Комментарии (7)
  4. Си / Говнокод #5938

    +138

    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
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <ctime>
    #include <signal.h>
    #include <sys/time.h>
    #include <fcntl.h>
    #include <termios.h>
    #include <time.h>
    
    #include <iostream>
    
    using namespace std;
    
    struct termios savetty;
    struct termios tty;
    char num[]="0123456789QWERTYUIOPASDFGHJKLZXCVBNM";
            char let[]="!\",#$%&'()*qwertyuiopasdfghjklzxcvbnm";
    int t=1;
    int tm=0;
    int opnum=0;
      char buffer[30];
    char var[1000];
    char out[1000];
    struct timeval tv;
    struct timeval tv2;
    int main()
    {
      if ( !isatty(0) ) {
      fprintf (stderr, "stdin not terminal\n");
      exit (1);
      };
    
    tcgetattr (0, &tty);
    savetty = tty;
    tty.c_lflag &= ~(ICANON|ISIG);
    tty.c_cc[VMIN] = 1;
    tcsetattr (0, TCSAFLUSH, &tty);
    
      srand(time(0));
    
      int i=0;
      bool c=true;
      time_t curtime;
      int passLen=200+rand()%400;
      for(int i=0;i<=passLen;i++){
        int s=rand()%2;
        if(s==1){
          out[i]=let[rand()%37];
        } else {
          out[i]=num[rand()%35];
        };
        if((i%5)==0 && i!=0)out[i]=' ';
      };
      out[passLen]='\0';
      int tt=gettimeofday(&tv, NULL);
      if(tt<0)exit(0);
      printf("%s\n",out);
      while(out[i]!='\0')
      {
        var[i]=getchar();
        if(var[i]!=out[i]){
          opnum++;
          printf("Er%c",out[i]);
        };
        i++;
      };
      tt=gettimeofday(&tv2, NULL);
      if(tt<0)exit(0);
      int tm=tv2.tv_sec-tv.tv_sec;
      int v=(passLen*60)/tm;
      int min=tm/60;
      tm%=60;
      printf("Time %d min %d sec\n",min,tm);
      cout<<"Num of errors "<<opnum<<" Speed "<<v<<endl;
      tcsetattr (0, TCSAFLUSH, &savetty);
      
    };

    Клавиатурный тренажер

    AliceGoth, 09 Марта 2011

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

    +138

    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
    function StripLeadingComma(str)
      str = Ltrim(str)
      if len(str) > 0 then
        if Left(str,1) = "," then  str = Mid(str,2)
      end if
      if len(str) > 0 then
        if Left(str,1) = "," then  str = Mid(str,2)
      end if
      if len(str) > 0 then
        if Left(str,1) = "," then  str = Mid(str,2)
      end if
      if len(str) > 0 then
        if Left(str,1) = "," then  str = Mid(str,2)
      end if
      StripLeadingComma = str
    end function
    
    function StripTrailingComma(str)
      str = rtrim(str)
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      if len(str) > 0 then
        if Right(str,1) = "," then  str = Left(str,len(str)-1)
      end if
      StripTrailingComma = str
    end function

    Классика жанра на production. ASP, VBScript.

    Seth, 08 Ноября 2010

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

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <div class="foot-menu">
    	<ul><li><a href='/artprojects/proekty-vystavki/'>Проекты<br />Выставки</a></li></ul>
    	<ul><li><a href='/theatre/teatralqnye-proekty/'>Театральные проекты</a></li></ul>
    	<ul><li><a href='/fashion/fashion-fotosessii/'>Fashion фотосессии</a></li></ul>
    	<ul><li><a href='/portfolio/aktery--teatra-i-kino/'>Актеры<br />театра и кино</a></li></ul>
    	<ul><li><a href='/wedding/svadebnye--fotografii/'>Свадебные<br />фотографии</a></li></ul>
    	<ul><li><a href='/advert/reklama--advertising/'>Реклама<br />Advertising</a></li></ul>
    	<ul><li><a href='/celeb/raznoe--film-prod/'>Oбучение<br />master class.</a></li></ul>
    </div>

    Семантичное меню должно быть сделано списками!

    Jesus, 26 Октября 2010

    Комментарии (25)
  7. Си / Говнокод #4137

    +138

    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
    static const char*const nullp,From_[]=FROM,exflags[]=RECFLAGS,
     drcfile[]="Rcfile:",pmusage[]=PM_USAGE,*etcrc=ETCRC,
     misrecpt[]="Missing recipient\n",extrns[]="Extraneous ",ignrd[]=" ignored\n",
     pardir[]=chPARDIR,curdir[]={chCURDIR,'\0'},
     insufprivs[]="Insufficient privileges\n",
     attemptst[]="Attempt to fake stamp by";
    char*buf,*buf2,*loclock,*tolock;
    const char shell[]="SHELL",lockfile[]="LOCKFILE",newline[]="\n",binsh[]=BinSh,
     unexpeof[]="Unexpected EOL\n",*const*gargv,*const*restargv= &nullp,*sgetcp,
     pmrc[]=PROCMAILRC,*rcfile=pmrc,dirsep[]=DIRSEP,devnull[]=DevNull,
     lgname[]="LOGNAME",executing[]="Executing",oquote[]=" \"",cquote[]="\"\n",
     procmailn[]="procmail",whilstwfor[]=" whilst waiting for ",home[]="HOME",
     host[]="HOST",*defdeflock,*argv0="",errwwriting[]="Error while writing to",
     slogstr[]="%s \"%s\"",conflicting[]="Conflicting ",orgmail[]="ORGMAIL",
     exceededlb[]="Exceeded LINEBUF\n",pathtoolong[]=" path too long";
    char*Stdout;
    int retval=EX_CANTCREAT,retvl2=EXIT_SUCCESS,sh,pwait,lcking,rcstate,rc= -1,
     ignwerr,lexitcode=EXIT_SUCCESS,asgnlastf,accspooldir,crestarg,skiprc,
     savstdout,berkeley,mailfilter,erestrict;
    size_t linebuf=mx(DEFlinebuf+XTRAlinebuf,1024/*STRLEN(systm_mbox)<<1*/);
    volatile int nextexit;			       /* if termination is imminent */
    pid_t thepid;
    long filled,lastscore;	       /* the length of the mail, and the last score */
    char*themail,*thebody;			    /* the head and body of the mail */
    uid_t uid;
    gid_t gid,sgid;

    Источник: http://opensource.apple.com/source/procmail/procmail-1.2/procmail/src/procmail.c

    sanchousf, 31 Августа 2010

    Комментарии (32)
  8. Си / Говнокод #3674

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    /usr/include/sys/seg.h:
    #define shm_ptr u_ptrs.shmptr
    
    myfile.c:
    static SHRMEM_INFO_PTR shm_ptr = NULL;

    Сегодня для разнообразия системный хедер от AIX.

    Повбывав бы производителей, которые ограничивают полет моей фантазии (и так весьма приземленный) в именованиях моих личных переменных!

    nil, 09 Июля 2010

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

    +138

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    -(void)terminateSearchThreadInBackground:(NSNumber*)threadPtr
    {
        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
        SearchThread* thread = (SearchThread*)[threadPtr unsignedLongValue];
    
        delete thread;
        [pool release];
    }

    И вновь я в шоке от нашего проекта. По какой-то неведомой причине передать в качестве параметра указатель на поток - это очень не трушно. Зато значительно более трушно - создать из него NSNumber, предварительно преобразовав к unsigned long...

    Highlander, 31 Мая 2010

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

    +138

    1. 1
    txtCollimator.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";

    Прапрапрадедушка можно уже не показывать.
    Дикая вложенность UserContol в ASP.Net дает о себе знать.

    vaceknt, 11 Августа 2009

    Комментарии (12)
  11. PHP / Говнокод #1014

    +138

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    <table border='1'>
    <tr><td>Дата</td><td><input type='text' name='timer' value='05 травня 2009 року' size='100'></td></tr>
    <tr><td>Заголовок</td><td><input type='text' name='zag' value='Нові мижливості від PEOPLEnet' size='100'></td></tr>
    <tr><td>Контент</td><td><textarea rows='20' cols='80' name='content'>PEOPLEnet, лідер на ринку швидкісного мобільного Інтернету в Україні, на початку року став провайдером фіксованого Інтернету, а на даний момент збільшив зовнішню пропускну спроможність до 2 Гбіт/с!
    
    В кінці січня 2009 року PEOPLEnet заявив себе як оператор першого рівня, тим самим надавши національним Інтернет-провайдерам і мобільним абонентам в Україні можливість користування якісними послугами доступу в світову глобальну мережу Інтернет!
    <b>
    Це досягається за рахунок введення в експлуатацію двох незалежних високошвидкісних підключень до TeliaSonera Int Carrier (Франкфурт-на-Майні, Німеччина) і KPN Eurorings B. V. (Амстердам, Голландія).
    </b><br><br>
    Не дивлячись на те, що PEOPLEnet зовсім нещодавно став оператором першого рівня, вже виникла необхідність розширення зовнішніх каналів! На даний момент PEOPLEnet завершив всі необхідні роботи, збільшивши зовнішню пропускну спроможність до 2 Гбіт/с (канали TeliaSonera (Франкфурт-на-Майні) і KPN Eurorings (Амстердам) - до 1 Гбіт/с кожний)!<br><br>Швидкість підключення до UA-IX (Українська мережа обміну трафіком) складає 1 Гбіт/с.<br><br>«Наші клієнти вже встигли оцінити чудову якість послуг Інтернет, які PEOPLEnet надає безпосередньо від європейських операторів. Ми у свою чергу раді запропонувати нашим співвітчизникам нові можливості користування послугами доступу до Інтернет на абсолютно іншому якісному рівні завдяки партнерству з такими зарубіжними лідерами як TeliaSonera Int Carrier і KPN Eurorings B. V.! - відзначив генеральний директор PEOPLEnet Олег Большешапов.</textarea></td></tr>
    
    </table>

    guest, 07 Мая 2009

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