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

    Всего: 122

  2. Куча / Говнокод #28083

    0

    1. 1
    https://pvs-studio.com/ru/blog/posts/cpp/0094/

    3_dar, 17 Марта 2022

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

    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
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    /*
       xdrv_96_blacklist.ino - Blacklist for Tasmota
    
       SPDX-FileCopyrightText: 2022 Theo Arends
    
       SPDX-License-Identifier: GPL-3.0-only
     */
     #define USE_BLACKLIST
    
     #ifdef USE_BLACKLIST
     /*********************************************************************************************\
      * Blacklist support
      *
      * Check language and user set latitude/longitude against blacklist table
     \*********************************************************************************************/
     #define XDRV_96            96
    
     typedef struct {
       int16_t latitude_tl;    // - 8999 to 8999
       int16_t longitude_tl;   // -17999 to 17999
       int16_t latitude_br;
       int16_t longitude_br;
       uint16_t lcid;
     } tBlArray;
    
     //const char BlacklistText[] PROGMEM = "Stop war - Free Ukrain|Stop war - Free Ukrain|";
     const char BlacklistText[] PROGMEM = "Stop war, Free Ukrain";
    
     //                   lat_tl lon_tl lat_br lon_br lcid
     tBlArray BlArray[] {  5900,  3200,  5300,  4400, 1049,     // Around Moscow
                           5450,  2633,  5280,  2900, 1049      // Around Minsk
                        };
    
     uint8_t blist_show = 0;
    
     void BListEverySecond(void) {
       if (Rtc.utc_time < 1648771200) {                         // Only until 2022-04-01
         if (0 == (TasmotaGlobal.uptime % 20)) {                // Only every 20 seconds
           if (TasmotaGlobal.power) {                           // Only if any power on
             uint32_t latitude = Settings->latitude / 10000;
             uint32_t longitude = Settings->longitude / 10000;
             uint32_t count = sizeof(BlArray) / sizeof(tBlArray);
             for (uint32_t i = 0; i < count; i++) {
               // Currently only supports top-right quarter of the earth
               if ((LANGUAGE_LCID == BlArray[i].lcid) &&        // Check language id
                   (latitude < BlArray[i].latitude_tl) &&       // Check user set latitude and longitude against table
                   (latitude > BlArray[i].latitude_br) &&
                   (longitude > BlArray[i].longitude_tl) &&
                   (longitude < BlArray[i].longitude_br)) {
    
     //            char bl_text[100];
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Power0 0"));   // Turn all power off - annoying
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Restart 1"));  // Restart - more annoying
     //            snprintf_P(bl_text, sizeof(bl_text), PSTR("Reset 1"));    // Reset - disastrous
     //            ExecuteCommand(bl_text, SRC_IGNORE);
    
     //            char bl_text[100];
     //            AddLog(LOG_LEVEL_NONE, PSTR("**** %s ****"), GetTextIndexed(bl_text, sizeof(bl_text), i, BlacklistText));
                 AddLog(LOG_LEVEL_NONE, PSTR("**** %s ****"), BlacklistText);
                 blist_show = i +1;                             // Set GUI message id
                 break;
               }
             }
           }
         } else if (0 == (TasmotaGlobal.uptime % 10)) {         // Only every 10 seconds
           blist_show = 0;                                      // Reset GUI message id after 10 seconds
         }
       }
     }
    
     void BListShow(bool json) {
       if (blist_show) {
     //    char bl_text[100];
     //    WSContentSend_PD(PSTR("{s}**** %s ****{m}{e}"), GetTextIndexed(bl_text, sizeof(bl_text), blist_show -1, BlacklistText));
         WSContentSend_P(PSTR("{s}**** %s ****{m}{e}"), BlacklistText);
       }
     }
    
     /*********************************************************************************************\
      * Interface
     \*********************************************************************************************/
    
     bool Xdrv96(uint8_t function) {
       bool result = false;
    
       switch (function) {
         case FUNC_EVERY_SECOND:
           BListEverySecond();
           break;
     #ifdef USE_WEBSERVER
         case FUNC_WEB_SENSOR:
           BListShow(0);
           break;
     #endif  // USE_WEBSERVER
       }
    
       return result;
     }

    https://github.com/arendst/Tasmota/commit/98cbf2587a1a914bbd16996ebb48dd451d3da448

    3_dar, 05 Марта 2022

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

    0

    1. 1
    Путин признал "PHP".

    3_dar, 22 Февраля 2022

    Комментарии (150)
  5. JavaScript / Говнокод #27989

    0

    1. 1
    http://motherfuckingwebsite.com

    <!-- yes, I know...wanna fight about it? -->
    <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-45956659-1', 'motherfuckingwebsite.com');
    ga('send', 'pageview');
    </script>


    Лол кек чебурек

    3_dar, 04 Февраля 2022

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

    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
    # Python 2.7
    import cgi
    print(cgi.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor']}
    
    # Python 3.7.3
    import urllib.parse
    print(urllib.parse.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor']}
    
    # Python 3.9.10
    import urllib.parse
    print(urllib.parse.parse_qs('a=bagor;+kakoi'))
    # {'a': ['bagor; kakoi']}

    Что, блядь, это за хуета???
    Переводил программу на Python3 и пол дня потратил в попытках понять почему блядь тесты сломались.
    Какой-то петух завязался, на ';' сепаратор, который обрезается.

    https://docs.python.org/3/library/urllib.parse.html
    Changed in version 3.10: Added separator parameter with the default value of &. Python versions earlier than Python 3.10 allowed using both ; and & as query parameter separator. This has been changed to allow only a single separator key, with & as the default separator.

    И у меня не 3.10, но да похуй.
    Как мне теперь закостылять это говно, не меняя данные?

    3_dar, 03 Февраля 2022

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    location ~ ^/(pituh|kurochka) {
        alias "static/pituh.gif";
        default_type image/gif;
    }
    
    curl "http://localhost/pituh" - OK
    curl "http://localhost/pituh123" - OK
    curl "http://localhost/pituh/1/2/3" - OK
    curl "http://localhost/pituh/1/2/3/" - INTERNAL SERVER ERROR: static/pituh.gifindex.html" is not a directory

    Что это, блядь, за багор и как можно исправить?

    3_dar, 11 Января 2022

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    public class Main {
      public static void main(String[] args) {
    	System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(new Date(2022 - 1900, 0, 1, 20, 30)));
    	System.out.println(new SimpleDateFormat("YYYY-MM-dd").format(new Date(2022 - 1900, 0, 1, 20, 30)));
      }
    }

    А что там у Jawa-блядей за отсос должен был случиться 1 января? Я что-то не могу воспроизвести:
    https://www.programmersought.com/article/47096700076/

    3_dar, 07 Января 2022

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

    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
    using KoKo.Property;
    
    namespace MyProject {
    
        public class Person {
    
            private StoredProperty<string> FirstName { get; }
            private StoredProperty<string> LastName { get; }
            public Property<string> FullName { get; }
    
            public Person(string firstName, string lastName) {
                FirstName = new StoredProperty<string>(firstName);
                LastName = new StoredProperty<string>(lastName);
                FullName = DerivedProperty<string>.Create(FirstName, LastName, (first, last) => $"{first} {last}");
            }
    
            public void SetFirstName(string firstName) {
                FirstName.Value = firstName;
            }
    
        }
    }

    3_dar, 04 Января 2022

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

    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
    'use strict'
     
    const {TheCtrl} = require('the-controller-base')
    const {withAuthorized} = require('the-controller-mixins')
     
    async function tryExample () {
      class MyCtrl extends withAuthorized(TheCtrl) {
        /* ... */
      }
    }
     
    tryExample().catch((err) => console.error(err))

    Mixins for the-controller

    Installation
    $ npm install the-controller-mixins --save

    Очень полезный и нужный пакет. Пользуйтесь.
    https://www.npmjs.com/package/the-controller-mixins/v/2.1.0

    3_dar, 31 Декабря 2021

    Комментарии (25)
  11. Java / Говнокод #27903

    +2

    1. 1
    2. 2
    - null, null, null, null, null, null, null, null, null, null, null, null, null, null))
    + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null))

    Это реальный коммит с работы
    (не мой, я к jawa не притрагиваюсь)

    3_dar, 30 Декабря 2021

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