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

    Всего: 48

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    (* /*
    C > /) 2> /dev/null & echo hello world!; exit
    *       This file is correct input for:
    *       sh, cc, pc, f77
    */ main(program)) { puts("hello world!"); /*
    *) program main(output);begin writeln('hello world!')end. {
          write( *, '("hello world!")')
          end
    */ return &program; }

    Bash: https://ideone.com/HKy5RJ
    C: https://ideone.com/KFbJsK
    Pascal (fpc): https://ideone.com/4zcc51

    inkanus-gray, 12 Сентября 2017

    Комментарии (42)
  3. Куча / Говнокод #23344

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    (*a/*/ % #)(PostScript)/Helvetica 40 selectfont 9 400 moveto show%v"f"a0
    true showpage quit%#) 2>/dev/null;echo bash;exit #*/);int main()/*>"eb"v
    %a*0)unless print"perl\n"__END__*/{printf("C\n");/*>>#;"egnu">:#,_@;,,,<
    *)begin writeln(*\output={\setbox0=\box255}\eject\shipout\hbox{\TeX}\end
    *)('pascal');end.{*/return 0;}

    C: https://ideone.com/Ntu3S0
    Pascal (fpc): https://ideone.com/A9qZ0x
    Bash: https://ideone.com/TYr7cu
    Perl: https://ideone.com/fAUhiv

    inkanus-gray, 12 Сентября 2017

    Комментарии (6)
  4. Куча / Говнокод #23343

    +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
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    (*O/*_/
    Cu  #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*------------------------------------------------------------------*+Ex=
    CuG #%*   POLYGLOT - a program in eight languages      15 February 1991  *+Ex=
    CuG #%*   10th Anniversary Edition                      1 December 2001  *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Written by Kevin Bungard, Peter Lisle, and Chris Tham          *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Polyglot suports the following languages:                      *+Ex=
    CuG #%*     1. COBOL (ANSI)                                              *+Ex=
    CuG #%*     2. Pascal (ISO)                                              *+Ex=
    CuG #%*     3. Fortran (ANSI, f77)                                       *+Ex=
    CuG #%*     4. C (ANSI-ish)                                              *+Ex=
    CuG #%*     5. PostScript                                                *+Ex=
    CuG #%*     6. Linux/Unix shell script (bash, sh, csh)                   *+Ex=
    CuG #%*     7. x86 machine language (MS-DOS, Win32, Linux)               *+Ex=
    CuG #%*     8. Perl (version 5)                                          *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Usage:                                                         *+Ex=
    CuG #%*     1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com|pl] *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     2. Compile and run with your favorite compiler and operating *+Ex=
    CuG #%*        system.                                                   *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Notes:                                                         *+Ex=
    CuG #%*     1. We have attempted to use only standard language features. *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     2. Without the -traditional flag gcc will issue a warning.   *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     3. When transferring from Unix to DOS make sure that a LF    *+Ex=
    CuG #%*        is correctly translated into a CR/LF.                     *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     4. Keep the black lines at the start of the program. They    *+Ex=
    CuG #%*        are important.                                            *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*     5. This text is a comment block in all eight languages.      *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*   Please mail any comments, corrections or additions to          *+Ex=
    CuG #%*   [email protected]                                       *+Ex=
    CuG #%*                                                                  *+Ex=
    CuG #%*------------------------------------------------------------------*QuZ=
    CuG #%*                                                                  *+Ex=
    CuG #%*!Mx)ExQX5ZZ5SSP5n*5X!)Ex+ExPQXH,B+ExP[-9A-9B(g?(gA'UTTER_XYZZXX!X *+
    CuG #(*                                                                  *(
    C   # */);                                                              /*(
    C   # *)  program        polyglot (output);                             (*+
    C   #     identification division.
    C   #     program-id.    polyglot.
    C   #
    C   #     data           division.
    C   #     procedure      division.
    C   #
    C   # * ))cleartomark   /Bookman-Demi findfont 36 scalefont setfont     (
    C   # *                                                                 (
    C   #
    C   # *                  hello polyglots$
    C   #     main.
    C   #         perform
    C  /# * ) 2>_$$; echo   "hello polyglots"; rm _$$; exit;
    C   # * (
    C   #
    C     *0 ) unless print "hello polyglots\n"; __END__
                  print
    C             stop run.
         -*,                'hello polyglots'
    C
    C         print.
    C             display   "hello polyglots".                              (
    C     */  int i;                                                        /*
    C     */  main () {                                                     /*
    C     */      i=printf ("hello polyglots\n"); O= &i; return *O;         /*
    C     *)                                                                (*
    C     *)  begin                                                         (*
    C     *)      writeln  ('hello polyglots');                             (*
    C     *)                                                                (* )
    C     * ) pop 60 360                                                    (
    C     * ) pop moveto    (hello polyglots) show                          (
    C     * ) pop showpage                                                  ((
    C     *)
               end                                                          .(* )
    C)pop%     program       polyglot.                                      *){*/}

    C: https://ideone.com/LzLeJH
    Pascal (gpc): https://ideone.com/J7VAQk
    Perl: https://ideone.com/AmODLG

    К сожалению, не все языки удалось проверить имеющимися интерпретаторами/компиляторами.

    inkanus-gray, 12 Сентября 2017

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

    −15

    1. 1
    do {btn_click();} while(1);

    1. Переходим по ссылке: https://4px.ru/seo/
    2. Вводим в поле «Адрес» доменное имя любимого сайта.
    3. Выполняем в сосноли JS вышеприведённый код.
    4. ?????
    5. Profit.

    inkanus-gray, 16 Февраля 2017

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

    −14

    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
    <?php
    define('SUBMIT_URL', 'http://archive.li/submit/');
    define('REFERER_URL', 'http://archive.li/');
    define('DEFAULT_UA', 'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.16');
    define('POST_HEADERS', 
    "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1\r\n"
    ."Accept-Language: ru-RU,ru;q=0.9,en;q=0.8\r\n"
    ."Content-Type: application/x-www-form-urlencoded\r\n");
    define('CSRF_SELECT', "//form[@id='submiturl']/input[@name='submitid']");
    define('MY_COOKIES', '__cfduid=d7474a5cc42c65aa882c01a40e7ea74f61484324040');
    
    function getCsrf($url) {
    	$context_options = stream_context_create(array('http' => array(
    	  'method' => 'GET',
    	  'user_agent' => DEFAULT_UA,
    	  'header' => 'Referer: '. REFERER_URL . "\r\n" . 'Cookie: ' . MY_COOKIES
    	)));
    	$links = array();
    	$file = @file_get_contents($url, false, $context_options);
    	if ($file) {
    	  $old_libxml_error = libxml_use_internal_errors(true);
    	  $dom = new DOMDocument;
     	  $dom->loadHTML($file);
    	  libxml_use_internal_errors($old_libxml_error);
     	  $domxpath = new DOMXPath($dom);
     	  $filtered = $domxpath->query(CSRF_SELECT);
    	  foreach ($filtered as $item) {
    		$links[] = $item->getAttribute('value');
    	  }
    	}  
    	return $links[0];
    }
    
    function doPost($url, $referer, $token) {
    	$postdata = http_build_query(array(
    	  'submitid' => $token,
    	  'url' => $url
     	));
    	$context_options = stream_context_create(array('http' => array(
    	  'protocol_version' => 1.1,
    	  'method' => 'POST',
    	  'user_agent' => DEFAULT_UA,
    	  'header' => POST_HEADERS . 'Referer: '. $referer . "\r\n" . 'Cookie: ' . MY_COOKIES,
    	  'content' => $postdata,
    	  'follow_location' => 1,
    	  'max_redirects' => 20,
    	  'timeout' => 1.0,
    	  'ignore_errors' => true
    	)));
    	return file_get_contents(SUBMIT_URL, false, $context_options);
    }
    
    $csrf = getCsrf(REFERER_URL.'?url='.urlencode($argv[1]));
    $result = doPost($argv[1], REFERER_URL.'?url='.urlencode($argv[1]), $csrf);
    if ($result) echo $argv[1] . ' OK' . PHP_EOL;

    Бекапилка URL в сервисе archive.li (он же archive.is, archive.ec, archive.today).

    inkanus-gray, 13 Февраля 2017

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

    −11

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    typedef char бл;
    typedef char вы;
    typedef char на;
    бл*ть = "программирование";
    вы*бать = "снизу вверх";
    на*уя = "наискосок";
    бл**ь = &ть;
    вы**ать = &бать;
    на**я = &уя;

    Любителям писать звёздочки в середине слов посвящается.

    inkanus-gray, 11 Февраля 2017

    Комментарии (36)
  8. C++ / Говнокод #22312

    −14

    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
    #include "hello.h"
    
    __static_data<System_Reflection_RuntimeModule> GModuleC__runtimemodule_hello_ehpqe23j_dll = { (Byte*) -1, (Byte*) -1, { { { (Void**) &System_Reflection_RuntimeModule_vtable_impl } },  0 , &GModuleC__runtimeassembly_hello_ehpqe23j_dll.data, {  0  }, {  0  }, {  0  }, {  0  } }};
    __static_data<System_Reflection_RuntimeAssembly> GModuleC__runtimeassembly_hello_ehpqe23j_dll = { (Byte*) -1, (Byte*) -1, { { { (Void**) &System_Reflection_RuntimeAssembly_vtable_impl } },  0 ,  0 , {  0  } }};
    Int32 GModuleC__cctor_called_hello_ehpqe23j_dll = -1;
    static __static_str<6> _s15063797403154689540_ = { (Byte*) -1, (Byte*) -1, (Void**) &System_String_vtable_impl, 5, L"pituh" };
    static __static_str<2> _s1054744840757602046_ = { (Byte*) -1, (Byte*) -1, (Void**) &System_String_vtable_impl, 0, L"\0" };
    __static_data<System_RuntimeType> pituh__runtimetype_hello_ehpqe23j_dll = { (Byte*) -1, (Byte*) -1, { { { { { (Void**) &System_RuntimeType_vtable_impl } } } },  0 , {  0  }, {  0  }, 0, (System_Type*) &System_Object__runtimetype.data,  0 , ((System_String*) ((Byte**) &_s15063797403154689540_ + 2)), ((System_String*) ((Byte**) &_s1054744840757602046_ + 2)), 18, 0, 0, 0, 0, &GModuleC__runtimemodule_hello_ehpqe23j_dll.data }};
    Int32 pituh__cctor_called_hello_ehpqe23j_dll = -1;
    Void Void_pituh__ctorFN_hello_ehpqe23j_dll(pituh* __this) {
        __check_this((Void*)__this);
        Void_System_Object__ctorFN((System_Object*) (__this));
        return ;
    }
    static __static_str<8> _s18790481933210356248_ = { (Byte*) -1, (Byte*) -1, (Void**) &System_String_vtable_impl, 7, L"Kokoko!" };
    
    Int32 Int32_pituh_MainFSystem_StringAYN_hello_ehpqe23j_dll(System_StringAY* args) {
        Void_System_Console_WriteLineFSystem_StringN(((System_String*) ((Byte**) &_s18790481933210356248_ + 2)));
        return 0;
    }
    pituh* pituh_pituh__newFN_hello_ehpqe23j_dll() {
        Int32 local0;
        Int32 _dup20;
        Int32 _dup22;
        Void* _dup42;
        Void* _dup51;
        Void* _dup56;
        Int32 _dup75;
        pituh* _dup104;
        _dup20 = ((sizeof(pituh) + sizeof(System_Object*)) + sizeof(System_Object*));
        ;
        local0 = _dup20;
    a22:
        _dup22 = _dup20;
        ;
        if ((UInt32)_dup22 >= (UInt32)102400) goto a37;
        Void* _phi30;
        Void* __expr30;
        __expr30 = GC_MALLOC_ATOMIC(_dup22);
        _phi30 = __expr30;
        goto a42;
    a37:
        Void* __expr37;
        __expr37 = GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(_dup22);
        _phi30 = __expr37;
    a42:
        _dup42 = _phi30;
        ;
        if (_dup42) goto a51;
        System_OutOfMemoryException* _new45;
        _new45 = System_OutOfMemoryException_System_OutOfMemoryException__newFN();
        Void_System_OutOfMemoryException__ctorFN(_new45);
        throw (Void*) _new45;
    a51:
        _dup51 = _dup42;
        ;
        Memset((Byte*) ((Byte*) (_dup51)), 0, (local0));
        _dup56 = _dup51;
        ;
        *((Int32*) (Int32*) (_dup56)) = -1;
        _dup75 = (Int32) (((Byte*) (_dup56) + sizeof(pituh*)));
        ;
        *((Int32*) (Int32*) (_dup75)) = -1;
        _dup104 = (pituh*) ((Void*) ((_dup75 + sizeof(pituh*))));
        ;
        Void_pituh__initFN_hello_ehpqe23j_dll(_dup104);
        return _dup104;
    }
    Void Void_pituh__initFN_hello_ehpqe23j_dll(pituh* __this) {
        __check_this((Void*)__this);
        ((System_Object*) (__this))->__vtbl = (Void**) &pituh_vtable_implhello_ehpqe23j_dll;
        return ;
    }
    Int32 Int32_pituh__getsizeFN_hello_ehpqe23j_dll(pituh* __this) {
        __check_this((Void*)__this);
        return (Int32) (sizeof(pituh));
    }
    System_Type* System_Type_pituh__gettypeFN_hello_ehpqe23j_dll(pituh* __this) {
        __check_this((Void*)__this);
        return (System_Type*) ((System_Type*) &pituh__runtimetype_hello_ehpqe23j_dll.data);
    }
    Void* VoidP_pituh__dynifaceFSystem_TypeN_hello_ehpqe23j_dll(pituh* __this, System_Type* _type) {
        __check_this((Void*)__this);
        return 0/*null*/;
    }
    Int32 Int32_pituh_get_static__cctor_calledFN_hello_ehpqe23j_dll() {
        return pituh__cctor_called_hello_ehpqe23j_dll;
    }
    Int32* Int32P_pituh_get_static_addr__cctor_calledFN_hello_ehpqe23j_dll() {
        return &pituh__cctor_called_hello_ehpqe23j_dll;
    }
    Void Void_pituh_set_static__cctor_calledFInt32N_hello_ehpqe23j_dll(Int32 _value) {
        pituh__cctor_called_hello_ehpqe23j_dll = _value;
        return ;
    }
    // Дальше копипастить нет смысла

    В эту простыню превращается простенькая программа на C# после прогона через IL2C:

    using System;

    class pituh {
    public static int Main (string [] args)
    {
    Console.WriteLine ("Kokoko!");
    return 0;
    }
    }


    IL2C брать отсюда: https://csnative.codeplex.com/

    inkanus-gray, 11 Февраля 2017

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

    −19

    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
    /*  conio.h
    
        Direct MSDOS console input/output.
    */
    
    /*
     *      C/C++ Run Time Library - Version 24.0
     *
     *      Copyright (c) 1987, 2016 by Embarcadero Technologies, Inc.
     *      All Rights Reserved.
     *
     */
    
    /* $Revision: 34003 $ */
    
    #if !defined(__CONIO_H)
    #define __CONIO_H
    
    #include <_stddef.h>
    
    #if !defined(__VALIST)
    #if defined(__clang__)
    #include <stdarg.h>
    #define __VALIST va_list
    #else
    #define __VALIST void *
    #endif
    #endif
    
    #if !defined(RC_INVOKED)
    
    #if defined(__STDC__)
    #pragma warn -nak
    #endif
    
    #pragma pack(push, 1)
    
    #endif  /* !RC_INVOKED */

    Не говнокод, а всего лишь фрагмент файла <conio.h> из Embarcadero C++ 10.1 ‘Berlin’ Compiler.

    http://docwiki.embarcadero.com/RADStudio/Berlin/en/BCC32C

    inkanus-gray, 24 Января 2017

    Комментарии (19)
  10. C++ / Говнокод #22011

    −25

    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
    OpFile file;
    		BOOL found;
    		
    		if (OpStatus::IsMemoryError(file.Construct(realPath.CStr(), OPFILE_ABSOLUTE_FOLDER)) || OpStatus::IsMemoryError(file.Exists(found)))
    		{
    			return NULL;
    		}
    		else if (found == TRUE)
    		{		
    			OpFileInfo::Mode mode;
    			if (OpStatus::IsMemoryError(file.GetMode(mode)))
    			{
    				return NULL;
    			}
    			else
    			{
    				is_file = (mode == OpFileInfo::FILE ? TRUE : FALSE);
    			}
    		}

    Оттуда.

    Potentially uninitialized local variable 'found' used.

    inkanus-gray, 20 Января 2017

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

    −22

    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
    /**
     * Generator for the opera:credits (third-party information) document.
     */
    class OperaCredits : public OpGeneratedDocument
    {
    public:
    
    	/**
    	 * Fills a string with the third party credit information in opera:about
    	 * (and opera:credits, if enabled).
    	 *
    	 * @param[in] str An OpString to write to.
    	 * @param[in] rtl Whether or not the text should be right-to-left.
    	 *
    	 * @return OK on success, or any error reported by URL or string code.
    	 */
    	static OP_STATUS GetString(OpString &str, BOOL rtl);
    
    #ifdef OPERA_CREDITS_PAGE
    
    	/**
    	 * Constructor for the credits page generator.
    	 *
    	 * @param url URL to write to.
    	 */
    	OperaCredits(URL &url) : OpGeneratedDocument(url, OpGeneratedDocument::HTML5) {}
    
    	/**
    	 * Generate the credits document to the specified internal URL.
    	 *
    	 * @return OK on success, or any error reported by URL or string code.
    	 */
    	virtual OP_STATUS GenerateData();
    
    #endif // OPERA_CREDITS_PAGE
    };

    Оттуда.

    Конструктор не нужен. Можем спрятать его в ифдеф.

    inkanus-gray, 20 Января 2017

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