Skip to content

Instantly share code, notes, and snippets.

View dreampuf's full-sized avatar

Dreampuf dreampuf

View GitHub Profile
@dreampuf
dreampuf / gist:4223370
Created December 6, 2012 09:57
ab Benchmark plot
# 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
@dreampuf
dreampuf / buyvm.net.py
Created December 12, 2012 06:47
Interval tool for check buyvm.net activate Instance send email to inform your by email
#!/usr/bin/env python
#vi: encoding=utf-8
""" Interval tool for check buyvm.net activate Instance send email to inform your by email
http://huangx.in
"""
import time
import json
import urllib2
@dreampuf
dreampuf / sqlite3_wal_test.py
Created November 11, 2015 06:06
Sqlite WAL test
import time
from playhouse.sqlite_ext import SqliteExtDatabase
sqlite_db = SqliteExtDatabase('my_app.db', journal_mode="WAL", autocommit=False)
with sqlite_db.transaction() as cursor:
cursor = sqlite_db.execute_sql("""CREATE TABLE server_status (
id INTEGER PRIMARY KEY,
time_created INT);""")
assert cursor.rowcount == -1
@dreampuf
dreampuf / build_python_rpm_package.sh
Created November 25, 2015 09:04
Build yourself Python 2.7 rpm package in RHEL5/CENTOS5
# 1. install pyenv and with it download python 2.7.10
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
exec $SHELL
pyenv install 2.7.10
pyenv rehash
# 2. install rvm and fpm gem package
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@dreampuf
dreampuf / gist:4328605
Last active December 9, 2015 21:08
Funny JD 

诚邀顶级的java程序猿参加一项颠覆性的事业,这不是忽悠。

能力要求如下:
1、全国性大赛的获奖者(条件可以放宽)。
2、两年以上开发经验。

参与项目:
领先的无代码开发平台的完善。

回报:

@dreampuf
dreampuf / image_format.py
Created December 25, 2012 10:35
图片转透明圆图
#!/usr/bin/env python
#vi: encoding=utf-8
"""
Image Convert
"""
__author__ = "dreampuf<soddyque@gmail.com>"
from glob import iglob
@dreampuf
dreampuf / marathon.yml
Last active December 14, 2015 01:35
Marathon single compose yml
# Zookeeper: -p 2181:2181 -p 2888:2888 -p 3888:3888
zookeeper:
image: jplock/zookeeper
ports:
- "2181"
- "2888"
- "3888"
master:
image: mesosphere/mesos-master:0.25.0-0.2.70.ubuntu1404
@dreampuf
dreampuf / V2exRelaTopNWord.py
Created April 21, 2013 02:58
a collection of high-frequency words the v2ex subject matter
#!/usr/bin/env python
# coding: utf-8
__author__ = "soddyque@gmail.com"
import tempfile
import cPickle as pickle
from collections import Counter
from xgoogle.search import GoogleSearch
@dreampuf
dreampuf / myreader.py
Created June 30, 2013 18:47
Backup my google reader records. Usage: ``` $ pip install libgreader python-daemon pony $ python myreader.py ``` Your data will save to `myreader.sqlite` file.
#!/usr/bin/env python
#vim: encoding=utf-8
"""
Backup my google reader records.
Usage:
$ pip install libgreader python-daemon pony
$ python myreader.py
@dreampuf
dreampuf / make_plda_data.py
Created July 1, 2013 06:11
make the data suit PLDA+
#!/usr/bin/env python
#vi: fileencoding=utf-8
__twitter__ = "dreampuf"
"""
Make the text data suit PLDA+
This script usage:
$ python make_data.py ../sgyy.utf-8.txt > data.txt