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

    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
    import std.stdio;
    import std.conv: to;
    import std.json;
    import std.path;
    import std.file;
    import std.process;
    import std.string: strip;
    import std.array;
    
    import core.stdc.stdlib;
    import core.exception: RangeError;
    
    void addServer(string* serverName, string* serverPath, int* t)
    {
    	JSONValue content = parseJSON(readConfig());
    	
    	string[][] json_arr;
    	if (content.array().length != 0)
    		for (int i = 0; i < content.array().length; ++i) {
    			string ps;
    			for (int x = 0; x < content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1].length; ++x)
    				if (content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x] != '\\')
    					ps ~= content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x];
    			json_arr ~= [
    				content[i].toString.strip("[\"").strip("\"]").split("\",\"")[0],
    				to!string(ps),
    				content[i].toString.strip("[\"").strip("\"]").split("\",\"")[2]
    			];
    		}
    	foreach (string[] key; json_arr)
    		if (key[0] == *serverName)
    			crash("This server already exists!");
    	json_arr ~= [
    		*serverName,
    		*serverPath,
    		to!string(*t)
    	];
    	std.file.write(config, JSONValue(json_arr).toPrettyString);
    }
    
    void getServerList()
    {
    	writeln("\tServer:\tPath:\tTime:");
    	immutable content = parseJSON(readConfig());
    	for (int i = 0; i < content.array().length; ++i) {
    		string ps;
    		for (int x = 0; x < content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1].length; ++x)
    			if (content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x] != '\\')
    				ps ~= content[i].toString.strip("[\"").strip("\"]").split("\",\"")[1][x];
    		writeln('\t',
    			content[i].toString.strip("[\"").strip("\"]").split("\",\"")[0], ' ',
    			to!string(ps), ' ',
    			content[i].toString.strip("[\"").strip("\"]").split("\",\"")[2]
    		);
    	}
    }

    Парочка функций на языке D. Одна добавляет данные в JSON-файл, вторая их оттуда берёт и печатает в консоль.

    GDMaster, 10 Февраля 2020

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    吾有一數。曰三。名之曰「甲」。
    為是「甲」遍。
    	吾有一言。曰「「問天地好在。」」。書之。
    云云。

    Программист из Шанхая создал язык программирования wenyan-lang, основанный на старинном классическом китайском языке.

    Язык может компилироваться в JavaScript, Python и Ruby. К нему уже успели написать плагины для VSCode, Vim и Sublime. С полной документацией можно ознакомиться на гитхабе:

    https://github.com/wenyan-lang/wenyan




    Перевод на "JavaScript":

    var n = 3;
    for (var i = 0; i < n; i++) {
    console.log("問天地好在。");
    }

    3_dar, 10 Февраля 2020

    Комментарии (35)
  3. Си / Говнокод #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)
  4. JavaScript / Говнокод #26429

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    //Use this to convert OffSet to postive:
    
    var offset = new Date().getTimezoneOffset();
    console.log(offset);
    this.timeOffSet = offset + (-2*offset);
    console.log(this.timeOffSet);

    Это такой особый JS way, или я чего-то не понимаю?

    eukaryote, 10 Февраля 2020

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

    +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
    template <typename function_type, typename vector_type>
    function_type read_memory(HANDLE hProcess, function_type base_address, std::vector< vector_type >&& offsets) {
        function_type tmp = base_address;
        for (function_type i : **reinterpret_cast< vector_type** >( &offsets )) {
            ReadProcessMemory(hProcess, reinterpret_cast< PBYTE* >( tmp + i ), &tmp, sizeof(function_type), nullptr);
        }
        return tmp;
    }
    
    int main() {
        std::vector< DWORD > offset = {
            0x10,
            0x14,
            0x158
        };
        auto buffer = read_memory< DWORD, DWORD >(hProcess, base_address, std::move(offset));
    }

    Полуговнокодер читает память чужого процесса...

    bcaoo, 10 Февраля 2020

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

    0

    1. 1
    let randomHexColor = (g = () => (a => (a < 16 ? '0' : '') + a.toString(16))(~~(Math.random() * 255)))() + g() + g();

    fuckyounoob, 09 Февраля 2020

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    Когда написал залупу на крестах
    https://pbs.twimg.com/media/EQNGt9QU4AABnd1?format=png&name=small
    
    Именно поэтому я за Electron.js

    phpBidlokoder2, 08 Февраля 2020

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

    +5

    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
    function fix_hacker_strings($str){
            $s=$str;
            $s=str_replace('/*', 'xx', $s);
            $s=str_replace('*/', 'xx', $s);
            $s=str_replace('../', 'xxx', $s);
            $s=str_replace('..\\', 'xxx', $s);
            $s=str_ireplace('file:', 'xxxxx', $s);
            $s=str_ireplace(':$', 'xx', $s);
            $s=str_ireplace('http:', 'xxxx', $s);
            $s=str_ireplace('https:', 'xxxxx', $s);
            $s=str_ireplace('script', 'xxxxxx', $s);
            $s=str_ireplace('delete', 'xxxxxx', $s);
            $s=str_ireplace('drop', 'xxxx', $s);
            $s=str_ireplace('select', 'xxxxxx', $s);
            $s=str_ireplace('update', 'xxxxxx', $s);
            $s=str_ireplace('replace', 'xxxxxxx', $s);
            $s=str_ireplace('/etc/', '/xxx/', $s);
            $s=str_ireplace('/var/', '/xxx/', $s);
            $s=str_ireplace('/root/', '/xxxx/', $s);
            $s=str_ireplace('/bin/', '/xxx/', $s);
            $s=str_ireplace('/usr/', '/xxx/', $s);
            $s=str_ireplace('/sys/', '/xxx/', $s);
            $s=str_ireplace('/sbin/', '/xxxx/', $s);        
            $s=str_ireplace('/proc/', '/xxxx/', $s);
            $s=str_ireplace('/boot/', '/xxxx/', $s);
            $s=str_ireplace('mysql', 'xxxxx', $s); 
            return $s;
    }

    обработка user input

    dim1r, 08 Февраля 2020

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

    −3

    1. 1
    Приведите реальный пример программы на 1С

    Вот прямо типичный пример задачи, где я должен взять именно 1С.

    bagrinho, 08 Февраля 2020

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

    0

    1. 1
    IT Оффтоп #31

    #1: https://govnokod.ru/18142 https://govnokod.xyz/_18142
    #2: https://govnokod.ru/18378 https://govnokod.xyz/_18378
    #3: https://govnokod.ru/19667 https://govnokod.xyz/_19667
    #4: https://govnokod.ru/21160 https://govnokod.xyz/_21160
    #5: https://govnokod.ru/21772 https://govnokod.xyz/_21772
    #6: https://govnokod.ru/24063 (потёр пидор сракер) https://govnokod.xyz/_24063
    #7: https://govnokod.ru/24538 https://govnokod.xyz/_24538
    #8: https://govnokod.ru/24815 (потёр пидор сракер) https://govnokod.xyz/_24815
    #9: https://govnokod.ru/24867 https://govnokod.xyz/_24867
    #10: https://govnokod.ru/25328 https://govnokod.xyz/_25328
    #11: https://govnokod.xyz/_25436 https://govnokod.ru/25436 (потёр пидор сракер)
    #12: https://govnokod.xyz/_25471
    #13: https://govnokod.xyz/_25590 (потёр пидор сракер)
    #14: https://govnokod.xyz/_25684
    #15: https://govnokod.xyz/_25694
    #16: https://govnokod.xyz/_25725
    #17: https://govnokod.xyz/_25731
    #18: https://govnokod.xyz/_25762
    #19: https://govnokod.xyz/_25767
    #20: https://govnokod.xyz/_25776
    #21: https://govnokod.xyz/_25798
    #22: https://govnokod.xyz/_25811
    #23: https://govnokod.xyz/_25863
    #24: https://govnokod.xyz/_25941
    #25: https://govnokod.xyz/_26026
    #26: https://govnokod.xyz/_26050
    #27: https://govnokod.xyz/_26340
    #28: https://govnokod.xyz/_26372
    #29: https://govnokod.xyz/_26385
    #30: https://govnokod.xyz/_26413

    syoma, 08 Февраля 2020

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