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

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

    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
    <vistefan> In recently installed Manjaro i have this (https://imgur.com/a/e0Prjez) instead of proper AwesomeWM menu called by Super button. Any Ideas? Tried to install additional fonts. Locales are correct.
    <HEX0> !give vistefan manjaro
    <phrik> vistefan: manjaro does things differently from arch, so we can't really support it. ask in #manjaro or ##linux
    <SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ? Even I do that :D
    <SGOrava> vistefan: My idea is that you are missing some fonts or locale...
    <vistefan> SGOrava, :D
    <Scimmia> !give SGOrava notarch
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <thingfish> you're better off being up front, from the beginning about what you're running.
    <Scimmia> seriously, we don't want you here if you're going to act like a total piece of shit
    <SGOrava> Scimmia: I know sure, but as long as one knows what one can ask here than it is fine
    <Scimmia> no, it's not
    <Scimmia> at all
    <SGOrava> how is it not ?
    <Scimmia> If you're not on Arch, it's not OK, end of story
    <SGOrava> what is wrong with that when one wants to ask a question 
    <Namarrgon> lying about your distro? ban
    <Scimmia> and asking here implies it's Arch, so knowing the rules and asking anyway is lying
    <SGOrava> why be so pedantic ?
    <Namarrgon> we don't like liars
    <SGOrava> that is why I said one needs to know what belongs here and what does not
    <thingfish> people who help in here have a hard enough time supporting actual Arch users.  They don't need to be wasting their time chasing down some issue for other distros, which should have their own support channels.
    <Namarrgon> support for other distros does not belong here
    <SGOrava> Namarrgon: peopúle lie everyday just to survive
    <Namarrgon> that's a shitty excuse
    <cyveris> That's a shitty person.
    <SGOrava> why are you so hostile ?
    <Namarrgon> if you don't like our rules then you there are plenty of other channels that you can join
    <thingfish> because you don't seem to have a clue, dude.
    <Namarrgon> SGOrava: because you are telling other people to lie to the community just to get support
    <SGOrava> I am not, I am telling them to distinguish where the problem is and ask at the source
    <demonicmaniac3> 21:14 < SGOrava> vistefan: you would be fine as long as you do not mention other distributions and pretend to be using Arch, is it that hard ?
    <Scimmia> and if it's not Arch, the problem is not here
    <demonicmaniac3> you are telling them to pretend to use arch when they ask questions
    <Scimmia> SGOrava: sounds like you aren't running arch...
    <SGOrava> I am running Arch, half of the packages comes from Arch repos, so I run Arch
    <Scimmia> So that's a no
    <thingfish> aargh
    <HEX0> !roulette
    * phrik has kicked HEX0 from #archlinux (BANG!)
    <Scimmia> !give SGOrava notarch
    <cyveris> Bold move, cotton.
    * phrik reloads and spins the chambers.
    <phrik> SGOrava: This channel is for Arch Linux support only. Also see https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_.2Aonly.2A
    <SGOrava> how is it a no ?
    <Scimmia> SGOrava: where do the other half come from?
    <SGOrava> Scimmia: you still would not care
    <Scimmia> yep, not Arch
    <SGOrava> I know what to ask where (mostly)
    <Scimmia> if you're asking here about anything at all, you obviously don't
    <SGOrava> ??
    <Namarrgon> SGOrava: https://wiki.archlinux.org/index.php/Code_of_conduct#Arch_Linux_distribution_support_*only*
    <phrik> Title: Code of conduct - ArchWiki (at wiki.archlinux.org)
    * HEX0 (~HEX0@unaffiliated/hex0) has joined
    <Namarrgon> you can use whatever distro you want but that doesn't mean that we have to put up with your nonsense
    <cyveris> SGOrava: You're not using Arch Linux. You're using some derivative. Hence, this is not the channel for you, and now that everyone here knows you advocate for lying about it to get help, no one will help you.
    <SGOrava> Namarrgon: sorry, it is too long
    <Namarrgon> alright
    <SGOrava> cyveris: nope, it is channel for me when I have problems which are sourced from Arch
    <Scimmia> SGOrava: and now that you know the rules, ask here and get banned
    <SGOrava> Scimmia: what should I ask ?
    <cyveris> And here we go.
    <SGOrava> cyveris: you said I should ask something, so think about it
    <HEX0> stop talking and install arch linux while you can

    vistefan, 29 Декабря 2019

    Комментарии (96)
  3. C# / Говнокод #26058

    +2

    1. 1
    2. 2
    3. 3
    https://tjournal.ru/analysis/128216-moshenniki-3-0-kak-ne-popastsya-na-udochku-novogo-pokoleniya-prestupnikov-v-sfere-it
    
    https://leonardo.osnova.io/0234cd39-a2ef-c6d8-d8df-87df562f9997/-/scale_crop/600x398/center/

    booratihno, 30 Ноября 2019

    Комментарии (96)
  4. Си / Говнокод #25899

    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
    #include <ncurses.h>
    
    #if defined(_WIN32) || defined(_WIN64) 
        #include <windows.h>
        #define msleep(msec) Sleep(msec)
    #else
        #include <unistd.h>
        #define msleep(msec) usleep(msec*1000)
    #endif
    
    int main()
    {
        initscr();
    
        char str[100];
        addstr("Enter string: ");
        getstr(str); //Считваем строку
        curs_set(0); //"Убиваем" курсор, чтобы не мешался
        while ( true )
        {
        //Перемещаем х-координату как можно дальше вправо, и будем уменьшать её, пока она != 0
            for ( unsigned x = getmaxx(stdscr); x; x-- ) 
            {
                clear();
                mvaddstr(getmaxy(stdscr) / 2, x, str);
                refresh();
                msleep(200);
            }
        }
    
        endwin();
        return 0;
    }

    https://code-live.ru/post/ncurses-input-output/#getstr-
    Сколько хуйни вы можете найти в этом примере?

    j123123, 04 Октября 2019

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

    +6

    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
    #include "stdafx.h"
    #include "hackery.h"
    #include <cstdint>
    #include <windows.h>
    
    
    /*XXX*/
    unsigned char udiv128Data[] =
    {
      0x48, 0x89, 0xD0, // mov rax,rdx
      0x48, 0x89, 0xCA, // mov rdx,rcx
      0x49, 0xF7, 0xF0, // div r8
      0x49, 0x89, 0x11, // mov [r9],rdx
      0xC3              // ret
    };
    
    /*XXX*/
    unsigned char sdiv128Data[] =
    {
      0x48, 0x89, 0xD0, // mov rax,rdx
      0x48, 0x89, 0xCA, // mov rdx,rcx
      0x49, 0xF7, 0xF8, // idiv r8
      0x49, 0x89, 0x11, // mov [r9],rdx
      0xC3              // ret
    };
    
    unsigned __int64(__fastcall *udiv128)(unsigned __int64 numhi, unsigned __int64 numlo, unsigned __int64 den, unsigned __int64* rem);
    
    __int64(__fastcall *sdiv128)(__int64 numhi, __int64 numlo, __int64 den, __int64* rem);
    
    namespace {
    struct Q {
      Q() {
        /*XXX*/
        udiv128 = reinterpret_cast<unsigned __int64(__fastcall *)(unsigned __int64, unsigned __int64, unsigned __int64, unsigned __int64*)>(&udiv128Data[0]);
        /*XXX*/
        sdiv128 = reinterpret_cast<__int64(__fastcall *)(__int64, __int64, __int64, __int64*)>(&sdiv128Data[0]);
        /*XXX*/
        DWORD dummy;
        /*XXX*/
        VirtualProtect(udiv128Data, sizeof(udiv128Data), PAGE_EXECUTE_READWRITE, &dummy);
        /*XXX*/
        VirtualProtect(sdiv128Data, sizeof(sdiv128Data), PAGE_EXECUTE_READWRITE, &dummy);
      }
    } q;
    }

    Вот такая вот загогулина получилась по причине того что в 64-х битной Вижуал Студии нет встроенного асма, нет интринсика для простой асмовой команды, но мне вот надо именно полное деление 128-битного числа на 64-х битное именно с остатком и мне совершенно фиолетово на то что Майкрософт думает на тему вредности команды DIV и заменимости деления умножением на обратное. Да, и мне влом усложнять структуру проекта и линковать какие-то символы с внешнего асма.

    MinorThreat, 12 Ноября 2015

    Комментарии (96)
  6. Си / Говнокод #17892

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    fi = fopen("kokoko.tmp", "rb");
    
            fseek(fi, 0, SEEK_END);
            file_size = ftell(fi);
            fseek(fi, 0, SEEK_SET);

    rewind? system call? Не, не слышали.

    codemonkey, 30 Марта 2015

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

    +155

    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
    try
    {
      return ($image = $this->row->image()->first())
        ? $image->{$this->imageAlias}
        : dummyThumbnail($this->imageAlias)
      ;
    }
    catch(\Exception $e)
    {
      if ($e->getMessage() === 'Method [image] is not defined on the Query class.')
      {
          $val = parent::value();
          return (is_string($val) and \Str::contains($val, 'http://'))
            ? $val
            : $this->row->getImageSrc($this->name, $this->imageAlias)
          ;
      }
    
      throw new \Exception($e->getMessage(), $e->getCode());
    }

    mobileka, 28 Января 2014

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

    +143

    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
    const int index64[64] = {
        0,  1, 48,  2, 57, 49, 28,  3,
       61, 58, 50, 42, 38, 29, 17,  4,
       62, 55, 59, 36, 53, 51, 43, 22,
       45, 39, 33, 30, 24, 18, 12,  5,
       63, 47, 56, 27, 60, 41, 37, 16,
       54, 35, 52, 21, 44, 32, 23, 11,
       46, 26, 40, 15, 34, 20, 31, 10,
       25, 14, 19,  9, 13,  8,  7,  6
    };
     
    /**
     * bitScanForward
     * @author Martin Läuter (1997)
     *         Charles E. Leiserson
     *         Harald Prokop
     *         Keith H. Randall
     * "Using de Bruijn Sequences to Index a 1 in a Computer Word"
     * @param bb bitboard to scan
     * @precondition bb != 0
     * @return index (0..63) of least significant one bit
     */
    int bitScanForward(U64 bb) {
       assert (bb != 0);
       return index64[((bb & -bb) * 0x03f79d71b4cb0a89) >> 58];
    }

    нашёл на кывте

    TarasB, 19 Декабря 2013

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

    +114

    1. 1
    2. 2
    // FxCop does not allow the string "Uri" in a method name that does not return a Uri object.
        public static string To_U_r_i_TypeString(DeviceType type)

    dirtygopher, 26 Декабря 2012

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

    +121

    1. 1
    (reverse (butlast ...))

    Родное :)

    wvxvw, 16 Июля 2012

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

    −6

    1. 1
    хде хруст?

    Превед, говнокод. Чому нет категории для раста?

    orion, 28 Июля 2022

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