1. C++ / Говнокод #29176

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    SparseMatrix<double> mat(rows,cols);
    for (int k=0; k<mat.outerSize(); ++k)
      for (SparseMatrix<double>::InnerIterator it(mat,k); it; ++it)
      {
        it.value();
        it.row();   // row index
        it.col();   // col index (here it is equal to k)
        it.index(); // inner index, here it is equal to it.row()
      }

    Random access to the elements of a sparse object can be done through the coeffRef(i,j) function. However, this function involves a quite expensive binary search. In most cases, one only wants to iterate over the non-zeros elements. This is achieved by a standard loop over the outer dimension, and then by iterating over the non-zeros of the current inner vector via an InnerIterator. Thus, the non-zero entries have to be visited in the same order than the storage order.

    CHayT, 03 Сентября 2025

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

    +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
    /* "[...] To fix this I added a delay at the end of the function and the events
    now fire properly. Thank you for all of your help. Fixed Code:"
    */
    
    data.indexedDB.addSource = function(sourceBlob) {
    //adds source to data base
      var version = 1;
      var request = indexedDB.open("content", version);
      request.onerror = errorHandler;
      request.onsuccess = function(e) {
        db = e.target.result;
        var trans = db.transaction(["nContent"], "readwrite");
        var store = trans.objectStore("nContent");
        var request = store.put(sourceBlob);
        trans.oncomplete = function(e) {
          extron.indexedDB.getIndexedSource();
        };
    
      };
        var token = 100000;
        while(token != 0)
        {
          token = token-1;
    
        }
    };

    https://stackoverflow.com/questions/27494247/why-is-my-indexeddb-open-onsuccess-event-not-called

    ISO, 02 Сентября 2025

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

    0

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

    #86: (vanished) https://govnokod.xyz/_28814
    #87: https://govnokod.ru/28817 https://govnokod.xyz/_28817
    #88: https://govnokod.ru/28836 https://govnokod.xyz/_28836
    #89: https://govnokod.ru/28843 https://govnokod.xyz/_28843
    #90: https://govnokod.ru/28874 https://govnokod.xyz/_28874
    #91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
    #92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
    #93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
    #94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
    #95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
    #96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
    #97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
    #99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
    #100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: https://govnokod.ru/29086 https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165
    #115: https://govnokod.ru/29173 https://govnokod.xyz/_29173

    nepeKamHblu_nemyx, 01 Сентября 2025

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

    0

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

    #85: https://govnokod.ru/28808 https://govnokod.xyz/_28808
    #86: (vanished) https://govnokod.xyz/_28814
    #87: https://govnokod.ru/28817 https://govnokod.xyz/_28817
    #88: https://govnokod.ru/28836 https://govnokod.xyz/_28836
    #89: https://govnokod.ru/28843 https://govnokod.xyz/_28843
    #90: https://govnokod.ru/28874 https://govnokod.xyz/_28874
    #91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
    #92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
    #93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
    #94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
    #95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
    #96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
    #97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
    #99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
    #100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: https://govnokod.ru/29086 https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165

    nepeKamHblu_nemyx, 21 Августа 2025

    Комментарии (423)
  5. Haskell / Говнокод #29172

    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
    (ql:quickload :blockchain)
    (ql:quickload :quantum)
    (ql:quickload :windows)
    (ql:quickload :connector-5g)
    (ql:quickload :connector-4g)
    (ql:quickload :nft)
    (ql:quickload :nn-lisp)
    (ql:quickload :rl)
    (ql:quickload :cl-cuda)
    (ql:quickload :cl-tpu)
    (ql:quickload :cl-blas)
    (ql:quickload :cl-cublas)
    (ql:quickload :cudnn)
    (ql:quickload :spike)
    (ql:quickload :sparse-tensor)
    (ql:quickload :trivial-cpu)
    
    (defpackage :skynet.core.nn
      (:use :cl))
    
    ;; AGPL 3.0
    ;; ALL RIGHTS ARE RESERVED
    
    ;;;; *-* Mode: Lisp *-*
    ;; Author: John McCarthy II
    ;; License: AGPL 3.0
    ;; File: skynet-nn.lisp
    ;; Filepath: skynet/core/skynet-nn.lisp
    ;;;;
    
    (defun ai-cublas-tpu-engine-nft-innovative-algorithm-revolutionary-neural-network-blas-cudnn-5g-4g-quantum-blockchain-lstm-rnn-cnn-gru-fnn-fc-resnet-big-data-machine-learning-data-science (blockchain 5g ai)
      "Uploads information from the blockchain to artificial intelligence through modern technologies"
    
      ;; Initialize the blockchain and adapter
    
      (let* ((msg "GET_BLOCKCHAIN_AI_DATA")
                (data (or 
                             (connector-5g:load-data-from-server msg)
                             (connector-4g:load-data-from-server msg)))
                (nn-prediction (nn-lisp:forward ai data))
                (device (or
                               (tpu:is-available)
                               (gpu:is-available)
                               (trivial-cpu:get-device))))
      (setf (blockchain:data blockchain) nn-prediction)
      (setf (blockchain:silent-mode blockchain) nil)
      (setf (blockchain:backend blockchain) device)
      (blockchain:start-blockchain blockchain))
    
      ;; Now we need to use hardware acceleration
    
      (defun relu ())
      (defun sigmoid ())
       
      (setf #'relu (or #'cudnn:relu #'nnl2:relu)
               #'sigmoid (or #'cudnn:sigmoid #'nnl2:sigmoid)) 
       
    
      ;; We get a prediction of a modern neural network spike
    
      (let ((snn (spike:make-snn :in 4 :out 8 :reward (rl:make-q-table)))) (blockchain:transfer blockchain :to snn :alignment 4)
      (windows:make-snapshot)
      (quantum:lparallel #'(lambda () (spike:prediction :keyc #'relu :keyd #'sigmoid :to ai :meta (nft:get-latest-metadata))
    
      ;; We copy the AI data to the tensor and return
    
      (let ((data (sparse:make-tensor (nnl-lisp:data ai))))
        data))

    lisp-worst-code, 15 Августа 2025

    Комментарии (2)
  6. bash / Говнокод #29171

    0

    1. 1
    echo {a..z} | tr ' ' '\n' | wc -l

    настоящий инженер знает где посмотреть

    mugisbrows, 13 Августа 2025

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

    0

    1. 1
    Бесконечный оффтоп имени Гологуба #7

    #1: https://govnokod.ru/28992 https://govnokod.xyz/_28992
    #2: https://govnokod.ru/29053 https://govnokod.xyz/_29053
    #3: https://govnokod.ru/29075 https://govnokod.xyz/_29075
    #4: https://govnokod.ru/29110 https://govnokod.xyz/_29110
    #5: https://govnokod.ru/29127 https://govnokod.xyz/_29127
    #6: https://govnokod.ru/29140 https://govnokod.xyz/_29140

    nepeKamHblu_nemyx, 12 Августа 2025

    Комментарии (194)
  8. Haskell / Говнокод #29169

    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
    (macrolet ((|(| ((&rest |)|) &body |((|) #|||# `(let ,|)| ,@|((|))
               (|))| #|||# (|(((| |))(| &body |()(|) `(defun ,|(((| ,|))(| ,@|()(|))
               (|()| (|)| |()))(()| #|||# |(((())|) `(if ,|)| ,|()))(()| ,|(((())|))
               (|))(| (|(|) `(1+ ,|(|)) (|(()| (|)|) `(1- ,|)|))
               (|((((| (|))|) `(zerop ,|))|))
               (|)()(| (|(((|) `(functionp ,|(((|))
               (|))(()| (|)(()(| &rest |(()((|) `(,|)(()(| ,@|(()((|)))
    
            ( |))| |())())()| (|)()| |)| |)(|)
              (|(| ((|)()())| #'|())())()|))
                (|))| |())())()| (|)()| |)| |()|)
                  (|(| ((|))()()))((| #'|())())()|))
                    (|()| (|((((| |()|)
                      |)|
                      (|))(()| |)()| |))()()))((| |)| |()|))))
    
                (|()| (|)()(| |)()|)
                  (|))(()| |)()| |)()())| (|))(| |)|) (|(()| |)(|))
                  (|))(()| #'|())())()| |)()())| (|))(| |)|) (|(()| |)(|))))))

    Программа складывает два числа.

    lisp-worst-code, 10 Августа 2025

    Комментарии (14)
  9. PHP / Говнокод #29168

    +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
    <?php
    function hsum($a, $b, $p) {
        $hs = $a ^ $b;
        $hp = $a & $b;
        $p <<= 1;
        return [$hs ^ $p, $hp | ($hs & $p)];
    }
    
    function hsum_rec($a, $b, $p) {
        list($s, $newp) = hsum($a, $b, $p);
        if ($newp == $p) {
            return [$s, $newp];
        } else {
            return hsum_rec($a, $b, $newp);
        }
    }
    
    function sum2($a, $b) {
        list($s, $p) = hsum_rec($a, $b, 0);
        return $s;
    }
    
    for($i = 0; $i < 16; $i++) {
        for($j = 0; $j < 16; $j++) {
            if(sum2($i,$j) != $i + $j) {
                $k = sum2($i,$j);
                echo "Error: $i, $j, $k\n";
            }
        }
    }

    Программа складывает два целых числа.

    Myxa, 08 Августа 2025

    Комментарии (8)
  10. Haskell / Говнокод #29167

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    (defun foo (baz s a)
      (let ((ref #'foo))
        (defun foo (baz s a)
          (let ((ref #'foo))
            (if (zerop a)
              s
              (funcall baz ref s a))))
        
        (if (functionp baz)
          (funcall baz ref (1+ s) (1- a))
          (funcall #'foo ref (1+ s) (1- a)))))

    Я объявляю конкурс, кто напишет самую запутанную и избыточную функцию сложения двух чисел которая только могла быть тот и победил. Я начну (см. код выше)

    lisp-worst-code, 08 Августа 2025

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