Skip to content

Instantly share code, notes, and snippets.

View nvie's full-sized avatar
🍀
Simplifying things

Vincent Driessen nvie

🍀
Simplifying things
View GitHub Profile
@nvie
nvie / pip-compile-specifics.txt
Created October 2, 2012 18:44
Cram test describing the interface for the pip-compile command.
Moved to https://github.com/nvie/pip-tools/blob/future/tests/pip-compile-specifics.t
@nvie
nvie / gist:3607425
Created September 3, 2012 06:51 — forked from bulkan/gist:3606776
rq job attributes
job = Job.fetch(job_id)
job.my_attr = ['one', 'two']
job.save()
# re-fetch job
job = Job.fetch(job_id)
print type(job.my_attr)
<type 'str'>
print job.my_attr
"['one', 'two']" # should be unpickled to a list, not a str
@nvie
nvie / new_workers.py
Created August 30, 2012 21:22
Initial experiment with a possible new worker structure for RQ
from gevent import monkey
monkey.patch_all()
import gevent.pool
import os
import random
import time
import datetime
from multiprocessing import Semaphore, Array
@nvie
nvie / workers.py
Created August 28, 2012 21:30
The following sample shows a pool of 5 child processes and submits calculations of the Fibonacci numbers 10..40 (this takes looooong). What you can see is that all work is submitted (as `apply_async` doesn't block), instead of blocking after the fifth.
from multiprocessing import Pool
def fib(n):
if n <= 1:
return n
else:
return fib(n - 1) + fib(n - 2)
@nvie
nvie / gist:3353413
Created August 14, 2012 22:03
rq-dashboard usage
$ rq-dashboard -h
Usage: rq-dashboard [options]
Options:
-h, --help show this help message and exit
-b ADDR, --bind=ADDR IP addr or hostname to bind to
-p PORT, --port=PORT port to bind to
-H ADDR, --redis-host=ADDR
IP addr or hostname of Redis server
-P PORT, --redis-port=PORT
@nvie
nvie / gist:3353391
Created August 14, 2012 21:59
rqworker usage
$ rqworker -h ~/Projects/rq
usage: rqworker [-h] [--host HOST] [--port PORT] [--db DB] [--burst]
[--name NAME] [--path PATH] [--verbose]
[queues [queues ...]]
Starts an RQ worker.
positional arguments:
queues The queues to listen on (default: 'default')
@nvie
nvie / mountain-lion-brew-setup.markdown
Created July 26, 2012 07:46 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

Counting objects: 19, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.39 KiB, done.
Total 12 (delta 10), reused 0 (delta 0)
remote: /usr/lib/ruby/1.8/securerandom.rb:53:in `random_bytes': PRNG not seeded (OpenSSL::Random::RandomError)
remote: from /usr/lib/ruby/1.8/securerandom.rb:53:in `random_bytes'
remote: from /usr/lib/ruby/1.8/securerandom.rb:91:in `hex'
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/activesupport_notifications_backport-0.0.4/lib/active_support/notifications/instrumenter.rb:29:in `unique_id'
remote: from /data/github/current/vendor/gems/ruby/1.8/gems/activesupport_notifications_backport-0.0.4/lib/active_support/notifications/instrumenter.rb:7:in `initialize'
@nvie
nvie / fnd.sh
Created July 18, 2012 08:00
Finds files by extension starting from the current working directory.
#!/bin/sh
set -e
extensions=$*
main() {
if [ -z "$extensions" ]; then
find .
else
echo "find . $(build_find_command_arguments)" | sh
@nvie
nvie / pip.log
Created June 6, 2012 12:55
Build errors with pandas (via pip)
------------------------------------------------------------
/Users/nvie/.virtualenvs/dash/bin/pip run on Wed Jun 6 14:45:52 2012
Obtaining pandas from git+git://github.com/pydata/pandas.git@master#egg=pandas
Found command 'git' at '/usr/local/bin/git'
Running command /usr/local/bin/git config remote.origin.url
git://github.com/pydata/pandas.git
Clone in /Users/nvie/.virtualenvs/dash/src/pandas exists, and has correct URL (git://github.com/pydata/pandas.git)
Updating /Users/nvie/.virtualenvs/dash/src/pandas clone (to master)
Running command /usr/local/bin/git fetch -q