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

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

    +44

    1. 1
    document.getElementById(element.id).checked = true;

    guest, 12 Декабря 2008

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

    −248

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    nop
    nop
    nop
    call somelabel
    somelabel:
    pop si
    sub si, 3

    ассемблер - источник массы говнокода, классика...

    guest, 08 Декабря 2008

    Комментарии (27)
  4. Kotlin / Говнокод #29088

    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
    //Вдохновил говнокод от DypHuu_niBEHb
    fun main() {
        Сорок тысяч обезъян в жопу сунули банан
    }
    
    object Сорок {
        infix fun тысяч(a: обезъян) : обезъян {
            print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ")
            return обезъян
        }
    }
    
    object обезъян {
        infix fun в(a: жопу) : жопу {
            print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ")
            return жопу
        }
    }
    
    object жопу {
       infix fun сунули(a: банан) : жопу {
           print("${this.javaClass.simpleName} ${Thread.currentThread().stackTrace[1].methodName} ${a.javaClass.simpleName}")
           return this
       }
    }
    
    object банан {
    }

    Сорок тысяч обезъян в жопу сунули банан

    Trix, 12 Февраля 2025

    Комментарии (26)
  5. Куча / Говнокод #28635

    0

    1. 1
    Плохие новости, Говнокод скоро закроется. Ищите более уютную борду.

    Начитайте искать уже сичас.

    Lure_Of_Chaos, 15 Марта 2023

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    [xcache.admin]
    xcache.admin.enable_auth = On
    
    ; use http://xcache.lighttpd.net/demo/cacher/mkpassword.php to generate your encrypted password
    xcache.admin.user = "mOo"
    xcache.admin.pass = "md5 encrypted password"

    mOo

    HoBorogHuu_nemyx, 16 Февраля 2023

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

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    if (true
        && (false
            || LYS_LEAF != ref_node->schema->nodetype
            || LY_TYPE_LEAFREF != reinterpret_cast<lys_node_leaf*>(ref_node->schema)->type.base
            )
        && (false
            || LYS_LEAFLIST != ref_node->schema->nodetype
            || LY_TYPE_LEAFREF != reinterpret_cast<lys_node_leaflist*>(ref_node->schema)->type.base
            )
        )
      return nullptr;

    Посоны, помогити!11
    Я блять чего то не ПОНИМАЮ, ШО ТАК ЗАЧЕМ ДЕЛАТЬ?

    dicklover, 07 Ноября 2022

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

    +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
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    
    #define NUMARGS(type,...)  (sizeof((type[]){__VA_ARGS__})/sizeof(type))
    #define xDEF(type) typedef struct {size_t size; type* arr;  }  xARR(type)
    #define xARR(type) jArr_ ## type
    
    #define A(type, ...) (xARR(type)) {NUMARGS(type,__VA_ARGS__), (type[]){__VA_ARGS__}}
    
    #define _FOR(type, item, Arr) type item=Arr.arr[0]; for(size_t I = 0; I < Arr.size; item=Arr.arr[++I] ) 
    // MSVC
    #define xFOR(type, item, array) do{  _FOR(type, item, array) {
    // GCC, Clang
    #define FOR(item, array)        do{ __auto_type Arr=array; _FOR(__auto_type, item, Arr) {
        
    #define NEXT }} while(0);
    
    #define OfArray(type,arr) (xARR(type)){sizeof(arr)/sizeof(type), arr }
    
    typedef struct {
        char *name;
        int     id;
    } Entry;
    
    
    typedef struct {const char *name;} Str;
    typedef struct {int x[2]; } Pair;
    
    xDEF(Entry);
    xDEF(Str);
    xDEF(Pair);
    xDEF(int);
    
    void printEntry(xARR(Entry) entries)
    {
        xFOR(Entry, e, entries)
            printf("%s %d \n", e.name, e.id);
        NEXT
    }
    
    void printSquares(xARR(int) ints)
    {
        FOR(v, ints)
            printf("%d²=%d\n", v,(int) pow(v,2.));
        NEXT
    }
    
    int main(void)
    {
        xARR(Entry) e = A(Entry, {"one",1}, {"two",2}, {"three",3});
        printEntry(e);
        
        puts("_______________________________________");
        
        // можно передавать в метод непосредственно аргуметом
        printSquares( A(int, 3, 7, 5, 4) );
        puts("_______________________________________");    
        
        int nums[]={4,3,2,1};
        // можно использовать ранее объявленный массив
        printSquares(OfArray(int,nums));
        
        // можно итерироватьcя по ранее объявленному массиву
        FOR(i, OfArray(int, nums))
            printf("%d-",i);
        NEXT
        
        puts("\n_______________________________________");
        
        //вложенные циклы:
        for (int k=1;k<3;k++)
            FOR(i, A(Str, "kakoi", "bagor"))    
                FOR(j, A(int, 1111,2222,3333))
                    printf("%d %s %d\n", k, i.name, j);
                NEXT
            NEXT
        
        puts("_______________________________________");
        
        FOR(v, A(Pair, {1,2}, {11,12}, {20,21}))
            printf("%d,%d\n", v.x[0], v.x[1]);
        NEXT
        puts("_______________________________________");    
        //проблема пустого варарга
        FOR(j, A(int))
            printf("%d\n", j);
        NEXT    
        return(0);
    }

    https://godbolt.org/z/o9Tv9EvGx

    Довёл for~each до ума.

    3.14159265, 23 Июля 2022

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

    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
    #define _CRT_SECURE_NO_WARNINGS
    #pragma comment(lib, "ntdll.lib")
    
    #include <Windows.h>
    #include <string>
    
    #define FLG_HEAP_ENABLE_TAIL_CHECK 0x10
    #define FLG_HEAP_ENABLE_FREE_CHECK 0x20
    #define FLG_HEAP_VALIDATE_PARAMETERS 0x40
    #define NT_GLOBAL_FLAG_DEBUGGED (FLG_HEAP_ENABLE_TAIL_CHECK | FLG_HEAP_ENABLE_FREE_CHECK | FLG_HEAP_VALIDATE_PARAMETERS)
    
    typedef NTSTATUS(NTAPI* pfnNtSetInformationThread)(
    	_In_ HANDLE	ThreadHandle,
    	_In_ ULONG ThreadInformationClass,
    	_In_ PVOID ThreadInformation,
    	_In_ ULONG ThreadInformationLenght);
    
    const ULONG ThreadHideFromDebugger = 0x11;
    
    typedef NTSTATUS(NTAPI* pfnNtQueryInformationProcess)(
    	_In_ HANDLE	ProcessHandle,
    	_In_ ULONG ProcessInformationClass,
    	_In_ PVOID ProcessInformation,
    	_In_ ULONG ProcessInformationLenght,
    	_Out_opt_ PULONG ReturnLenght);
    
    const UINT ProcessDebugPort = 7;
    
    void HideFromDebugger()
    {
    	HMODULE hNtDll = LoadLibrary("ntdll.dll");
    
    	if (!hNtDll)
    		throw std::exception("can't load kernel");
    
    	pfnNtSetInformationThread NtSetInformatioThread = (pfnNtSetInformationThread)
    		GetProcAddress(hNtDll, "NtSetInformationThread");
    
    	NTSTATUS status = NtSetInformatioThread(GetCurrentThread(), ThreadHideFromDebugger, NULL, NULL);
    }
    
    PVOID GetPEB()
    {
    	return (PVOID)__readfsword(0x0C * sizeof(PVOID));
    }
    
    int main()
    {
    	pfnNtQueryInformationProcess NtQueryInformationProcess = nullptr;
    	NTSTATUS status;
    	DWORD IsDebuggerPresent = 0;
    	HMODULE hNtDll = LoadLibrary("ntdll.dll");
    
    	if (!hNtDll)
    		throw std::exception("can't load kernel");
    	
    	NtQueryInformationProcess = (pfnNtQueryInformationProcess)GetProcAddress(hNtDll, "NtQueryInformationProcess");
    	void HideFromDebugger();
    
    	while (true)
    	{
    		PVOID pPEB = GetPEB();
    		DWORD offsetNtGlobalFlag = 0x68;
    		DWORD NtGlobalFlag = (DWORD)((PBYTE)pPEB + offsetNtGlobalFlag);
    
    		NTSTATUS stat = NtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
    			&IsDebuggerPresent, sizeof(DWORD), NULL);
    
    		if ((NtGlobalFlag & NT_GLOBAL_FLAG_DEBUGGED) || (stat == 0x00000000 && IsDebuggerPresent != 0))
    		{
    			MessageBox(NULL, "Close your fucking debuger!", "FUCK YOU", MB_OK);
    			return -1;
    		}
    	}
    
    	return 0;
    }

    PVOID, 23 Мая 2022

    Комментарии (26)
  10. SQL / Говнокод #28161

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    -- Теперь мы можем легко получить отчёт по продажам на прошлую дату:
    
    DELIMITER ;
    BEGIN;
    CALL set_prot_snapshot_date('2018-10-09 17:23:47', NULL, -1);
    SELECT NOW() report_time, d.date, SUM(p.amount * p.price) sum
    FROM docs d
    INNER JOIN doc_pos p ON d.id = p.doc_id
    GROUP BY d.date;
    ROLLBACK;

    https://habr.com/ru/post/425769/
    Как научить MySQL заглядывать в прошлое

    ISO, 09 Мая 2022

    Комментарии (26)
  11. C++ / Говнокод #28139

    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
    #include <iostream>
    #include <vector>
    #include <thread>
    int f()
    {
        static int i = 0;
        synchronized { // begin synchronized block
            std::cout << i << " -> ";
            ++i;       // each call to f() obtains a unique value of i
            std::cout << i << '\n';
            return i; // end synchronized block
        }
    }
    int main()
    {
        std::vector<std::thread> v(10);
        for(auto& t: v)
            t = std::thread([]{ for(int n = 0; n < 10; ++n) f(); });
        for(auto& t: v)
            t.join();
    }
    
    0 -> 1
    1 -> 2
    2 -> 3
    ...
    99 -> 100

    https://en.cppreference.com/w/cpp/language/transactional_memory

    kcalbCube, 27 Апреля 2022

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