1. Куча / Говнокод #27625

    0

    1. 1
    Бесконечный оффтоп имени Борманда #5

    #1: https://govnokod.ru/25864 https://govnokod.xyz/_25864
    #2: https://govnokod.ru/25921 https://govnokod.xyz/_25921
    #3: https://govnokod.ru/26544 https://govnokod.xyz/_26544
    #4: https://govnokod.ru/26838 https://govnokod.xyz/_26838

    nepeKamHblu_nemyx, 29 Августа 2021

    Комментарии (734)
  2. JavaScript / Говнокод #27624

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    <!DOCTYPE html>
    <html lang="ru">
    <heaad><title>calculator Protestant of sins [beta]</title></head><body><script>
    let m = ["сколько Вам лет [в годах]?","мало!","всего наилучшего тебе",0,16668,"сколько вы отдыхаете?  [в часах]","у вас накопилось :"," грехов! "];
    var x="Этот супер калькулятор поможет тебе подсчитать количество нажитых тобой - за твои годы Грехов!\n Не бойся, смелее вводи свои данные в последующие окошки, и получай результат!\nне переживай, если у тебя получится болше одного миллиона - то это в пределах нормы, если больше то надо делать обряд!";
    try{function b(e) {let l=d(c(m[e]));e==0?x=l:0;return l};							  
       function c(a) {return prompt(a)}
       function d(d) {if(d<=2){alert(m[1]);d(c(m[0]))}else{return d;}}
       if(confirm(x)){let s=0x1E32F50*b(0);let a=x*0x16D*0x18-b(5);alert(m[6]+`${s-a-m[4]-Math.PI}`+m[7])}else{alert(m[2])}}catch(x){alert("©by den")};
    </script></body></html>

    Hello народ))
    Уверен вы ещё не встречали такого супер калькулятора!
    Чую даже без запуска вы поймёте что это полное Г

    prefix-not, 28 Августа 2021

    Комментарии (1)
  3. JavaScript / Говнокод #27623

    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
    function* foo() {
        let i = 1;
        yield ++i;
        yield ++i;
    }
    
    function main() {
        for (const o of foo()) {
    	print(o);
        }
    
        print("done.");
    }

    вот... решил самую крутую проблему в итераторах... а ты (С/C++) так можешь?

    ASD_77, 28 Августа 2021

    Комментарии (106)
  4. Куча / Говнокод #27622

    0

    1. 1
    Электрика / электроника #4

    #1: https://govnokod.ru/25437 https://govnokod.xyz/_25437
    #2: https://govnokod.ru/25820 https://govnokod.xyz/_25820
    #3: https://govnokod.ru/26570 https://govnokod.xyz/_26570

    nepeKamHblu_nemyx, 27 Августа 2021

    Комментарии (569)
  5. C++ / Говнокод #27621

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    struct Foo {
    };
    
    struct Bar {
        int x[0];
    };

    https://ideone.com/upuoOg

    Какая консистентность )))

    bormand, 27 Августа 2021

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

    +1

    1. 1
    Питушня #19

    #1: https://govnokod.ru/26692 https://govnokod.xyz/_26692
    #2: https://govnokod.ru/26891 https://govnokod.xyz/_26891
    #3: https://govnokod.ru/26893 https://govnokod.xyz/_26893
    #4: https://govnokod.ru/26935 https://govnokod.xyz/_26935
    #5: (vanished) https://govnokod.xyz/_26954
    #6: (vanished) https://govnokod.xyz/_26956
    #7: https://govnokod.ru/26964 https://govnokod.xyz/_26964
    #8: https://govnokod.ru/26966 https://govnokod.xyz/_26966
    #9: https://govnokod.ru/27017 https://govnokod.xyz/_27017
    #10: https://govnokod.ru/27045 https://govnokod.xyz/_27045
    #11: https://govnokod.ru/27058 https://govnokod.xyz/_27058
    #12: https://govnokod.ru/27182 https://govnokod.xyz/_27182
    #13: https://govnokod.ru/27260 https://govnokod.xyz/_27260
    #14: https://govnokod.ru/27343 https://govnokod.xyz/_27343
    #15: https://govnokod.ru/27353 https://govnokod.xyz/_27353
    #16: https://govnokod.ru/27384 https://govnokod.xyz/_27384
    #17: https://govnokod.ru/27482 https://govnokod.xyz/_27482
    #18: https://govnokod.ru/27514 https://govnokod.xyz/_27514

    nepeKamHblu_nemyx, 27 Августа 2021

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

    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
    95. 95
    96. 96
    const int sum(int a, int b){
        return a+b;
    }
    
    int a(int x)
    {
        const std::function<int(int)> sum4 = std::bind(sum,_1, 4);    
        return sum4(123);
    }
    
    int b(int x)
    {
        puts("bagor");    
        const std::function<int(int)> sum4 = std::bind(sum,_1, 4);    
        return sum4(123);
    }
    
    int c(int x)
    {
        const std::function<int(int)> sum4 = std::bind(sum,_1, 4);    
        puts("bagor");    
        return sum4(123);
    }
    
    // Функции a и b нормально инлайнятся. Ассемблерный выхлоп:
    
    sum(int, int):                               # @sum(int, int)
            lea     eax, [rdi + rsi]
            ret
    a(int):                                  # @a(int)
            mov     eax, 127
            ret
    b(int):                                  # @b(int)
            push    rax
            mov     edi, offset .L.str
            call    puts
            mov     eax, 127
            pop     rcx
            ret
    
    //А вот int c(int x)
    c(int):                                  # @c(int)
            push    rbx
            sub     rsp, 32
            mov     edi, 16
            call    operator new(unsigned long)
            mov     rbx, rax
            mov     qword ptr [rax], offset sum(int, int)
            mov     dword ptr [rax + 8], 4
            mov     qword ptr [rsp], rax
            mov     qword ptr [rsp + 24], offset std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_invoke(std::_Any_data const&, int&&)
            mov     qword ptr [rsp + 16], offset std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)
            mov     edi, offset .L.str
            call    puts
            mov     esi, dword ptr [rbx + 8]
            mov     edi, 123
            call    qword ptr [rbx]
            mov     ebx, eax
            mov     rax, qword ptr [rsp + 16]
            test    rax, rax
            je      .LBB3_3
            mov     rdi, rsp
            mov     rsi, rdi
            mov     edx, 3
            call    rax
    .LBB3_3:
            mov     eax, ebx
            add     rsp, 32
            pop     rbx
            ret
            mov     rdi, rax
            call    __clang_call_terminate
            mov     rbx, rax
            mov     rax, qword ptr [rsp + 16]
            test    rax, rax
            je      .LBB3_6
            mov     rdi, rsp
            mov     rsi, rdi
            mov     edx, 3
            call    rax
    .LBB3_6:
            mov     rdi, rbx
            call    _Unwind_Resume@PLT
            mov     rdi, rax
            call    __clang_call_terminate
    __clang_call_terminate:                 # @__clang_call_terminate
            push    rax
            call    __cxa_begin_catch
            call    std::terminate()
    std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_invoke(std::_Any_data const&, int&&): # @std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_invoke(std::_Any_data const&, int&&)
            mov     rax, qword ptr [rdi]
            mov     rcx, qword ptr [rax]
            mov     edi, dword ptr [rsi]
            mov     esi, dword ptr [rax + 8]
            jmp     rcx                             # TAILCALL
    std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation): # @std::_Function_handler<int (int), std::_Bind<int const (*(std::_Placeholder<1>, int))(int, int)> >::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)

    Решил попробовать std::bind.

    https://godbolt.org/z/eW5eT5oj4

    3.14159265, 27 Августа 2021

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

    +3

    1. 1
    Афганистан заебал.

    rotoeb, 26 Августа 2021

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

    −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
    # Дамп базы хуза
    # Постобработка export-а из MySQL
    
    import pandas as pd
    import numpy as np
    import csv
    
    comments = pd.read_csv('/wp_comments-2.csv', header=None)
    comments.head()
    
    ##
    
    comments_clean = pd.DataFrame({
        'comment_id': comments[0],
        'comment_post_id': comments[1],
        'comment_parent': comments[13],
        'name': comments[2],
        'gravatar_hash': comments[3].str.split('@').str[0],
        'gravatar_domain': comments[3].str.split('@').str[1],
        'profile': comments[4],
        'date': comments[6],
        'content': comments[8],
    })
    
    ##
    
    comments_clean[(comments_clean.gravatar_domain != 'lo.ol') & ~comments_clean.gravatar_domain.isna()]
    
    ##
    
    comments_clean = comments_clean[(comments_clean.gravatar_domain == 'lo.ol') | comments_clean.gravatar_domain.isna()]
    comments_clean.drop(columns=['gravatar_domain'], inplace=True)
    comments_clean.head()
    
    ##
    
    posts = pd.read_csv('/wp_posts.csv', header=None)
    posts = posts[(posts[20] == 'post') & (posts[7] == 'publish') & (posts[11].str.match('^_'))]
    posts.head()
    
    ##
    
    posts_clean = pd.DataFrame({
        'post_id': posts[0],
        'date': posts[2],
        'content': posts[4],
        'description': posts[6],
        'original_id': posts[11].str[1:]
    })
    posts_clean.head()
    
    ##
    
    comments_clean.to_csv('~/Downloads/gost/comments.csv', index=False)
    posts_clean.to_csv('~/Downloads/gost/posts.csv', index=False)

    https://govnokod.xyz/dump/wp_gk_legacy_users.csv
    ../comments.csv
    ../posts.csv

    guest6, 26 Августа 2021

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

    +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
    Steps to reproduce:
    
      var s = "a huge, huge, huge string...";
      s = s.substring(0, 5);
    
    Expected results: s takes five bytes of memory, plus some overhead.
    Actual results: s takes a huge, huge, huge amount of memory.
    Unfortunately, most String functions use substring() or no-ops internally: concatenating with empty string, trim(), slice(), match(), search(), replace() with no match, split(), substr(), substring(), toString(), trim(), valueOf().
    My workaround is:
    
    function unleakString(s) { return (' ' + s).substr(1); }
    
    But it's not satisfying, because it breaks an abstraction and forces me to think about memory allocation.

    https://bugs.chromium.org/p/v8/issues/detail?id=2869

    Status: Assigned (Open)
    Reported on: Sep 3, 2013

    3.14159265, 26 Августа 2021

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