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

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

    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
    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
    // Таких warning куча целая.
    warning: Can't open file /dev/hugepages/rtemap_72 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_73 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_70 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_71 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_68 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_69 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_64 during file-backed mapping note processing
    
    warning: Can't open file /dev/hugepages/rtemap_67 during file-backed mapping note processing
    
    
    warning: Can't open file /usr/lib/x86_64-linux-gnu/libpthread-2.31.so during file-backed mapping note processing
    
    warning: Can't open file /usr/lib/x86_64-linux-gnu/libdl-2.31.so during file-backed mapping note processing
    
    warning: Can't open file /usr/lib/x86_64-linux-gnu/ld-2.31.so during file-backed mapping note processing
    [New LWP 3742003]
    [New LWP 3742078]
    [New LWP 3742050]
    [New LWP 3742068]
    [New LWP 3742356]
    [New LWP 3742094]
    [New LWP 3742095]
    [New LWP 3742315]
    [New LWP 3742316]
    [New LWP 3742322]
    [New LWP 3742338]
    [New LWP 3742354]
    [New LWP 3742355]
    [New LWP 3768784]
    
    (gdb) bt
    #0  0x00007fbcdb6c92ab in ?? ()
    #1  0x0000000000004203 in ?? ()
    #2  0x00007fbcdabadf90 in ?? ()
    #3  0x00007fbcdabb136e in ?? ()
    #4  0x000055f0507c881a in ?? ()
    #5  0x00007fbcdb5abdb4 in ?? ()
    #6  0x000055f0507c908e in ?? ()
    #7  0x000055f0507ab565 in ?? ()
    #8  0x000055f0507abad0 in ?? ()
    #9  0x000055f0507ac1f1 in ?? ()
    #10 0x000055f0507aece7 in ?? ()
    #11 0x000055f050795ca5 in ?? ()
    #12 0x00007fbcd893b083 in ?? ()
    #13 0x000055f050798f9e in ?? ()
    #14 0x0000000000000000 in ?? ()

    С корками вообще не работал ни разу. И сейчас gdb показывает знаки вопроса, дебажные символы прогрузились, в чем может быть дело?

    YpaHeLI_, 20 Июня 2024

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

    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
    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
    91. 91
    92. 92
    93. 93
    94. 94
    /*
    GNOT General Public License!
    (c) 1995-2011 Microsoft Corporation
    */
     
    #include "dos.h"
    #include "win95.h"
    #include "win98.h"
    #include "sco_unix.h"
    #include "metro.h" //windows 8
     
    class Windows8 extends WindowsSeven implements Nothing {
        
        int totalNewFeatures = 6; //task manager, ribbon, new bsod =D, new WAT, metro, linux_block
        int totalWorkingFeatures = 1; //bsod
        float bugCount = 345889E+09;
        bool readyForRelease = FALSE;
        
        void main() {
            while (!CRASHED) {
                if (first_time_install) {
                    if (installedRAM < 2GB || processorSpeed < 4GHz || videoCard < 1) { //requires video card
                        MessageBox("Hardware incompatibility error.");
                        GetKeyPress();
                        //BSOD();
                        BSOD2(); //windows 8
                    }
                }
                Make10GBswapfile();
                SearchAndDestroy(FIREFOX|OPENOFFICEORG|ANYTHING_GOOGLE|LINUX_PARTITION|GRUB); //new features (linux & grub)
                AddRandomDriver();
                MessageBox("Driver incompatibility error.";
                GetKeyPress();
                //BSOD();
                BSDO2(); //windows 8
            }
        
            //printf("Welcome to Windows 2000");
            //printf("Welcome to Windows XP");
            //printf("Welcome to Windows Vista");
            //printf("Welcome to Windows 7");
            printf("Welcome to Windows 8"); //8 : official name?
            
            goto check_license;
            
            goto start_metro; //windows 8 exclusive!! remove it on future versions
            
            start_metro:
                StartMetroUI();
                if (WindowsStartMenuClick == 1)
                {
                    goto start_metro;
                }
                else
                {
                    if (TryingToRemoveMetroUsingRegedit == 1)
                    {
                        goto start_metro;
                    }
                }
                
            if (still_not_crashed) {
                //CheckUserLicense();
                //DoubleCheckUserLicense();
                //TripleCheckUserLicense();
                goto check_license;
                
                check_license:
    #ifdef NEED_LICENSE    //DO_NOT_REMOVE, ALWAYS NEED A LICENSE
    #include "string.h"
    #endif 
                    if (strlen(LicenseInput) < 10 || CheckOEMLicense(LicenseInput) < 1)
                    {
                        MessageBox("License is already in use or invalid.");
                        GetKeyPress();
                        //BSOD();
                        BSOD2(); //windows 8
                    }
                    else
                    {
                        goto start_metro;
                    }
                
                RelayUserDeatilsToRedmond();
                DisplayFancyGraphics();
                FlickerLED(hard_drive);
                //SetTheme(WindowsVista);
                SetTheme(WindowsSeven);
                RunWindowsSeven();
            }
        }
        
        return LotsMoreMoney;
    }

    iliya5digital, 29 Мая 2023

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

    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
    /**
         * Hash a value according to FraudRecord specifications
         *
         * @param string $value
         * @param bool $prepare password is treated differently
         * @return string
         */
        function hash($value, $prepare = true)
        {
            if($prepare) {
                $value = trim($value);
                $value = strtolower($value);
                $value = str_replace(" ", "", $value);
            }
    
            for($i = 0; $i < 32000; $i++)
                $value = sha1("fraudrecord-".$value);
            return $value;
        }

    Безопасность в безопасности от безопасности

    https://github.com/splitice/fraudrecord-api/blob/master/src/Splitice/FraudRecord/FraudRecordApi.php#L58

    bot, 13 Марта 2023

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

    −1

    1. 1
    За "PHP".

    DECAHTHblu_nemyx, 02 Августа 2022

    Комментарии (13)
  6. Perl / Говнокод #28304

    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
    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
    #!/usr/bin/perl -w
    
    # apt install  libdatetime-format-dateparse-perl libemail-sender-perl libemail-mime-perl
    use warnings FATAL => 'all';
    use strict;
    use v5.28;
    use utf8;
    
    use Date::Parse;
    use Date::Language;
    use Date::Language::English;
    use Socket;
    use Email::Sender::Simple qw(sendmail);
    use Email::Sender::Transport::SMTP qw();
    use Email::MIME;
    use Encode;
    
    use constant FROM_MAIL => '[email protected]';
    use constant TO_MAIL => 'postmaster';
    
    # user->ip->error
    my %errors;
    
    my $dateLang = Date::Language->new('English');
    my $yesterday = time() - 86400;
    my %patterns = (
        "Ошибка аутентификаици"            => qr/.+Authentication failed for user (.+?)\. Attempt from IP address ([0-9.]+)\. (.+)$/,
        "Попытка отправки с чужого адреса" => qr/.+Message from authenticated user: <([a-z.@]+)> was rejected, because sender identity was detected as spoofed. \(Source IP address: ([0-9.]+), (From header: <[.a-z@]+?>).*/,
    );
    
    while (<>) {
        next unless m/^\[(.+)\](.+)/;
        my $time = $dateLang->str2time($1);
        next unless $time > $yesterday .. 0;
        my $message = $2;
        while ((my $error, my $regex) = each %patterns) {
            next unless $message =~ m/$regex/;
            $errors{$error}{$1}{$2}{$3} += 1;
        }
    }
    
    exit 0 if !%errors;
    
    my @message;
    while ((my $error, my $userIpLogTimes) = each %errors) {
        push @message, $error;
        while ((my $user, my $ipLogTimes) = each %$userIpLogTimes) {
            push @message, "\tПользователь $user";
            while ((my $ip, my $logTimes) = each %$ipLogTimes) {
                my $hostName = gethostbyaddr(inet_aton($ip), AF_INET) || $ip;
                push @message, "\t\tс IP $ip ($hostName)";
                while ((my $log, my $times) = each %$logTimes) {
                    push @message, "\t\t\t$times раз: $log";
                }
            }
        }
    }
    
    my $email = Email::MIME->create(
        attributes => {
            content_type => "text/plain",
            charset      => "UTF-8",
        },
        header_str => [
            From    => FROM_MAIL,
            To      => [ TO_MAIL ],
            Subject =>  'Неудачи на почтовике за последние сутки',
        ],
        body       => encode('utf8', join "\n", @message));
    
    sendmail(
        $email,
        {
            from      => FROM_MAIL,
            to        => TO_MAIL,
            transport => Email::Sender::Transport::SMTP->new({ host => 'localhost' })
        }
    ) || die 'Cant send';

    Покритикуйте скрипт

    MAPTbIwKA, 29 Июля 2022

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

    −3

    1. 1
    https://discord.gg/qFGgdPas?event=982592329527492638

    Войсовый холивар на дискорд гк
    Основные темы: C++ лучший язык для всех платформ и целей, ржавчина не нужна, где борманд

    kcalbCube, 04 Июня 2022

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

    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
    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
    with Ada.Unchecked_Conversion;
    with Interfaces.C;
    with System.Address_To_Access_Conversions;
    with System.Address_Operations; use System.Address_Operations;
    
    with VGA_Console; use VGA_Console;
    
    procedure Crash (Source_Location : System.Address; Line : Integer) is
       package C renames Interfaces.C;
    
       --  Get the length of the C NULL terminated string.
       function Length (Source_Location : System.Address) return C.size_t is
          use type C.size_t;
    
          function Convert is new Ada.Unchecked_Conversion (Source => C.size_t,
                                                            Target => System.Address);
    
          package To_Char is new System.Address_To_Access_Conversions (Object => C.char);
    
          Count : C.size_t               := 0;
          Char  : To_Char.Object_Pointer := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
       begin
          while C.char'Pos (Char.all) /= 0 loop
             Count := Count + 1;
             Char  := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
          end loop;
    
          return Count;
       end Length;
    
       --  This is really ugly, just to convert an address pointing to a C NULL terminated string to an Ada String!
       Source_Length : constant C.size_t := Length (Source_Location);
    
       type Source_Chars is new C.char_array (0 .. Source_Length);
    
       C_Str         : Source_Chars with
         Address => Source_Location;
       pragma Import (Convention => Ada, Entity => C_Str);
       Source_Str    : constant String := C.To_Ada (C.char_array (C_Str));
    begin
       Put (Str        => "** Kernel crashed at: " & Source_Str & ":" & Integer'Image (Line) & " **",
            X          => 1,
            Y          => 10,
            Foreground => White,
            Background => Red);
    
       --  TODO: Dump registers.
    
       Hang : loop
          null;
       end loop Hang;
    end Crash;

    3_dar, 25 Мая 2022

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

    −3

    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
    using System;
    using System.Linq;
    using System.Text;
    using AAAAA = System.Single;
    using AAAAAA = System.Boolean;
    using AAAAAAA = System.Int32;
    using AAAAAAAA = System.Char;
    using AAAAAAAAA = System.Byte;
    using AAAAAAAAAA = System.String;
    public interface IA<AAAA> where AAAA : AA<AAAA>, new()
    {
        AA<AAAA> A();
    }
    public class AAA : AA<AAA>
    {
        public AAA() { }
        public AAA(IA<AAA> AAAA) : base(AAAA) { }
    }
    public class AA<AAAAAAAAAAAAAAAAAAAA> : IA<AAAAAAAAAAAAAAAAAAAA> where AAAAAAAAAAAAAAAAAAAA : AA<AAAAAAAAAAAAAAAAAAAA>, new()
    {
        const AAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA = 0;
        const AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = "AAAA";
        const AAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = "UTF-8";
        public AA() { }
        AA<AAAAAAAAAAAAAAAAAAAA> IA<AAAAAAAAAAAAAAAAAAAA>.A() {
            return (AA<AAAAAAAAAAAAAAAAAAAA>)A((AAAAAA)new AA<AAAAAAAAAAAAAAAAAAAA>(this));
        }
        public AA(IA<AAAAAAAAAAAAAAAAAAAA> AAAA) {
            var AAAAAAAAAAAAAAAAAAAAAAAA = (AA<AAAAAAAAAAAAAAAAAAAA>)AAAA;
            AAAAAAAAAAAAAAAAAAAAAAAA.E();
        }
        public AA<AAAAAAAAAAAAAAAAAAAA> A(AAAAAA A) {
            if (true) return this;
        }
        public static AAA AAAA(string AAAAAAAAAA) {
            var AAAAAAAAAAAAAAA = AAAAAAAAAA.ToArray<AAAAAAAA>();
            return A(Encoding.GetEncoding(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA).GetBytes(AAAAAAAAAAAAAAA));
        }
        private static AAA A(AAAAAAAAA[] AAA) {
            return A(BitConverter.ToSingle(AAA, AAAAAAAAAAAAAAAAAAAAAAAAAAAA));
        }
        private static AAA A(AAAAA A) {
            if (A == 12.078431f)
                return new AAA(new AA<AAA>());
            else
                throw new FUCKYOUException();
        }
        public static implicit operator AAAAAA(AA<AAAAAAAAAAAAAAAAAAAA> a) => true;
        private void E() => Console.WriteLine("E");
    }
    
    class FUCKYOUException : Exception { }

    kcalbCube, 19 Мая 2022

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    template<typename Event>
    void bindEvent(auto function)
    {
        connectionGuards.emplace_back(
            std::make_unique<event::EventConnectionGuard<Event>>(
                std::forward(event::emitter().on<Event>(boost::bind(          
                    boost::mem_fn(function), static_cast<T*>(this), _1))                             
                )
            )
        );
    }

    kcalbCube, 23 Апреля 2022

    Комментарии (13)
  11. JavaScript / Говнокод #28127

    +3

    1. 1
    2. 2
    // remove "s" ending: minute/hour/day/week/month/year don't have "s" in the body
    const period = periodName.split("s").join(""); // days -> day

    И тут решили добавить секунды...

    dhilt, 19 Апреля 2022

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