Skip to content

Instantly share code, notes, and snippets.

RSVPs Date
106 20120329
3 20120329-Waitinglist
104 20120426
93 20120531
125 20120628
110 20120726
126 20120831
65 20120925
1 20120925
@flores
flores / 0_reuse_code.js
Created March 5, 2014 00:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@flores
flores / gist:7e64061457448b48c66e
Created August 26, 2014 01:56
gross one-liner to get a random member for August's LA DevOps giveaways
curl 'http://www.meetup.com/ladevops/events/201936162/printrsvp/?pop=true&show_survey=1' | grep D_name |perl -pi -e 's/<span class.+>//g' |shuf |head -1
@flores
flores / proxyctl
Created October 18, 2010 17:17
just a ruby wrapper to a haproxy socket
#!/usr/bin/ruby -w
require 'socket'
ctl=UNIXSocket.new("/tmp/proxystats")
ctl.puts "#{ARGV}"
while (line = ctl.gets) do
puts line
wet:~# chmod +x proxyctl
wet:~# ./proxyctl help
Unknown command. Please enter one of the following commands only :
clear counters : clear max statistics counters (add 'all' for all counters) help : this message prompt : toggle interactive mode with prompt quit : disconnect show info : report information about the running process show stat : report counters for each proxy and server show errors : report last request and response errors for each proxy show sess [id] : report the list of current sessions or dump this session get weight : report a server's current weight set weight : change a server's weight set timeout : change a timeout setting disable server : set a server in maintenance mode enable server : re-enable a server that was previously in maintenance mode
wet:~#
wet:~# # who's connected
wet:~# ./proxyctl "show sess"
0x8111a70: proto=tcpv4 src=82.41.169.69:49837 fe=http be=static srv=nginx_stellatus ts=04 age=1m1s calls=6 rq[f=1901000h,l=0,an=800h,rx=,wx=,ax=] rp[f=110010h,l=8030,an=100000h,rx=,wx=5
wet:~# # remove a server from the rotation. takes the argument of backend/server
wet:~# ./proxyctl "disable server static/nginx_stellatus"
wet:~#
wet:~# # let's see the status of that server now. MAINT is, as you'd expect, maintenance mode
wet:~# ./proxyctl "show stat" |grep -i nginx_stellatus
static,nginx_stellatus,0,0,0,3,,966,368345,253599033,,0,,0,0,0,0,MAINT,1,1,0,1,0,297143,0,,1,4,3,,966,,2,0,,5,INI,,0,0,847,49,70,0,0,0,,,,124,1,
backend sinatra
balance leastconn
mode http
option http-server-close
option httpchk
server sinatra_downoi downoi.mysite.com:4567 check inter 60s rise 5 fall 2
server sinatra_rindica r.indica.mysite.com:4567 check inter 60s rise 5 fall 2
server sinatra_wet wet.mysite.com:4567 check inter 60s rise 5 fall 2
backend apache
balance source
mode http
option http-server-close
server wet 127.0.0.1:8080
frontend http
bind :80
mode http
option http-server-close
retries 3
option redispatch
maxconn 5000
# 120,000 ms is 2 minutes
contimeout 120000