Skip to content

Instantly share code, notes, and snippets.

View wenhoujx's full-sized avatar

Wenshuai Hou wenhoujx

  • Washington, DC
View GitHub Profile
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#00002B2B3636"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "#65657B7B8383"
@wenhoujx
wenhoujx / dtw1.py
Last active August 29, 2015 14:02
compute dtw with mlpy package
from mlpy import dtw_std
import numpy as np
def dtw_mlpy( x):
distmat = np.array([dtw_std( xx,yy) for xx in x for yy in x])
return distmat
@wenhoujx
wenhoujx / exclude.py
Created June 11, 2014 16:53
remove from csv1 all csv2, and overwrite csv1.
import sys
import pandas as pd
if __name__ == "__main__":
"""
excluding from f1.csv all those names in f2.csv
and write back to f1
"""
f1, f2 = sys.argv[1:]
@wenhoujx
wenhoujx / bo.c
Last active August 29, 2015 14:02
buffer overflow example
#include <stdio.h>
#include <string.h>
int main(void) {
char buff[15];
int passed = 0;
printf("Pleaes enter your password \n" ) ;
gets(buff) ;
// equal strings return 0
@wenhoujx
wenhoujx / joblib_tut01.py
Created October 23, 2014 04:13
joblib_tut01
#!/usr/bin/env python
# encoding: utf-8
import joblib as jl
@wenhoujx
wenhoujx / closure_1.py
Created October 29, 2014 15:22
closure
def foo(x):
def bar():
return x**2
return bar
@wenhoujx
wenhoujx / closure_2.py
Created October 30, 2014 14:06
closure_2
from functools import wraps
import pickle
import sys
@wenhoujx
wenhoujx / wraps.py
Created October 30, 2014 14:28
decorator and pickle and wraps
1 from functools import wraps
2 import pickle
3 import sys
4
@wenhoujx
wenhoujx / wraps.py
Created October 30, 2014 14:28
decorator and pickle and wraps
from functools import wraps
import pickle
import sys
@wenhoujx
wenhoujx / generator_safety.py
Last active August 29, 2015 14:08
how to trigger a generator thread safety error.
"""
generator are not thread safe, two or more thread accessing the same generator
causes an error: