NOTE: 534 stars, 106 forks. I love you all. Please contribute tips and edits back to this cheat sheet -- email's will.sargent@gmail.com and you can treat gists like git repositories and send git diffs.
Steps to install PIL
$ sudo apt-get install python-imaging
$ sudo apt-get install libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
$ pip install PIL
This file contains hidden or 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.db import connection | |
| from django.utils.log import getLogger | |
| logger = getLogger(__name__) | |
| class QueryCountDebugMiddleware(object): | |
| """ | |
| This middleware will log the number of queries run | |
| and the total time taken for each request (with a | |
| status code of 200). It does not currently support |
This file contains hidden or 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
| sudo aptitude -y install nginx | |
| cd /etc/nginx/sites-available | |
| sudo rm default | |
| sudo cat > jenkins | |
| upstream app_server { | |
| server 127.0.0.1:8080 fail_timeout=0; | |
| } | |
| server { | |
| listen 80; |
This file contains hidden or 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
| #!/usr/bin/python | |
| # | |
| # Author: Chris Reid | |
| # chris.reid@suite101.com | |
| # | |
| # Memcache monitoring plugin for server density | |
| # http://www.serverdensity.com/ | |
| # | |
| # Depends on python-memcached | |
| # http://www.tummy.com/Community/software/python-memcached/ |
This file contains hidden or 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
| #!/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 'mboza@reamea.com' |