Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
PuercoPop / convert to utf
Created July 20, 2012 00:22
Script to find the files that aren't encoded in uft-8 and do so
file -i `find templates/ | xargs` | sed -r '/charset=utf-8/d' | sed -r '/charset=binary/d'
@PuercoPop
PuercoPop / Populate circuits
Created June 6, 2012 00:58 — forked from gnrfan/Populate circuits
small snippet to replicate circuits in development database
import random
from circuits.models import Circuit
from user_profile.models import UserProfile
circuits = Circuit.objects.all()
profiles = UserProfile.objects.all()
countdown = 100
while countdown > 0:
circuit = random.choice( circuits )
@PuercoPop
PuercoPop / Populate circuits
Created June 5, 2012 23:42
small snippet to replicate circuits in development database
import random
from circuits.models import Circuit
from user_profile.models import UserProfile
circuits = Circuit.objects.all()
users = UserProfile.objects.all()
countdown = 1
while countdown > 0:
circuit = random.choice( circuits )
@PuercoPop
PuercoPop / pre-commit
Created April 10, 2012 04:33
Git pre-commit hook
#!/bin/sh
ack '# TODO' apps --ignore-dir=common > TODO
git add ${GIT_DIR}/TODO
@PuercoPop
PuercoPop / gist:2332771
Created April 7, 2012 23:18
card app model
class Gifts(models.Model):
"""
Represents the relationship between a Card, and Accounts
"""
#created_by?
number of coupons
@PuercoPop
PuercoPop / blame.sh
Created March 30, 2012 14:14
Presents an aggregated count of the 'blame' of each contributor to a git repository
#!/bin/sh
#
# Execute in the repo root dir
#
git ls-tree -r HEAD | awk '{print $4}' | tr -s '\n' ' ' | xargs -n 1 git blame| awk '{print $1,$2,$3,$4,$5,$6,$7}' | gsed -r 's/.*\((.*?) [0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/p' | sort | uniq -c | sort -r