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

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

    0

    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
    async def register_experiment(self, pool):
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                sql = "INSERT INTO " + str(self.auxname) + "." + 
                    str(self.auxtable)
                sql += " VALUES(NULL, '" 
                sql += str(self.dbname) 
                sql += "', '" 
                sql += str(self.encoder) 
                sql += "', 0, '" #goodEncoder
                sql += str(self.lattices) 
                sql += "', 0, '" #goodLattices
                sql += str(self.complex) 
                sql += "', 0, '" #goodComplex 
                sql += str(self.verges_total) 
                sql += "', 0, " #goodVerges
                sql += str(self.verges_total) 
                sql += ", '" 
                sql += str(self.trains) 
                sql += "', 0, '" #goodTrains 
                sql += str(self.tests) 
                sql += "', 0, '" #goodTests 
                sql += str(self.hypotheses) 
                sql += "', 0, '" #goodHypotheses 
                sql += str(self.type)
                sql += "')"
                await cur.execute(sql)
                await conn.commit()

    https://habr.com/ru/post/509338/
    > Web-сервер машинного обучения «ВКФ-решатель»

    gost, 03 Июля 2020

    Комментарии (28)
  3. PHP / Говнокод #26595

    +1

    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
    function connect( $db_user, $db_pass, $db_name, $db_location )
     {
     $db_location = explode( ":", $db_location );
     if ( isset( $db_location[1] ) ) {
      $this->db_object = @mysqli_connect( $db_location[0], $db_user, $db_pass, $db_name, $db_location[1] );
      }
     else {
      $this->db_object = @mysqli_connect( $db_location[0], $db_user, $db_pass, $db_name );
      }
     if ( ! $this->db_object ) {
      $this->display_error( mysqli_connect_error(  ), '1' );
      }
     $this->mysql_version = mysqli_get_server_info( $this->db_object );
     mysqli_query( $this->db_object, "SET NAMES '" . COLLATE . "'" );
     mysqli_set_charset( $this->db_object, "utf8" );
     return true;
     }

    https://profiphp.ru/useful/class_mysqli.html
    немного ООП ПХП

    MAKAKA, 22 Апреля 2020

    Комментарии (28)
  4. Perl / Говнокод #26407

    0

    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
    $the_cow = <<EOC;
          $thoughts
           $thoughts                            @@@###==#######@#@@@@@@@@@@@@
                                       @@@###====***====##########@@@@#
                                       @@@###===***++********===###@@@#
                                      #@@###==*****+++++++++**===##@@@#
                                      =@@#####==****++++++++***==###@@@
                                     #@@=##======*++*+++++***===###@@#
                                     #@#===###===#**+++++*+***==###@#
                                     @###**#=*++==#=****==#===####@@#
                                    ##====**==***+==++==##@###=###@@#
                     ###=====***=######====*******==*+*=*+***=##=###
                ###====******+++*=#####===******===**==*****====##
              #===*******++++++++=######==******#=***==******==##
            #===******+++++++++++*=#####==**+++=#=*+*==****==####
          #===****++++++++++++++++*=####=**++++**=====*+***==###=###
        ##==****++++++++++++++++++*=####===***===*=*=**+***==##**===###
       ##==***++++++++++++++++++++*#######=======*====****==##=***====###
      ##==***+++++++++++++++:+++++*######===#@@@@@@##=====##===****=====##
      #===***++++++++++++++++++++*=########===@@@@@@@######=====**++*=====##@@
     ##===*****++*++++++++++++++**=####@@@@@##=====####@##=======******====###
    ###===***********+++++++++++***=####@#@######=##@@###===#===*********====#
    ##====*************+*****+******=###@@#@##@##@@@####======*****+******====
    ###===***************************=##@@@@@@@@######=======****++++*+****===
    @##=====**************************===#########=#========*****++++++++**===
    ###======*********************========######================**********====
    ####=======****=**********==================================**=*==***=====
    ####============***====*=======================================*=**======#

    Пахом для cowsay

    ExModE, 03 Февраля 2020

    Комментарии (28)
  5. PHP / Говнокод #26000

    +1

    1. 1
    SCRIPT="<?php http_response_code(429); ob_clean(); //" php -S localhost:80 /proc/self/environ

    sql injection is for kids, grownups use environment variable injection

    Fike, 28 Октября 2019

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

    −103

    1. 1
    Я гниль.

    rHujlb, 20 Сентября 2019

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    switch (true)
    {
    
    }

    pillar_hunter, 11 Апреля 2019

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

    +1

    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
    #include <stdio.h>
    #include <stdlib.h>
    
    void myfree(void *ptr)
    {
      printf("%p\n", *(void **)ptr);
      free(*(void **)ptr);
      printf("freed!\n");
    }
    
    int main(void) {
      char *x __attribute__ (( cleanup (myfree)  )) = malloc(1);
      printf("%p\n", x);
      return 0;
    }

    https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html

    cleanup (cleanup_function)

    The cleanup attribute runs a function when the variable goes out of scope. This attribute can only be applied to auto function scope variables; it may not be applied to parameters or variables with static storage duration. The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored.

    If -fexceptions is enabled, then cleanup_function is run during the stack unwinding that happens during the processing of the exception. Note that the cleanup attribute does not allow the exception to be caught, only to perform an action. It is undefined what happens if cleanup_function does not return normally.

    j123123, 09 Апреля 2019

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

    +4

    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
    #include <inttypes.h>
    
    auto a(auto b) __attribute__ ((noinline));
    
    auto a(auto b)
    {
        return b*1.5;
    }
    
    double test1(double in)
    {
      return a(in);
    }
    
    uint64_t test2(uint64_t in)
    {
      return a(in);
    }
    
    
    /*
    https://godbolt.org/z/6ZQAnv
    
    auto a<double>(double):
            mulsd   xmm0, QWORD PTR .LC0[rip]
            ret
    test1(double):
            jmp     auto a<double>(double)
    auto a<unsigned long>(unsigned long):
            test    rdi, rdi
            js      .L5
            pxor    xmm0, xmm0
            cvtsi2sd        xmm0, rdi
            mulsd   xmm0, QWORD PTR .LC0[rip] # хули ты мне плавучего питуха в xmm0 возвращаешь?
            ret
    .L5:
            mov     rax, rdi
            and     edi, 1
            pxor    xmm0, xmm0
            shr     rax
            or      rax, rdi
            cvtsi2sd        xmm0, rax
            addsd   xmm0, xmm0
            mulsd   xmm0, QWORD PTR .LC0[rip]
            ret
    test2(unsigned long):
            sub     rsp, 8
            call    auto a<unsigned long>(unsigned long)
            movsd   xmm1, QWORD PTR .LC1[rip]
            comisd  xmm0, xmm1
            jnb     .L8
            cvttsd2si       rax, xmm0 # ну нахуй тут надо double в uint64_t конвертить
            add     rsp, 8 # почему это не делается в auto a<unsigned long>(unsigned long)
            ret
    .L8:
            subsd   xmm0, xmm1
            add     rsp, 8
            cvttsd2si       rax, xmm0
            btc     rax, 63
            ret
    .LC0:
            .long   0
            .long   1073217536
    .LC1:
            .long   0
            .long   1138753536
    
    */

    концепты-хуепты

    j123123, 23 Марта 2019

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

    0

    1. 1
    2. 2
    3. 3
    [...]
    After some configuration changes, I was able to add the 2000 ports by defining them out manually.
    [...]

    https://stackoverflow.com/questions/37992007/creating-ftp-service

    Потрудился наславу: создал 2К портов в конфигурации, вручную!

    Напомнило историю с МСДН, когда гейдев пожаловался на то, что сапер тормозит: он его создал из 5000 кнопок, которые он поставил на формочку в ВинФормс.

    Но самое говно-то не там, а в Кубернетисе, конечно.

    wvxvw, 10 Октября 2018

    Комментарии (28)
  11. Pascal / Говнокод #24826

    −3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    {$APPTYPE CONSOLE}
    Procedure G(p: pointer);
    Const
        Messages: array[false..true] of string = ('Не гниль', 'Гниль');
    Begin
        Writeln(Messages[p=nil])
    End;
    
    Begin
        G(nil)
    End.

    https://ideone.com/XWhPQf

    nu3gELL, 27 Сентября 2018

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