1. Си / Говнокод #26528

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    #include                             <stdio.h>
              #define q  t=*u,*u=*l,*l=t
           int f(char*s,char*p){char*u,*l,t
       ;static long g=0; if(!s)return 0;if(!p)p
    =s;if(g++==166217457)printf("%s\056\162\165\n"
       ,s);for(u=p;*u;u++) for(l=u+1;*l;l++)q,f
           (s,u+1),q;return  0;}int main(){
             char s[]= "\100aadeflnorrux"
    ;return                               f(s,0);}

    http://alexfru.narod.ru/econtact.html
    > My e-m@!1 address can be obtained with the following...

    Вот бля как надо свой email скрывать! А то вот какие-то анскилушные myemail (гав-гав) mail.ru - это всё хуйня, боты наверняка расшифруют

    j123123, 25 Марта 2020

    Комментарии (185)
  2. Си / Говнокод #26430

    +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
    // https://www.linux.org.ru/forum/development/15520475
    // *Какой #define макрит for в while?
    
    #include <stdio.h>
    #include <stdlib.h>
    
    #define FOR(a, b, c, ...) {a;while(b){__VA_ARGS__ c;}}
    
    int main(void)
    {
      for(int i = 0; i < 10; i++)
      {
        printf("test %d\n", i);
      }
      
      printf("\n");
      
      FOR(int i = 0, i < 10, i++,
      {
        printf("test %d\n", i);
      }   
      )
        
      return EXIT_SUCCESS;
    }

    j123123, 10 Февраля 2020

    Комментарии (3)
  3. Си / Говнокод #26384

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // https://github.com/microsoft/PQCrypto-SIDH/blob/ebd1c80a8ac35e9ca2ef9680291a8a43b95a3bfa/src/random/random.c#L22
    
    static __inline void delay(unsigned int count)
    {
        while (count--) {}
    }

    ... guess what?

    j123123, 25 Января 2020

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

    +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
    // I'm interested in using something other than the C preprocessor to preprocess my C and Objective-C source code. Are there good alternatives?
    //
    // ---
    //
    // You can use PHP as a C preprocessor. The advantages are:
    //
    // - very similiar syntax, so syntax highlighting works.
    // - <? and ?> are not used in standard C (with non-standard C, the only thing that gets broken is old GCC extension operator that returns min/max)
    // - it's rich in libraries.
    // - it's turing complete.
    // - usage of macros is very explicit. (compared to sneaky C preprocessor macros)
    // For serious use though, making PHP print the #line directives is needed for debugging preprocessed code.
    
    <?php include_once "stdio.h"; ?>
    
    int main()
    {
        <?php
            for($i = 0; $i < 20; $i++)
                echo 'printf("%d\n", '.$i.');';
        ?>
    }

    https://stackoverflow.com/a/16256052

    абсолютно невыносимо

    Fike, 25 Января 2020

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

    +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
    83. 83
    switch (pattern)
                {
                    case 0:
                    case 1:
                    case 4:
                    case 32:
                    case 128:
                    case 5:
                    case 132:
                    case 160:
                    case 33:
                    case 129:
                    case 36:
                    case 133:
                    case 164:
                    case 161:
                    case 37:
                    case 165:
                        {
                            PIXEL00_20
                            PIXEL01_60
                            PIXEL02_60
                            PIXEL03_20
                            PIXEL10_60
                            PIXEL11_70
                            PIXEL12_70
                            PIXEL13_60
                            PIXEL20_60
                            PIXEL21_70
                            PIXEL22_70
                            PIXEL23_60
                            PIXEL30_20
                            PIXEL31_60
                            PIXEL32_60
                            PIXEL33_20
                            break;
                        }
                    case 2:
                    case 34:
                    case 130:
                    case 162:
                        {
                            PIXEL00_80
                            PIXEL01_10
                            PIXEL02_10
                            PIXEL03_80
                            PIXEL10_61
                            PIXEL11_30
                            PIXEL12_30
                            PIXEL13_61
                            PIXEL20_60
                            PIXEL21_70
                            PIXEL22_70
                            PIXEL23_60
                            PIXEL30_20
                            PIXEL31_60
                            PIXEL32_60
                            PIXEL33_20
                            break;
                        }
                    case 16:
                    case 17:
                    case 48:
                    case 49:
                        {
                            PIXEL00_20
                            PIXEL01_60
                            PIXEL02_61
                            PIXEL03_80
                            PIXEL10_60
                            PIXEL11_70
                            PIXEL12_30
                            PIXEL13_10
                            PIXEL20_60
                            PIXEL21_70
                            PIXEL22_30
                            PIXEL23_10
                            PIXEL30_20
                            PIXEL31_60
                            PIXEL32_61
                            PIXEL33_80
                            break;
                        }

    Отсюда:
    https://github.com/grom358/hqx/blob/master/src/hq4x.c

    HoBorogHuu_nemyx, 09 Января 2020

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

    −3

    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
    97. 97
    98. 98
    99. 99
    void push_stack(node *topPTR, int value) {
    	node newPTR = malloc(sizeof(Stack));
    
    	if (newPTR != NULL) {
    
    		newPTR->alpha = value;
    		newPTR->nxtPTR = *topPTR;
    		*topPTR = newPTR;
    	}
    	else {
    
    		puts("error");
    	}
    }
    
    void push_stack_2(node_2 *topPTR_2,  double value) {
    
    	node_2 newPTR = malloc(sizeof(Stack_2));
    
    	if (newPTR != NULL) {
    
    		newPTR->alpha = value;
    		newPTR->nxtPTR_2 = (void *)  *topPTR_2;
    		*topPTR_2 = newPTR;
    
    	}
    	else {
    
    		puts("error");
    	}
    }
    
    int pop(node *fix) {
    	
    	int  value = 0;
    	node temp = *fix;
    	value = (*fix)->alpha;
    	*fix = (*fix)->nxtPTR;
    	free(temp);
    return value;
    }
    
    double pop_2(node_2 *fix) {
    	double  value = 0;
    	node_2 temp = *fix;
    	value = (*fix)->alpha;
    	*fix = (void *)   (*fix)->nxtPTR_2;
    	free(temp);
    return value;
    }
    
    char check_stack(node data) {
    	return data->alpha   ==  0  ;
    }
    
    int isOperator(char c) {
    	return c == '/' || c == '*' || c == '-' || c == '+' || c == '^' ;
    }
    
    int precedence(char data_1, char  data_2) {
    		
    		switch(data_1){
    		case '(':	
    		return -1;
    		case '^':
    	
    			if(data_2 == '^' ){
    					return    0;
    			} 
    			 else if (data_2 == '*' || data_2 == '/' || data_2 == '+' || data_2 == '-'   ){
    			 	
    			 }
    	 		
    	 	case 	'/' : 
            case 	'*':        
    			
    			if(data_2 == '^' ){
    					return    -1;
    				} 
    					else if( data_2 == '/' || data_2 == '*'     ){
    						return    0;
    					}	
    				
    			else if( data_2 == '+' || data_2 == '-'     ){
    						return     1;
    		
    		}
    		
    		case  '+':
    		case  '-':		
    		
    		if(data_2 == '^'  || data_2 == '/' || data_2 == '*'        ){
    			return    -1;
    				} 
    		else{
    			return     0;
    			 }
    		}
    }

    calc 3

    tyrin, 05 Января 2020

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

    −1

    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
    double end_line( char data[0][200]){
    double x = 0 , y = 0, sum = 0,ml = 0    ; 
    char	*point =   strtok(  &data[1][0] , " " );
    	
    	while( point !=   '\0'   ){
    			
    			if(isdigit(  *point ) ){
    				
    			ml  = atof( (char *)  point  )  ;
    		
    				push_stack_2( &topPTR_2,ml);
    				}	
    			
    			
    			else if ( isOperator ( *point ) == 1 ){
    				 
    				 y =	pop_2(&topPTR_2);
    				 x = 	pop_2(&topPTR_2);	 	
    					
    					if( *point  == '^' ){
    						  sum  =  pow(x, y) 	  ;
    						 	push_stack_2(  &topPTR_2, sum  );
    						 }
    					
    					
    					if( *point  == '*' ){
    						 
    							
    							 push_stack_2(&topPTR_2,    	x * y         );
    						 }
    				 		
    				 	  if( *point == '+' ){
    			
    							 push_stack_2(&topPTR_2, 	x + y  	 );
    						 }
    				 
    				     if(  *point == '/' ){
    						 	
    							    
    							 push_stack_2(&topPTR_2, x / y    );
    						 }
    				 
    				 if(   *point == '-' ){
    					 
    							 push_stack_2(&topPTR_2,   x - y     );
    						 }
    				 	}
    				
    			point = strtok(NULL , " " ) ;
    	return    pop_2(&topPTR_2);
    }
    
    int in_line(char data[][200] , int  lng  ){
    	
    double x = 0 , y = 0, sum = 0 ; 
    int j = 0  , k = 0 , d = 0;
    	
    	data[0][lng ] = ')';
        push_stack(&topPTR, '(');
    	
    	for (k = 0; check_stack((void *) &topPTR) != 1   ; k++)  {
    
    		if (  isdigit(data[0][k]) ||  data[0][k] == '.'  ) {
    
    			data[1][j++] = data[0][k];
    	
    		}
    
    		if (data[0][k] == '(') {
    
    			push_stack(&topPTR, infix[0][k]);
    
    		}
    			if (isOperator(data[0][k]) == 1) {
    				data[1][j++]  = ' ';
    			for (;         precedence(topPTR->alpha, data[0][k]) != -1 ; ) {
    		
    			data[1][j++] = pop(&topPTR);
    				data[1][j++]  = ' ';	
    		}
    				
    			push_stack(&topPTR, data[0][k]);
    			push_stack(&topPTR, ' ' );
    			
    		}
    
    		if (data[0][k] == ')') {
    	
    		d = pop(&topPTR);
    			for (; d != '('     ; 	d = pop(&topPTR)) {
    					data[1][j++] = d;
    				}
    			}
    		else if (isalpha(data[0][k]   ) ) {
    			puts ("error");
    			return 0;
    		}
    	}
    	return 1;
    	}

    calc 2

    tyrin, 05 Января 2020

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

    −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
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    #include<ctype.h>
    #include <math.h>
    struct stack {
    	int alpha;
    	struct stack *nxtPTR;
    };
    
    typedef struct stack  Stack;
    
    typedef  Stack *node;
    
    	struct stack_2 {
    	
    	long	double alpha;
    	
    	struct stack *nxtPTR_2;
    	};
    
    typedef struct stack_2  Stack_2;
    
    typedef  Stack_2 *node_2;
    
    node   topPTR = NULL;
    
    node_2 topPTR_2 = NULL;
    
    char check_stack(node data);
    
    int isOperator(char c);
    
    int precedence(char data_1, char   data_2);
    
    void push_stack(node *topPTR, int value);
    
    void push_stack_2(node_2 *topPTR_2,  double value);
    
    int pop(node *fix) ;
    
    double pop_2(node_2 *fix);
    
    
    char infix[2][200];
    
    double end_line( char data[0][200]);
    
    int in_line(char  data[][200] , int  lng  );
    
    int main(void) {
    
    
    	
    
    fgets(&infix[0][0], sizeof(infix), stdin);
    	
    int  k = strlen(&infix[0][0]);
    double sl = 0;	
    
     
     if (in_line( infix , k ) == 1){
     	puts(  &infix[1][0] );
    	puts(" ");
    	sl =   end_line(infix);
    	printf("%.6f\n", sl );
     }
    
    return 0;
    }

    Calc 1

    tyrin, 05 Января 2020

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