Skip to content

Instantly share code, notes, and snippets.

@contextmanager
def virtualenv():
with prefix(env.activate):
yield
env.activate = 'source /srv/beehive/.virtualenvs/beehive/bin/activate'
def meh():
with virtualenv():
run('./manage.py do crap')
#!/usr/bin/env python
import site, sys
import env.other_settings as settings
from django.core.management import execute_manager
if __name__ == "__main__":
execute_manager(settings)
@wraithan
wraithan / fabfile.py
Created September 15, 2011 20:05 — forked from bingomanatee/fabfile.py
slipping throught exception handling with fabric
import time
from fabric.api import puts
def update_agi(delay=4):
prep_hosts()
puts('waiting %s seconds for agis to cycle down' % delay)
time.sleep(delay)
fab_lib.kill_rails()
# where ever this is defined
In [10]: timeit.Timer('Order.objects.all()[0]','from __main__ import Order').timeit(number=100)
Out[10]: 67.119456052780151
In [11]: timeit.Timer('Order.objects.all().order_by()[0]','from __main__ import Order').timeit(number=100)
Out[11]: 0.34228992462158203
set nocompatible
set backspace=indent,eol,start
set incsearch
set ruler
set history=50
set mouse=a
set number
set nohlsearch
set expandtab
set shiftwidth=4
"""
This is the Django template system.
How it works:
The Lexer.tokenize() function converts a template string (i.e., a string containing
markup with custom template tags) to tokens, which can be either plain text
(TOKEN_TEXT), variables (TOKEN_VAR) or block statements (TOKEN_BLOCK).
The Parser() class takes a list of tokens in its constructor, and its parse()
Running Sphinx v1.0.8
loading pickled environment... done
loading intersphinx inventory from http://docs.python.org/objects.inv...
loading intersphinx inventory from http://api.mongodb.org/python/current/objects.inv...
building [html]: targets for 4 source files that are out of date
updating environment: 0 added, 4 changed, 0 removed
reading sources... [ 25%] api
Traceback (most recent call last):
File "/home/docs/sites/readthedocs.org/lib/python2.6/site-packages/sphinx/ext/autodoc.py", line 329, in import_object
__import__(self.modname)
NAMES #pdxWebDev
:sendak.freenode.net 353 Wraithan = #pdxWebDev :brennannovak axolx_ zrobo MarcinM ahhrrr Loqi anth0ny nijotz jedediah plamb Metroknow austinh martin_c soycamo rozwell dcamp racicot brett dietricha ZenWraithBot dukeleto edrex selenamarie mshadle jeremydei lisamusing johnmetta-away keturn adaburrows wajiii-afk christiekoehler neophiliac onewheelskyward JoelBernstein aaronpk adabot vhost- ChrisPitzer tyler-iphone ericholscher wagle robotadam mpacific GDorn mwehner bkero ubiquill clouserw reidab pdxleif
:sendak.freenode.net 353 Wraithan = #pdxWebDev :Wraithan jslabaugh donpdonp manimal paulproteus maxogden
:sendak.freenode.net 366 Wraithan #pdxWebDev :End of /NAMES list.

Open Source

ZenIRCBot

Figure out what is stopping me from integrating node-irc

Solidify message types for 1.0

Write docs for adding a service

Document current message types and channels

Follow up on my pull requests to node-irc

Followed up once, dev has fallen behind on personal work due to RL, follow up in a week.

Read The Docs

@wraithan
wraithan / Run
Created October 12, 2011 01:03
Evil Pure Python Evil
$ python2 replace.py
woof
woof
meow