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

    В номинации:
    За время:
  2. Pascal / Говнокод #13231

    +122

    1. 1
    Привет, посетите наш сайт [color=red]yadelphi.ru[/color]!

    Stertor, 25 Июня 2013

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

    +122

    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
    data IdPState a r = IdPEnd r | IdPNeedInput | IdPHaveInput a
    {-# INLINE_STREAM idP #-}
    idP :: (Monad m) => Stream l a a r m r
    idP = Stream next IdPNeedInput where
    	{-# INLINE_INNER next #-}
    	next (IdPEnd r) = Done r
    	next IdPNeedInput = NeedInput IdPHaveInput IdPEnd
    	next (IdPHaveInput a) = HaveOutput IdPNeedInput (return ()) a
    
    {-# INLINE_STREAM pipe #-}
    pipe :: Monad m => Stream l a b r0 m r1 -> Stream Void b c r1 m r2 -> Stream l a c r0 m r2
    pipe (Stream nextL sL) (Stream nextR sR) = Stream next (Right (return (), sL, Right sR)) where
    	{-# INLINE_INNER next #-}
    	next (Left r) = Done r
    	next (Right (final, sL, Right sR)) = case nextR sR of
    		Skip sR' -> Skip (Right (final, sL, Right sR'))
    		HaveOutput sR' c o -> HaveOutput (Right (final, sL, Right sR')) (c >> final) o
    		NeedInput p c -> Skip (Right (final, sL, Left (p, c)))
    		Done r -> PipeM (final >> return (Left r))
    		PipeM ms -> PipeM (liftM (Right . (final, sL,) . Right) ms)
    		Leftover _ i -> absurd i
    	next (Right (final, sL, Left (p, c))) = case nextL sL of
    		Skip sL' -> Skip (Right (final, sL', Left (p, c)))
    		HaveOutput sL' final' o -> Skip (Right (final', sL', Right (p o)))
    		NeedInput pL cL -> NeedInput (Right . (final,, Left (p, c)) . pL) (Right . (final,, Left (p, c)) . cL)
    		Done r -> Skip (Right (return (), sL, Right (c r)))
    		PipeM ms -> PipeM (liftM (Right . (final,, Left (p, c))) ms)
    		Leftover sL' i -> Leftover (Right (final, sL', Left (p, c))) i
    
    {-# INLINE_STREAM purePipe #-}
    purePipe :: (forall m . Monad m => Stream l a b r0 m r1) -> (forall m . Monad m => Stream Void b c r1 m r2) -> (forall m . Monad m => Stream l a c r0 m r2)
    purePipe (Stream nextL sL) (Stream nextR sR) = Stream next (sL, Right sR) where
    	{-# INLINE_INNER next #-}
    	next (sL, Right sR) = case nextR sR of
    		Skip sR' -> Skip (sL, Right sR')
    		HaveOutput sR' _ o -> HaveOutput (sL, Right sR') (return ()) o
    		NeedInput p c -> Skip (sL, Left (p, c))
    		Done r -> Done r
    		PipeM ms -> Skip (sL, Right (runIdentity ms))
    		Leftover _ i -> absurd i
    	next (sL, Left (p, c)) = case nextL sL of
    		Skip sL' -> Skip (sL', Left (p, c))
    		HaveOutput sL' _ o -> Skip (sL', Right (p o))
    		NeedInput pL cL -> NeedInput ((, Left (p, c)) . pL) ((, Left (p, c)) . cL)
    		Done r -> Skip (sL, Right (c r))
    		PipeM ms -> Skip (runIdentity ms, Left (p, c))
    		Leftover sL' i -> Leftover (sL', Left (p, c)) i

    qbasic, 03 Ноября 2012

    Комментарии (23)
  4. PHP / Говнокод #11876

    +122

    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
    class xxxxxxxxxx
    {
    	
    	private $string_services;
    	
    	public  function init() {
    		$this->string_services  = '<script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
    		<div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus"></div> ';
    	}
    	
    	public function run() {
    		if(empty($this->string_services))
    		{
    			$this->init();
    		}
    		echo $this->string_services;
    	}
    }

    В нашел в проекте над которым работаю.

    Vasiliy, 05 Октября 2012

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

    +122

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    gid_t sgid=0;
      cpd=getpwuid(ut);
      if(argc<1){
          fprintf(stderr,"%s: uid not specified:%s\n",argv[0]);
          exit(EXIT_FAILURE);
      }
      suid= atolevl(argv[1]);
      printf("uid %d\n",suid);
      if(cpd==NULL){
       fprintf(stderr,"%s: cant get current user:%s\n",argv[0]);
       exit(-1);
      }
      printf("%s: %s\n",cpd->pw_name,cpd->pw_passwd);
      strcpy(user_name,cpd->pw_name);
      fp=fopen(fpass,"r");
      if(fp==NULL){
        fprintf(stderr,"can't open file %s:%s",fpass,argv[0]);
      }
      cpd = fgetpwent(fp);
      if(cpd==NULL){
        fprintf(stderr,"no find user",fpass,argv[0]);
      }
      while((cpd=fgetpwent(fp))!=NULL){
        if(strcmp(cpd->pw_name,user_name)==0){
          if(strmycpy(salt,cpd->pw_passwd,3,19)==NULL){
    	fprintf(stderr,"can't choose salt:%s\n",argv[0]);
    	exit(-1);
          };
          strcpy(pass,cpd->pw_passwd);
          if(strmycpy(mt,cpd->pw_passwd,0,2)==NULL){
    	fprintf(stderr,"can't choose salt:%s\n",argv[0]);
    	exit(-1);
          };
    	printf("%s: %s: salt: %s\n",\
    	cpd->pw_name,cpd->pw_passwd,salt);
    	sz=strlen(cpd->pw_passwd);
    	printf("sz: %d\n",sz);
        }
      }
      fclose(fp);
      int fl=0;
          size_t i=0;
         for(i=0;i<=10 && fl<2;i++){
           if(pass[i]=='$'){fl++;printf("fl %d\n",fl);}
         }
         static char mtt[5];
         if(fl==2){
          
          strmycpy(mtt,pass,1,i-1); 
         }
         printf("%s\n ",mtt);
         write(1,"Scheme: ",8);
          if(strcmp(mtt,"")==0)write(1,"des_crypt\n",10);
      if(strcmp(mtt,"1")==0)write(1,"md5_crypt\n",10);
      if(strcmp(mtt,"2")==0 || strcmp(mt,"2a")==0 || strcmp(mt,"2x")==0 || strcmp(mt,"2y")==0)write(1,"bcrypt\n",7);
      if(strcmp(mtt,"6")==0)write(1,"sha512_crypt\n",13);
      if(strcmp(mtt,"3")==0)write(1,"bsd_nhash\n",10);
      if(strcmp(mtt,"5")==0)write(1,"sha256_crypt\n",13);
      if(strcmp(mtt,"md5")==0 )write(1,"sun_md5_crypt\n",14);
      if(strcmp(mtt,"sha1")==0 )write(1,"sha1_crypt\n",11);
      
      char *prompt="Please enter your password: ";
      char *mpass=getpass(prompt);
    	char *mypass=crypt(mpass,pass);
      if(strcmp(mypass,pass)==0){
        printf("Password is ok\n");
    if(seteuid(0)==-1 || setuid(0)==-1){
           fprintf(stderr, "%s: can't change euid to %d: %s\n", argv[0],suid,
     		strerror(errno));
     	exit(EXIT_FAILURE);
         }
        if(setuid(suid)==-1){
           fprintf(stderr, "%s: can't change uid to %d: %s\n", argv[0],suid,
     		strerror(errno));
     	exit(EXIT_FAILURE);
         }
         if(seteuid(suid)==-1){
           fprintf(stderr, "%s: can't change euid to %d: %s\n", argv[0],suid,
     		strerror(errno));
     	exit(EXIT_FAILURE);
         }
         if(suid==0){
           if(setresuid(eut,suid,eut)==-1){
    	fprintf(stderr, "%s: can't change euid to %d: %s\n", argv[0],suid,
    		strerror(errno));
    	exit(EXIT_FAILURE);
         };
         }
         pid_t pt=fork();
         if(pt>0){
         execv(shell,NULL);
         abort();
         } else if(pt==0){
          waitpid(pt,&status,WEXITED);
           abort();
         }
      } else printf("The password isn't OK\n");
      abort();
      return 0;
    };

    Тупая программа стаем рутом sudo chown root:root sume && sudo chmod u+s sume

    AliceGoth, 23 Сентября 2012

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

    +122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Уважаемые знатоки, вопрос такой:
    sizeof('a') для  С и Сpp имеет различное значение и это вам известно из 
    C99 Standard: 6.4.4.4 Character constants  Para 2
    и
    C++03 Standard: 2.13.2 Character literals Para 1. 
    
    Интересует ваше предположение/мнение/версия/etc, для чего такое приняли?

    Стандартоособенности и внезапнонесовместимости.

    sayidandrtfm, 15 Июля 2012

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

    +122

    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
    <table border='0' cellspacing='1' cellspacing='1' width=707>
      <thead>
        <a>
          <th width=44 align='center'>
            <IMG name='Image300' SRC='images/check.gif' height='22' width='44'>
          </th>
        </a>
        <a href=javascript:SortForm('Agent_Name');>
          <th  class='header'>Name</th>
        </a>
        <a href=javascript:SortForm('Description');>
          <th class='header'>Description</th>
        </a>
      </thead>

    Сортировка таблицы по полю при нажатии на заголовок. Код отформатирован для читабельности.

    roman-kashitsyn, 28 Мая 2012

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

    +122

    1. 1
    Console.WriteLine(Math.Sin(long.MaxValue));

    Выведет 9,22337203685478E+18

    koodeer, 26 Апреля 2012

    Комментарии (62)
  9. PHP / Говнокод #10012

    +122

    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
    <?php
    $pictures =new Array(4);
    pictures[0]="1.jpg";
    pictures[1]="2.png";
    pictures[2]="3.jpg";
    pictures[3]="4.jpg";
    global $i=0;
    function Next(){
    if($i==3)
    $i=0;
    else
    $i++;
    document.getElementById('pic').setAttribute("src", picture[i]);
    }
    function Prev(){
    if($i==0)
    $i=3;
    else
    $i--;
    document.getElementById('pic').setAttribute("src", picture[i]);
    }
    ?>

    Отличный салат.

    cthulhu25, 22 Апреля 2012

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

    +122

    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
    switch (count)
    {
    	case 2:
    		return Tuple.Create(col[1]);
    	case 3:
    		return Tuple.Create(col[1], col[2]);
    	case 4:
    		return Tuple.Create(col[1], col[2], col[3]);
    	case 5:
    		return Tuple.Create(col[1], col[2], col[3], col[4]);
    	case 6:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6]);
    	case 8:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7]);
    	case 9:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], col[7]);
    	case 10:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8]));
    	case 11:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9]));
    	case 12:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10]));
    	case 13:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10], col[11]));
    	case 14:
    		return Tuple.Create(col[1], col[2], col[3], col[4], col[5], col[6], col[7], Tuple.Create(col[8], col[9], col[10], col[11], col[12]));
    	default:
    		throw new ArgumentOutOfRangeException("count", count, "Can't convert array to tuple.");
    }

    a553r7fa1L3d, 05 Апреля 2012

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

    +122

    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
    else
                    {
                        if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text)) textBox1.ForeColor = Color.Red; else textBox1.ForeColor = Color.Black;
                        if ((textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text)) textBox2.ForeColor = Color.Red; else textBox2.ForeColor = Color.Black;
                        if ((textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text)) textBox3.ForeColor = Color.Red; else textBox3.ForeColor = Color.Black;
                        if ((textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text)) textBox4.ForeColor = Color.Red; else textBox4.ForeColor = Color.Black;
                        if ((textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text)) textBox5.ForeColor = Color.Red; else textBox5.ForeColor = Color.Black;
                        if ((textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text)) textBox6.ForeColor = Color.Red; else textBox6.ForeColor = Color.Black;
                        if ((textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text)) textBox7.ForeColor = Color.Red; else textBox7.ForeColor = Color.Black;
                        if ((textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text)) textBox8.ForeColor = Color.Red; else textBox8.ForeColor = Color.Black;
                        if ((textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) textBox9.ForeColor = Color.Red; else textBox9.ForeColor = Color.Black;
                        if ((textBox1.Text == textBox2.Text) | (textBox1.Text == textBox3.Text) | (textBox1.Text == textBox4.Text) | (textBox1.Text == textBox7.Text) |
                            (textBox2.Text == textBox1.Text) | (textBox2.Text == textBox3.Text) | (textBox2.Text == textBox5.Text) | (textBox2.Text == textBox8.Text) |
                            (textBox3.Text == textBox1.Text) | (textBox3.Text == textBox2.Text) | (textBox3.Text == textBox6.Text) | (textBox3.Text == textBox9.Text) |
                            (textBox4.Text == textBox5.Text) | (textBox4.Text == textBox6.Text) | (textBox4.Text == textBox1.Text) | (textBox4.Text == textBox7.Text) |
                            (textBox5.Text == textBox4.Text) | (textBox5.Text == textBox6.Text) | (textBox5.Text == textBox2.Text) | (textBox5.Text == textBox8.Text) |
                            (textBox6.Text == textBox4.Text) | (textBox6.Text == textBox5.Text) | (textBox6.Text == textBox3.Text) | (textBox6.Text == textBox9.Text) |
                            (textBox7.Text == textBox8.Text) | (textBox7.Text == textBox9.Text) | (textBox7.Text == textBox1.Text) | (textBox7.Text == textBox4.Text) |
                            (textBox8.Text == textBox7.Text) | (textBox8.Text == textBox9.Text) | (textBox8.Text == textBox2.Text) | (textBox8.Text == textBox5.Text) |
                            (textBox9.Text == textBox7.Text) | (textBox9.Text == textBox8.Text) | (textBox9.Text == textBox3.Text) | (textBox9.Text == textBox6.Text)) ;
                        else
                        {
                            label1.Visible = true;
                            label2.Visible = true;
                        }

    Удивлению нет границ! Полная версия: http://pastebin.com/S2getyHn

    P4R4, 22 Марта 2012

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