1. Python / Говнокод #28796

    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
    @dataclass(slots=True)
    class Govno:
        govno_index: int
        
        def patch(self, indices_dict: Dict[int, int]) -> None:
            new_index = indices_dict[self.govno_index]
            self.govno_index = new_index
    
    
    @dataclass(slots=True)
    class Mocha:
        mocha_index: int
        
        def patch(self, indices_dict: Dict[int, int]) -> None:
            new_index = indices_dict[self.govno_index]
            self.govno_index = new_index

    Метод «patch» был скопипащен из класса «Govno» в класс «Mocha». Тайпчекер никаких ошибок не показывал; все типы были выведены корректно.

    А в рантайме всё упало, что и неудивительно!

    ISO, 13 Июня 2023

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

    0

    1. 1
    Пиздец-оффтоп #84

    #54: https://govnokod.ru/28353 https://govnokod.xyz/_28353
    #55: https://govnokod.ru/28361 https://govnokod.xyz/_28361
    #56: https://govnokod.ru/28383 https://govnokod.xyz/_28383
    #57: https://govnokod.ru/28411 https://govnokod.xyz/_28411
    #58: https://govnokod.ru/28454 https://govnokod.xyz/_28454
    #59: https://govnokod.ru/28472 https://govnokod.xyz/_28472
    #60: https://govnokod.ru/28540 https://govnokod.xyz/_28540
    #61: https://govnokod.ru/28548 https://govnokod.xyz/_28548
    #62: https://govnokod.ru/28555 https://govnokod.xyz/_28555
    #63: https://govnokod.ru/28573 https://govnokod.xyz/_28573
    #64: https://govnokod.ru/28584 https://govnokod.xyz/_28584
    #65: https://govnokod.ru/28599 https://govnokod.xyz/_28599
    #66: https://govnokod.ru/28609 https://govnokod.xyz/_28609
    #67: https://govnokod.ru/28615 https://govnokod.xyz/_28615
    #68: https://govnokod.ru/28636 https://govnokod.xyz/_28636
    #69: (vanished) https://govnokod.xyz/_28660
    #70: (vanished) https://govnokod.xyz/_28667
    #71: https://govnokod.ru/28677 https://govnokod.xyz/_28677
    #72: https://govnokod.ru/28685 https://govnokod.xyz/_28685
    #73: https://govnokod.ru/28692 https://govnokod.xyz/_28692
    #74: https://govnokod.ru/28699 https://govnokod.xyz/_28699
    #75: https://govnokod.ru/28705 https://govnokod.xyz/_28705
    #76: https://govnokod.ru/28712 https://govnokod.xyz/_28712
    #77: https://govnokod.ru/28722 https://govnokod.xyz/_28722
    #78: https://govnokod.ru/28730 https://govnokod.xyz/_28730
    #79: https://govnokod.ru/28736 https://govnokod.xyz/_28736
    #80: https://govnokod.ru/28740 https://govnokod.xyz/_28740
    #81: https://govnokod.ru/28750 https://govnokod.xyz/_28750
    #82: https://govnokod.ru/28779 https://govnokod.xyz/_28779
    #83: https://govnokod.ru/28788 https://govnokod.xyz/_28788

    nepeKamHblu_nemyx, 13 Июня 2023

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

    0

    1. 1
    IT Оффтоп #185

    #155: https://govnokod.ru/28281 https://govnokod.xyz/_28281
    #156: https://govnokod.ru/28322 https://govnokod.xyz/_28322
    #157: https://govnokod.ru/28344 https://govnokod.xyz/_28344
    #158: https://govnokod.ru/28366 https://govnokod.xyz/_28366
    #159: https://govnokod.ru/28391 https://govnokod.xyz/_28391
    #160: https://govnokod.ru/28434 https://govnokod.xyz/_28434
    #161: https://govnokod.ru/28449 https://govnokod.xyz/_28449
    #162: https://govnokod.ru/28477 https://govnokod.xyz/_28477
    #163: https://govnokod.ru/28501 https://govnokod.xyz/_28501
    #164: https://govnokod.ru/28527 https://govnokod.xyz/_28527
    #165: https://govnokod.ru/28557 https://govnokod.xyz/_28557
    #166: https://govnokod.ru/28574 https://govnokod.xyz/_28574
    #167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
    #168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
    #169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
    #170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
    #171: (vanished) https://govnokod.xyz/_28665
    #172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
    #173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
    #174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
    #175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
    #176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
    #177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
    #178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
    #179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
    #180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
    #181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
    #182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
    #183: https://govnokod.ru/28777 https://govnokod.xyz/_28777
    #184: https://govnokod.ru/28790 https://govnokod.xyz/_28790

    nepeKamHblu_nemyx, 12 Июня 2023

    Комментарии (470)
  4. C# / Говнокод #28793

    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
    public class Archvile:Actor{public Archvile(){Health=700;Radius=20;Height=56;Mass=500;Speed=15;PainChance=10;Monster=true;MaxTargetRange=896;SetFlag(Flags.QUICKTORETALIATE,true);SetFlag(Flags.FLOORCLIP,true);SetFlag(Flags.NOTARGET,true);SeeSound="vile/sight";PainSound="vile/pain";DeathSound="vile/death";ActiveSound="vile/active";MeleeSound="vile/stop";Obituary="$OB_VILE";Tag="$FN_ARCH";}
    public override void BeginPlay(){base.BeginPlay();SetState("Spawn");}
    void Spawn(){SetState("See");}
    void See(){A_Chase();}
    void Missile(){A_VileStart();A_FaceTarget();A_VileTarget();A_FaceTarget();A_VileAttack();Delay(20);SetState("See");}
    void Heal(){Delay(10);SetState("See");}
    void Pain(){A_Pain();SetState("See");}
    void Death(){A_Scream();A_NoBlocking();Delay(7);SetState("Death   1");}
    void Death1(){Delay(7);SetState("Death   2");}
    void Death2(){Delay(7);SetState("Death   3");}
    void Death3(){Delay(7);SetState("Death   4");}
    void Death4(){Delay(7);SetState("Death   5");}
    void Death5(){Delay(7);SetState("Death   6");}
    void Death6(){Delay(7);SetState("Death   7");}
    void Death7(){Delay(1);Destroy();}
    void A_VileStart(){StartSound("vile/start",CHAN_VOICE);}
    void A_VileTarget(){if(target!=null){A_FaceTarget();Actor fog=Spawn<Actor>("ArchvileFire",target.Pos,SpawnFlags.ALLOW_REPLACE);if(fog!=null){tracer=fog;fog.target=self;fog.tracer=self.target;fog.A_Fire(0);}}}
    void A_VileAttack(){Actor targ=target;if(targ!=null){A_FaceTarget();if(!CheckSight(targ,0))return;StartSound("vile/stop",CHAN_WEAPON);int newdam=targ.DamageMobj(self,self,20,DamageType.none);if(newdam>0)targ.TraceBleed(newdam,self);Actor fire=tracer;if(fire!=null){fire.SetOrigin(targ.Vec3Angle(-24.0,angle,0),true);fire.A_Explode(70,70,ExplosionFlags.XF_NOSPLASH,false,0,0,0,"BulletPuff",DamageType.Fire);}
    if(!targ.bDontThrust){targ.Vel.z=1000.0*thrust/Math.Max(1,targ.Mass);}}}
    void A_StartFire(){StartSound("vile/firestrt",CHAN_BODY);A_Fire();}
    void A_Fire(){Actor dest=tracer;if(dest==null||target==null)return;if(!target.CheckSight(dest,0))return;SetOrigin(dest.Vec3Angle(24,dest.angle,0),true);}
    void A_FireCrackle(){StartSound("vile/firecrkl",CHAN_BODY);A_Fire();}}
    public static class ActorExtensions{public static void A_VileStart(this Actor self){self.StartSound("vile/start",CHAN_VOICE);}
    public static void A_VileTarget(this Actor self,string fire="ArchvileFire"){if(self.target!=null){self.A_FaceTarget();Actor fog=self.Spawn<Actor>(fire,self.target.Pos,SpawnFlags.ALLOW_REPLACE);if(fog!=null){self.tracer=fog;fog.target=self;fog.tracer=self.target;fog.A_Fire(0);}}}
    public static void A_VileAttack(this Actor self,string snd="vile/stop",int initialdmg=20,int blastdmg=70,int blastradius=70,double thrust=1.0,string damagetype="Fire",int flags=0){Actor targ=self.target;if(targ!=null){self.A_FaceTarget();if(!self.CheckSight(targ,0))return;self.StartSound(snd,CHAN_WEAPON);int newdam=targ.DamageMobj(self,self,initialdmg,(flags

    Арчвайл из ZDooM на C#

    DartPower, 07 Июня 2023

    Комментарии (0)
  5. JavaScript / Говнокод #28792

    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
    const ttfMeta = require('ttfmeta');
    const fs = require('fs');
    
    let oldName = process.argv[2];
    
    ttfMeta.ttfInfo(oldName, (err, result) => {
      if (err) {
        console.log('error', err)
      } else {
        let newName = result.tables.name[6];
    
        if(newName.charCodeAt(0) === 0) {
            let buf = new ArrayBuffer(newName.length);
            let bufView = new Uint16Array(buf);
            for (let i = 0, strLen = newName.length / 2; i < strLen; i++) {
              bufView[i] = (newName.charCodeAt(2 * i) << 8) + newName.charCodeAt(2 * i + 1);
            }
            newName = String.fromCharCode.apply(null, bufView);
        }
        
        newName = 'renamed/' + newName + '.ttf';
        fs.createReadStream(oldName).pipe(fs.createWriteStream(newName));
      }
    });

    Дано: 100500 ttf-файлов с рандомными именами файла (цифры, гуиды, что угодно, но только не название шрифта).
    Требуется: переименовать файлы так, чтобы название хоть как-то было похоже на имя шрифта.
    Решение: есть 100500 библиотек на сишке для вытаскивания метушни из ttf-файлов, но мы же извращенцы, поэтому напишем на скриптушне.

    Багор: пакет «ttfmeta» из «npm» иногда возвращает нормальные текстовые строки, а иногда хуйню (детектируемую условием newName.charCodeAt(0) === 0), когда пара соседних «символов» — это на самом деле половинки кодпоинта из кодировки utf16be. «Нода» умеет только в toString('utf16le'), а кодировку с большим индейцем ('utf16be') не знает.

    Izumka, 05 Июня 2023

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

    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
    public class MathGame {
    
        public static Map<Integer, String> data = new HashMap<Integer, String>();
        public static Map<String, Integer> result = new HashMap<String, Integer>();
        String problem;
        Random random = new Random();
    
        public void NewProblem() {
    
            String sign = null;
    
            for (int i = 1; i < 5; i++) {
    
                switch (GenNumber(3)) {
                    case 1:
                        sign = Sign.MINUS.get();
                        break;
                    case 2:
                        sign = Sign.PLUS.get();
                        break;
                    case 3:
                        sign = Sign.TIMES.get();
                        break;
                    default:
                        sign = Sign.PLUS.get();
                        break;
                }
    
                problem = GenNumber(9) + " " + sign + " " + GenNumber(9);
                result.put(problem + " = ???", Decide(Integer.parseInt(
                        problem.split(" ")[0]), problem.split(" ")[1], Integer
                        .parseInt(problem.split(" ")[2])));
                data.put(i, problem);
    
            }
        }
    
        private int GenNumber(int s) {
            return random.nextInt(s) + 1;
        }
    
        private int Decide(int a, String sign, int b) {
            switch (sign) {
                case "+":
                    return a + b;
                case "-":
                    return a - b;
                case "*":
                    return a * b;
            }
            return 0;
        }
    
        public enum Sign {
            PLUS("+"),
            MINUS("-"),
            TIMES("*");
    
            private final String sign;
    
            Sign(String sign) {
                this.sign = sign;
            }
    
            public String get() {
                return sign;
            }
    
        }
    
    }

    girixok149, 05 Июня 2023

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

    0

    1. 1
    IT Оффтоп #184

    #154: https://govnokod.ru/28275 https://govnokod.xyz/_28275
    #155: https://govnokod.ru/28281 https://govnokod.xyz/_28281
    #156: https://govnokod.ru/28322 https://govnokod.xyz/_28322
    #157: https://govnokod.ru/28344 https://govnokod.xyz/_28344
    #158: https://govnokod.ru/28366 https://govnokod.xyz/_28366
    #159: https://govnokod.ru/28391 https://govnokod.xyz/_28391
    #160: https://govnokod.ru/28434 https://govnokod.xyz/_28434
    #161: https://govnokod.ru/28449 https://govnokod.xyz/_28449
    #162: https://govnokod.ru/28477 https://govnokod.xyz/_28477
    #163: https://govnokod.ru/28501 https://govnokod.xyz/_28501
    #164: https://govnokod.ru/28527 https://govnokod.xyz/_28527
    #165: https://govnokod.ru/28557 https://govnokod.xyz/_28557
    #166: https://govnokod.ru/28574 https://govnokod.xyz/_28574
    #167: https://govnokod.ru/28588 https://govnokod.xyz/_28588
    #168: https://govnokod.ru/28607 https://govnokod.xyz/_28607
    #169: https://govnokod.ru/28628 https://govnokod.xyz/_28628
    #170: https://govnokod.ru/28653 https://govnokod.xyz/_28653
    #171: (vanished) https://govnokod.xyz/_28665
    #172: https://govnokod.ru/28675 https://govnokod.xyz/_28675
    #173: https://govnokod.ru/28681 https://govnokod.xyz/_28681
    #174: https://govnokod.ru/28689 https://govnokod.xyz/_28689
    #175: https://govnokod.ru/28696 https://govnokod.xyz/_28696
    #176: https://govnokod.ru/28703 https://govnokod.xyz/_28703
    #177: https://govnokod.ru/28709 https://govnokod.xyz/_28709
    #178: https://govnokod.ru/28716 https://govnokod.xyz/_28716
    #179: https://govnokod.ru/28726 https://govnokod.xyz/_28726
    #180: https://govnokod.ru/28734 https://govnokod.xyz/_28734
    #181: https://govnokod.ru/28739 https://govnokod.xyz/_28739
    #182: https://govnokod.ru/28749 https://govnokod.xyz/_28749
    #183: https://govnokod.ru/28777 https://govnokod.xyz/_28777

    nepeKamHblu_nemyx, 02 Июня 2023

    Комментарии (475)
  8. 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)
  9. Куча / Говнокод #28788

    0

    1. 1
    Пиздец-оффтоп #83

    #53: (vanished) https://govnokod.xyz/_28346
    #54: https://govnokod.ru/28353 https://govnokod.xyz/_28353
    #55: https://govnokod.ru/28361 https://govnokod.xyz/_28361
    #56: https://govnokod.ru/28383 https://govnokod.xyz/_28383
    #57: https://govnokod.ru/28411 https://govnokod.xyz/_28411
    #58: https://govnokod.ru/28454 https://govnokod.xyz/_28454
    #59: https://govnokod.ru/28472 https://govnokod.xyz/_28472
    #60: https://govnokod.ru/28540 https://govnokod.xyz/_28540
    #61: https://govnokod.ru/28548 https://govnokod.xyz/_28548
    #62: https://govnokod.ru/28555 https://govnokod.xyz/_28555
    #63: https://govnokod.ru/28573 https://govnokod.xyz/_28573
    #64: https://govnokod.ru/28584 https://govnokod.xyz/_28584
    #65: https://govnokod.ru/28599 https://govnokod.xyz/_28599
    #66: https://govnokod.ru/28609 https://govnokod.xyz/_28609
    #67: https://govnokod.ru/28615 https://govnokod.xyz/_28615
    #68: https://govnokod.ru/28636 https://govnokod.xyz/_28636
    #69: (vanished) https://govnokod.xyz/_28660
    #70: (vanished) https://govnokod.xyz/_28667
    #71: https://govnokod.ru/28677 https://govnokod.xyz/_28677
    #72: https://govnokod.ru/28685 https://govnokod.xyz/_28685
    #73: https://govnokod.ru/28692 https://govnokod.xyz/_28692
    #74: https://govnokod.ru/28699 https://govnokod.xyz/_28699
    #75: https://govnokod.ru/28705 https://govnokod.xyz/_28705
    #76: https://govnokod.ru/28712 https://govnokod.xyz/_28712
    #77: https://govnokod.ru/28722 https://govnokod.xyz/_28722
    #78: https://govnokod.ru/28730 https://govnokod.xyz/_28730
    #79: https://govnokod.ru/28736 https://govnokod.xyz/_28736
    #80: https://govnokod.ru/28740 https://govnokod.xyz/_28740
    #81: https://govnokod.ru/28750 https://govnokod.xyz/_28750
    #82: https://govnokod.ru/28779 https://govnokod.xyz/_28779

    nepeKamHblu_nemyx, 28 Мая 2023

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

    0

    1. 1
    2. 2
    У меня для Вас плохие новости.
    http://govnokod.ru/user/1347 - одна из фаек Инкануса.

    Таким образом, получается, что всё это время мистификатор наёбывал нас и создавал активность с охулиона фаек.

    Такого коварства даже я не ожидал.

    AHOHNM, 24 Мая 2023

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