Skip to content

Instantly share code, notes, and snippets.

@ftao
ftao / mongo-aggregate-in-pandas.md
Last active April 2, 2016 08:52
express-mongo-aggregate-operation-in-pandas
@ftao
ftao / introrx-cn.md
Last active February 19, 2016 09:14 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ftao
ftao / make_nghttp2_deb.sh
Created December 14, 2015 11:19
make_nghttp2_deb.sh
#/bin/sh
FAKEROOT=/home/vagrant/workspace/nghttpx/dist
PYTHONPATH=$FAKEROOT/usr/local/lib/python2.7/site-packages
mkdir -p $PYTHONPATH
PYTHONPATH=$PYTHONPATH make DESTDIR=$FAKEROOT install
fpm -s dir -t deb -n nghttp2 -v 1.5.0 -C $FAKEROOT -p nghttp2_VERSION_ARCH.deb \
-d "libssl1.0.0 >= 1.0.1" \
-d "libev4 >= 4.15" \
-d "zlib1g >= 1.2.3" \
@ftao
ftao / strongswan5.2.1-openvz.patch
Created December 9, 2015 16:09
strongswan debian package openvz patch
--- rules.origin 2015-12-09 06:13:45.756687865 -0500
+++ strongswan-5.2.1/debian/rules 2015-12-09 09:43:52.992183631 -0500
@@ -50,7 +50,7 @@
--with-capabilities=libcap \
--enable-farp \
--enable-dhcp \
- --enable-af-alg
+ --enable-kernel-libipsec
endif
--- strongswan-5.2.1/debian/rules 2014-10-27 14:36:53.659872404 +0300
+++ strongswan-5.2.1/debian/rules 2014-10-27 15:10:07.003054721 +0300
@@ -15,7 +15,7 @@
--enable-ha \
--enable-led --enable-gcrypt \
--enable-test-vectors \
- --enable-xauth-eap --enable-xauth-pam \
+ --enable-xauth-eap --enable-xauth-pam --enable-xauth-noauth \
--enable-cmd \
--enable-certexpire \
@ftao
ftao / flatten_json.py
Created June 17, 2015 02:22
flatten json
import sys
import json
def flatten(data):
for key, value in data.iteritems():
if type(value) is dict:
for k,v in flatten(value):
yield (key + '.' + k, v)
else:
yield (key, value.encode("utf-8"))
@ftao
ftao / gist:7982948
Created December 16, 2013 06:06
my public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC23tUdjQbKxLj0xeNgseWTwFy08C7rtWRSgbA1sTy1HzL25D+4Bl5+t0VQxdHyll29io9rbBafiBg3epBHMY3ziPdXT6Bk6PNteA6bLQwB/eKaxdyW8s4ZE8wh+WiXv4FAhyBB3GlVm6S1mb69JFe3d87M3E5mNIpxjm/Q4XmPtTO20TTA90D3Uw1H5XnPCkrOQD3xgDlN0IvsHq817eLC8QtStR4FY9apmB1xU0f9uCcqPh57hV9qZgguvx18L3KdJXjldpbYYZBL5jkyhR26TQBzRov4z4aPk9g45ETNf8u/3EhGPwmeNCHwz9rm3Kp5uJPrPvB5SgBr6ch9p223 vagrant@preci
@ftao
ftao / index.html
Last active December 15, 2015 12:39
生成四则运算的题目
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
#result{
width:900px;
line-height:25px;
@ftao
ftao / install_pub_key
Created December 29, 2012 07:58
Install ssh pub key to remote server in one line
cat path/to/pub.key | ssh your.remote.server 'sh -c "mkdir -p ~/.ssh/; cat - >>~/.ssh/authorized_keys"'
@ftao
ftao / test.html
Created September 11, 2012 08:46
django floatformat problem
f: {{ f|floatformat:9}}
<br/>
f2: {{ f2|floatformat:9}}
<br/>
d: {{ d|floatformat:9}}
<br/>
s: {{ s|floatformat:9}}