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
$ find -name "*.html" | xargs sed -i "s/{{ STATIC_URL }}\([^\"]\+\)/{% static '\1' %}/g" |
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
""" | |
jQuery templates use constructs like: | |
{{if condition}} print something{{/if}} | |
This, of course, completely screws up Django templates, | |
because Django thinks {{ and }} mean something. | |
Wrap {% verbatim %} and {% endverbatim %} around those | |
blocks of jQuery templates and this will try its best |
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
import re | |
import simplejson | |
from django.http import HttpResponse | |
from django.conf import settings | |
class JSONResponse(HttpResponse): | |
def __init__(self, request, data): | |
indent = 2 if settings.DEBUG else None |
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
""" Usage: python grid.py > grid.css """ | |
MAX = 960 | |
COL = 10 | |
rules = [] | |
rules.append(".column { float: left; min-height: 1px; }") | |
for x in range(COL, MAX + COL, COL): | |
rules.append(".column-%s { width: %spx; }" % (x, x)) |
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 functools import wraps | |
from json import dumps | |
from django.http import HttpResponse | |
def json_view(view_func): | |
@wraps(view_func) | |
def inner(request, *args, **kwargs): | |
response = view_func(request, *args, **kwargs) | |
if request.GET.get("format") == "json" and hasattr(response, "context_data"): |
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
find /my/directory/ -type d -exec chmod 755 {} \; |
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
UTF8 := $(shell locale -c LC_CTYPE -k | grep -q charmap.*UTF-8 && echo -utf8) | |
SERIAL=0 | |
.PHONY: usage | |
.SUFFIXES: .key .csr .crt .pem | |
.PRECIOUS: %.key %.csr %.crt %.pem | |
usage: | |
@echo "This makefile allows you to create:" | |
@echo " o public/private key pairs" |
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
pip install https://vnvault.trustcommerce.com/downloads/tclink-3.4.4-python.tar.gz | |
Docs: | |
https://vnvault.trustcommerce.com/downloads/TC_Developers_Guide_v4.0.pdf |
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
#! /bin/bash | |
# /etc/init.d/uwsgi | |
# | |
daemon=/path/to/uwsgi | |
pid=/path/to/uwsgi.pid | |
args="-x /path/to/uwsgi.xml" | |
# Carry out specific functions when asked to by the system | |
case "$1" in |
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
# http://distributedaweso.me/past/2011/5/4/pip_workaround_for_no_ppc_support_in_xcode4/ | |
ARCHFLAGS="-arch i386 -arch x86_64" pip install fabric | |