Moved to https://github.com/mtigas/dotfiles/blob/master/bin/twittersearch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models.signals import post_init | |
def track_data(*fields): | |
""" | |
Tracks property changes on a model instance. | |
The changed list of properties is refreshed on model initialization | |
and save. | |
>>> @track_data('name') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd .. | |
env -i git reset --hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
echo "Purging pyc files and empty directories..." | |
# Start from the repository root. | |
cd ./$(git rev-parse --show-cdup) | |
# Delete .pyc files and empty directories. | |
find . -name "*.pyc" -delete 2>&1 > /dev/null & | |
find . -type d -empty -delete 2>&1 > /dev/null & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import local | |
_blah = local() | |
class StopThatShit(Exception): | |
pass | |
def patch(): | |
from django.db.backends import util | |
from django import template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ERROR_LIST=$(find . -name \*.py -not -path \*migrations/\* -not -path \*settings/\* -not -path \*vendor/\* -not -path \*node_modules/\* | xargs pyflakes) | |
RETVAL=$? | |
if [[ $RETVAL -ne 0 ]]; then | |
echo "Encountered errors during pyflakes check, cowardly refusing to commit." | |
echo "$ERROR_LIST" | |
exit $RETVAL | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.placeholder = function (_options) { | |
var defaults = { | |
blank: '', | |
className: 'default' | |
}, | |
options = $.extend({}, defaults, _options || {}); | |
return this.each(function () { |
OlderNewer