I hereby claim:
- I am drawks on github.
- I am drawks (https://keybase.io/drawks) on keybase.
- I have a public key ASD1ZCq0zxgk8MCOBCX9Cnk3-mBp5w2cnF-9s7q3ufTzxwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from bottle import route, run, template, Bottle | |
from prometheus_client import multiprocess | |
from prometheus_client import generate_latest, REGISTRY, Gauge, Counter | |
application = Bottle() | |
IN_PROGRESS = Gauge("inprogress_requests", "help") | |
REQUESTS = Counter('http_requests_total', 'Description of counter', ['method', 'endpoint']) | |
class CoerceDateTime(TypeDecorator): | |
"""Extend DateTime to also coerce iso formatted datetime strings and epoch | |
ints in addition to native python datetimes""" | |
impl = DateTime | |
def process_bind_param(self, value, dialect): | |
if isinstance(value, str): | |
try: | |
value = iso8601.parse_date(value) |
"borders": { | |
"mississippi": [ | |
"alabama", | |
"arkansas", | |
"louisiana", | |
"tennessee" | |
], | |
"oklahoma": [ | |
"arkansas", | |
"colorado", |
#!/usr/bin/env python | |
import msgpack, socket, time, pickle, struct | |
from random import shuffle | |
words = [ word.strip() for word in open('/tmp/word.lst','rt').readlines() ] | |
def metric_name(): | |
while True: | |
shuffle(words) | |
yield ".".join(words[0:3]) |
#This is the "site config" for nginx | |
upstream django { | |
# Distribute requests to servers based on client IP. This keeps load | |
# balancing fair but consistent per-client. In this instance we're | |
# only using one uWGSI worker anyway. | |
ip_hash; | |
server unix:/tmp/uwsgi.sock; | |
} | |
server { |
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d ' | |
{ | |
"template": "logstash-*", | |
"mappings": { | |
"_default_": { | |
"_all" : {"enabled" : false} | |
} | |
} | |
}' |
curl -XPOST 'http://localhost:9200/logstash-2001.01.01/_optimize?max_num_segments=2' |
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d ' | |
{ | |
"template": "logstash-*", | |
"mappings": { | |
"_default_": { | |
"_source": { "compress": "true" }, | |
} | |
} | |
}' |