Skip to content

Instantly share code, notes, and snippets.

@Zearin
Zearin / python_decorator_guide.md
Last active June 28, 2024 13:59
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@cpdean
cpdean / apache.wsgi
Created June 27, 2013 23:38
wsgi apache setup with error logging and virtualenv
import sys
sys.stdout = sys.stderr
sys.path.insert(0,'/home/user/public/appname.example.com/public/appname')
activate_this = '/home/user/public/appname.example.com/public/appname/appvirtualenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from app import app as application
@koenbollen
koenbollen / punch.py
Created July 5, 2010 19:10
Proof of Concept: UDP Hole Punching
#!/usr/bin/env python
#
# Proof of Concept: UDP Hole Punching
# Two client connect to a server and get redirected to each other.
#
# This is the client.
#
# Koen Bollen <meneer koenbollen nl>
# 2010 GPL
#