Skip to content

Instantly share code, notes, and snippets.

View trobrock's full-sized avatar

Trae Robrock trobrock

View GitHub Profile
function gbd() {
if [[ -n $1 ]]; then
if [[ -n $2 ]]; then
git push $1 :$2
git branch -d $2
else
git push origin :$1
git branch -d $1
fi
fi
#!/bin/bash
curl -s https://rvm.beginrescueend.com/install/rvm | bash
'[[ -s "/Users/release/.rvm/scripts/rvm" ]] && source "/Users/release/.rvm/scripts/rvm"\nexport JAVA_HOME=/Library/Java/Home\nexport JRE_HOME=/Library/Java/Home\nexport JAVA_OPTS="-Djava.awt.headless=true -Xmx2048M"' > /Users/release/.profile
source /Users/release/.profile
rvm install --force ruby-1.8.7-p352
rvm install --force ree
#!/bin/bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.git.com/gist/323731)"
brew install tomcat
brew install wget
brew install jenkins
brew install node
@trobrock
trobrock / snapshots.rake
Created November 17, 2011 23:18
Clean up EC2 snapshots
namespace :snapshots do
desc "cull all snapshots except for 1st of each month and last 60 days."
task :cull do
ec2 = Configuration.instance.connection
snaps = ec2.describe_snapshots
snaps = snaps.select {|s| DateTime.parse(s[:aws_started_at]) < 60.days.ago }
snaps.inject({}) { |newhash, h| newhash[Time.parse(h[:aws_started_at])] = h; newhash }
saved = newhash.keys.group_by { |date| date.month }.map { |k, v| v.first }
saved.each do |key|
snaps.delete key
set -g default-terminal "screen-256color"
# Use the system pasteboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Bind Control key to match Screen
set -g prefix C-a
# Use vi key bindings
set -g status-keys vi
numbers = [1,2,3,4,5,6,7,8,9]
target = 50
k = 5
def calculate_sum(inputs, k)
inputs.each_index do |i|
pairing = [inputs[i]]
inputs.each_index do |j|
next if i == j
def create
@glitch = current_user.glitches.new(params[:glitch])
respond_to do |format|
if @glitch.save
UserMailer.glitch(@glitch).deliver
format.xml { render :xml => @glitch, :status => :created, :location => @glitch }
format.json { render :json => @glitch }
else
format.xml { render :xml => @glitch.errors, :status => :unprocessable_entity }
@trobrock
trobrock / error
Created August 22, 2011 20:08
Rvm failure with iconv
~/Sites/outright.github.com[master]% gem list
*** LOCAL GEMS ***
rake (0.9.2 ruby)
rubygems-update (1.8.8)
~/Sites/outright.github.com[master]% gem install jekyll
Fetching: liquid-2.2.2.gem (100%)
Fetching: fast-stemmer-1.0.0.gem (100%)
Building native extensions. This could take a while...
#!/bin/bash
exec god -D
@trobrock
trobrock / gist:1085567
Created July 15, 2011 21:19
gerrit config
Reference:
refs/heads/*
Owner
Administrators
Anonymous Users
Create Reference
Administrators
Anonymous Users
Push
Administrators