Skip to content

Instantly share code, notes, and snippets.

@mislav
Last active December 11, 2015 07:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mislav/4564682 to your computer and use it in GitHub Desktop.
Save mislav/4564682 to your computer and use it in GitHub Desktop.
git post-commit hook to snap an image of you from the webcam
#!/bin/bash
# git post-commit hook to snap an image of your smiling face.
set -e
[ -n "$GIT_DIR" ] && cd "${GIT_DIR}/.."
image_dir="commit_images"
image_file="${image_dir}/${USER} $(date '+%Y-%m-%d at %H.%M.%S').jpg"
grep "$image_dir" .gitignore &>/dev/null || echo "${image_dir}" >> .gitignore
mkdir -p "$(dirname "$image_file")"
imagesnap -q "$image_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment