Skip to content

Instantly share code, notes, and snippets.

Phil Christensen philchristensen

Block or report user

Report or block philchristensen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
yeti-detective /
Last active Oct 30, 2019
This function will let you make MacOs screen captures into .gif files by running `gifit <input_filename> <output_filename>`
function gifit {
if [[ $# -eq 0 ]]; then
echo "Usage: gifit <input_mov_file> <output_gif_filename>"
echo " converts mov files into 600x400 gif files"
if [ $# -eq 1 ]
philchristensen / svn-prompt.bash
Created Feb 16, 2011
add current svn branch to shell prompt
View svn-prompt.bash
function parse_svn_branch {
if [ -d '.svn' ]; then
ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
if [ $ref != $cur ]; then
echo "#$ref"
philchristensen / git-prompt.bash
Created Dec 19, 2010
add current git branch to shell prompt
View git-prompt.bash
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "#"${ref#refs/heads/}
export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_git_branch)\[\e[0m\] \$ "
philchristensen /
Created Nov 8, 2010
a method decorator to enable asynchronous object construction in Twisted
from twisted.internet import defer, reactor
from twisted.enterprise import adbapi
def deferredInit(deferredName):
Mark a method as waiting on deferred initialization.
def _deferredInit(func):
def __deferredInit(self, *args, **kwargs):
initDeferred = None
philchristensen /
Created Aug 10, 2010
Color-Coded `svn status`

First there was:

Then there was:

A few days ago, I found a handy script online that colorized the output of SVN status. It worked pretty well, but needed a little polish and a couple of tweaks to make it use more common Python idioms. As I continued to use it and fix bugs and inefficiencies, I ended up replacing nearly every line in the original, but it was still a great starting point.

Additional changes include ANSI word-wrapping, a configurable tab expansion feature (for better code alignment), the 'colorizedSubcommands' sequence so that only applicable commands get colorized, use of proper subprocess module calls so that piping through less will work (for example, try svn-color diff | less -r to see colorized diff output).

To use, stick it somewhere, make executable (`chmod 7

You can’t perform that action at this time.