Skip to content

Instantly share code, notes, and snippets.

View bryanveloso's full-sized avatar

Bryan Veloso bryanveloso

View GitHub Profile

Python 2.6 + Virtualenv + Django 1.1 + Postgres on WebFaction

  1. mkdir -p ~/bin ~/lib/python2.6/site-packages
  2. Configure the environment by putting something like this in your .bashrc and sourcing it:

    export CFLAGS=-I/usr/local/pgsql/include 
    export LDFLAGS=-L/usr/local/pgsql/lib
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# NOTE:
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to reamea.com, and your
# ssh public key associated with the account 'mboza@reamea.com'

Kyle's Guide

Just a placeholder for now, move along. Going to add what I consider vital design & development practices for use somewhere else in more complete form.

I am writing this down so I remember it. I have been writing HTML & CSS since somewhere around 1998, and much of what I have ingrained in my brain is outdated (body{ text-align:center; } anyone?). I need to rid this of my brain, and this is the only way I know how.

=====================
Readernaut Public API
=====================
1.0 (pre-release)
=================
Reader Books
------------
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
RELATIONSHIP_CACHE = 60*60*24*7
RELATIONSHIP_CACHE_KEYS = {
'FRIENDS': 'friends',
'FOLLOWERS': 'followers',
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
# Based off of the script from here:
# http://coffee.geek.nz/how-change-author-git.html
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "joern.zaefferer@googlemail.com" ];
then
GIT_AUTHOR_EMAIL="joern.zaefferer@gmail.com";
GIT_COMMITTER_EMAIL="joern.zaefferer@gmail.com";
git commit-tree "$@";
@bryanveloso
bryanveloso / update_git.sh
Created September 21, 2009 23:44
Scripts I use to keep my huge load of local repositories updated.
#!/bin/bash
for dir in ~/Repositories/Git/*
do
(cd $dir && git pull)
done
"""
Some simple utilities to read the magic bytes from the beginning of a
file and determine whether the file meets certain criteria (e.g., contains
JPEG image data).
"""
import array
from operator import eq
IMAGE_MAGIC_DATA = (
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
import re
register = template.Library()
# (?:\A|[\s\.,:;'"])(@(\w{1,20}))(?!\.?\w)
twitterize_pattern = r'''