Skip to content

Instantly share code, notes, and snippets.

from reviewgallery.settings.development.defaults import *
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'default': {
'format': '%(name)s-%(levelname)s -- %(message)s'
}
},
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
tedkaemming@reventon % sudo ipfw pipe 1 config bw 128Kbit/s delay 200ms
tedkaemming@reventon % sudo ipfw add 1 pipe 1 src-port 8000
00001 pipe 1 ip from any 8000 to any
@tkaemming
tkaemming / post-checkout
Created December 8, 2010 04:13
super simple git post-checkout hook to alert if a file has been changed requires gitpython: http://gitorious.org/git-python
#!/usr/bin/env python
import os, git, sys
previous, current, branch = sys.argv[1:4]
WATCH_FILES = ('conf/python/requirements.txt',)
if branch:
repository = git.Repo(os.getcwd())
previous_commit = repository.commit(previous)
current_commit = repository.commit(current)
@tkaemming
tkaemming / exceptions.js
Created December 15, 2010 18:22
Based on an aside from Tim Caswell's talk at NodeCamp.
function foo () {
setTimeout(function () {
throw new Error('Uh oh!');
}, 10);
}
try {
foo();
} catch (e) {
// This catch block will never get called, because the `foo` function has
#!/usr/bin/env python
"""
Nagios plugin to check PostgreSQL 9 streaming replication lag.
Requires psycopg2 and nagiosplugin (both installable with pip/easy_install).
MIT licensed:
Copyright (c) 2010 Jacob Kaplan-Moss. All rights reserved.
@tkaemming
tkaemming / post-receive
Created January 7, 2011 23:07
a git post-receive hook to autoupdate to the new HEAD. good for push deploys for a static or PHP site.
#!/bin/sh
cd ..
env -i git reset --hard
var _ = require('./vendor/underscore'),
spawn = require('child_process').spawn;
var log = function (message, newline) {
if (newline === undefined) { newline = true; }
process.stdout.write('[' + Date.now().toString() + '] ' + message + (newline ? '\n' : ''));
return;
};
// Stores the exit codes for each test runner.
#!/bin/bash
export PROJECT_NAME=$1
export REPOSITORY_URL=$2
#
export PROJECT_DIRECTORY="${PWD}/${PROJECT_NAME}"
virtualenv --no-site-packages $PROJECT_DIRECTORY
cd $PROJECT_DIRECTORY
echo >> ./bin/activate
@tkaemming
tkaemming / django-admin-wrapper.py
Created February 19, 2011 21:11
wrapper for django-admin.py that automatically bootstraps it's virtualenv
#!/usr/bin/env python
import os
ENVIRONMENT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
activate_file = os.path.join(ENVIRONMENT_ROOT, 'bin', 'activate_this.py')
execfile(activate_file, dict(__file__=activate_file))
admin_file = os.path.join(ENVIRONMENT_ROOT, 'bin', 'django-admin.py')
execfile(admin_file)