- 1
https://pastebin.com/ABfdEgS5
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
https://pastebin.com/ABfdEgS5
Выкладываю не глядя мой код примерно 12-го года.
0
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-файл, вторая их оттуда берёт и печатает в консоль.
+2
吾有一數。曰三。名之曰「甲」。
為是「甲」遍。
吾有一言。曰「「問天地好在。」」。書之。
云云。
Программист из Шанхая создал язык программирования 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("問天地好在。");
}
+1
// 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;
}
+1
//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, или я чего-то не понимаю?
+1
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));
}
Полуговнокодер читает память чужого процесса...
0
let randomHexColor = (g = () => (a => (a < 16 ? '0' : '') + a.toString(16))(~~(Math.random() * 255)))() + g() + g();
0
Когда написал залупу на крестах
https://pbs.twimg.com/media/EQNGt9QU4AABnd1?format=png&name=small
Именно поэтому я за Electron.js
+5
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
−3
Приведите реальный пример программы на 1С
Вот прямо типичный пример задачи, где я должен взять именно 1С.