Skip to content

Instantly share code, notes, and snippets.

View mathieue's full-sized avatar

Mathieu Elie mathieue

View GitHub Profile
@mathieue
mathieue / haproxy.cfg.txt
Last active December 15, 2015 22:49
Websocket on port 80 and subpath with HAProxy !
frontend mayappfront
bind 0.0.0.0:80
acl is_front hdr_end(host) -i myapp.fr
acl is_websocket path_beg -i /websockets
use_backend websocketappprod if is_websocket is_front
use_backend backend if is_front
default_backend backend
backend backend
balance roundrobin
# linux-tips.sh
# https://gist.github.com/3927552
# collection of great tips picked from the UNIX TOOLBOX
# http://cb.vu/unixtoolbox.xhtml
# get distrib infos
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
@mathieue
mathieue / install-varnish-debian-with-munin.sh
Created October 2, 2012 12:45
Install varnish on debian squeeze with munin plugins
curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -
echo "deb http://repo.varnish-cache.org/debian/ squeeze varnish-3.0" >> /etc/apt/sources.list
apt-get update
apt-get install varnish
# test
varnishtop -i rxurl
varnishstat
# munin plugins
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash-shipper
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
@mathieue
mathieue / remove-host.sh
Created August 11, 2012 19:47
Remove entry in known host by line number (sed)
sed -i "209 d" .ssh/known_hosts
@mathieue
mathieue / knife-boot-ec2.sh
Created August 10, 2012 21:19
Boot a ec2 instance with chef
knife ec2 server create -I ami-359ea941 -f t1.micro -x ubuntu --region 'eu-west-1' -Z 'eu-west-1a'
@mathieue
mathieue / init-bucky
Created May 28, 2012 13:46
Monit conf for bucky (statsd daemon)
#!/bin/bash
case $1 in
start)
echo $$ > /var/run/bucky.pid;
exec 2>&1 /usr/local/bin/bucky --disable-collectd --statsd-ip=192.168.0.1 /etc/bucky.py | logger -t bucky
;;
stop)
kill `cat /var/run/bucky.pid` ;;
*)
echo "usage: bucky {start|stop}" ;;
@mathieue
mathieue / es-monit
Created May 24, 2012 15:56
Monit configuration for elasticsearch service
set daemon 120
set logfile syslog facility log_daemon
check process es with pidfile /home/es/elasticsearch-0.17.10/var/run.pid
start program = "/home/es/elasticsearch-0.17.10/bin/elasticsearch -p /home/es/elasticsearch-0.17.10/var/run.pid"
stop program = "kill $(cat /home/es/elasticsearch-0.17.10/var/run.pid)"
# humm.. need to improve this...
if cpu > 80% for 20 cycles then restart
@mathieue
mathieue / sar-snapshot.sh
Created April 9, 2012 09:26
Store system stats on a sar archive during a bench. Read it later !
#write each second ten times
sar -A -o /tmp/sar-snapshot-$(date +%Y-%m-%d%H-%M-%S) 1 10
# read
sar -f /tmp/sarsnapshot-2012-04-0911-21-55
sar -f /tmp/sarsnapshot-2012-04-0911-21-55 -b
# etc..
require 'couchrest'
class CouchWarmer
# database = 'http://127.0.0.1:5984/dbname'
def initialize(database)
@db = CouchRest.database!(database)
end
# name with suffix, suffix
def warm(name, suffix)