Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
͜͡w͜͜͡͡o͜͜͡͡w͜͜͡͡,͜͜͡͡ ͜͜͡͡G͜͜͡͡i͜͜͡͡t͜͜͡͡H͜͜͡͡u͜͜͡͡b͜͡!

CUI Hao cuihaoleo

:octocat:
͜͡w͜͜͡͡o͜͜͡͡w͜͜͡͡,͜͜͡͡ ͜͜͡͡G͜͜͡͡i͜͜͡͡t͜͜͡͡H͜͜͡͡u͜͜͡͡b͜͡!
View GitHub Profile
View strace.txt
execve("/usr/bin/git", ["git", "config", "test.test", "test"], [/* 18 vars */]) = 0
brk(NULL) = 0x7fffb909c000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5e08070000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=52542, ...}) = 0
mmap(NULL, 52542, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5e08063000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
View update-he-ddns.sh
#!/bin/bash
DOMAIN=$1
KEY=$2
IPV4=$(ip route get 1 | grep -Po '(?<=src )[^ ]+')
IPV6=$(ip route get 2001:: | grep -Po '(?<=src )[^ ]+')
if [[ -n $IPv4 ]]; then
echo "Update IPv4: $IPV4"
View keybase.md

Keybase proof

I hereby claim:

  • I am cuihaoleo on github.
  • I am cuihao (https://keybase.io/cuihao) on keybase.
  • I have a public key whose fingerprint is AA0C BF38 59E5 80B9 7D9F 0463 8FDE 3D8F C99F 40AE

To claim this, I am signing this object:

View crypto.py
#!/usr/bin/env python3
import binascii
import string
from collections import Counter
total_chars = 0
lines = []
result = []
@cuihaoleo
cuihaoleo / Hello.g4
Created Jan 26, 2016 — forked from mattmcd/Hello.g4
Simple ANTLR4 grammar example
View Hello.g4
// define a grammar called Hello
grammar Hello;
r : 'hello' ID;
ID : [a-z]+ ;
WS : [ \t\r\n]+ -> skip ;
View gist:a311de2dcbffa401fe3a
import concurrent.futures
with concurrent.futures.ProcessPoolExecutor() as executor:
for ans in executor.map(lambda x: 2**x, range(10)):
print(ans)
View drawpic.py
#!/usr/bin/env python3
from PIL import Image
import concurrent.futures
from colorfinder import hex2term_accurate, hex2term_quick
from lolcat import get_terminal_size
import argparse
if __name__ == "__main__":
default_size = get_terminal_size()
@cuihaoleo
cuihaoleo / a.c
Created Aug 29, 2015
test struct init
View a.c
#include <stdio.h>
struct test {
int a, b, c;
};
int main() {
struct test st = {
.b = 15,
};
View r.sh
#!/bin/bash -e
if [[ $IFACE == "vlan95" ]]; then
ip route add 202.38.95.0/25 dev vlan95 table 1000
ip route add default via 202.38.95.126 table 1000
ip rule add from 202.38.95.110 table 1000
fi
if [[ $IFACE == "vlan10" ]]; then
ip route add 202.141.160.0/25 dev vlan10 table 1001
View PKGBUILD
# Maintainer: CUI Hao <cuihao.leo@gmail.com>
pkgname=toxvpn-git
pkgver=20150710
pkgrel=1
pkgdesc="toxvpn is a powerful tool that allows one to make tunneled point to point connections over Tox."
arch=(i686 x86_64)
url=https://github.com/cleverca22/toxvpn
license=(GPL3)
depends=(tox)