1. Список говнокодов пользователя guest6

    Всего: 4

  2. PHP / Говнокод #27871

    −5

    1. 1
    2. 2
    3. 3
    В бота добавлены 2 новые фичи:
    - можно писать сообщения без reply, тогда появятся кнопки в какой оффтоп запостить
    - бота можно добавлять в группы*, и если кто-то на ваш комментарий отвечает - срабатывает mention

    Ссылка на бота - https://t.me/GovnokodBot
    А также подписывайтесь на канал Говнокода в телеграме: https://t.me/GovnokodChannel

    * в группу 1*1 с ботом можно, на группах больше не тестировал

    guest6, 12 Декабря 2021

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

    −6

    1. 1
    2. 2
    3. 3
    Подписывайтесь на канал Говнокода в телеграме:
    
    https://t.me/GovnokodChannel

    guest6, 14 Ноября 2021

    Комментарии (3)
  4. PHP / Говнокод #27702

    −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
    <?php
    
    function is_russian_char($c) {
        return preg_match('/[А-Яа-яЁё]/u', $c);
    }
    
    function nemyxify_char($a) {
        $map = [
            "а" => "a",
            "б" => "6",
            "в" => "B",
            "г" => "r",
            "д" => "g",
            "е" => "e",
            "ё" => "e",
            "ж" => "Jk",
            "з" => "3",
            "и" => "u",
            "й" => "u",
            "к" => "k",
            "л" => "JI",
            "м" => "M",
            "н" => "H",
            "о" => "o",
            "п" => "n",
            "р" => "p",
            "с" => "c",
            "т" => "m",
            "у" => "y",
            "ф" => "qp",
            "х" => "x",
            "ц" => "LL",
            "ч" => "4",
            "ш" => "LLI",
            "щ" => "LLL",
            "ь" => "b",
            "ы" => "bI",
            "ъ" => "b",
            "э" => "3",
            "ю" => "I0",
            "я" => "9I",
    
            "А" => "A",
            "Д" => "D",
            "Е" => "E",
            "Ё" => "E",
            "Ж" => "JK",
            "И" => "U",
            "Й" => "U",
            "К" => "K",
            "О" => "O",
            "Р" => "P",
            "С" => "C",
            "Т" => "T",
            "У" => "Y",
            "Х" => "X",
        ];
        if (isset($map[$a])) {
            return $map[$a];
        }
        return $map[mb_strtolower($a)];
    }
    
    function gk_nemyxify($text) {
        $res = '';
        foreach (preg_split( '//u', $text, null, PREG_SPLIT_NO_EMPTY ) as $c) {
            if (is_russian_char($c)) {
                $res .= nemyxify_char($c);
            } else {
                $res .= $c;
            }
        }
        return $res;
    }

    guest6, 04 Октября 2021

    Комментарии (24)
  5. Python / Говнокод #27617

    −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
    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
    # Дамп базы хуза
    # Постобработка export-а из MySQL
    
    import pandas as pd
    import numpy as np
    import csv
    
    comments = pd.read_csv('/wp_comments-2.csv', header=None)
    comments.head()
    
    ##
    
    comments_clean = pd.DataFrame({
        'comment_id': comments[0],
        'comment_post_id': comments[1],
        'comment_parent': comments[13],
        'name': comments[2],
        'gravatar_hash': comments[3].str.split('@').str[0],
        'gravatar_domain': comments[3].str.split('@').str[1],
        'profile': comments[4],
        'date': comments[6],
        'content': comments[8],
    })
    
    ##
    
    comments_clean[(comments_clean.gravatar_domain != 'lo.ol') & ~comments_clean.gravatar_domain.isna()]
    
    ##
    
    comments_clean = comments_clean[(comments_clean.gravatar_domain == 'lo.ol') | comments_clean.gravatar_domain.isna()]
    comments_clean.drop(columns=['gravatar_domain'], inplace=True)
    comments_clean.head()
    
    ##
    
    posts = pd.read_csv('/wp_posts.csv', header=None)
    posts = posts[(posts[20] == 'post') & (posts[7] == 'publish') & (posts[11].str.match('^_'))]
    posts.head()
    
    ##
    
    posts_clean = pd.DataFrame({
        'post_id': posts[0],
        'date': posts[2],
        'content': posts[4],
        'description': posts[6],
        'original_id': posts[11].str[1:]
    })
    posts_clean.head()
    
    ##
    
    comments_clean.to_csv('~/Downloads/gost/comments.csv', index=False)
    posts_clean.to_csv('~/Downloads/gost/posts.csv', index=False)

    https://govnokod.xyz/dump/wp_gk_legacy_users.csv
    ../comments.csv
    ../posts.csv

    guest6, 26 Августа 2021

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