1. bash / Говнокод #27549

    +4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    #!/bin/sh
    
    count_roosters(){
        echo $1: `grep -c -P $1 gk_users.csv`
    }
    
    for rooster_name in nemyx_HoMep g0_14 Antibagor _daSome spooler ebebebeb assosin pdro alisher 14sun bot.number ,rss       
    do
        count_roosters $rooster_name
    done

    Выхлоп:

    nemyx_HoMep: 40817
    g0_14: 1434
    Antibagor: 1404
    _daSome: 1001
    spooler: 1000
    ebebebeb: 678
    assosin: 490
    pdro: 300
    alisher: 281
    14sun: 250
    bot.number: 131
    ,rss: 127

    3EHuTHblu_nemyx, 06 Августа 2021

    Комментарии (567)
  2. Kotlin / Говнокод #27548

    −1

    1. 1
    val cityEq: (City) -> (Customer) -> Boolean = { city -> { it.city == city } }

    Какой Kotlin ^_^^_^^_^

    PolinaAksenova, 04 Августа 2021

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

    +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
    Ltac destruct_mint_ H := 
       match type of H with
          (MInt_ _ ?z ?t) =>
          lazymatch goal with
            |- ?GOAL =>
            refine (match H in (MInt_ _ z0 t0) return (z = z0 -> t = t0 -> GOAL) with
                    | mint_nil    _  =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons   _ te rest l      r   t H =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons_l _ te rest l r z t Hz H  =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    | mint_cons_r _ te te' rest l r z t Hz Hcomm H =>
                      fun Heq_z Heq_tt_ =>
                        ltac:(destruct_mint_common Heq_tt_ Heq_z H)
                    end (eq_refl z) (eq_refl t))
          end
        end.

    Наебавшись с inversion в механизированным доказательстве, закрыл я очи.

    CHayT, 04 Августа 2021

    Комментарии (23)
  4. JavaScript / Говнокод #27546

    +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
    function main() {
        let { aa, bb } = { aa: 10, bb: 20 };
        print(aa + bb);
    
        let {
            aa,
            bb: { q, r },
        } = { aa: 10, bb: { q: 1, r: 2 } };
        assert(aa == 10, "{}");
        assert(q == 1, "{}");
        assert(r == 2, "{}");
    
        let { x, y } = new ObjF(1, "foo");
        assert(x == 1, "{}");
        assert(y == "foo", "{}");
    
        print("done.");
    }

    Добрый вечер дорогие неопределившиеся... или заблудшие... вот я тут вам новую фичу притарабанил .. называет деконстракт :)

    ASD_77, 04 Августа 2021

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

    0

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

    #1: https://govnokod.ru/26503 https://govnokod.xyz/_26503
    #2: https://govnokod.ru/26541 https://govnokod.xyz/_26541
    #3: https://govnokod.ru/26583 https://govnokod.xyz/_26583
    #4: https://govnokod.ru/26689 https://govnokod.xyz/_26689
    #5: https://govnokod.ru/26784 https://govnokod.xyz/_26784
    #5: https://govnokod.ru/26839 https://govnokod.xyz/_26839
    #6: https://govnokod.ru/26986 https://govnokod.xyz/_26986
    #7: https://govnokod.ru/27007 https://govnokod.xyz/_27007
    #8: https://govnokod.ru/27023 https://govnokod.xyz/_27023
    #9: https://govnokod.ru/27098 https://govnokod.xyz/_27098
    #10: https://govnokod.ru/27125 https://govnokod.xyz/_27125
    #11: https://govnokod.ru/27129 https://govnokod.xyz/_27129
    #12: https://govnokod.ru/27184 https://govnokod.xyz/_27184
    #13: https://govnokod.ru/27286 https://govnokod.xyz/_27286
    #14: https://govnokod.ru/27298 https://govnokod.xyz/_27298
    #15: https://govnokod.ru/27322 https://govnokod.xyz/_27322
    #16: https://govnokod.ru/27328 https://govnokod.xyz/_27328
    #17: https://govnokod.ru/27346 https://govnokod.xyz/_27346
    #18: https://govnokod.ru/27374 https://govnokod.xyz/_27374
    #19: https://govnokod.ru/27468 https://govnokod.xyz/_27468
    #20: https://govnokod.ru/27469 https://govnokod.xyz/_27469
    #21: https://govnokod.ru/27479 https://govnokod.xyz/_27479
    #22: https://govnokod.ru/27485 https://govnokod.xyz/_27485
    #23: https://govnokod.ru/27493 https://govnokod.xyz/_27493
    #24: https://govnokod.ru/27501 https://govnokod.xyz/_27501
    #25: https://govnokod.ru/27521 https://govnokod.xyz/_27521

    nepeKamHblu_nemyx, 02 Августа 2021

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

    0

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

    #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
    #90: https://govnokod.ru/27439 https://govnokod.xyz/_27439
    #91: https://govnokod.ru/27449 https://govnokod.xyz/_27449
    #92: https://govnokod.ru/27460 https://govnokod.xyz/_27460
    #93: https://govnokod.ru/27463 https://govnokod.xyz/_27463
    #94: https://govnokod.ru/27466 https://govnokod.xyz/_27466
    #95: https://govnokod.ru/27473 https://govnokod.xyz/_27473
    #96: https://govnokod.ru/27478 https://govnokod.xyz/_27478
    #97: https://govnokod.ru/27484 https://govnokod.xyz/_27484
    #98: https://govnokod.ru/27495 https://govnokod.xyz/_27495
    #99: https://govnokod.ru/27504 https://govnokod.xyz/_27504
    #100: https://govnokod.ru/27508 https://govnokod.xyz/_27508
    #101: https://govnokod.ru/27511 https://govnokod.xyz/_27511
    #102: https://govnokod.ru/27518 https://govnokod.xyz/_27518
    #103: https://govnokod.ru/27526 https://govnokod.xyz/_27526
    #104: https://govnokod.ru/27534 https://govnokod.xyz/_27534

    nepeKamHblu_nemyx, 01 Августа 2021

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

    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
    namespace Ifaces {
        interface IFoo {
            foo(): number;
            bar(x: number): string;
            twoArg(x: number, y: number): number;
            baz: string;
        }
    
        class A implements IFoo {
            constructor() {
                this.baz = "Q" + "A";
            }
            foo(): number {
                return 12;
            }
            bar(v: number) {
                return v.toString();
            }
            twoArg(x: number, y: number) {
                return x;
            }
            baz: string;
        }
        class B extends A {
            foo(): number {
                return 13;
            }
        }
    
        function foo(f: IFoo) {
            return "" + f.foo() + f.baz + f.bar(42);
        }
    
        export function run() {
            print("Ifaces.run");
            let a = new A();
            assert("" + foo(a) + "X" == "12.QA42.X");
            assert((a as IFoo).twoArg(1, 2) == 1, "t");
            a = new B();
            assert("" + foo(a) + "X" == "13.QA42.X", "b");
            let q = a as IFoo;
            q.baz = "Z";
            assert("" + foo(q) + "X" == "13.Z42.X", "x");
            print("Ifaces.runDONE");
        }
    }
    
    function main() {
        Ifaces.run();
        print("done.");
    }

    хотел оставить вас в покое. но не смог. Ловите - fields в интерфейсах

    ASD_77, 01 Августа 2021

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

    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
    class Bagor:
    	r = []
    	
    	def __init__(self, val):
    		self.r.append(val)
    		
    	def get(self):
    		return self.r[0]
    		
    kakoi = Bagor(1)
    bagor = Bagor(2)
    print([kakoi.get(), bagor.get()])

    https://ideone.com/K7tADi

    3_dar, 29 Июля 2021

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

    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
    /* https://fstarlang.github.io/lowstar/html/Introduction.html#the-essence-of-low
    
    Consider the following very simple program:
    
    module Intro
    
    module P = LowStar.Printf
    module C = LowStar.Comment
    module B = LowStar.Buffer
    
    open FStar.HyperStack.ST
    open LowStar.BufferOps
    
    let main (): St Int32.t =
      push_frame ();
      let b: B.buffer UInt32.t = B.alloca 0ul 8ul in
      b.(0ul) <- 255ul;
      C.comment "Calls to printf are desugared via meta-programming";
      let s = "from Low*!" in
      P.(printf "Hello from %s\nbuffer contents: %xul\n"
        s 8ul b done);
      pop_frame ();
      0l
    
    ....
    
    Once compiled by the KreMLin compiler, we obtain the following C code:
    */
    
    int32_t main()
    {
      uint32_t b[8U] = { 0U };
      b[0U] = (uint32_t)255U;
      /* Calls to printf are desugared via meta-programming */
      Prims_string s = "from Low*!";
      LowStar_Printf_print_string("Hello from ");
      LowStar_Printf_print_string(s);
      LowStar_Printf_print_string("\nbuffer contents: ");
      LowStar_Printf_print_lmbuffer_u32((uint32_t)8U, (uint32_t *)b);
      LowStar_Printf_print_string("\n");
      return (int32_t)0;
    }

    Какая-то компилируемая в сишку хренотень с завтипами, разрабатываемая в Microsoft Research

    j123123, 29 Июля 2021

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

    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
    namespace InstanceOf {
    
        class Foo {
            x: number
            y: string
            bar() {
                return this.x
            }
        }
    
        class Bar extends Foo { }
        class Baz extends Foo { }
        class Bar2 extends Bar { }
        class Bar3 extends Bar { }
    
        export function run() {
            print("InstanceOf")
    
            assert(new Bar2() instanceof Foo, "if")
            assert(new Bar2() instanceof Bar, "ib")
            assert(new Bar2() instanceof Bar2, "ib2")
            assert(new Bar3() instanceof Bar, "ib")
            assert(!(new Bar2() instanceof Baz), "!ib")
            assert(!(new Foo() instanceof Baz), "!ib2")
            assert(!(new Foo() instanceof Bar), "!ib2")
    
            (new Foo()).bar();
            (new Bar3()).bar();
        }
    }
    
    function main()
    {
      InstanceOf.run()
      print("done");
    }

    Возрадуйтесь братья и сестры. я вам принес зачатки RTTI :) и узрите этот дампик во очию.

    ASD_77, 29 Июля 2021

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