1. Лучший говнокод

    В номинации:
    За время:
  2. Куча / Говнокод #28619

    +1

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

    #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: (vanished) 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
    #19: https://govnokod.ru/27620 https://govnokod.xyz/_27620
    #20: https://govnokod.ru/27816 https://govnokod.xyz/_27816
    #21: https://govnokod.ru/27956 https://govnokod.xyz/_27956
    #22: https://govnokod.ru/28143 https://govnokod.xyz/_28143
    #23: https://govnokod.ru/28315 https://govnokod.xyz/_28315
    #24: https://govnokod.ru/28362 https://govnokod.xyz/_28362
    #25: https://govnokod.ru/28463 https://govnokod.xyz/_28463
    #26: https://govnokod.ru/28481 https://govnokod.xyz/_28481
    #27: https://govnokod.ru/28537 https://govnokod.xyz/_28537

    nepeKamHblu_nemyx, 02 Марта 2023

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

    +1

    1. 1
    Γεια σας, гражданы.

    Как Ваше сердчишко? Не болит, не колет?
    Значит, причина будет иная. Не будем спешить и спойлерить.

    CMEPTb, 10 Февраля 2023

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

    +1

    1. 1
    error[E0277]: the trait bound `Filtered<tracing_subscriber::fmt::Layer<Layered<OpenTelemetryLayer<Layered<Filtered<tracing_subscriber::fmt::Layer<Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>, Pretty, tracing_subscriber::fmt::format::Format<Pretty>>, tracing_subscriber::reload::Layer<EnvFilter, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, opentelemetry::sdk::trace::tracer::Tracer>, Layered<Filtered<tracing_subscriber::fmt::Layer<Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>, Pretty, tracing_subscriber::fmt::format::Format<Pretty>>, tracing_subscriber::reload::Layer<EnvFilter, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>>, Pretty, tracing_subscriber::fmt::format::Format<Pretty>, fn() -> Stderr {stderr}>, EnvFilter, Layered<OpenTelemetryLayer<Layered<Filtered<tracing_subscriber::fmt::Layer<Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>, Pretty, tracing_subscriber::fmt::format::Format<Pretty>>, tracing_subscriber::reload::Layer<EnvFilter, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, opentelemetry::sdk::trace::tracer::Tracer>, Layered<Filtered<tracing_subscriber::fmt::Layer<Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>, Pretty, tracing_subscriber::fmt::format::Format<Pretty>>, tracing_subscriber::reload::Layer<EnvFilter, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>, Layered<Box<dyn tracing_subscriber::Layer<Registry> + Send + Sync>, Registry>>>>: tracing_subscriber::Layer<Registry>` is not satisfied

    PE3yC, 30 Января 2023

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

    +1

    1. 1
    https://www.youtube.com/shorts/XTUYEkDy-5M

    Такое ощущение, что наступил на коровью бомбочку.

    CMEPTb, 29 Января 2023

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

    +1

    1. 1
    я дрочу

    cepreu_monoJlb, 23 Января 2023

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

    +1

    1. 1
    2. 2
    Надо же. Мои скрижали истории подчищены, а быть может, перо их и не касалось...
    Как уж тут не поверить в реинкарнацию!..

    CMEPTb, 18 Января 2023

    Комментарии (0)
  8. Java / Говнокод #28543

    +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
    static private Double getHashString(String string, Integer foundation){
        Double hash = 0.0 ;
        short [] charsToInteger = getCharArray(string);
        double step = Double.MAX_VALUE / 256 - foundation;
        for (int i = 0; i < charsToInteger.length ; i++ ){
            hash += charsToInteger[i] * step;
            step = step / 2 - 1;
        }
        return hash;
    }
    
    static private short [] getCharArray(String string){
        char [] chars = string.toLowerCase().toCharArray();
        short [] bytes = new short [chars.length];
        for (int i = 0; i < chars.length; i++){
            bytes [i] = (short) (chars[i] & 0x00FF);
            //System.out.println("bytes [" + i + "] = " + bytes[i]);
        }
        return bytes;
    }

    Вычисление сигнатуры строки для её применения в сортировке строк в алфавитном порядке по всем символам
    https://habr.com/ru/post/709406/ / https://itnan.ru/post.php?c=1&p=709406
    https://github.com/Helgi-cell/HashStringAlphabetical

    ISO, 08 Января 2023

    Комментарии (43)
  9. C++ / Говнокод #28528

    +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
    ListNode* mergeTwoLists(ListNode* list1, ListNode* list2) {
            bool f;
            ListNode* t;
            return (ListNode*)
                ( 
                    (!list1 * (unsigned long long)list2) + 
                    (!list2 * (unsigned long long)list1) +
                    ((!!list1 && !!list2 && 
                        (
                            ((f = (list1 -> val <= list2 -> val)) && (t = list1, list1->next = mergeTwoLists(list1 -> next, list2)))||
                            ((!f) && (t = list2, list2->next = mergeTwoLists(list1, list2->next)))
                        )
                    ) * (unsigned long long)t)
                ); 
        }

    2022. Хабр. Итоги.

    JloJle4Ka, 30 Декабря 2022

    Комментарии (110)
  10. Python / Говнокод #28524

    +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
    def __get_column_names(table: str) -> tuple:
        try:
            with conn:
                cur.execute("SELECT name FROM PRAGMA_TABLE_INFO(?)", (table,))
                column_names = cur.fetchall()
        except Exception as excpt:
            print(excpt)
        column_names = tuple(i[0] for i in column_names)
        return column_names
    
    
    def db_register_user(user_data: types.User):
        """
        SQL запрос для внесения данных о пользователе
    
        Args:
            user_data: telebot User объект, содержащий словарь с параметрами пользователя
        """
        user_data = user_data.to_dict()
        column_names: tuple = __get_column_names('Users')
        user_values = tuple(user_data.get(key) for key in column_names if key in user_data)
        try:
            with conn:
                query = 'INSERT INTO Users cn'.replace('cn', str(column_names))+' VALUES (?,?,?,?,0,3)'
                parameters = (*user_values,)
                conn.execute(query, parameters)
        except Exception as excpt:
            print(excpt)
        conn.close()

    На сколько в такой ситуации .format не безопасен? Идея в том, чтобы не объебошится программисту в коде введя неверное значение колонки. Для этого имена колонок берутся из самой базы (есть мысль ещё и типы брать). Есть вариант реализации получше? Спасибо

    rockkley94, 26 Декабря 2022

    Комментарии (82)
  11. PHP / Говнокод #28515

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function gk_nitter_filter($url) {
        $url = preg_replace('/https?:\/\/(?:mobile\.)?twitter\.com\/(\S*)/', 'https://nitter.kavin.rocks/$1', $url);
        $url = preg_replace('/https?:\/\/pbs\.twimg\.com\/(\S+)\?format=(\w+)(\S*)/', 'https://nitter.kavin.rocks/pic/$1.$2', $url);
        $url = preg_replace('/https?:\/\/pbs\.twimg\.com\/(\S*)/', 'https://nitter.kavin.rocks/pic/$1', $url);
        return $url;
    }

    НИТТЕР КАВИН РОКС!

    gostinho, 20 Декабря 2022

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