Skip to content

Instantly share code, notes, and snippets.

@gaving
Last active August 29, 2015 14:09
Show Gist options
  • Save gaving/900f31dad54266b48b46 to your computer and use it in GitHub Desktop.
Save gaving/900f31dad54266b48b46 to your computer and use it in GitHub Desktop.
q() {
/bin/mysql --unbuffered --skip-column-names --raw -A -B -e "$@"
}
images() {
(
for i in {1..$(q "select MAX(photoid) from photos")}; \
echo -n $i && q "select photo from photos where photoid=${i}" | magick - info:-
) | sort -h -k 7 | tail -n 10
}
# wishlist, get 'magick' to pipe
# http://stackoverflow.com/questions/12594364/can-i-output-multiple-files-to-stdout-and-process-them-individually
# http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=18320
# http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=26276
# e.g. q "select photo from photos where photoid=1" | magick - info:-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment