This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AbstractMixin(object): | |
_classcache = {} | |
@classmethod | |
def contribute(cls): | |
return {} | |
@classmethod | |
def construct(cls, *args, **kwargs): | |
attrs = cls.contribute(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To run do: | |
# wget https://gist.github.com/raw/850359/ea02e22f021b7ebf2f602811461677ab4a3f2a9e/bootstrap.sh && chmod +x bootstrap.sh && ./bootstrap.sh && source ~/.profile | |
# | |
# Based on Amazon EC2 AMI ID ami-ccf405a5 Ubuntu Server 10.10 | |
# This script will: | |
# * install/config apache2 | |
# * install mod_wsgi | |
# * install/config nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.template import Context, loader | |
from django.core.mail import send_mail | |
def send_template_mail(slug, context, recipient_list, from_email=settings.DEFAULT_FROM_EMAIL): | |
if isinstance(recipient_list, basestring): | |
recipient_list = [recipient_list] | |
if not isinstance(context, Context): | |
context = Context(context) | |
subject_tmpl = loader.get_template('mail/%s/subject.txt' % (slug,)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
s=$(/usr/bin/dropbox status) | |
case "$s" in | |
"Dropbox isn"*) | |
echo '💣' | |
;; | |
Idle*) | |
echo '💤' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: python | |
python: | |
- "2.6" | |
- "2.7" | |
env: | |
- DJANGO=1.2.7 SUITE=tests | |
- DJANGO=1.3.1 SUITE=tests | |
- DJANGO=1.4 SUITE=tests | |
- DJANGO=1.4 SUITE=lint | |
install: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finding and creating models | |
// =========================== | |
// | |
// We might need to get a reference to a model from anywhere in our code | |
// and we want to make sure that these references all point to the same model. | |
// Otherwise updates to one copy of the model won't affect another. | |
// | |
// The methods here let you get models through a wrapper that will either | |
// create the model if it doesn't exist anywhere, or return a reference to | |
// the existing model. E.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create ramdisk: | |
sudo mkdir <foo> | |
Add to /etc/fstab: | |
tmpfs <foo> tmpfs size=4G,mode=1700,uid=114,gid=125 0 1 | |
Mount the ramdisk: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# brew install rtmpdump | |
print ' && '.join(['rtmpdump -r "rtmp://streamcloud.klewel.com/cfx/st/v0/djangocon-2012-flash-%d.flv" -o djangocon-2012-flash-%d.flv' % (i, i) for i in xrange(1, 45 + 1)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DJ Ango, yo! | |
http://railsenvy.com/2007/9/10/ruby-on-rails-vs-django-commercial-7 | |
The Whistles | |
[now broken] http://www.youtube.com/watch?v=ccgXjA2BLEY | |
http://www.youtube.com/watch?gl=US&hl=en&client=mv-google&v=Nnzw_i4YmKk | |
Do it live! | |
http://www.youtube.com/watch?v=2tJjNVVwRCY | |
REMIX: http://www.youtube.com/watch?v=5j2YDq6FkVE&NR=1 |
OlderNewer