Skip to content

Instantly share code, notes, and snippets.

View blasterpal's full-sized avatar

Hank Beaver blasterpal

View GitHub Profile
@blasterpal
blasterpal / fill_up_disk.sh
Created December 24, 2010 17:29
Fill up disk space to test monitoring, like Cloudkick.
dd if=/dev/zero of=11gb-file.bin bs=1GB count=11
@blasterpal
blasterpal / data_bag_helper.rb
Created January 26, 2011 16:52
Chef Data Bag Helper Module to pop into recipes and easily get overrides from Data Bags.
module DataBagHelper
#wrapper methods to insulate from change :)
def node_run_list
node.run_list.role_names.reverse
end
def current_data_bag_items
@blasterpal
blasterpal / nested_system_timer.rb
Created February 18, 2011 15:25
Nested System Timer Test
require 'rubygems'
require 'system_timer'
class JobWrapper
attr_accessor :timeout, :job, :name
# slowjob1 = SlowJob.new(15,'slowjob1')
# wrapper = JobWrapper.new(10,slowjob1)
@blasterpal
blasterpal / curl_http_status_code_check.sh
Created July 12, 2011 11:53
Curl HTTP Status code check
#!/bin/bash
#http://beerpla.net/2010/06/10/how-to-display-just-the-http-response-code-in-cli-curl/
if test -z "$1"
then
echo "No URL provided."
exit
fi
@blasterpal
blasterpal / varnishlog_egrep.sh
Created July 13, 2011 18:14
Varnishlog egrep for mostly HTML requests
varnishlog | grep RxURL | egrep -v '/(assets|images|javascripts|stylesheets)/'
@blasterpal
blasterpal / rails_multiline_exception_removal.txt
Created July 13, 2011 21:17
Remove Exception Block from standard Rails logs
#example to remove PageNotFoundError from logs for cleaning up
sed '/ApplicationController::PageNotFoundError (ApplicationController::PageNotFoundError):/,/^\W*$/d' production.log.cleaned.app01
@blasterpal
blasterpal / bash_profile
Created August 4, 2011 14:38
My generic bash_profile
export EDITOR=/usr/bin/vim
export PATH=${HOME}/scripts/git_ps_tools:${PATH}
#using ReinH's ps_tools and rvm-prompt
export PS1="\[\033[01;32m\]\u\[\033[00m\]\[\033[01;31m\]\$(git_br)\[\033[01;32m\]\[\033[00m\]:\[\033[01;36m\]\$(git_pwd)\[\033[00m\]\[\033[1;34m\]:$(~/.rvm/bin/rvm-prompt)\[\033[00m\]\$ "
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
@blasterpal
blasterpal / screen_cheat_sheet.txt
Created August 19, 2011 20:34
screen cheat sheet
BETTER: http://aperiodic.net/screen/quick_reference
screen -r
Ctrl - a d => detatch
screen -list
screen -S 31517.pts-1.mxm-util -X kill
http://haruska.com/2009/09/29/remote-pair-programming/
@blasterpal
blasterpal / cpu_mem_status.sh
Created September 19, 2011 19:22
CPU, Mem, IO stats
echo 'CPU hogs'
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
echo '#############'
echo 'IO'
iostat
echo 'The mems'
vmstat
@blasterpal
blasterpal / verify_cert.sh
Created September 22, 2011 18:29
Verify SSL Cert
openssl x509 -text -in cert-2012.crt