Skip to content

Instantly share code, notes, and snippets.

@jellea
Created August 23, 2012 17:18
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jellea/3438926 to your computer and use it in GitHub Desktop.
Save jellea/3438926 to your computer and use it in GitHub Desktop.
Webcam snapshot on every git commit
#!/bin/bash
#
# This script will make a webcam snapshot every commit. The jpg file will have
# the commit id as the filename.
#
# This script requires imagesnap. Install with: 'brew install imagesnap'
#
# Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by:
# 'chmod +x .git/hooks/post-commit'
#
# Make sure the .gitshots directory exists in the root of the repo.
#
# Inspired by Victor Martinez (http://coderwall.com/p/xlatfq?p=1&q=)
#
#
# Todo:
# * Check if '.gitshots' excists otherwise make it!
# * Add snapshot on pre-commit to repo
#
COMMITID=$(git rev-parse HEAD)
imagesnap -q -w 1 .gitshots/$COMMITID.jpg
@niksumeiko
Copy link

@jellea, do you know if your script lags after each commit while producing webcam snapshot? Or you still need to wait for camera to take a picture?

@marcolz
Copy link

marcolz commented Aug 25, 2015

@manakor Adding an ampersand at the end of the last line should prevent the script from lagging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment