Skip to content

Instantly share code, notes, and snippets.

View klizhentas's full-sized avatar
Be kind

Alexander Klizhentas klizhentas

Be kind
View GitHub Profile
@klizhentas
klizhentas / main.go
Created May 11, 2014 04:33
Benchmark path router
package main
import (
"bytes"
"fmt"
. "github.com/mailgun/vulcan/location"
. "github.com/mailgun/vulcan/netutils"
. "github.com/mailgun/vulcan/request"
. "github.com/mailgun/vulcan/route/pathroute"
"io"
@klizhentas
klizhentas / parser.py
Created May 7, 2014 00:37
Bind XML statistics parser
import sys
import time
import requests
import argparse
from datetime import datetime
from lxml import etree
parser = argparse.ArgumentParser()
// simplest api possible
http('http://localhost:5000', 'http://localhost:5001')
// same but using discovery service
http(etcd('upstreams/.*'))
// adding tls
http({
tls: filesystem('/home/certificates/*.cert'),
port: 443,
<!--
MDMN88N
ODMMDNDNMNN
M8DMNNMMMNNN
M7DMID8ZOMNMN
N8??NODIN7MNIZ?N
Z~==?I7$O78D7NDZ8M8NM
O~+II77?7??8D8OOO8DD8D8N$MOI$=N
:~8D$~~?7Z$7DZZ8DDDNN888N8N88I~$$+~+N
M~DD8ZZ8Z$77I$ODNNNNNNN8D8MNN8++?$I?7D8OO+
@klizhentas
klizhentas / gist:7388993
Created November 9, 2013 19:39
Data loss
DEBUG:mgcore.transports.http:SASHA: debug: Traceback (most recent call last):
File "/home/mg/mgcore-py/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/internet/endpoints.py", line 124, in connectionLost
return self._wrappedProtocol.connectionLost(reason)
File "/home/mg/mgcore-py/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/_newclient.py", line 908, in dispatcher
return func(*args, **kwargs)
File "/home/mg/mgcore-py/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/_newclient.py", line 1574, in _connectionLost_WAITING
self._disconnectParser(reason)
File "/home/mg/mgcore-py/lib/python2.7/site-packages/Twisted-13.1.0-py2.7-linux-x86_64.egg/twisted/web/_newclient.py", line 1496, in _disconnectParser
parser.connectionLost(reason)
--- <exception caught here> ---
from mailgun/base:latest
ENV REDIS_VERSION 2.6.13
run wget http://redis.googlecode.com/files/redis-$REDIS_VERSION.tar.gz -O /opt/redis-$REDIS_VERSION.tar.gz
run cd /opt && tar -xzvf /opt/redis-$REDIS_VERSION.tar.gz
run cd /opt/redis-$REDIS_VERSION && make
run mv /opt/redis-$REDIS_VERSION /opt/redis
run mkdir -p /var/log/redis/ /var/run/redis/ /var/lib/redis/
ADD ./conf /opt/redis
from mailgun/erlbase:latest
ENV DEBIAN_FRONTEND noninteractive
ENV RIAK_VERSION 1.4.1
ENV RIAK_MAJOR_VERSION 1.4
ENV PATH /usr/local/lib/erlang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
run apt-get -y -q install libc6-dev-i386
run wget http://s3.amazonaws.com/downloads.basho.com/riak/$RIAK_MAJOR_VERSION/$RIAK_VERSION/riak-$RIAK_VERSION.tar.gz -O /tmp/riak-$RIAK_VERSION.tar.gz
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
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
@klizhentas
klizhentas / mongo
Created October 25, 2013 20:51
Mongo
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