Skip to content

Instantly share code, notes, and snippets.

View robertlagrant's full-sized avatar

Robert Grant robertlagrant

  • Oxford Nanopore Technologies
  • Oxford
View GitHub Profile
@jterrace
jterrace / gist:1823320
Created February 14, 2012 03:42
Automatically log in user after django-registration activation
from registration.signals import user_activated
from django.contrib.auth import login, authenticate
def login_on_activation(sender, user, request, **kwargs):
"""Logs in the user after activation"""
user.backend = 'django.contrib.auth.backends.ModelBackend'
login(request, user)
# Registers the function with the django-registration user_activated signal
user_activated.connect(login_on_activation)
@poke
poke / mailserver.py
Last active May 15, 2018 10:07
Simple debug mail server
#!/usr/bin/env python3
import argparse
import asyncore
import email.header
import email.parser
import smtpd
def decodeHeader (value):
return email.header.make_header(email.header.decode_header(value))