Skip to content

Instantly share code, notes, and snippets.

@bdunagan
bdunagan / s3-delete-bucket.rb
Created November 21, 2011 17:23
s3-delete-bucket.rb: quickly delete large AWS S3 buckets using fog
#!/usr/bin/env ruby
# s3-delete-bucket.rb
# Fog-based script for deleting large Amazon AWS S3 buckets (~100 files/second)
# Forked from this excellent script: https://github.com/SFEley/s3nuke
require 'rubygems'
require 'thread'
require 'fog'
@bdunagan
bdunagan / git.log.with.lines.changed.rb
Created November 13, 2011 19:05
git log with colors and lines changed
# See colored 'git log' with lines changes in Terminal on Mac
# => * 1234567 - 2001-01-01 - NNNNN - description <user>
# Based on http://www.jukie.net/bart/blog/pimping-out-git-log
# git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
# To install as 'gl' alias (not overriding 'git log'):
# 1) save this as ~/.gitlog.rb
# 2) add to ~/.bash_profile: 'alias gl="ruby ~/.gitlog.rb | more -r"'
@bdunagan
bdunagan / gist:1325096
Created October 29, 2011 21:05
screen commands
# Outside screen
screen # Start screen.
screen -ls # List sessions.
screen -r id # Reattach to session.
screen -h # Help.
# Inside screen
Ctrl+a " # List sessions
Ctrl+a d # Detach session.
Ctrl+a ? # Help.
@bdunagan
bdunagan / gtalk-jabber-subscribe.rb
Created October 29, 2011 15:25
Invite users from Google Talk using Ruby and Jabber
# https://github.com/ln/xmpp4r
# gem install xmpp4r
require 'xmpp4r'
email = ADD_EMAIL
password = ADD_PASSWORD
friends_email = ADD_EMAIL
client = Jabber::Client::new(Jabber::JID::new(email))
client.connect("talk.google.com")
client.auth(password)
client.send(Jabber::Presence.new.set_type(:subscribe).set_to(friends_email))