1. Куча / Говнокод #26037

    +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
    .server-config
      .component
        .title(translate) protsessor
        .value(ng-if="!server.custom")
          | {{ server.cpu || '—' }}
        .value(ng-if="server.custom")
          span(ng-if="server.custom.cpu && server.custom.cpu.length && server.custom.cpu[0].count > 1")
            | {{ server.custom.cpu[0].count + ' x ' }}
          span(ng-if="server.custom.cpu && server.custom.cpu.length")
            | {{ server.custom.cpu[0].name }}
          span(ng-if="!server.custom.cpu || !server.custom.cpu.length")
            | —
    
      .component
        .title(translate) pamyat
        .value(ng-if="!server.custom")
          | {{ server.memory || '—' }}
        .value(ng-if="server.custom")
          span(ng-if="server.custom.ram && server.custom.ram.length")
            span(ng-if="server.custom.ram[0].count > 1")
              | {{ +server.custom.ram[0].name.split(' ')[0].replace('GB', '') * server.custom.ram[0].count + ' GB — ' }}
            span(ng-if="server.custom.ram[0].count > 1")
              | {{ server.custom.ram[0].count + ' x ' }}
            span
              | {{ server.custom.ram[0].name }}
          span(ng-if="!server.custom.ram || !server.custom.ram.length")
            | —
    
      .component
        .title(translate) disk
        .value(ng-if="!server.custom")
          | {{ server.hdd || '—' }}
        .value(ng-if="server.custom.disk && server.custom.disk.length")
          .line(ng-repeat="hdd in server.custom.disk")
            span(ng-if="hdd.count > 1") {{ hdd.count + ' x ' }}
            span {{ hdd.name }}
        .value(ng-if="server.custom && (!server.custom.disk || !server.custom.disk.length)")
          | —
    
      .component(ng-if="server.custom")
        .title(translate) Platform
        .value(ng-if="server.custom.case && server.custom.case.length")
          | {{ server.custom.case[0].name }}
        .value(ng-if="server.custom && (!server.custom.case || !server.custom.case.length)")
          | —
    
      .component(ng-if="server.custom")
        .title(translate) Motherboard
        .value(ng-if="server.custom.motherboard && server.custom.motherboard.length")
          | {{ server.custom.motherboard[0].name }}
        .value(ng-if="server.custom && (!server.custom.motherboard || !server.custom.motherboard.length)")
          | —
    
      .component(ng-if="server.custom.pcie && server.custom.pcie.length")
        .title(translate) pcie
        .value
          .line(ng-repeat="pcie in server.custom.pcie")
            span(ng-if="pcie.count > 1") {{ pcie.count + ' x ' }}
            span {{ pcie.name }}

    Код написан на Pug, представляет из себя фрагмент шаблона AngularJS, предназначенный для отображения конфигурации сервера. Данный код, через копирование-вставку, был заботливо размещен в нескольких файлах, иногда претерпевая незначительные изменения. Здесь публикую отчищенный от всего лишнего и сильно отформатированный вариант, дабы проще было насладиться полетом фантазии автора, в исходном виде весь этот код - одно сплошное месиво.

    maksim_ovcharik, 21 Ноября 2019

    Комментарии (15)
  2. C# / Говнокод #26036

    +1

    1. 1
    if (tableOfVariables[i].Name == "replace".ToUpper())

    )))00

    neonmystery, 19 Ноября 2019

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

    +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
    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
    public class AdvancedBoolean {
        private boolean result;
        private DefenitionDictionary.RESULT_CODE code;
        
        
        
    //------------------------------------------------------------------------------  
    //constructors
    //------------------------------------------------------------------------------       
        public AdvancedBoolean() {
            result = true;
        }
            
        public AdvancedBoolean(boolean _result) {
            result = _result;
        }
     
         
        public AdvancedBoolean(boolean _result, DefenitionDictionary.RESULT_CODE _code) {
            result = _result;
            code = _code;
        }
    
        
        
    //------------------------------------------------------------------------------
    //get methods
    //------------------------------------------------------------------------------     
        public boolean isResult() {
            return result;
        }
    
        public DefenitionDictionary.RESULT_CODE getCode() {
            return code;
        }
    
    
            
    //------------------------------------------------------------------------------
    //set methods
    //------------------------------------------------------------------------------ 
        public void setResult(boolean _result) {
            result = _result;
        }
        
        public void setCode(DefenitionDictionary.RESULT_CODE _code) {
            code = _code;
        }
        
        
        
    //------------------------------------------------------------------------------
    //other methods
    //------------------------------------------------------------------------------     
        public String getLabel() {
            return code.getResultLabel();
        }
    }

    Без комментариев

    Veers, 19 Ноября 2019

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

    +2

    1. 1
    2. 2
    Comparing structs with, let's say, memcmp, does not work,
     as you end up comparing the "unspecified" padding bytes as well — you must compare member-by-member.

    While writing this post, the author observed that some verions of GCC (experimentally, >= 4.7, < 8.0) do not zero padding if an empty intializer list is passed, under certain a certain code pattern; if an entire struct (i.e. sizeof(STRUCTNAME)) is subsequently memcpy'd after assigment of its members, and this intermediate buffer is what is used by the code going forward. This appears to be based on how optimization passes interact with GCC's built-in memcpy, since passing -fno-builtin-memcpy returns the behavior to the expected.
    https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2019/october/padding-the-struct-how-a-compiler-optimization-can-disclose-stack-memory/

    3.14159265, 18 Ноября 2019

    Комментарии (179)
  5. Assembler / Говнокод #26033

    −1

    1. 1
    2. 2
    Перекат
    http://govnokod.ru/18591

    Этот петух так и не выложил ответ.

    OCETuHCKuu_nemyx, 18 Ноября 2019

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

    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
    1419 guest
    234 j123123
    222 LispGovno
    202 wvxvw
    188 Говногость
    161 gost
    160 Lure Of Chaos
    158 Stertor
    155 bormand
    128 kyzi007
    123 pedarok
    120 qbasic
    116 Elvenfighter
    115 someone
    113 3.14159265
    102 dm_fomenok
    101 roman-kashitsyn
    100 eldachello
    94 Dummy00001
    93 TarasB
    88 Vasiliy
    86 cmepmop
    85 Dr_Stertor
    84 syoma
    73 7ion
    72 laMer007
    69 d_fomenok
    61 хуита
    60 Мартин
    60 BEPETEHO
    60 3_14dar
    58 AliceGoth
    58 CHayT
    56 Fai
    56 kegdan
    55 uiopqwertyasd
    55 munin
    54 HaskellGovno
    51 bugmenot
    51 Abbath
    51 vistefan
    50 nethak
    49 makc3d
    49 Fike
    48 inkanus-gray
    47 telnet
    47 Govnocoder#0xFF
    47 3_dar
    44 codemonkey
    44 OlegUP
    43 RaZeR
    42 Sulik78
    41 CPPGovno
    41 alexoy
    41 DrFreez
    41 varg242
    40 danilissimus
    39 taburetka
    39 KitKat
    38 dwinner
    38 absolut
    38 striker
    37 raorn
    37 jQuery
    37 inho
    35 psina-from-ua
    35 rat4
    35 1kasper
    35 brainstorm
    35 Stallman
    34 ursus
    34 KirAmp
    33 evg_ever
    33 invision70
    33 Lokich
    33 Xom94ok
    32 1_and_0
    32 istem
    32 volter9

    OCETuHCKuu_nemyx, 17 Ноября 2019

    Комментарии (137)
  7. Perl / Говнокод #26031

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    #!/usr/bin/perl -w
    use strict;
    use warnings;
    use v5.22;
    use Encode qw(encode decode);
    
    binmode $_, ':utf8' for qw(STDOUT STDIN);
    my $c = 'KOI8-R';
    print decode $c, join '', map {chr (ord() & 0x7F)} split '', encode $c, $_ while (<>);

    данный програмный продукт переводит русские буквы в забавные волапюки.
    Пользуйтесь на здоровье!

    $ echo "милости прошу к нашему шалашу" | ./koi.pl
    mILOSTI PRO[U K NA[EMU [ALA[U

    neTyx_npoTKHyTbIu, 16 Ноября 2019

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

    +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
    QVariant AtdItem::data(int column, int role) const {
    	if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole) {
    		if (column == 0)
    			return m_name;
    		if (column == 1)
    			return m_id;
    		if (column == 2)
    			return m_shortName;
    		if (column == 3)
    			return m_code;
    		if (column == 4)
    			return m_code_alpha_2;
    		if (column == 5)
    			return m_capital;
    		if (column == 6)
    			return m_type_id;
    		if (column == 7)
    			return m_number;
    		if (column == 8)
    			return m_dir_id;
    		if (column == 9)
    			return m_area;
    		if (column == 10)
    			return m_pop;
    		if (column == 11)
    			return m_info;
    		if (column == 12)
    			return m_reduction_name;
    		if (column == 13)
    			return m_scheme_name;
    		if (column == 14)
    			return m_num_on_scheme;
    		if (column == 15)
    			return m_code_alpha3;
    		if (column == 16)
    			return m_code_hasc;
    		if (column == 17)
    			return m_level;
    	}
    
    	if (role == Qt::UserRole) {
    		return m_id;
    	}
    	return QVariant();
    };

    уроки по switch && enum будут после обеда

    mvngr, 15 Ноября 2019

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

    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
    $ objdump -f libyjpagent64.so
    
    libyjpagent64.so:     file format elf64-x86-64
    architecture: i386:x86-64, flags 0x00000150:
    HAS_SYMS, DYNAMIC, D_PAGED
    start address 0x00000000000c2690
    
    
    $ readelf -h  libyjpagent64.so
    ELF Header:
      Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
      Class:                             ELF64
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI Version:                       0
      Type:                              DYN (Shared object file)
      Machine:                           Advanced Micro Devices X86-64
      Version:                           0x1
      Entry point address:               0xc2690
      Start of program headers:          64 (bytes into file)
      Start of section headers:          5131216 (bytes into file)
      Flags:                             0x0
      Size of this header:               64 (bytes)
      Size of program headers:           56 (bytes)
      Number of program headers:         7
      Size of section headers:           64 (bytes)
      Number of section headers:         30
      Section header string table index: 29

    куик, зачем на прыщах две дублирующие друг друга утилиты?

    MAKAKA, 14 Ноября 2019

    Комментарии (12)
  10. Java / Говнокод #26028

    +1

    1. 1
    float sales = new Integer(getSalesCount()).floatValue();

    someone, 13 Ноября 2019

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