Skip to content

Instantly share code, notes, and snippets.

@elvinio
elvinio / tcp_poll.cpp
Created July 24, 2015 01:17
C++: how to poll the TCP socket to read and write data.
void poller(int socketIn, std::string srcIP, int port){
struct pollfd fds[2];
// Initialize the fds to 0
memset(fds, 0, sizeof(fds));
// Wait in ms before poll times out. -1 for infinite
int timeout = 15000;
fds[0].fd = socketIn;
@elvinio
elvinio / chinesetech.md
Last active September 4, 2017 02:55
Chinese words you need to know to speak technical with Chinese developers
Programming -
Abstract 抽象
Acronym 首字母缩写
Algorithm 算法
Array 数组
Assembly Language 汇编语言
Asynchronous 异步
Attribute 属性
Binary 二进制
@elvinio
elvinio / color.reg
Created May 27, 2016 01:42
Putty color scheme
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
"Colour0"="217,230,242"
"Colour1"="217,230,242"
"Colour2"="14,27,48"
"Colour3"="14,27,48"
"Colour4"="14,27,48"
"Colour5"="217,230,242"
"Colour6"="0,0,0"
@elvinio
elvinio / openssl_cipher_suite
Created July 29, 2015 21:49
List of cipher suite in OpenSSL 1.0.1e-fips
> $ openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013
> $ openssl ciphers -v | column -t
ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD
ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(256) Mac=AEAD
ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA384
ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA384
ECDHE-RSA-AES256-SHA SSLv3 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA1
ECDHE-ECDSA-AES256-SHA SSLv3 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA1
In the grand scale of this cosmic universe, man is but a blip in the heavens. All his desires, wants, and needs pass on but a speck of dust in the vast nothinginess. His trials and tribulations, these are but meaningless distractions in his journey towards his own death. His lovers and passions are nothing compared to the great grand scale of the universe. His existence has no function, serves no propose, and is nothing. So, eat at Arby’s.
@elvinio
elvinio / patch_codegen_c_json_parser.c
Created November 4, 2016 07:21
Patch for flatcc to support null
545 println(out, "if(*buf == 'n' && memcmp(buf+1, \"ull\", 3) == 0){buf+=4; ref = flatcc_builder_create_string(ctx->ctx, mark, 0);}else{");
546 indent();
565 unindent(); println(out, "}");
@elvinio
elvinio / x86.json
Created August 24, 2016 02:42
x86 instruction set
{
" AAA":"ASCII Adjust After Addition",
" AAD":"ASCII Adjust AX Before Division",
" AAM":"ASCII Adjust AX After Multiply",
" AAS":"ASCII Adjust AL After Subtraction",
" ADC":"Add with Carry",
" ADCX":"Unsigned Integer Addition of Two Operands with Carry Flag",
" ADD":"Add",
" ADDPD":"Add Packed Double-Precision Floating-Point Values",
" ADDPS":"Add Packed Single-Precision Floating-Point Values",
@elvinio
elvinio / Perf
Last active June 1, 2016 13:20
Perf
[ec2-user@ip-172-31-27-8 pmu-tools]$ ./ocperf.py
Downloading https://download.01.org/perfmon/mapfile.csv to mapfile.csv
Downloading https://download.01.org/perfmon/IVT/IvyTown_core_V17.json to GenuineIntel-6-3E-core.json
Downloading https://download.01.org/perfmon/IVT/IvyTown_matrix_V17.json to GenuineIntel-6-3E-offcore.json
Downloading https://download.01.org/perfmon/IVT/IvyTown_uncore_V17.json to GenuineIntel-6-3E-uncore.json
Downloading https://download.01.org/perfmon/readme.txt to readme.txt
perf
[ec2-user@ip-172-31-27-8 pmu-events]$ l
total 880
@elvinio
elvinio / .screenrc
Created May 31, 2016 10:04
Screenrc
startup_message off
#turn off visual bell
vbell off
shelltitle '> |'
maptimeout 5
#remove vim buffer when done
altscreen on
@elvinio
elvinio / .vimrc
Created May 31, 2016 10:04
vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set nocompatible
set exrc
set secure
set tabstop=4
set softtabstop=4
set shiftwidth=4
set wmh=0