Skip to content

Instantly share code, notes, and snippets.

[1,2,3].map(x => x * x)
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
__git_ps1 ()
{
local g="$(git rev-parse --git-dir 2>/dev/null)"
if [ -n "$g" ]; then
local r
local b
if [ -d "$g/rebase-apply" ]
then
from optparse import make_option
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
test_runner = get_runner(settings)
from optparse import make_option
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
test_runner = get_runner(settings)
from datetime import datetime
import random
from pyquery import PyQuery
URL = ('https://wiki.mozilla.org/Webdev:Meetings:%s-%s-%s' %
datetime.now().timetuple()[:3])
names = PyQuery(url=URL)('h2 .mw-headline').text().split()
@jbalogh
jbalogh / meeting.py
Created October 20, 2009 18:42 — forked from fwenzel/meeting.py
from datetime import datetime
import random
from pyquery import PyQuery
URL = ('https://wiki.mozilla.org/Webdev:Meetings:%s-%s-%s' %
datetime.now().timetuple()[:3])
names = PyQuery(url=URL)('h2 .mw-headline').text().split()
"""
Watch a bunch of files and run a command if any changes are detected.
Usage
-----
::
python watcher.py 'echo changes' one.py two.py
To automatically keep Sphinx docs up to date::
#!/bin/sh
BIN=$1/bin
$BIN/easy_install -Z pip
$BIN/pip install -i 'http://people.mozilla.org/~jbalogh/pypi' ipython
site_packages=$(virtualenvwrapper_get_site_packages_dir)
PROJECT=`basename $VIRTUAL_ENV`
DIR="$HOME/dev/$PROJECT"
if [ -d $DIR ]; then
cd $DIR
fi
unset DIR
site_packages=$(virtualenvwrapper_get_site_packages_dir)
PROJECT=`basename $VIRTUAL_ENV`
DIR="$HOME/dev/$PROJECT"
if [ -d $DIR ]; then
cd $DIR
fi
unset DIR