Skip to content

Instantly share code, notes, and snippets.

View costa's full-sized avatar

Costa Shapiro costa

View GitHub Profile
require 'digest/md5'
hash = {}
Dir.glob("**/*", File::FNM_DOTMATCH).each do |filename|
next if File.directory?(filename)
# puts 'Checking ' + filename
key = Digest::MD5.hexdigest(IO.read(filename)).to_sym
if hash.has_key? key
#!/usr/bin/env ruby
# NOTE current directory is assumed
# NOTE run with 'rm {}' to remove duplicate copies (while taking necessary caution)
exec_command = ARGV[0] || 'echo {}'
require 'digest/md5'
require 'shellwords'
filenames_by_md5 = {}