Last active
December 4, 2016 10:36
-
-
Save amutake/c1b77bd19a19cd6982b911d4a88df6fe to your computer and use it in GitHub Desktop.
A script for making 'focal length - number' graph
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
#!/usr/bin/env bash | |
FOCAL=focal.dat | |
WC=~/tmp/wc.rb | |
if [[ "$1" == "-t" && ! -z "$2" ]]; then | |
exiftool -T -focallengthin35mmformat *.JPG | grep -v '-' | awk '{print NR, $0}' > $FOCAL | |
gnuplot -p -e "set terminal png; set term png size 2000,500; set term png font 'ヒラギノ丸ゴ ProN W4, 16'; set output '$2'; set xlabel 'n枚目'; set ylabel '焦点距離'; plot '$FOCAL' using 1:2:(1) with boxes" | |
rm $FOCAL | |
open $2 | |
elif [[ "$1" == "-c" && ! -z "$2" ]]; then | |
exiftool -T -focallengthin35mmformat *.JPG | grep -v '-' | awk '{print $1}' | $WC > $FOCAL | |
gnuplot -p -e "set terminal png; set output '$2'; set term png font 'ヒラギノ丸ゴ ProN W4, 12'; set xlabel '焦点距離'; set ylabel '枚数'; plot '$FOCAL' using 1:2:(1) with boxes" | |
rm $FOCAL | |
open $2 | |
else | |
echo "Usage: focal.sh (-c|-t) PLOTFILE" | |
fi |
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
#!/usr/bin/env ruby | |
wc = {} | |
while w = gets | |
w = w.to_i | |
wc[w] = if wc[w] then wc[w] + 1 else 1 end | |
end | |
wc.sort_by do |kv| | |
kv[0] | |
end.each do |kv| | |
puts "#{kv[0]}\t#{kv[1]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wc.rb いらなくて、
sort -n | uniq -c
でいい