Skip to content

Instantly share code, notes, and snippets.

Building Altair

Bryan Veloso bryanveloso

Building Altair
View GitHub Profile
bryanveloso /
Created Aug 7, 2008
A few examples of __dict__. Thanks Eric!
# Let's create a dummy class
>>> class ABC(object):
... pass
# Let's see if it works for the class
>>> ABC.__dict__
<dictproxy object at 0x2b83b7887750>
>>> dict(ABC.__dict__)
{'__dict__': <attribute '__dict__' of 'ABC' objects>, '__module__': '__main__', '__weakref__': <attribute '__weakref__' of 'ABC' objects>, '__doc__': None}
bryanveloso / gist:7329
Created Aug 26, 2008
Adds "Ubuntu-like" coloring to the Mac Terminal.
View gist:7329
# Add color to the Terminal
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=gxgxcxdxbxegedabagacad # cyan directories
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
#!/usr/bin/env python
# encoding: utf-8
import demjson
from pprint import pprint
import urllib2
def main():
user = "jeremybanks"
userJSON = urllib2.urlopen("" % user).read()
user = demjson.decode(userJSON)["user"]
bryanveloso / cashpoints.sql
Created Aug 31, 2008
Selects the number of cash points or kafra points an account has.
View cashpoints.sql
SELECT SUM(CAST(`value`/100 AS DECIMAL(7,2))) FROM `global_reg_value` WHERE (`str` LIKE '#CASHPOINTS' || `str` LIKE '#KAFRAPOINTS') AND `type` = '2' AND `account_id` = 'THEIR_ACCOUNT_ID';
from mimetypes import guess_type
from django.core.exceptions import ImproperlyConfigured
from import Storage
from django.utils.encoding import iri_to_uri
import re
import S3
except ImportError:
raise ImproperlyConfigured, "Could not load amazon's S3 bindings.\
View gist:179447
<!DOCTYPE html>
<title>Standard Blog</title>
<h1><a href="#">Standard Blog</a></h1>
View gist:182473
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'''
View gist:182474
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
bryanveloso /
Created Sep 21, 2009
Scripts I use to keep my huge load of local repositories updated.
for dir in ~/Repositories/Git/*
(cd $dir && git pull)