Skip to content

Instantly share code, notes, and snippets.

View cuihaoleo's full-sized 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
@cuihaoleo
cuihaoleo / a.c
Created August 29, 2015 03:04
test struct init
#include <stdio.h>
struct test {
int a, b, c;
};
int main() {
struct test st = {
.b = 15,
};
@cuihaoleo
cuihaoleo / fib
Created September 28, 2014 01:34
def fib (m):
a, b, c = 0, 1, 1
yield 1
while a+b <= m:
c = a + b
yield c
a, b= b, c
s = 0
for i in fib(4000000):
#include <stdio.h>
int main ()
{
int a = 0, b = 1, c = 1, sum = 0;
while (c < 4000000)
{
if (c % 2 == 0)
sum += c;
#!/usr/bin/env python3
import re
import sys
prog = re.compile(r"\\N(?:{[^{}]*})?")
prog2 = re.compile(r"(Dialogue: \w*,\w*:\w*:\w*.\w*,\w*:\w*:\w*.\w*,\w*,\w*,\w*,\w*,\w*,\w*,)(.*)")
for line in sys.stdin:
#!/usr/bin/env python3
import re
import sys
prog = re.compile(r"\\N(?:{[^{}]*})?")
prog2 = re.compile(r"(Dialogue: \w*,\w*:\w*:\w*.\w*,\w*:\w*:\w*.\w*,\w*,\w*,\w*,\w*,\w*,\w*,)(.*)")
for line in sys.stdin:
<html>
<body>
<select id="s1">
<option value="CN">China</option>
<option value="JP">Japan</option>
</select>
<select id="s2">
<option value="Beijing" data-country="CN">Beijing</option>
<option value="Shanghai" data-country="CN">Shanghai</option>
<option value="Tokyo" data-country="JP">Tokyo</option>
#!/usr/bin/env python3
from itertools import count
from math import sqrt
from concurrent.futures import ProcessPoolExecutor
def factory (x):
f = lambda k: 1.0/(k*(k+x))
return (f(k) for k in range(1, 1000000))
# 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)
#!/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
#!/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()