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
handlers: | |
- url: /(.*\..+) | |
static_files: static/\1 | |
upload: static/(.*) | |
- url: /(.*) | |
static_files: static/\1/index.html | |
upload: static/(.*) |
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 socket | |
def random_port(): | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.bind(('127.0.0.1', 0)) | |
port = sock.getsockname()[1] | |
sock.close() | |
return port |
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
# Activate the virtualenv | |
source /opt/python/run/venv/bin/activate | |
# Then either: | |
django-admin.py shell --settings=MYAPP.settings | |
# or if you have a manage.py file in the top level directory of your app: | |
cd /opt/python/current/app | |
python manage.py shell |
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
# -*- coding: utf-8 -*- | |
MISSING_KEY_VALUE = None | |
def diff(d2, d1={}, missing=MISSING_KEY_VALUE): | |
for key, val in d2.items(): | |
if key not in d1: | |
yield key, (missing, val) |
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
#!/usr/bin/env python | |
from binascii import hexlify | |
import hashlib | |
# If a secure random number generator is unavailable, exit with an error. | |
try: | |
import Crypto.Random.random | |
secure_random = Crypto.Random.random.getrandbits | |
except ImportError: |
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
docker run $(etcdctl ls $ETCD_ENV | while read e; do etcdctl get $e > /dev/null 2>&1 && echo --env $(echo $e | rev | cut -d/ -f1 | rev)=$(etcdctl get $e); done) busybox env |
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
server { | |
listen 80 default_server deferred; | |
listen 443 default_server deferred ssl; | |
listen [::]:80 ipv6only=on default_server deferred; | |
listen [::]:443 ipv6only=on default_server deferred ssl; | |
server_name example.com www.example.com testing.example.com; | |
root /path/to/static/files | |
# Include SSL stuff |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import requests | |
import urlparse | |
import click | |
@click.command() | |
@click.argument('iam_role') | |
@click.option('--metadata-url', default='http://169.254.169.254/latest/meta-data/iam/security-credentials/') |
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 dockerfile/python | |
RUN pip install boto |
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 StringIO | |
import subprocess | |
import os | |
import time | |
from datetime import datetime | |
from PIL import Image | |
# Motion detection settings: | |
# Threshold (how much a pixel has to change by to be marked as "changed") | |
# Sensitivity (how many changed pixels before capturing an image) |