1. Lua / Говнокод #28063

    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
    Писать однострочный код это плохо? А если в одном файле совместить серверную и клиентскую часть? Пример аддона из Garry's Mod https://steamcommunity.com/sharedfiles/filedetails/?id=2754127067
    AddCSLua("cl_init.lua")
    if istable( xdestore ) then if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end
    if xdestore.Namer then xdestore.Namer:Remove() end  if xdestore.Lock then xdestore.Lock:Remove() end end xdestore = {} xdestore.Players = {}
    
    	util.AddNetworkString( "XDEST_MenuS2COpen" ) util.AddNetworkString( "XDEST_MenuS2CClose" ) util.AddNetworkString( "XDEST_SendRes" )
    	util.AddNetworkString( "XDEST_MenuS2CUpdate" ) util.AddNetworkString( "XDEST_MenuS2CResult" ) util.AddNetworkString( "XDEST_MenuC2SClose" )
    	util.AddNetworkString( "XDEST_LockReset" ) util.AddNetworkString( "XDEST_MenuC2SAction" ) util.AddNetworkString( "XDEST_SendSnd" ) util.AddNetworkString( "XDEST_SendHint" )
    
    xdestore.AmmoMdl = {
    	[ "AR2" ] = "models/items/combine_rifle_cartridge01.mdl",
    	[ "AR2AltFire" ] = "models/items/combine_rifle_ammo01.mdl",
    	[ "Pistol" ] = "models/items/boxsrounds.mdl",
    	[ "SMG1" ] = "models/items/boxmrounds.mdl",
    	[ "357" ] = "models/items/357ammo.mdl",
    	[ "XBowBolt" ] = "models/items/crossbowrounds.mdl",
    	[ "Buckshot" ] = "models/items/boxbuckshot.mdl",
    	[ "RPG_Round" ] = "models/weapons/w_missile_closed.mdl",
    	[ "SMG1_Grenade" ] = "models/items/ar2_grenade.mdl",
    	[ "Grenade" ] = "models/items/grenadeammo.mdl",
    	[ "slam" ] = "models/weapons/w_slam.mdl"
    }
    xdestore.NonSWEP = {
    	[ "weapon_357" ] = "models/weapons/w_357.mdl",
    	[ "weapon_pistol" ] = "models/weapons/w_pistol.mdl",
    	[ "weapon_bugbait" ] = "models/weapons/w_bugbait.mdl",
    	[ "weapon_crossbow" ] = "models/weapons/w_crossbow.mdl",
    	[ "weapon_crowbar" ] = "models/weapons/w_crowbar.mdl",
    	[ "weapon_frag" ] = "models/weapons/w_grenade.mdl",
    	[ "weapon_physcannon" ] = "models/weapons/w_physics.mdl",
    	[ "weapon_ar2" ] = "models/weapons/w_irifle.mdl",
    	[ "weapon_rpg" ] = "models/weapons/w_rocket_launcher.mdl",
    	[ "weapon_slam" ] = "models/weapons/w_slam.mdl",
    	[ "weapon_shotgun" ] = "models/weapons/w_shotgun.mdl",
    	[ "weapon_smg1" ] = "models/weapons/w_smg1.mdl",
    	[ "weapon_stunstick" ] = "models/weapons/w_stunbaton.mdl",
    	[ "weapon_alyxgun" ] = "models/weapons/w_alyx_gun.mdl",
    	[ "weapon_annabelle" ] = "models/weapons/w_annabelle.mdl",
    	[ "weapon_physgun" ] = "models/weapons/w_physics.mdl"
    }
    xdestore.ValidAct = { [ "Take" ] = true, [ "Move" ] = true, [ "Store" ] = true, [ "Rename" ] = true, [ "TakeAll" ] = true, [ "Split" ] = true, [ "Lock" ] = true, [ "Unlock" ] = true }
    xdestore.ActToNum = { "Take", "Move", "Store", "TakeAll", "Rename", "Split", "Lock", "Unlock" }
    xdestore.LockType = { "Simple", "Complex", "Question", "Key Weapon", "Group", "Personal" }
    net.Receive( "XDEST_MenuS2COpen", function() local int = net.ReadFloat()  local tab = net.ReadString()  local con = net.ReadString()
    local ent = net.ReadEntity() xdestore:OpenMenu( ply, int, tab, con, ent ) end )
    net.Receive( "XDEST_MenuS2CClose", function() if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Namer then xdestore.Namer:Remove() end
    if xdestore.Lock then xdestore.Lock:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end end )
    net.Receive( "XDEST_MenuS2CUpdate", function()
    	local tab = util.JSONToTable( net.ReadString() )  local con = util.JSONToTable( net.ReadString() )  local aa = net.ReadBool()  local bb = net.ReadBool()
    	if IsValid( xdestore.Menu ) then xdestore.Menu.V_DataStat = tab  xdestore.Menu.V_DataCont = con  xdestore.Menu:UpdateItems( aa, bb ) end
    end )
    net.Receive( "XDEST_MenuC2SClose", function( len, ply ) if len > 32 or !IsValid( ply ) then return end
    	local int = net.ReadFloat() if IsValid( ply ) and ply:IsPlayer() and !ply:IsBot() and isnumber( int ) then xdestore:CloseMenu( ply, int ) end
    end )
    net.Receive( "XDEST_MenuC2SAction", function( len, ply ) if len >= 4096 or !IsValid( ply ) then return end
    	if isnumber( ply.XDEST_Cool ) and ply.XDEST_Cool > CurTime() then xdestore:SendHint( ply, "You are doing too fast!", "resource/warning.wav", 0 ) end
    	ply.XDEST_Cool = CurTime()+0.25  if !IsValid( ply:GetNWEntity( "XDEST_Ent" ) ) or ply:GetNWEntity( "XDEST_Ent" ) == Entity( 0 ) then return end local self = ply:GetNWEntity( "XDEST_Ent" )
    	if ( ( !isstring( self.Base ) or self.Base != "xdest_base" ) and self:GetClass() != "xdest_base" and self:GetClass() != "weapon_xdest" )
    	or !isstring( self.XDEST_Data ) or !isstring( self.XDEST_Contain ) then return end
    	local act = net.ReadFloat()  local str = net.ReadString() if !isnumber( act ) then return end act = math.Round( act )
    	if !isstring( str ) then str = "_" end if isstring( xdestore.ActToNum[ act ] ) then act = xdestore.ActToNum[ act ] else return end  xdestore:SlotAction( ply, self, act, str )
    end )
    net.Receive( "XDEST_MenuS2CResult", function() local ply = LocalPlayer() local yes = net.ReadBool()  if IsValid( xdestore.Unlock ) then xdestore.Unlock:XDE_Result( yes ) end end )
    net.Receive( "XDEST_LockReset", function() local ent = net.ReadEntity() if IsValid( ent ) and ent != Entity( 0 ) then ent.XDE_Pass = nil end end )
    net.Receive( "XDEST_SendSnd", function() local str = net.ReadString() if !isstring( str ) or str == "!V" then return end surface.PlaySound( str ) end )
    net.Receive( "XDEST_SendRes", function() local str = net.ReadString()  local ply = LocalPlayer()  local ent = net.ReadEntity() if !IsValid( ent )
    or ent == Entity( 0 ) or !isstring( str ) or str == "" then return end if !isstring( ent.XDE_Pass ) then xdestore:SendHint( nil, "Access granted.", "", 0 ) end ent.XDE_Pass = str end )
    net.Receive( "XDEST_SendHint", function() local txt = net.ReadString()  local snd = net.ReadString()  local typ = net.ReadFloat()  xdestore:SendHint( nil, txt, snd, typ ) end )

    Ivan_Evlasiev, 28 Февраля 2022

    Комментарии (1)
  2. Си / Говнокод #28061

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    #pragma aux __cdecl "_*"                            \
                    parm caller [ ]                          \
                    value struct float struct routine [eax] \
                    modify [eax ecx edx]

    kcalbCube, 28 Февраля 2022

    Комментарии (11)
  3. Assembler / Говнокод #28059

    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
    .org 80h
    inc:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFEh] %sp
    	mov [%bp + FFFCh] %b
    	lea %a [%bp + FFFCh]
    	mov %a [%a]
    	push %a
    	inc %a
    	pop %si
    	mov [%si] %a
    	jmp @.return.inc
    .return.inc:
    	mov %sp %bp
    	pop %bp
    	ret
    main:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFCh] %sp
    	memset [%bp + FFFEh] 0002h 0h
    	lea %a [%bp + FFFEh]
    	push %a
    	mov %a 0000h
    	pop %si
    	mov [%si] %a
    .L.begin.1:
    	mov %a 0001h
    	cmp %a 0h
    	jz @.0
    	lea %a [%bp + FFFEh]
    	push %a
    	pop %b
    	call @inc
    	push %a
    	mov %a 0050h
    	pop %si
    	cmp %si %a
    	jgz @.compare3
    	mov %al 1h
    	.compare3:
    	mov %ah 0h
    	cmp %a 0h
    	jz  @.else.2
    	jmp @.0
    	jmp @.end.2
    .else.2:
    .end.2:
    .1:
    	jmp @.L.begin.1
    .0:
    .return.main:
    	mov %sp %bp
    	pop %bp
    	ret
    start:
    	mov %sp FFFFh
    	call @main
    .return.start:
    	int 0h
    
    <-------------------->
    
    short inc(short* i)
    {
    	return ++(*i);
    }
    
    void main(void)
    {
    	short i = 0s;
    	while(1) 
    	{
    		if(inc(&i) > 0x50)
    			break;
    	}
    }
    
    void start(void)
    {
    	asm("mov %sp FFFFh");
    	main();
    }

    да что вы знаете о неоптимизированном коде

    kcalbCube, 27 Февраля 2022

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

    +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>
    
    int main(void)
    {
    	(
    		*********************
    		**  **     ** ***** *
    		* ** * **** ** *** **
    		* ** * **** *** * ***
    		* ** * **** **** ****
    		* ** * **** *** * ***
    		* ** **    *** *** **
    		*********************
    	printf)("pidor");
    }

    kcalbCube, 26 Февраля 2022

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

    +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
    static char *cast_table[][11] = {
      // i8   i16     i32     i64     u8     u16     u32     u64     f32     f64     f80
      {NULL,  NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i8
      {i32i8, NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i16
      {i32i8, i32i16, NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   i64f32, i64f64, i64f80}, // i64
    
      {i32i8, NULL,   NULL,   i32i64, NULL,  NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u8
      {i32i8, i32i16, NULL,   i32i64, i32u8, NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u16
      {i32i8, i32i16, NULL,   u32i64, i32u8, i32u16, NULL,   u32i64, u32f32, u32f64, u32f80}, // u32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   u64f32, u64f64, u64f80}, // u64
    
      {f32i8, f32i16, f32i32, f32i64, f32u8, f32u16, f32u32, f32u64, NULL,   f32f64, f32f80}, // f32
      {f64i8, f64i16, f64i32, f64i64, f64u8, f64u16, f64u32, f64u64, f64f32, NULL,   f64f80}, // f64
      {f80i8, f80i16, f80i32, f80i64, f80u8, f80u16, f80u32, f80u64, f80f32, f80f64, NULL},   // f80
    };

    красивое

    kcalbCube, 26 Февраля 2022

    Комментарии (2)
  6. Си / Говнокод #28055

    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
    // Takes a printf-style format string and returns a formatted string.
    char *format(char *fmt, ...) {
      char *buf;
      size_t buflen;
      FILE *out = open_memstream(&buf, &buflen);
    
      va_list ap;
      va_start(ap, fmt);
      vfprintf(out, fmt, ap);
      va_end(ap);
      fclose(out);
      return buf;
    }

    kcalbCube, 25 Февраля 2022

    Комментарии (6)
  7. Си / Говнокод #28054

    −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
    typedef enum {
      FILE_NONE, FILE_C, FILE_ASM, FILE_OBJ, FILE_AR, FILE_DSO,
    } FileType;
    
    StringArray include_paths;
    bool opt_fcommon = true;
    bool opt_fpic;
    
    static FileType opt_x;
    static StringArray opt_include;
    static bool opt_E;
    static bool opt_M;
    static bool opt_MD;
    static bool opt_MMD;
    static bool opt_MP;
    static bool opt_S;
    static bool opt_c;
    static bool opt_cc1;
    static bool opt_hash_hash_hash;
    static bool opt_static;
    static bool opt_shared;
    static char *opt_MF;
    static char *opt_MT;
    static char *opt_o;
    
    static StringArray ld_extra_args;
    static StringArray std_include_paths;
    
    char *base_file;
    static char *output_file;
    
    static StringArray input_paths;
    static StringArray tmpfiles;

    благо поиск по проекту работает

    kcalbCube, 25 Февраля 2022

    Комментарии (23)
  8. Python / Говнокод #28053

    +1

    1. 1
    2. 2
    if x == 2 or 3: # если x равен 2 или 3
        print('Пыщь.')

    Вот уже не впервый раз натыкаюсь на подобный "машинный перевод с русского на питон".

    Vindicar, 25 Февраля 2022

    Комментарии (6)
  9. Python / Говнокод #28051

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    While 1:
        twy:
           throu Excertion(process(input(> ))
        except Exxepton as s:
          pront(s)

    Я напесавл говнокод. Как вам,

    BOPEHHOE, 24 Февраля 2022

    Комментарии (7)
  10. JavaScript / Говнокод #28050

    −2

    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
    95. 95
    96. 96
    97. 97
    98. 98
    99. 99
    from lib2to3.pgen2 import token
    import logging
    import re
    
    import requests
    import pandas as pd
    
    from bs4 import BeautifulSoup
    
    from aiogram import Bot, Dispatcher, executor, types
    from aiogram.dispatcher.filters import Text
    
    bot = Bot(token="5243563589:AAHZL9JyJ0Q36dBpuXcjgzDuM-0n9OEWhpk")
    dp = Dispatcher(bot)
    logging.basicConfig(level=logging.INFO)
    
    sso = "http://pinskgptklp.brest.by/sso.html"
    pto = "http://pinskgptklp.brest.by/pto2.html"
    logg = ""
    
    response = requests.get(sso)
    soup = BeautifulSoup(response.text, "lxml")
    quotes = soup.find_all("tbody")
    t = str(quotes)
    arr = t.split('</tbody>, ')
    stroka = arr[1]
    stroki = stroka.split('<tr')
    
    i = 1
    j = 0
    
    tablica = [0] 8
    ttt = [[]] 8
    
    tab1 = [0] len(stroki)
    while i < len(tab1):
    j = 0
    tab1 = re.sub(r'\n+', '\n', stroki)
    tab1 = re.sub(r'\<[^>]\>', '', "<" + stroki).split('\n')
    while j < len(tab1):
    if tab1[j] != "" and tab1[j] != "]":
    logg += '|' + tab1[j]
    
    j = j + 1
    
    logg += '~'
    i = i + 1
    
    q = []
    rem = logg.split('~')
    o = 0
    while o < len(rem):
    q.append(rem.split('|'))
    o = o + 1
    
    o = 0
    while o < len(rem):
    o = o + 1
    
    print(q)
    
    sso_sh = q[4][1] + q[4][2] + q[4][3] + q[4][4] + '\n' + q[0][2] + " - " + q[4][5] + '\n' + q[0][3] + " - " + q[4][8]
    sso_p = q[5][1] + q[5][2] + q[5][3] + q[5][4] + '\n' + q[0][2] + " - " + q[5][5] + '\n' + q[0][3] + " - " + q[5][8]
    
    @dp.message_handler(commands="start")
    async def cmd1(message: types.Message):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton(text="ПТО", callback_data="n1"))
    keyboard.add(types.InlineKeyboardButton(text="CCO", callback_data="n2"))
    await message.answer("Действия:", reply_markup=keyboard)
    
    #@dp.message_handler(Text(equals="Показать что-то"))
    #async def cmd2(message: types.Message):
    #await message.reply(stroki[1])
    
    @dp.callback_query_handler(text="see")
    async def see(call: types.CallbackQuery):
    await call.message.answer("123123123")
    await call.answer()
    
    @dp.callback_query_handler(text="n1")
    async def next(call: types.CallbackQuery):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton(text=q[4][3], callback_data="pto1"))
    keyboard.add(types.InlineKeyboardButton(text=q[5][3], callback_data="pto2"))
    await call.message.answer("Что именно?", reply_markup=keyboard)
    await call.answer()
    
    @dp.callback_query_handler(text="n2")
    async def next(call: types.CallbackQuery):
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton(text=q[4][3], callback_data="sso1"))
    keyboard.add(types.InlineKeyboardButton(text=q[5][3], callback_data="sso2"))
    await call.message.answer("Что именно?", reply_markup=keyboard)
    await call.answer()
    
    @dp.callback_query_handler(text="sso1")
    async def next(call: types.CallbackQuery):
    await call.message.answer(sso_sh)

    Саб, нужна помощь с ботом, нужно сделать 2 часть с кнопкой ПТО, а то не получается спарсить

    dddccc, 24 Февраля 2022

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