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
@philchristensen
philchristensen / svn-color.py
Created Aug 10, 2010
Color-Coded `svn status`
View svn-color.py

First there was: http://snipplr.com/view/15246/color-coded-svn-status

Then there was: http://snipplr.com/view/16540/color-coded-svn-status-v2

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

@philchristensen
philchristensen / django.cgi.py
Last active Jul 23, 2019
A very slow way to serve Django when all you have is CGI
View django.cgi.py
#!/usr/bin/env python
# encoding: utf-8
"""
django.cgi
A simple cgi script which uses the django WSGI to serve requests.
Code copy/pasted from PEP-0333 and then tweaked to serve django.
http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
View anti-spam-autoresponse.txt
Your post advocates a
( ) technical ( ) legislative (X) market-based (X) vigilante ( ) form-based
approach to fighting spam. Your idea will not work. Here is why it won't work. (One or more of the following may apply to your particular idea, and it may have other flaws which used to vary from state to state before a bad federal law was passed.)
( ) Spammers can easily use it to harvest email addresses
( ) Mailing lists and other legitimate email uses would be affected
( ) No one will be able to find the guy or collect the money
( ) It is defenseless against brute force attacks
@philchristensen
philchristensen / sqs.py
Created Sep 5, 2013
Minimal script for sending/reading from Amazon SQS using Boto/Python.
View sqs.py
conf = {
"sqs-access-key": "",
"sqs-secret-key": "",
"sqs-queue-name": "",
"sqs-region": "us-east-1",
"sqs-path": "sqssend"
}
import boto.sqs
conn = boto.sqs.connect_to_region(
@philchristensen
philchristensen / refresh_puppet_modules.py
Created Sep 19, 2014
Script to checkout/refresh per-environment puppet modules
View refresh_puppet_modules.py
#!/usr/bin/env python
import sys
import os
import os.path
import logging
import subprocess
ENV_DIR = "environments"
MODULES = ['core', 'client']
View dune-unix-names
bijaz
stilgar
othyem
farok
kaitan
caladan
tabr
fedaykin
korba
tlielax
@philchristensen
philchristensen / r2sync.sh
Created Mar 24, 2017
RSync between two remote hosts
View r2sync.sh
# r2sync stage-jira /var/lib/jira/ prod-jira /var/lib/jira
ssh -R localhost:50000:$1:22 $3 'rsync -e "ssh -p 50000" -vuar $2 localhost:$4'
@philchristensen
philchristensen / zappa-unix-names.md
Last active Mar 2, 2016
zappa-related unixlike names
View zappa-unix-names.md
stinkfoot
muffinman
grandwazoo
unclemeat
zombywoof
zootallures
lumpygravy
mudshark
jazzdischarge
partyhat
View homers-revenge-list.md
  • Bill of Rights
  • Grandpa
  • fat free lard
  • gravity
  • Emmys
  • Darwin
  • H2-WHOA!
  • Billy Crystal
  • God
  • Soloflex
@philchristensen
philchristensen / mnemo.py
Created Jan 13, 2014
Generate nonsense words out of integers
View mnemo.py
# Port of rufus-mnemo to Python
# https://github.com/jmettraux/rufus-mnemo
# Original copyright (c) 2007-2011, John Mettraux, jmettraux@gmail.com
consonants = list('bdghjkmnprstz')
vowels = list('aeiou')
syllables = [c + v for c in consonants for v in vowels] + ['wa', 'wo', 'ya', 'yo', 'yu']
negative = 'wi'
replacements = [
You can’t perform that action at this time.