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
for conf in $(find /etc/circus/enabled/ -name *.ini); do \ | |
circusd $$conf --daemon; \ | |
done |
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 | |
""" | |
jinja2 | |
====== | |
A CLI interface to jinja2. | |
$ jinja helloworld.tmpl data.json --format=json | |
$ cat data.json | jinja helloworld.tmpl | |
$ curl -s http://httpbin.org/ip | jinja helloip.tmpl | |
$ curl -s http://httpbin.org/ip | jinja helloip.tmpl > helloip.html |
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
location /xml { | |
rewrite ^/xml/(.*)$ /$1; | |
proxy_pass http://xml.test.com; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_max_temp_file_size 0; |
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
# Thwart off some spam bots by giving them a cup of tea | |
if ($host = '') { return 418; } |
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 | |
BRANCHES=( master kovu ) | |
PACKAGES=( src activity proxy ) | |
for branch in ${BRANCHES[@]}; do | |
for package in ${PACKAGES[@]}; do | |
BUILDS=( $(repoman show drund | grep drund-$package-$branch-r | sort -r) ) | |
for build in ${BUILDS[@]:10}; do | |
repoman rm drund $build | |
done |
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
# Location of main build file for require.js | |
JS_BUILD_FILE = kovu.build.js | |
# List of all drund apps for determining migrations | |
MIGRATE_APPS = \ | |
account \ | |
app.connections \ | |
app.filebrowser \ | |
app.reader \ | |
app.tv \ |
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
foo = map(lambda s: { | |
# lol my lambda's body is indented | |
s = s.upper() | |
print s | |
return s | |
}, ['does', 'the', 'lambda', 'implicitly', 'end', 'after', 'toplevel', 'returns?']) |
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 __future__ import with_statement | |
import factory | |
from functools import wraps | |
class override_strategy(object): | |
def __init__(self, strategy): | |
self.strategy = strategy |
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
# Data set is a large SQL dump. Most lines are around 1MB. | |
# When the chunk size is at a smaller (default) chunk size, CPU jumps ridiculously high. | |
# If the chunk size is even smaller, there is obviously more CPU consumed as a high rate. | |
# When setting the chunk size of 0.5MB or even 1MB, it is smoothed out to a realistic usage. | |
# The obvious bottleneck is around testing each chunk with "splitlines()" | |
import requests | |
res = requests.get('https://s3.amazonaws.com/littlesis/public-data/littlesis-data.sql', prefetch=False) | |
bytes_total = int(res.headers['content-length']) |
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
class foo(object): | |
a = 'b!' | |
b = 'b!' | |
def keys(self): | |
return ['a', 'b'] | |
def __getitem__(self, item): | |
return getattr(self, item) |