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

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    Число 1 = 1;
    Число номер 2 = 2;
    Сумма = Число 1 + Число номер 2;
    print Сумма; print; 
    function Открытие двери в поезде() {
      print "Дверь открыта"; print;
    }
    Открытие двери в поезде();

    https://habr.com/ru/sandbox/133385/

    OCETuHCKuu_nemyx, 06 Октября 2019

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

    +1

    1. 1
    2. 2
    3. 3
    size_t 	nChLen = it_ch_end - it_ch;
    
    до меня дошло не сразу.

    OlegUP, 03 Октября 2019

    Комментарии (18)
  4. Pascal / Говнокод #25892

    +1

    1. 1
    https://pastebin.com/8c6KxabR

    Бон аппетит, блядь.

    cmepmop, 01 Октября 2019

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

    +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
    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
    <?php
    $fin = fopen($argv[1], 'r');
    if($fin === false) die();
    
    $fout = fopen('dump.csv', 'w');
    if($fout === false) die();
    
    while(!feof($fin)) {
        $rawline = fgets($fin);
        if(!preg_match('#\[+(.*)\]+,?#', $rawline, $matches)) continue;
        $fields = str_getcsv($matches[1]);
        $parts = explode(')', $fields[0]);
        if(count($parts) < 2) continue;
        list($host, $path) = $parts;
        $domains = explode(',', $host);
        $dirs    = explode('/', $path);
        if($domains[0] === 'ru' && $domains[1] === 'mail') {
            $email = $dirs[2] . '@' . $dirs[1] . '.ru';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
        } else if($domains[0] === 'ru' && $domains[1] === 'rambler' && $dirs[1] = 'users') {
            if(strpos($dirs[2], '@') === false) {
                $email = $dirs[2] . '@rambler.ru';
            } else {
                $email = $dirs[2];
            }
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
        } else if($domains[0] === 'ru' && $domains[1] === 'ya') {
            $email = $domains[2] . '@yandex.ru';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $domains[2] . '@yandex.by';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $domains[2] . '@yandex.ua';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $domains[2] . '@yandex.kz';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $domains[2] . '@yandex.com';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $domains[2] . '@ya.ru';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
        } else if($domains[0] === 'ru' && $domains[1] === 'yandex' && $dirs[1] = 'users') {
            $email = $dirs[2] . '@yandex.ru';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $dirs[2] . '@yandex.by';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $dirs[2] . '@yandex.ua';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $dirs[2] . '@yandex.kz';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $dirs[2] . '@yandex.com';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
            $email = $dirs[2] . '@ya.ru';
            $hash = md5($email);
            fputcsv($fout, array($hash, $email));
        }
    }
    
    fclose($fout);
    fclose($fin);

    Генератор радужных таблиц для е-мейлов.

    Особенность программы в том, что «JSON» парсится как «CSV» в целях экономии оперативки.

    ropuJIJIa, 01 Октября 2019

    Комментарии (34)
  6. Java / Говнокод #25882

    +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
    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
    public class Main {
        public static void main(String[] args) {
            ThreeD[] f = {new ThreeD(5, 9, 7), new FourD(1,3,8,5)};
            Coords<ThreeD> c = new Coords<>(f);
            showXYZ(c);
            FiveD[] x = new FiveD[] {new FiveD(11,22,3,4, 123)};
            Coords<FiveD> b = new Coords<>(x);
            showAll(b);
            FiveD[] z = new FiveD[] {new FiveD(1,2,1,6,5)};
            Coords<FiveD> zz = new Coords<>(z);
        }
        private static void showXY(Coords<? super FourD> c) {
            for(int i = 0; i < c.coords.length; i++) {
                System.out.println(c.coords[i].x +" "+ c.coords[i].y+" ");
            }
        }
    
        private static void showXYZ(Coords<? extends ThreeD> c) {
            for(int i = 0; i < c.coords.length; i++) {
                System.out.println(c.coords[i].x +" "+ c.coords[i].y+" "+c.coords[i].z+" ");
            }
        }
        private static void showAll(Coords<? extends FiveD> c) {
            for(int i = 0; i < c.coords.length; i++) {
                System.out.println(c.coords[i].x +" "+ c.coords[i].y+" "+c.coords[i].z+" "+c.coords[i].t+" "+c.coords[i].m);
            }
        }
    }
    
    class Coords<T extends TwoD> {
        T[] coords;
        Coords(T[] o) {
            coords = o;
        }
    }
    
    class TwoD {
        int x,y;
        TwoD(int a, int b) {
            x = a;
            y = b;
        }
    }
    class ThreeD extends TwoD {
        int z;
        ThreeD(int a, int b, int c) {
            super(a, b);
            z = c;
        }
    }
    class FourD extends ThreeD {
        int t;
        FourD(int a, int b, int c, int d) {
            super(a, b, c);
            t = d;
        }
    }
    class FiveD extends FourD {
        int m;
        FiveD(int a, int b, int c, int d, int e) {
            super(a, b, c, d);
            m = e;
        }
    }

    говнецо или нет

    codershitter, 29 Сентября 2019

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

    +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
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    //Создадим типизированные колонки в ТЗ
    	Запрос = Новый Запрос("ВЫБРАТЬ
    	                      |	CRM_ЗначенияРеквизитовТрафика.РеквизитТрафика КАК РеквизитТрафика,
    	                      |	CRM_ЗначенияРеквизитовТрафика.ЗначениеРеквизита КАК ЗначениеРеквизита,
    	                      |	CRM_ЗначенияРеквизитовТрафика.ИдентификаторТрафика
    	                      |ИЗ
    	                      |	РегистрСведений.CRM_ЗначенияРеквизитовТрафика КАК CRM_ЗначенияРеквизитовТрафика
    	                      |ГДЕ
    	                      |	CRM_ЗначенияРеквизитовТрафика.ИдентификаторТрафика ЕСТЬ NULL");
    	РеквизитыТрафика = Запрос.Выполнить().Выгрузить();
    	//Удалим "лишние записи" на всякий случай
    	РеквизитыТрафика.Очистить();
    	
    	//Заполним реквизиты трафика
    	
    	//Логин клиента из онлайнконсультанта
    	НовоеСвойство = РеквизитыТрафика.Добавить();
    	НовоеСвойство.ИдентификаторТрафика = Идентификатор;
    	НовоеСвойство.РеквизитТрафика = ПланыВидовХарактеристик.CRM_РеквизитыТрафика.ОнлайнКонсультантЛогинКлиента;
    	НовоеСвойство.ЗначениеРеквизита = Описание.ЛогинКлиента;
    
    	//Запись в регистр
    	НЗ = РегистрыСведений.CRM_ЗначенияРеквизитовТрафика.СоздатьНаборЗаписей();
    	НЗ.Отбор.ИдентификаторТрафика.Установить(Идентификатор);
    	НЗ.Прочитать();
    	НЗ.Загрузить(РеквизитыТрафика);
    	Нз.Записать();

    Зачем столько раз читать регистр не понятно. Для чего вообще нужна типизированная таблица если используется прочитать? Одни вопросы.

    NioGoth, 27 Сентября 2019

    Комментарии (8)
  8. JavaScript / Говнокод #25873

    +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
    /**
       * The expanded S-box and inverse S-box tables.  These will be computed
       * on the client so that we don't have to send them down the wire.
       *
       * There are two tables, _tables[0] is for encryption and
       * _tables[1] is for decryption.
       *
       * The first 4 sub-tables are the expanded S-box with MixColumns.  The
       * last (_tables[01][4]) is the S-box itself.
       *
       * @private
       */
      _tables: [[[],[],[],[],[]],[[],[],[],[],[]]],

    booratihno, 26 Сентября 2019

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

    +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
    18. 18
    There was once a programmer who was attached to the court of the
    warlord Wu.  The warlord asked the programmer: "Which is easier to design:
    an accounting package or an operating system?"
            "An operating system," replied the programmer.
            The warlord uttered an exclamation of disbelief. "Surely an
    accounting package is trivial next to the complexity of an operating
    system," he said.
            "Not so," said the programmer, "when designing an accounting package,
    the programmer operates as a mediator between people having different ideas:
    how it must operate, how its reports must appear, and how it must conform to
    tax laws.  By contrast, an operating system is not limited by outward
    appearances.  When designing an operating system, the programmer seeks the
    simplest harmony between machine and ideas.  This is why an operating system
    is easier to design."
            The warlord of Wu nodded and smiled. "That is all good and well,"
    he said, "but which is easier to debug?"
            The programmer made no reply.
                    -- Geoffrey James, "The Tao of Programming"

    друзья, а как думаете вы?
    что проще делать, а что дебажить?

    MAPTbIwKA, 26 Сентября 2019

    Комментарии (18)
  10. Assembler / Говнокод #25867

    +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
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    #include <stdbool.h>
    
    bool impl(bool a, bool b) // ->
    {
        return (!a || b);
    }
    
    bool always_true(bool a, bool b)
    {
        return (impl(a,b) == impl(b,a)) == (a == b); // ( (a -> b) = (b -> a) ) = (a = b) tautology
    }
    
    /*
    GCC не хочет мне тавтологию оптимизировать!
    https://godbolt.org/z/kgFMpR
    always_true:
            movl    %esi, %eax
            xorl    %edi, %eax
            cmpb    %dil, %sil
            sete    %dl
            xorl    %edx, %eax
            ret
    Но Clang может
    https://godbolt.org/z/YcOat-
    always_true:                            # @always_true
            movb    $1, %al
            retq
    */

    ГОВНО!

    j123123, 24 Сентября 2019

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

    +1

    1. 1
    https://www.youtube.com/watch?v=WT-oowiPUVQ

    Черная дыра

    cmepmop, 18 Сентября 2019

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