Skip to content

Instantly share code, notes, and snippets.

View usagizmo's full-sized avatar

usagizmo

View GitHub Profile
<meta http-equiv="refresh" content="0;url=/next/" />
rsync -ahvu --delete --exclude=".*" public/ dev:/var/www/html/
echo "\npublished: https://usagizmo.com/\n"
@usagizmo
usagizmo / move_all_photos.js
Last active August 29, 2015 14:17
iPhotoのすべてのオリジナル画像を特定のディレクトリに移動
var fs = require('fs');
var glob = require('glob');
var path = require('path');
var Exif = require('exif').ExifImage;
var imageDir = 'photos/';
glob('Masters/**/*', function(err, files) {
if (err) throw err;
files.forEach(function(file) {
@usagizmo
usagizmo / set_from_filename.rb
Last active July 7, 2016 07:31
写真ファイルの作成日/更新日のメタ情報をファイル名から置換する
# coding: utf-8
require 'find'
require 'time'
Find.find 'files' do |f|
if File.basename(f).match /\d{4}-\d{2}-\d{2} \d{2}\.\d{2}\.\d{2}/
originaltime = Time.parse File.basename(f, File.extname(f)).gsub '.', ':'
File.utime File.atime(f), originaltime, f unless originaltime.nil?
end
@usagizmo
usagizmo / mv_10kb.rb
Created October 18, 2014 22:34
10KB以下のファイルを trashed ディレクトリに移動する
# coding: utf-8
require 'find'
require 'fileutils'
Find.find('files') do |f|
next unless File.file? f
size = File.size?(f)
if size.nil? || size < 10000 # 10KB
puts f
@usagizmo
usagizmo / exif.rb
Created October 18, 2014 22:31
写真/動画の作成日/更新日情報をExifの情報に置換する
# coding: utf-8
require 'mini_exiftool'
require 'find'
Find.find('files') do |f|
next unless File.file? f
begin
exif = MiniExiftool.new f
rescue
@usagizmo
usagizmo / trim.jsx
Last active August 29, 2015 14:05
[Photoshop Script] 指定フォルダ内の PNG 画像をトリミングしてWeb用に保存
function saveForWebPNG(doc, folder, filename) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.PNG;
sfwOptions.PNG8 = false;
doc.exportDocument(new File(folder + '/' + filename), ExportType.SAVEFORWEB, sfwOptions);
}
function main() {
var inputFolder = Folder.selectDialog('トリミングしたい画像の入ったフォルダを選択してください');