Skip to content

Instantly share code, notes, and snippets.

View jbittel's full-sized avatar

Jason Bittel jbittel

  • Airship
  • Portland, OR
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jbittel on github.
  • I am envfriction (https://keybase.io/envfriction) on keybase.
  • I have a public key ASC3Z4f_h5HUQRKRJ5YdScPa6tmbd2yoCKFrodUX1-fQUwo

To claim this, I am signing this object:

map $remote_addr $proxy_remote_user {
default '';
192.168.0.1 'username';
}
server {
location / {
if ($proxy_remote_user) {
proxy_set_header X-Proxy-Remote-User $proxy_remote_user;
}
@jbittel
jbittel / backends.py
Created March 17, 2013 14:14
A Django case-insensitive model backend. Copied (and slightly modified) from this snippet: http://djangosnippets.org/snippets/1368/
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
class CaseInsensitiveModelBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
user = User.objects.get(username__iexact=username)
if user.check_password(password):
return user
#!/bin/bash
# This hook is sourced after every virtualenv is activated.
PROJECT_DIR="$HOME/code/$(basename $VIRTUAL_ENV)"
if [ -d $PROJECT_DIR ]; then
# If we aren't already within the project dir, cd into it
if [[ ! `pwd` == "$PROJECT_DIR*" ]]; then
export PRE_VENV_ACTIVATE_DIR=`pwd`
cd "$PROJECT_DIR"
fi
@jbittel
jbittel / index.html
Created December 14, 2012 04:23 — forked from esjay/index.html
<button id="lever">Pull!</button>
<div id="outcome"></div>
<button id="test">Distribution</button>
<div><table>
<thead>
<th>Symbols</th>
<th>Chance</th>
<th>Result</th>
<th>Variance</th>
</thead>