Skip to content

Instantly share code, notes, and snippets.

View jezdez's full-sized avatar
🚴
💨

Jannis Leidel jezdez

🚴
💨
View GitHub Profile
@jezdez
jezdez / gist:278358
Created January 15, 2010 19:54 — forked from yashh/gist:278347
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=info ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@jezdez
jezdez / fabfile.py
Created January 24, 2010 12:47 — forked from heckj/fabfile.py
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
# ================================================================
# NOTE:
# using this fabfile expects that you have the python utility
# fabric installed locally, ssh access to reamea.com, and your
# ssh public key associated with the account '[email protected]'
@jezdez
jezdez / howto.txt
Created February 12, 2010 01:33 — forked from simonw/howto.txt
Save the supervisord.initscript script as /etc/init.d/supervisord
Run /usr/sbin/update-rc.d -f supervisord defaults
@jezdez
jezdez / gist:314471
Created February 25, 2010 11:35 — forked from mmalone/gist:299905
"Memcached cache backend"
from django.core.cache.backends import memcached
from django.utils.encoding import smart_unicode, smart_str
MIN_COMPRESS_LEN = 150000
class CacheClass(memcached.CacheClass):
def add(self, key, value, timeout=None, min_compress_len=MIN_COMPRESS_LEN):
if isinstance(value, unicode):
The goal of Summer of Code is to get your project written, reviewed, and
ultimately merged back into Django's trunk. We want your project to
succeed, and we approved it because we think you've got a good chance of
pulling it off.
However, this is easier said than done. You'll need to work hard,
communicate effectively with the community, and pass a rigorous peer
review. Your mentor -- and Django's committer team in general -- will give
you as much support as possible, but ultimately the onus is on your
shoulders to get this done.

How django_compressor {% compress %} works behind the scenes

This document assumes you already have an up and running instance of django_compressor, and that you understand how to use it in your templates. The goal is to explain what the main template tag, {% compress %}, does behind the scenes, to help you debug performance problems for instance.

First step: Offline cache

@jezdez
jezdez / ps1.bash
Created May 30, 2011 12:18 — forked from zain/ps1.bash
PS1 that looks smexy (with added hg support)
#### PS1 customization ####
NONE="\[\033[0m\]" # unsets color to term fg color
# regular colors
K="\[\033[0;30m\]" # black
R="\[\033[0;31m\]" # red
G="\[\033[0;32m\]" # green
Y="\[\033[0;33m\]" # yellow
B="\[\033[0;34m\]" # blue
M="\[\033[0;35m\]" # magenta
@jezdez
jezdez / __init__.py
Created July 13, 2012 07:23 — forked from aliles/__init__.py
PEP 302 import hook to reload modules on changes
# apkg/__init__.py
# Empty. Nothing to see here.
@jezdez
jezdez / common [stash] fields.py
Created December 1, 2012 15:07 — forked from thomasyip/common [stash] fields.py
Updated version of Django BigInt Patch for 64bit Primary Keys
"""
module mydjangolib.bigint_patch
A fix for the rather well-known ticket #399 in the django project.
Create and link to auto-incrementing primary keys of type bigint without
having to reload the model instance after saving it to get the ID set in
the instance.
Logs:
  1. The code will get better. Linus' Law: "given enough eyeballs, all bugs are shallow": we'll be able to get community contributions and bug reports, and thus the code will grow better faster than we can grow it ourselves. Also, Joy's Law - "No matter who you are, most of the smartest people work for someone else": we'll get better code from people who don't work for us than from people who do.

  2. We'll write better code. Wall's 3rd great virtual of a programmer, Hubris: we'll write better code people we don't want other people to say bad things about us. We'll do better with the world watching than with just us.

  3. Increased ability to hire. We're a 19k circ newspaper in a town most people have never heard of. Open source will help put us on the map, make us a place people actually might be interested in working.

  4. When we do hire, we'll be able to hire pe