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 time import time | |
from logging.config import fileConfig | |
from twisted.internet import epollreactor | |
epollreactor.install() | |
from flask import Flask, request | |
app = Flask(__name__) | |
fileConfig("logging.ini") |
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 time import time | |
from logging.config import fileConfig | |
from twisted.internet import epollreactor | |
epollreactor.install() | |
from flask import Flask, request | |
app = Flask(__name__) | |
fileConfig("logging.ini") |
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
# http://notmysock.org/blog/hacks/a-twisted-dns-story.html | |
# http://blog.inneoin.org/2009/11/i-used-twisted-to-create-dns-server.html | |
# twistd -y dns.py | |
import socket | |
from twisted.internet import reactor | |
from twisted.names import dns | |
from twisted.names import client, server | |
from twisted.web.server import Site | |
import klein |
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 operator import attrgetter, itemgetter | |
from itertools import groupby, chain | |
from random import shuffle | |
from twisted.names.client import Resolver | |
from twisted.internet import defer | |
from twisted.python import log | |
def init(config): | |
R.resolver = Resolver(resolv='/etc/resolv.conf') |
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
CREATE TABLE hits ( | |
hit text PRIMARY KEY, | |
counter counter | |
) WITH COMPACT STORAGE; | |
UPDATE hits USING TTL 3600 SET counter = counter + 1 WHERE hit='api-call-some-hour'; |
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
:cluster_name => "Mailgun Tanks", | |
:initial_token => "", | |
:version => '1.2.5', | |
:user => "cassandra", | |
:jvm => { | |
:xms => 32, | |
:xmx => 512 | |
}, | |
:limits => { | |
:memlock => 'unlimited', |
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
"""Aggregates events in batches and flushes them after max batch size | |
have been achieved or certain amount of seconds has passed | |
""" | |
import logging | |
from threading import Lock | |
from datetime import datetime | |
log = logging.getLogger(__name__) | |
FLUSH_SECONDS = 3 |
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 mailgun/base:latest | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV MONGO_VERSION 2.4.5 | |
ENV MONGO_PLATFORM linux-x86_64 | |
ENV MONGO_DISTRO linux-x86_64-2.4.5 | |
ENV MONGO_PORT 27016 | |
ENV MONGO_DBPATH /var/mongodb | |
run wget http://fastdl.mongodb.org/linux/mongodb-$MONGO_DISTRO.tgz |
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 mailgun/base:latest | |
ENV DEBIAN_FRONTEND noninteractive | |
run apt-get install -y postgresql-9.1 postgresql-contrib-9.1 | |
add . /src | |
run cp /src/*.conf /etc/postgresql/9.1/main/ | |
run su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" < /src/psql-init.sql | |
run su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single mg_dev -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" < /src/create-extension.sql | |
run su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single mg_test -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" < /src/create-extension.sql |
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 ubuntu:12.04 | |
ENV DEBIAN_FRONTEND noninteractive | |
run apt-get -y install aptitude curl emacs wget net-tools less | |
# install Java 6 | |
run wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin | |
run chmod u+x jdk-6u45-linux-x64.bin | |
run ./jdk-6u45-linux-x64.bin | |
run mv jdk1.6.0_45 /opt |
OlderNewer