This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
require 'fileutils' | |
hash = {} | |
["/Users/frankbehrens/Desktop/niels\ backup/Pictures/iPhoto\ Library/Originals/**/*.*","**/*.*"].each do |dir| | |
Dir.glob(dir).each do |file| | |
print '.' | |
digest = Digest::MD5.hexdigest(File.read(file)) | |
if hash[digest] | |
puts "#{file}is dublicate" | |
FileUtils.rm file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'highline/import' | |
puts "usage ruby generate_keystore.rb host password" | |
def read_certificate | |
answer = [ ask("and paste generated Certificate here >>\n") ] | |
until (answer << ask("") ).last.include? "END CERTIFICATE" | |
end | |
answer.join("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#rakefile | |
require 'rake' | |
extend FileUtils | |
PID = '.pid' | |
task :default => :reset | |
module Kernel | |
def pid | |
raise "pid file already exists" if File.exists? PID | |
touch PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mechanize' | |
agent = Mechanize.new | |
agent.set_proxy('proxy', 8080, 'user', 'secret') | |
page = agent.get( 'http://www.feiertage.net/frei-tage.php') | |
h = {} | |
%w(2010 2011 2012 2013).each do |year| | |
f = page.forms.first | |
f.state = 'NW' | |
f.year = year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = <<-HERE | |
chile,santiago,5000000,02 | |
chile,valparaiso,100000,55 | |
chile,la serena,80000,56 | |
usa,los angeles,15000000,44 | |
usa,washington dc,500000,88 | |
china,beijing,14000000,98 | |
HERE | |
result = Hash.new{|h,k| h[k] = [] } |
NewerOlder