Skip to content

Instantly share code, notes, and snippets.

@yanofsky
Created December 18, 2012 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanofsky/4323918 to your computer and use it in GitHub Desktop.
Save yanofsky/4323918 to your computer and use it in GitHub Desktop.
Quartz's Fiscal Cliff Webcam bash script
#!/bin/bash
#
#`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
#```````````***`````````````***```````***```````````***````````````******```````````************``````************````
#```````***********`````````***```````***``````````*****```````````**********```````************``````************````
#`````***`````````***```````***```````***`````````***`***``````````***`````***``````````***```````````````````***`````
#````***```````````***``````***```````***````````***```***`````````***``````***`````````***`````````````````***```````
#````***```````````***``````***```````***```````***`````***````````***********``````````***```````````````***`````````
#````***``````***`***```````***```````***``````*************```````*********````````````***``````````````***``````````
#`````***```````****`````````***`````***``````***************``````***````***```````````***````````````***````````````
#```````*************`````````*********``````***```````````***`````***`````***``````````***```````````************````
#```````````***`````**```````````***````````***`````````````***````***``````***`````````***```````````************````
#`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
#
FTP_UN = " "
FTP_URL = " "
REM_DIR = "hastheusgoneoffthefiscalcliff.com/"
#kill any running camera processes (because macs will steal control of the camera sometimes)
killall -SIGINT PTPCamera
#take a new picture
gphoto2 --capture-image-and-download --filename imagecapture.jpg
#resize image
convert -resize 1000 -compress JPEG -quality 80 imagecapture.jpg imagecapture_1000.jpg
#resize image for social
convert -resize 550 -compress JPEG -quality 80 imagecapture.jpg imagecapture_550.jpg
#upload the photo to the remote server (we set up an authorized key on the remote so the script doesn't need a password)
scp imagecapture_1000.jpg $FTP_UN@$FTP_URL:$REM_DIR
#upload the sized-for-social social photo to the remote server
scp imagecapture_550.jpg $FTP_UN@$FTP_URL:$REM_DIR
#move file to local archive
mv imagecapture.jpg archive/archive-$(date +%F-%H%M%S).jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment