Skip to content

Instantly share code, notes, and snippets.

View bcarl's full-sized avatar

Brandon Carl bcarl

View GitHub Profile
@bcarl
bcarl / backends.py
Created July 6, 2012 06:08
Django Email as Username Authentication Backend
from django.contrib.auth.models import User, check_password
class LoginUsingEmailAsUsernameBackend(object):
"""
Custom Authentication backend that supports using an e-mail address
to login instead of a username.
See: http://blog.cingusoft.org/custom-django-authentication-backend
"""
supports_object_permissions = False
@bcarl
bcarl / main.py
Last active December 10, 2015 20:39
#!/usr/bin/env python
"""
Another fun python variable manipulation question is: given an int, write a one
liner that returns the string representation of the int, but with a comma every
three decimal places starting from the right. (i.e., 1 return "1", and 1000
returns "1,000")
(Rules: the one line cannot use anything that has to be imported, and cannot use
any string formatting)
@bcarl
bcarl / autograder.py
Created June 10, 2012 14:19 — forked from bulatb/autograder.py
Autograder submission bot for CSE 120
#!/software/common/python-2.7/bin/python2.7
# ^ /software is where ieng6 keeps the nice things we can't have
import os
import time
import subprocess
from optparse import OptionParser

Keybase proof

I hereby claim:

  • I am bcarl on github.
  • I am bcarl (https://keybase.io/bcarl) on keybase.
  • I have a public key whose fingerprint is 9F77 306B C9E6 297D 34E7 2A7A 5C2C F74C D843 9578

To claim this, I am signing this object: