Skip to content

Instantly share code, notes, and snippets.

View mathieue's full-sized avatar

Mathieu Elie mathieue

View GitHub Profile
@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 / socat-tty.sh
Created August 7, 2012 21:21
socat read tty serial and provide a server to read serial output
socat -d -d tcp-l:1234,reuseaddr,fork file:/dev/ttyUSB0,nonblock,raw,echo=0,waitlock=/var/run/tty,min=0,b38400
@mathieue
mathieue / install-ctags-mac.sh
Created July 20, 2012 14:22
Install exuberant ctags on mac
cd src
wget http://surfnet.dl.sourceforge.net/sourceforge/ctags/ctags-5.7.tar.gz
tar -xvzf ctags-5.7.tar.gz
cd ctags-5.7/
./configure
make
sudo make install
# matt
vi dotfiles/.mybashrc
@mathieue
mathieue / reverse.es
Created June 29, 2012 09:11
Simple apache read only reverse proxy on elasticsearch
<VirtualHost *:80>
ServerName es.yourhost.com
<Proxy balancer://main>
BalancerMember http://127.0.0.1:9200 max=1 retry=5
<Limit GET >
order deny,allow
deny from all
allow from 127.0.0.1
@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)
@mathieue
mathieue / rmvm-system-wide.sh
Created September 9, 2011 21:23
System wide RVM
sudo su
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
apt-get install zlib1g-dev libssl-dev libreadline5-dev
rvm install 1.9.2
rvm 1.9.2
add rvm script below to your .bashrc and to /root/.bashrc
# Load RVM if it is installed,
# first try to load user install
# then try to load root install, if user install is not there.
#!/bin/bash
ssh mathieu@127.0.0.1 -p 2222 sudo halt -n