Skip to content

Instantly share code, notes, and snippets.

View bartek's full-sized avatar
🐗

Bartek Ciszkowski bartek

🐗
View GitHub Profile
# This configuration assumes you are running some kind of PHP FastCGI daemon to send for processing.
# I've commented parts of the file for clarity if someone does not understand what's going on.
# Here we simply rewrite the `www` out of the domain name because it's useless in most cases.
# Totally optional.
server {
listen 80;
server_name www.example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}
# Place this in its own file and add it to your `AUTHENTICATION_BACKENDS` setting in settings.py
from django.conf import settings
from django.contrib.auth.models import User
class EmailModelBackend(object):
def authenticate(self, username=None, password=None):
kwargs = {'email': username}
try:
server {
2 listen 98.129.237.54:80;
3 server_name www.mysite.com;
4 rewrite ^/(.*) http://mysite.com/$1 permanent;
5 }
6
7 server {
8 listen 98.129.237.54:80;
9 server_name mysite.com;
10
# section1.1.7 from SICP written in python .. was just making sure I understood how it all worked.
def square(x):
return x * x
def sqrt_iter(guess, x):
if good_enough(guess, x):
return guess
else:
return sqrt_iter(improve(guess, x), x)