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
| [uwsgi] | |
| socket = /tmp/example.com.sock | |
| ; Worker processes | |
| master = 1 | |
| processes = 4 | |
| ; Virtualenv and home directory | |
| virtualenv = /var/virtualenvs/example.com | |
| chdir = /var/www/example.com |
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=/usr/local/bin/uwsgi | |
| pid=/var/run/uwsgi.pid | |
| args="--master --emperor /etc/vassals/ --uid www-data --daemonize /var/log/uwsgi/uwsgi.log" | |
| case "$1" in | |
| start) | |
| echo "Starting uwsgi" |
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
| user www-data; | |
| worker_processes 1; | |
| error_log /var/log/nginx/error.log warn; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| } |
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 ast | |
| from django import template | |
| register = template.Library() | |
| class StripNode(template.Node): | |
| """ | |
| Strips leading and trailing characters in the enclosed content. |
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 dateutil import parser | |
| from dateutil.tz import gettz | |
| import csv | |
| import os | |
| import sys | |
| FORMAT = '%Y-%m-%d %H.%M.%SZ.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
| #!/usr/bin/env python | |
| from dateutil import parser | |
| from dateutil.tz import gettz | |
| import csv | |
| import os | |
| import sys | |
| FORMAT = '%Y-%m-%d %H.%M.%SZ.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
| local base_cmd="grep --exclude-dir=CACHE --exclude-dir=ckeditor --binary-files=without-match --colour -Enr" | |
| if [[ $# -eq 1 ]]; then | |
| eval "$base_cmd $1 *" | |
| elif [[ $# -gt 1 ]]; then | |
| eval "$base_cmd $@" | |
| else | |
| echo "usage: se SEARCH_STRING [FILE_PATTERN]" | |
| fi |
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
| """ | |
| Utilities for dynamically updating links in rich text fields. | |
| We had a project in which many models had rich text fields. These rich text | |
| fields contained links to model instance detail pages. Since these links were | |
| being entered by hand, we needed a way to update them in the event that the | |
| instance for the detail page they were pointing to changed. | |
| The routines in this file allow links in rich text content to be automatically | |
| updated with a python html parsing library called `BeautifulSoup`. |
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 sys | |
| import time | |
| from datetime import datetime, timedelta | |
| START_TIME = datetime(2013, 3, 23, 0, 0, 0, 0) | |
| TRIP_TIME = timedelta(minutes=8.7 * 60) | |
| END_TIME = START_TIME + TRIP_TIME | |
| BAR_WIDTH = 100 |
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 | |
| import itertools | |
| import sys | |
| from collections import defaultdict | |
| from pyparsing import CharsNotIn, Group, Optional, Word, ZeroOrMore, alphanums | |
| word = Word(alphanums) | |
| space = CharsNotIn(alphanums) | |
| doc = ZeroOrMore(Group(word + Optional(space))) |