Skip to content

Instantly share code, notes, and snippets.

View tylertreat's full-sized avatar

Tyler Treat tylertreat

View GitHub Profile
@tylertreat
tylertreat / Dockerfile
Created February 6, 2014 05:47
Docker container for a Python WSGI application.
# Container for a Python WSGI application.
FROM ubuntu:12.04
MAINTAINER Tyler Treat <tyler.treat@webfilings.com>
RUN apt-get update
# Install Python tools
RUN apt-get install -y python python-dev python-distribute python-pip
package main
import (
"fmt"
"sync"
"time"
)
const maxThread = 16
package main
import (
"fmt"
"strconv"
"time"
"github.com/gdamore/mangos"
"github.com/gdamore/mangos/protocol/pub"
"github.com/gdamore/mangos/protocol/sub"
package main
import (
"fmt"
"log"
"os"
"github.com/Shopify/sarama"
)
package nsq
import (
"github.com/bitly/go-nsq"
"github.com/tylertreat/Flotilla/flotilla-server/daemon/broker"
)
const topic = "test"
type NSQPeer struct {
func start(host string) {
pub := NewNSQPeer(host)
for i := 0; i < 1000; i++ {
message := getMessage()
pub.Send(message)
}
pub.Teardown()
}
$ iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
$ iptables -A OUTPUT -m statistic --mode random --probability 0.1 -j DROP
$ tc qdisc add dev eth0 root netem delay 250ms loss 10% rate 1mbps
$ ipfw add 1 pipe 1 ip from me to any
$ ipfw add 2 pipe 1 ip from any to me
$ ipfw pipe 1 config delay 500ms bw 1Mbit/s plr 0.1
$ tc qdisc add dev eth0 root netem delay 50ms 20ms