Skip to content

Instantly share code, notes, and snippets.

@mribica
Created December 15, 2012 17:52
Show Gist options
  • Save mribica/4297617 to your computer and use it in GitHub Desktop.
Save mribica/4297617 to your computer and use it in GitHub Desktop.
Gitshot post-commit hook (Ubuntu)
#!/usr/bin/env ruby
puts "[Cheese!]"
# Get some info about current commit
repository_name = `basename "$PWD"`.chop
commit_hash, commit_date = `git log -1 --pretty="%H%n%ci"`.split(/\r?\n/)
# Capture image and save it to ~/Pictures/gitshots/REPOSITORYNAME-TIMESTAMP-COMMITHASH.jpeg
exec "streamer -c /dev/video0 -b 16 -o ~/Pictures/gitshots/#{repository_name}_#{commit_date.gsub!(' ', '_')}_#{commit_hash}.jpeg"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment