Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am billmoritz on github.
* I am billmoritz (https://keybase.io/billmoritz) on keybase.
* I have a public key ASAwUSZsqn3dRlmgPqqxfI5rb8aD3sW4ILDWNw9FhNmYjgo
To claim this, I am signing this object:
provider "aws" {
region = "us-west-2"
}
variable "server_count" {
default = 4
}
resource "aws_eip" "ip" {
count = "${var.server_count}"
hipchat_arguments = [ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "My Room" ]
include_recipe "hipchat"
chef_handler "HipChat::NotifyRoom" do
source "#{Gem::Specification.find_by_name("hipchat").lib_dirs_glob}/hipchat/chef.rb"
arguments hipchat_arguments
action :enable
end
app = node[:rails][:app]
rails_base app[:name] do
ruby_ver app[:ruby_ver]
gemset app[:gemset]
end
%w{config log pids cached-copy bundle system}.each do |dir|
directory "#{app[:app_root]}/shared/#{dir}" do
owner app[:deploy_user]
@billmoritz
billmoritz / cleanmerged.sh
Created January 16, 2013 13:37
Deletes remote branches from origin that have been merged in to origin/master
git branch -r --merged origin/master |
grep origin | egrep -v '>|master' |
awk '{sub(/origin\//,"");print}' |
xargs git push origin --delete
@billmoritz
billmoritz / download_stacks.sh
Last active December 3, 2015 16:06
Download cloudformation templates from your aws account
#!/bin/bash
for i in `aws cloudformation list-stacks --output text --stack-status-filter CREATE_COMPLETE | awk '{ print $4 }'`; do
aws cloudformation get-template --stack-name $i | jq .TemplateBody | jq -S '.AWSTemplateFormatVersion="2010-09-09"' > stacks/$i.json
done
for i in `aws cloudformation list-stacks --output text --stack-status-filter UPDATE_COMPLETE | awk '{ print $5 }'`; do
aws cloudformation get-template --stack-name $i | jq .TemplateBody | jq -S '.AWSTemplateFormatVersion="2010-09-09"' > stacks/$i.json
done
# Git-FTP install
cd /tmp
git clone https://github.com/resmo/git-ftp.git
cd git-ftp
git checkout master
sudo make install
#!/bin/bash
# Darwin or Linux
[ `uname -s` = 'Darwin' ] || { echo 'Im not a Mac.'; exit 1; }
brew doctor || { echo "*** Fix Homebrew before running again."; exit 1; }
brew install git
brew update
brew install hub
@billmoritz
billmoritz / gist:3837723
Created October 5, 2012 02:25
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value={DBInstanceClassMemory/32}, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \