This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install cryptodome | |
from Crypto.Cipher import AES | |
from binascii import a2b_hex | |
KEY = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' | |
def decrypt(text): | |
cryptor = AES.new(KEY, AES.MODE_ECB) | |
plain_text = cryptor.decrypt(a2b_hex(text)) | |
return plain_text | |
cfg_file = open("db_user_cfg.xml", "rb") | |
dec_file = open("db_user_cfg.decode.xml", "w") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\ | |
function register_clang_version { | |
local version=$1 | |
local priority=$2 | |
update-alternatives \ | |
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
class SegmentTreeNode { | |
public: | |
int sum = 0; | |
int delta = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <benchmark/benchmark.h> | |
#include <charconv> | |
#include <fcntl.h> | |
#include <fstream> | |
#include <iostream> | |
#include <cstdlib> | |
#include <sys/file.h> | |
#include <sys/mman.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
auto result = [](auto&& g) { | |
return [](auto&& f) { | |
return f(f); | |
}([&g](auto&& f) { return g([&f](auto&& x) { return f(f)(x); }); }); | |
}([](auto&& f) { | |
return [&f](auto&& x) -> int { return x == 0 ? 1 : x * f(x - 1); }; | |
})(5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use std::fs::File; | |
use std::io::prelude::*; | |
use std::io::BufWriter; | |
use std::ops::Add; | |
use std::ops::Div; | |
use std::ops::Mul; | |
use std::ops::Neg; | |
use std::ops::Sub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import edu.princeton.cs.algs4.*; | |
public class HeapSort { | |
private static int currentSinking; | |
public static void sink(int[] heap, int k, int N) { | |
while (2 * k <= N) { | |
int j = 2 * k; | |
if (j < N && heap[j] < heap[j + 1]) j++; | |
if (heap[k] > heap[j]) break;// already ordered | |
exch(heap, k, j); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -rdynamic -o main main.c -ldl | |
#include <dlfcn.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <iostream> | |
using namespace std; | |
typedef int (*calc_func)(int, int); | |
const char *LIB_PATH = "./libctest.so"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
enum Color { RED, BLACK }; | |
template <class K, class V> | |
class RBTree { | |
struct RBNode { | |
K key; | |
V value; | |
size_t N; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template <class K, class V> | |
struct AVLNode { | |
K key; | |
V value; | |
AVLNode *left, *right; | |
AVLNode(K key, V value) : key(key), value(value), left(NULL), right(NULL) {} |
NewerOlder