Skip to content

Instantly share code, notes, and snippets.

View zellyn's full-sized avatar

Zellyn Hunter zellyn

View GitHub Profile
* Uncompiled Python code is over 2317 times faster than
uncompiled Java or C
* Guido van Rossum invented whitespace
* There are over 350 million Python programmers in the
continental United States
* Python use has been outlawed repeatedly by Kim Jong il, but an
underground movement thrives in North Korea
@zellyn
zellyn / *scratch*
Created March 8, 2010 19:35
vi(m) flags
set sts=4
set ts=4
set sw=4
set et
vagrant@vagrantbase:~$ sudo apt-get -q -y install apache2=2.2.8-1ubuntu0.14
sudo apt-get -q -y install apache2=2.2.8-1ubuntu0.14
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1
libaprutil1 libexpat1 libmagic1 libpcre3 libpq5
Suggested packages:
apache2-doc www-browser file
(tmp)datl9wzhunter:~ zhunter$ pip install psycopg2
Downloading/unpacking psycopg2
Running setup.py egg_info for package psycopg2
Warning: Unable to find 'pg_config' filereading manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: no files found matching 'TODO' under directory 'doc'
no previously-included directories found matching 'doc/src/_build'
Installing collected packages: psycopg2
Running setup.py install for psycopg2
Warning: Unable to find 'pg_config' filebuilding 'psycopg2._psycopg' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.0.14 (dt dec ext pq3)" -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -I. -c psycopg/psycopgmodule.c
@zellyn
zellyn / cmgd.org
Created March 19, 2010 18:19
Starbucks Card Balance

wget -q –no-check-certificate -O - https://www.starbucks.com/card/manage/check-your-balance –post-data=”Card.Number=$CARD_NUMBER&Card.Pin=$CARD_PIN” –header=’X-Requested-With:XMLHttpRequest’ | sed -n ‘s|.*<span class=”fetch_balance_value”>\(.*\)</span>|\1|p’

@zellyn
zellyn / MANIFEST.in
Created March 31, 2010 18:14
“Fake” python packages for media
recursive-include media *
@zellyn
zellyn / vagrant.org
Created April 3, 2010 18:25
Setting up a CentOS 5.4 base box for Vagrant
#!/usr/bin/env python
from distutils.core import setup
setup(name='zjh_appa',
version='1.0',
description='Test Application A',
author='Zellyn Hunter',
author_email='zellyn@gmail.com',
url='http://www.zellyn.com/example/appA/',
class SpecialOpenIDAuth(OpenIDAuth):
def authenticate(self, identity=None):
user = super(SpecialOpenIDAuth, self).authenticate(identity)
if user and is_staff_openid_provider(identity):
user.is_staff = True
user.save()
return user
@zellyn
zellyn / init.el
Created June 10, 2010 14:34
Read environment vars into emacs
(let* ((env-output (shell-command-to-string "source .bashrc ; source .emacs.d/emacsenv.sh"))
(lines (split-string env-output "[\r\n]+" t))
(regex "^\\([^ ]+\\) \\(.*\\)$")
(pairs (mapcar (lambda (line)
(if (string-match regex line)
(list (match-string 1 line) (match-string 2 line))))
lines)))
(mapc (lambda (pair) (apply 'setenv pair)) pairs))