Skip to content

Instantly share code, notes, and snippets.

View coty's full-sized avatar

Coty Rosenblath coty

View GitHub Profile
@coty
coty / two_factor_ssh.rb
Created September 29, 2011 19:21 — forked from moomerman/two_factor_ssh.rb
Two Factor SSH Authentication
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
require 'time'
user = ARGV[0]
secret = ARGV[1]
abort unless user and secret
trap("INT") do
@coty
coty / multi_store_finder.rb
Created April 20, 2011 21:52 — forked from sarchertech/multi_store_finder.rb
This requires Ruby 1.9. It will run under 1.8 because uniq! will ignore the block, but it won't be correct.
require 'yaml'
class Store
attr_accessor :name, :address, :city, :state, :zip, :phone_number
def unique_attributes
[name[0..5], zip, phone_number, address[0..3]]
end
end
@coty
coty / sl_gems_update.rb
Created January 11, 2010 16:12 — forked from mattetti/sl_gems_update.rb
Modified to find GEM_PATH and actually check bundle type
#!/usr/bin/env ruby
require 'rubygems'
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob("#{Gem.dir}/**/*.bundle").map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file #{path}`