Skip to content

Instantly share code, notes, and snippets.

@bdunagan
bdunagan / s3-delete-bucket.rb
Created Nov 21, 2011
s3-delete-bucket.rb: quickly delete large AWS S3 buckets using fog
View s3-delete-bucket.rb
#!/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 Nov 13, 2011
git log with colors and lines changed
View git.log.with.lines.changed.rb
# 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"'
View gist:1325096
# 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 Oct 29, 2011
Invite users from Google Talk using Ruby and Jabber
View gtalk-jabber-subscribe.rb
# 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))