Skip to content

Instantly share code, notes, and snippets.

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']
@jassinm
jassinm / pyprofling
Created March 21, 2012 19:29
python profiling
python -m cProfile -o rep.prof <script.py>
python -c 'import pstats; p=pstats.Stats('rep.prof'); p.sort_stats('cumulative').print stats(10)'
@jassinm
jassinm / nosetests profiling
Created March 16, 2012 00:24
nosetest profiling
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)"
@jassinm
jassinm / pdf decrypt
Created March 15, 2012 14:52
decrypt pdf
qpdf --decrypt <encrypted.pdf> <output.pdf>