Skip to content

Instantly share code, notes, and snippets.

Dreampuf dreampuf

Block or report user

Report or block dreampuf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dreampuf
dreampuf / logic_func.js
Created May 21, 2011
函数化Javascript
View logic_func.js
var sgs = sgs || {};
(function(sgs){
var srd = Math.random,
slice = Array.prototype.slice,
copy = function(ary){ return slice.apply(ary); };
sgs.func = sgs.func || {};
sgs.func.rint = function(max) {
max = max || 100;
View bf.js
(function(g) {
var cur = 0,
p = 0,
mem = [0],
ret = [],
slen = -1,
pos = [],
unlimit_loop = 5000,
tmp = "",
ptype = Object.prototype.toString,
@dreampuf
dreampuf / gist:3302527
Created Aug 9, 2012
Pkg-config error Log
View gist:3302527
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pkg-config configure 0.27, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-debug --prefix=/Users/dreampuf/opt/homebrew/Cellar/pkg-config/0.27 --with-pc-path=/Users/dreampuf/opt/homebrew/lib/pkgconfig:/Users/dreampuf/opt/homebrew/share/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig --with-internal-glib
## --------- ##
## Platform. ##
@dreampuf
dreampuf / gist:3600472
Created Sep 2, 2012
HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install uwsgi
View gist:3600472
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pkg-config configure 0.27, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --disable-debug --prefix=/Users/dreampuf/opt/homebrew/Cellar/pkg-config/0.27 --with-pc-path=/Users/dreampuf/opt/homebrew/lib/pkgconfig:/Users/dreampuf/opt/homebrew/share/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig --with-internal-glib
## --------- ##
## Platform. ##
@dreampuf
dreampuf / profiler.py
Created Sep 25, 2012
Python Profile script
View profiler.py
#!/usr/bin/env python
# vim: fileencoding=utf-8
__author__ = "dreampuf<soddyque@gmail.com>"
import os
import sys
from functools import wraps
try:
from line_profiler import LineProfiler
@dreampuf
dreampuf / gist:3859636
Created Oct 9, 2012
双拼域名采集
View gist:3859636
#!/usr/bin/env python
#vim: encoding=utf-8
__author__ = "Dreampuf<soddyque@gmail.com>"
import subprocess
import itertools
dc = "a,ai,an,ang,ao,ba,bai,ban,bang,bao,bei,ben,beng,bi,bian,biao,bie,bin,bing,bo,bu,ca,cai,can,cang,cao,ce,cei,cen,ceng,cha,chai,chan,chang,chao,che,chen,cheng,chi,chong,chou,chu,chua,chuai,chuan,chuang,chui,chun,chuo,ci,cong,cou,cu,cuan,cui,cun,cuo,da,dai,dan,dang,dao,de,dei,den,deng,di,dia,dian,diao,die,din,ding,diu,dong,dou,du,duan,dui,dun,duo,e,ei,en,eng,er,fa,fan,fang,fei,fen,feng,fiao,fo,fou,fu,ga,gai,gan,gang,gao,ge,gei,gen,geng,gong,gou,gu,gua,guai,guan,guang,gui,gun,guo,ha,hai,han,hang,hao,he,hei,hen,heng,hm,hng,hong,hou,hu,hua,huai,huan,huang,hui,hun,huo,ji,jia,jian,jiang,jiao,jie,jin,jing,jiong,jiu,ju,juan,jue,jun,ka,kai,kan,kang,kao,ke,kei,ken,keng,kong,kou,ku,kua,kuai,kuan,kuang,kui,kun,kuo,la,lai,lan,lang,lao,le,lei,leng,li,lia,lian,liang,liao,lie,lin,ling,liu,lo,long,lou,lu,luan,lun,luo,lüe,lǘ,lǚ,lǜ,ma,mai,man,mang,mao,me,mei,men,meng,mi,mian,miao,mie,min,ming,miu,mo,mo
View gist:3946886
#!/usr/bin/env python
#vim: encoding=utf-8
"""
拼音分词
"""
__author__ = "dreampuf<soddyque@gmail.com>"
import unittest
@dreampuf
dreampuf / gist:4142565
Created Nov 25, 2012
Python True Value Testing
View gist:4142565
#!/usr/bin/env python
#vi: encoding=utf-8
__author__ = "dreampuf <soddyque@gmail.com>"
"""
Reference : http://docs.python.org/2/library/stdtypes.html#truth-value-testing
"""
class S(object):
@dreampuf
dreampuf / gist:4187641
Created Dec 2, 2012
get ips from ping command
View gist:4187641
$ for i in {1..20}; do echo `echo s$i.vpnst.com;ping -c1 s$i.vpnst.com|grep -o '(.\+)'`; done
s1.vpnst.com (106.187.39.125)
s2.vpnst.com (96.44.186.158)
s3.vpnst.com (106.187.39.125)
s4.vpnst.com (109.169.68.137)
s5.vpnst.com (173.231.12.99)
s6.vpnst.com (76.164.225.211)
s7.vpnst.com (74.82.183.119)
s8.vpnst.com (106.187.39.125)
s9.vpnst.com (76.74.172.234)
@dreampuf
dreampuf / gist:4223370
Created Dec 6, 2012
ab Benchmark plot
View gist:4223370
# output as png image
set terminal png
# save file to "benchmark.png"
set output "benchmark.png"
# graph title
set title "Benchmark for gunicorn(default) vs. gunicorn(gevent) vs. gunicorn(eventlet) vs. Flask default"
# aspect ratio for image size
You can’t perform that action at this time.