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

    +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
    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
    dirty_boostrap_test() ->
        SourceTab = ets:new(source, [public, named_table]),
        ReplicaTab = ets:new(replica, [public, named_table]),
        %% Insert some initial data:
        ets:insert(source, {1, 1}),
        ets:insert(source, {2, 2}),
        ets:insert(source, {3, 3}),
        try
            register(testcase, self()),
            Replica = spawn_link(fun replica/0),
            register(replica, Replica),
            %% "importer" process emulates mnesia_tm:
            spawn_link(fun importer/0),
            %% "bootstrapper" process emulates bootstrapper server:
            spawn_link(fun bootstrapper/0),
            receive
                done ->
                    SrcData = lists:sort(ets:tab2list(source)),
                    RcvData = lists:sort(ets:tab2list(replica)),
                    ?assertEqual(SrcData, RcvData)
            end
        after
            ets:delete(SourceTab),
            ets:delete(ReplicaTab)
        end.
    
    importer() ->
        Ops = [ {write, 3, 3}
              , {write, 4, 4}
              , {write, 4, 5}
              , {delete, 2}
              ],
        lists:map(fun(OP) ->
                          import_op(source, OP),
                          %% Imitate mnesia event (note: here we send it
                          %% directly to the replica process bypassing
                          %% the agent):
                          replica ! {tlog, OP}
                  end,
                  Ops),
        replica ! last_trans.
    
    replica() ->
        receive
            {bootstrap, K, V} ->
                ets:insert(replica, {K, V}),
                replica();
            bootstrap_done ->
                replay()
        end.
    
    replay() ->
        receive
            {tlog, Op} ->
                import_op(replica, Op),
                replay();
            last_trans ->
                testcase ! done
        end.
    
    import_op(Tab, {write, K, V}) ->
        ets:insert(Tab, {K, V});
    import_op(Tab, {delete, K}) ->
        ets:delete(Tab, K).
    
    bootstrapper() ->
        {Keys, _} = lists:unzip(ets:tab2list(source)),
        [replica ! {bootstrap, K, V} || K <- Keys, {_, V} <- ets:lookup(source, K)],
        replica ! bootstrap_done.

    Follow-up к треду про то, как делать снепшоты.

    CHayT, 20 Июня 2021

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

    +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
    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
    insert(Alias, Tab, Val) ->
        ok.
    
    delete(_Alias, _Tab, _Key) ->
        ok.
    
    add_aliases(_) ->
        ok.
    
    remove_aliases(_) ->
        ok.
    
    check_definition(_Alias, _Tab, _Nodes, _Properties) ->
        ok.
    
    close_table(_Alias, _Tab) ->
        ok.
    
    create_table(_Alias, _Tab, _Properties) ->
        ok.
    
    delete_table(_Alias, _Tab) ->
        ok.
    
    first(_Alias, _Tab) ->
        '$end_of_table'.
    
    fixtable(_Alias, _Tab, _Bool) ->
        ok.
    
    last(_Alias, _Tab) ->
        '$end_of_table'.
    
    index_is_consistent(_Alias, _IxTag, _Bool) ->
        ok.
    
    init_backend() ->
        ok.
    
    info(_Alias, Tab, memory) ->
        0;
    info(Alias, Tab, size) ->
        0;
    info(_Alias, _Info, _Item) ->
        nobody_here_but_us_chicken.
    
    lookup(_Alias, _Tab, _Key) ->
        [].
    
    is_index_consistent(_Alias, _IxTag) ->
        true.
    
    load_table(_Alias, _Tab, _Reason, _CsList) ->
        ok.
    
    match_delete(_Alias, _Tab, _Pattern) ->
        ok.
    
    next(_Alias, _Tab, _Key) ->
        '$end_of_table'.
    
    prev(_Alias, _Tab, _Key) ->
        '$end_of_table'.
    
    real_suffixes() ->
        [].
    
    repair_continuation(Continuation, _MatchSpec) ->
        Continuation.
    
    select(_Continuation) ->
        '$end_of_table'.
    
    select(_Alias, _Tab, _Pattern) ->
        '$end_of_table'.
    
    select(_Alias, _Tab, _Pattern, _Limit) ->
        '$end_of_table'.
    
    
    semantics(_Alias, storage) -> ram_copies;
    semantics(_Alias, types  ) -> [set, ordered_set, bag];
    semantics(_Alias, index_types) -> [];
    semantics(_Alias, _) -> undefined.
    
    slot(_Alias, _Tab, _Pos) ->
        '$end_of_table'.
    
    sync_close_table(_Alias, _Tab) ->
        ok.
    
    tmp_suffixes() ->
        [].

    If /dev/null is fast in web scale I will use it. Is it web scale? Does /dev/null support sharding?

    CHayT, 09 Июня 2021

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

    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
    if (1 != 1)
    {
        1 = 1;
    }
    else if (2 != two)
    {
        2 = 1;
    }
    else if (1 == one)
    {
        3 = two;
    }
    else if (two != three)
    {
        3 != 2;
    }
    else
    {
        DynamicSenseMessage("Are you coding with JavaScript, son?");
    }

    BelCodeMonkey, 07 Июня 2021

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Tactic Notation "sleep" integer(seconds) :=
        do seconds try solve [ timeout 1 (repeat eapply proj1) ].
    
    Goal True.
        sleep 3.
        exact I.
    Qed.

    Какой пруф )))

    bormand, 06 Июня 2021

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

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Ltac solveInstr :=
      unfold mov, ldr,
      str, cmp,
      jnz, jmp, halt, fail,
      hvc, run, yield, share, lend, donate,
      retrieve, relinquish, reclaim, send, wait,
      option_state_unpack, unpack_hvc_result_normal, unpack_hvc_result_yield,
      get_reg, update_reg, update_incr_PC, get_memory, update_memory;
      repeat case_match;
      subst; eauto.

    Hijikata, 05 Июня 2021

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

    0

    1. 1
    for /f "delims=" %f in ('dir /s /b c:\*readelf*.exe') do "%f" --version

    gcc hell

    gologub, 02 Июня 2021

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

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    На любимом форуме Сёмы шаблоны никак не защищены от внешнего доступа. Сёме особенно должен понравиться последний файл:
    
    https://2ch.hk/makaba/templates/Search.template
    https://2ch.hk/makaba/templates/Archive.template
    https://2ch.hk/makaba/templates/Posting.template
    
    Судя по всему, используется шаблонизатор CTPP для Perl.

    rotoeb, 28 Мая 2021

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

    +1

    1. 1
    1/-~a

    Если тоже задолбались писать скобочки

    1/(a+1)

    3_dar, 26 Мая 2021

    Комментарии (37)
  9. Куча / Говнокод #27439

    +1

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

    #60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
    #61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
    #62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
    #63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
    #64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
    #65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
    #66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
    #67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
    #68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
    #69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
    #70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
    #71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
    #72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
    #73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
    #74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
    #75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
    #76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
    #77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
    #78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
    #79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
    #80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
    #81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
    #82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
    #83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
    #84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
    #85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
    #86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
    #87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
    #88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
    #89: https://govnokod.ru/27435 https://govnokod.xyz/_27435

    nepeKamHblu_nemyx, 25 Мая 2021

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

    0

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

    #59: https://govnokod.ru/26934 https://govnokod.xyz/_26934
    #60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
    #61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
    #62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
    #63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
    #64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
    #65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
    #66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
    #67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
    #68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
    #69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
    #70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
    #71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
    #72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
    #73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
    #74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
    #75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
    #76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
    #77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
    #78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
    #79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
    #80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
    #81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
    #82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
    #83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
    #84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
    #85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
    #86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
    #87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
    #88: https://govnokod.ru/27432 https://govnokod.xyz/_27432

    nepeKamHblu_nemyx, 21 Мая 2021

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