This file contains 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.core.files.storage import FileSystemStorage | |
from slimit import minify | |
class StaticFileStorageAndJSMinifier(FileSystemStorage): | |
""" | |
A storage backend to be used by the staticfiles app -- STATICFILES_STORAGE | |
setting. This backend operates just as a normal filesystem storage backend | |
except when it detects a javascript file. | |
After a javascript file is saved, we reopen the file, minify the contents |
This file contains 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 import forms | |
from django.forms.fields import MultiValueField | |
import pytz | |
# provided by django-timezone-field==0.4 | |
from timezone_field import TimeZoneFormField | |
class DatetimeTZWidget(forms.MultiWidget): |
This file contains 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 os, argparse, hashlib | |
from datetime import datetime | |
from PIL import Image, ExifTags | |
from shutil import move | |
def modification_date(filename): | |
t = os.path.getmtime(filename) | |
return datetime.fromtimestamp(t) | |
def md5_for_file(f, block_size=2**20): |
This file contains 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
include: | |
- requirements | |
nodejs: | |
pkg.installed | |
statsd: | |
git.latest: | |
- name: https://github.com/etsy/statsd.git | |
- rev: v0.7.0 |
This file contains 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
# bashrc | |
. ~/.newtab.sh | |
tssh() { ssh `aws_name_to_ip $1` | sed -n "${2:-1}p"; } | |
aws_name_to_ip() { | |
if [ -z "$VIRTUAL_ENV" ]; then | |
workon aws; | |
fi | |
aws ec2 describe-instances --filters "Name=tag-value,Values=$1" --output text --query 'Reservations[*].Instances[*].PrivateIpAddress' | sort; | |
} |
This file contains 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 json | |
import requests | |
import gdata.photos.service | |
GOOGLE_ALBUM_ID = 0 | |
GOOGLE_EMAIL = "you@gmail.com" | |
GOOGLE_PASSWORD = "hunter42" | |
FB_ACCESS_TOKEN = "" |
This file contains 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
exiftool '-Directory<DateTimeOriginal' -d %Y-%m-%d dir |
This file contains 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
# syslog-ng.conf | |
@version: 3.12 | |
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no); | |
owner("root"); group("adm"); perm(0640); stats_freq(0); | |
bad_hostname("^gconfd$"); | |
}; | |
source s_src { | |
network( |
This file contains 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
def pytest_collection_modifyitems(session, config, items): | |
"""Reorder the execution of tests based on the dependency marks on tests. | |
To setup a test dependency, decorate the test function with the "depends" | |
mark and give a list of dependencies via the "on" keyword arg to the | |
decorator. Dependencies can be specified by name only when in the same | |
file as the test being decorated, or by pytest node path for tests in | |
other files/classes. | |
@pytest.mark.depends(on=["test_in_same_file", |
OlderNewer