Skip to content

Instantly share code, notes, and snippets.

@toddlers
toddlers / benchmark-commands.txt
Created October 30, 2016 08:33 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@toddlers
toddlers / stack.go
Created September 19, 2016 21:58 — forked from bemasher/stack.go
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}
@toddlers
toddlers / kafka
Created August 3, 2016 18:36 — forked from superscott/kafka
Simple Kafka Ubuntu init.d Startup Script
DAEMON_PATH=/opt/kafka/bin
DAEMON_NAME=kafka
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$DAEMON_PATH
# See how we were called.
case "$1" in
start)
@toddlers
toddlers / gist:ce3d9d78456985b779138a24f759658d
Created July 25, 2016 18:03
HAProxy Config with ACL for Load Balancing Multiple Named Virtual Hosts
# Config ideal for load balancing many back-end Virtual Hosts with a pair of load balancers (one is for fail-over).
# HAProxy's ACL is ideal for dedicating more resources to certain virtual hosts especially to handle traffic spikes.
# Reference:
# http://www.techrawr.com/2009/09/18/using-the-acl-in-haproxy-for-load-balancing-named-virtual-hosts
# Don't copy blindly, change to suit your needs; at a minimum:-
# change maxconn based on your back-end server(s) capabilities
# enable/disable cookie option - disable if you don't want sticky sessions
@toddlers
toddlers / iptableflip.sh
Created June 18, 2016 14:27 — forked from lewisd32/iptableflip.sh
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
@toddlers
toddlers / manipulate_qdisc.py
Created June 18, 2016 14:00 — forked from jolynch/manipulate_qdisc.py
Shows how to manipulate a plug qdisc manually using pyroute2
import pyroute2
from pyroute2 import IPRoute
from pyroute2.iproute import transform_handle
from pyroute2.netlink import NLM_F_ACK
from pyroute2.netlink import NLM_F_REQUEST
from pyroute2.netlink.rtnl.tcmsg import tcmsg
PLUG_CLASS = '1:4'
PLUG_QDISC = '40:'
@toddlers
toddlers / README.markdown
Created June 15, 2016 14:28 — forked from terlar/README.markdown
ArchLinux on Mac Book Retina 13"
@toddlers
toddlers / songs.md
Created June 5, 2016 17:12 — forked from febuiles/songs.md
Fetching lyrics in Unix

Fetching lyrics in the command line

Objective: Print the lyrics for the current playing song.

How: We'll create a small bash script to do the fetching for us (using curl) and then we'll display it either in the terminal or in our $EDITOR

Get the current song

First we'll need to get the name of the current song and its artist:

@toddlers
toddlers / setup_kafka.sh
Created March 3, 2016 15:39 — forked from ekampf/setup_kafka.sh
Setup Kafka (0.8.0) on OSX
brew install sbt
cd /tmp
wget http://apache.spd.co.il/kafka/0.8.0/kafka_2.8.0-0.8.0.tar.gz
tar -zxvf kafka_2.8.0-0.8.0.tar.gz -C /usr/local/
cd /usr/local/kafka_2.8.0-0.8.0
sbt update
sbt package