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
Dir.glob('*.JPG') do |f| | |
puts f | |
end |
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 'exifr' | |
puts EXIFR::JPEG::new('DSC_2315.JPG').date_time_original |
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 'exifr' | |
Dir.glob('*.JPG') do |f| | |
exif_time = EXIFR::JPEG::new(f).date_time_original | |
yyyymmdd = exif_time.strftime('%Y-%m-%d') | |
Dir::mkdir(yyyymmdd) unless FileTest.exist?(yyyymmdd) | |
File.rename(f, yyyymmdd + '/' + f) | |
end |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Japan</title> | |
</head> | |
<body> | |
<svg> | |
<rect x="320" y="0" fill="#ffff00" stroke="#ff0000" width="150" height="150"/><!--北海道--> | |
<rect x="0" y="320" fill="#ffff00" stroke="#ff0000" width="100" height="200"/><!--九州--> |
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 'mini_magick' | |
Dir.glob('*.png') do |f| | |
image = MiniMagick::Image.open(f); | |
image.crop("752x422+229+206") | |
image.write('tmp/' + f) | |
end |
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' | |
hash = Hash.new {} | |
Dir.glob('*') do |f| | |
digest = Digest::MD5.file(f).to_s | |
if hash[digest] == nil then | |
hash.store(digest, f) | |
else | |
hash.store(digest, hash[digest] + ", " + f) | |
end | |
end |
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 'mini_exiftool' | |
Dir.glob(['*.NEF']) do |f| | |
photo = MiniExiftool.new(f) | |
puts photo.DateTimeOriginal | |
end |
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 'mini_exiftool' | |
exif = MiniExiftool.new(TO_FILE) | |
exif.copy_tags_from(FROM_FILE, 'all') | |
exif.save |
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
Dir.glob(FROM + '**/*').sort{|a, b| a <=> b}.each do |f| | |
puts f | |
end | |
# 順場関係なしに全部出力したいだけなら以下の通り | |
# Dir.glob(FROM + '**/*') do |f| | |
# puts f | |
# end |
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 'sequel' | |
require 'pp' | |
DB = Sequel.sqlite('photo.db') | |
items = DB["select * from photos where datetime(date_time_original) > datetime('2014-01-01 00:00:00')"].all | |
pp items |
OlderNewer