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 | |
# | |
# sixty.py, a (10+2)x5 implimentation. | |
# http://www.43folders.com/2005/10/11/procrastination-hack-1025 | |
# | |
# Copyright 2009 Tristram Oaten | |
# This program is distributed under the | |
# terms of the GNU General Public License | |
# see <http://www.gnu.org/licenses/> |
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 | |
# | |
# An example hook script that is called after a successful | |
# commit is made. | |
# | |
# To enable this hook, make this file executable. | |
echo "Starting auto-deploy..." | |
cd /usr/share/django |
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
clean: | |
find ./ -name '*~' -exec rm -f {} \; | |
find ./ -name '#*' -exec rm -f {} \; | |
find ./ -name 'Thumbs.db' -exec rm -f {} \; | |
find ./ -name '*.pyc' -exec rm -f {} \; |
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
""" | |
Python features bingo. | |
I hope you enjoy reading this as much as I enjoyed writing it! | |
""" | |
import json | |
def tracks_to_json_playlist(tracks, playlist=None): | |
''' | |
Takes a queryset of tracks and returns a json playlist | |
''' |
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
while inotifywait -r -q -q -e close_write *; | |
do ./manage.py test -v0 --failfast; | |
done |
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 datetime import date, timedelta | |
from textwrap import wrap | |
years = timedelta(weeks=52) | |
tris = { | |
"fullname": "Tristram Oaten", | |
"email": "[email protected]", | |
"bio": """I specialise in functional and object-oriented Javascript,Python and Django development | |
and high-availability Linux systems administration in a heterogeneous environment. |
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 | |
if [ -z "$1" ]; then | |
echo "`basename $0` {start|stop}" | |
exit | |
fi | |
case "$1" in | |
start) | |
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & |
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
./manage.py schemamigration cms --auto; ./manage.py migrate && ./manage.py graph_models cms -g -o cms.svg && ./manage.py runserver_plus |
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
def find_subclasses(module, clazz): | |
""" | |
Finds all subclasses of `clazz` in `module`, returns a list. | |
Source: http://stackoverflow.com/a/408465 | |
""" | |
return [ | |
cls for name, cls in inspect.getmembers(module) | |
if inspect.isclass(cls) and issubclass(cls, clazz) | |
] |
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
Copyright (c) 2013 Blackgate Research. | |
This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 license, | |
http://creativecommons.org/licenses/by-sa/3.0/." |
OlderNewer