This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qpdf --decrypt <encrypted.pdf> <output.pdf> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nosetests --with-profile --profile-stats-file=nose.prof | |
python -c "import hotshot.stats ; stats = hotshot.stats.load('nose.prof') ; stats.sort_stats('time', 'calls') ; stats.print_stats(20)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m cProfile -o rep.prof <script.py> | |
python -c 'import pstats; p=pstats.Stats('rep.prof'); p.sort_stats('cumulative').print stats(10)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pymongo | |
import gridfs | |
from test import sanitize, size_chunks, CsvChunkReader | |
import multiprocessing as mp | |
import csv | |
mongo_conn = pymongo.Connection() | |
mongo_db = mongo_conn['test'] | |
docs = mongo_db['docs'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn send_multipart [socket iter] | |
(map mq/send-more (repeat socket) (pop iter)) | |
(mq/send socket (last iter))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dthandler = lambda obj: obj.isoformat() if isinstance(obj, datetime.datetime) else None | |
def jsonify(data): | |
return Response(json.dumps(data, default=dthandler)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def mongo_cleanup(item, replacement=''): | |
"""clean's a nested structure keys to adapt to mongodb's | |
legal keys | |
see http://www.mongodb.org/display/DOCS/Legal+Key+Names """ | |
if hasattr(item, 'items'): | |
newdict = {} | |
for key, value in item.items(): | |
nkey = key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install python | |
easy_install pip | |
#install scipy use temp branch | |
pip install git+https://github.com/minrk/scipy-1.git@accelerate | |
#ft2build.h not found ==> | |
pip install git+git://github.com/matplotlib/matplotlib.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xen-create-image --hostname ubuntu.dev --size=30G --swap=1G --dhcp --memory=8192Mb --mirror=http://archive.ubuntu.com/ubuntu/ --lvm server --dist=precise --passwd --force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::vector<std::string> split(const std::string &s, const std::string &tosplit){ | |
const std::regex rsplit(tosplit + "+"); | |
auto rit = std::sregex_token_iterator(s.begin(), s.end(), rsplit, -1); | |
auto rend = std::sregex_token_iterator(); | |
auto res = std::vector<std::string>(rit, rend); | |
return res; | |
} |
OlderNewer