Skip to content

Instantly share code, notes, and snippets.

@knoopx
Created June 14, 2012 22:04
Show Gist options
  • Save knoopx/2933250 to your computer and use it in GitHub Desktop.
Save knoopx/2933250 to your computer and use it in GitHub Desktop.
Gitshots Post-Commit Hook
#!/usr/bin/env ruby
# Requires imagesnap from https://github.com/alexwilliamsca/imagesnap (brew install imagesnap)
# To assemble the video use http://www.dayofthenewdan.com/projects/tlassemble
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file}"
exit 0
@glukki
Copy link

glukki commented May 10, 2013

Or you could simplify it like this ;)

#!/bin/sh
imagesnap -q $HOME/.gitshots/$(date "+%s").jpg &

Because on my system date -j -f "%a %b %d %T %Z %Y" "date" "+%s" fails to convert date

@najamkhn
Copy link

For Linux/Ubuntu you can use streamer..

file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "streamer -f jpeg #{file}"
exit 0

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