Skip to content

Instantly share code, notes, and snippets.

"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} means something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@offmessage
offmessage / copydatabase.sh
Created February 9, 2012 11:56
Copy a postgres database on the same machine
# old database must be idle (no held open connections or write transactions)
sudo -u postgres createdb newdatabase -T olddatabase
@offmessage
offmessage / apache.cnf
Created February 9, 2012 11:55
Proxy traffic from old to new server to allow for smooth DNS transitions
# proxy traffic from original to new machine to allow for smooth DNS transfers
# Set new-www.therealserver.com up in /etc/hosts on the original machine
<VirtualHost *:80>
ServerName www.therealservername.com
RewriteEngine On
RewriteRule ^(.*)$ http://new-www.therealservername.com$1 [P,L]
ProxyPass / http://new-www.therealservername.com/
ProxyPreserveHost On
<Proxy *>
Allow from all
@offmessage
offmessage / emergency-www.yoursite.com
Created December 21, 2011 18:00
An apache config for a maintenance page
<VirtualHost *:80>
ServerName www.yoursite.com
ServerAdmin hosting@yourdomain.com
DocumentRoot /var/local/sites/www.yoursite.com/emergency
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteRule ^ - [L,R=503]
# Make sure index.html doesn't exist