Skip to content

Instantly share code, notes, and snippets.

View rhoml's full-sized avatar
WFH

Rhommel Lamas rhoml

WFH
View GitHub Profile
@rhoml
rhoml / gist:5441940
Created April 23, 2013 08:57
Launch_ami AWS
#!/bin/bash
#
# USAGE: launch_ami
AMI_ID=ami-xxxx
KEY_ID=xxxxxx
INSTANCE_TYPE="t1.micro"
EC2_RUN_INSTANCES=`which ec2-run-instances`
EC2_DESCRIBE_INSTANCES=`which ec2-describe-instances`
SEC_ID="xxx-xxx"
@rhoml
rhoml / OSX List AWS Public DNS on a Security Group
Created May 28, 2013 11:07
Add this to your bash_profile of your OSX profile and enjoy.
publicdns() {
EC2_DESCRIBE_INSTANCES=`which ec2-describe-instances | awk '{print $3}'`
EC2_DESCRIBE_GROUP=`which ec2-describe-group | awk '{print $3}'`
SECURITY_GROUP="$1"
AWS_CERT=~/.ec2/cert.pem
AWS_PK=~/.ec2/pk.pem
echo "This are the Available servers on ${SECURITY_GROUP} security group."
${EC2_DESCRIBE_INSTANCES} -C ${AWS_CERT} -K ${AWS_PK} | grep INSTANCE | grep `${EC2_DESCRIBE_GROUP} -C ${AWS_CERT} -K ${AWS_PK} ${SECURITY_GROUP} | head -1 | awk '{print $2}'` | awk '{print $4 }'
}
# Documentation for HAProxy
# http://code.google.com/p/haproxy-docs/w/list
# http://haproxy.1wt.eu/download/1.2/doc/architecture.txt
# NOTES:
# open files limits need to be > 256000, use ulimit -n to set (on most POSIX systems)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
@rhoml
rhoml / b00m.rb
Created June 28, 2013 19:26 — forked from jpr5/b00m.rb
require 'rubygems'
require 'mechanize'
account = {
:email => "jpr5@serv.io",
:password => "balls",
}
agent = Mechanize.new
site = agent.post("https://www.hipchat.com/sign_in", account).uri.host
@rhoml
rhoml / clear_hipchat.rb
Created June 29, 2013 00:24
Erase Hipchat history
#!/usr/lib/ruby env
# Modified from https://gist.github.com/jpr5/4260656
require 'rubygems'
require 'mechanize'
account = {
:email => "example@example.com",
:password => "123456",
}
agent = Mechanize.new
Check out README.md to get started editing Clojure with Emacs.
@rhoml
rhoml / unicorn
Created September 16, 2013 15:21
Init for unicorn and puppet
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn-puppet
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn app server
# Description: starts unicorn puppet
192.168.2.1
192.168.2.2
@rhoml
rhoml / ab_benchmark.md
Created October 29, 2013 14:23
Benchmarking Lua and Mruby on Nginx
Metric Lua Mruby Metric
Concurrency Level 150 150 transactions
Time taken for tests 7.981 8.269 seconds
Complete requests 3000 3000 requests
Failed requests 0 0 requests
Write errors 0 0
Non-2xx responses 3001 3001 requests
Total transferred 1233411 1206402 bytes
HTML transferred 582194 582194 bytes
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#