Take a photo of yourself every time you commit
Download imagesnap from https://github.com/rharder/imagesnap or install it with homebrew:
brew install imagesnap
Create ~/.gitshots
directory:
mkdir ~/.gitshots
Add this as a post-commit hook to yout git repo:
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
unless File.directory?(File.expand_path("../../rebase-merge", __FILE__))
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file} &"
end
exit 0
Assemble the video with http://www.dayofthenewdan.com/projects/tlassemble
Enjoy!
<iframe src="http://player.vimeo.com/video/44067957" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<a href="http://vimeo.com/44067957">Demo on Vimeo</a>.</p>
Written by Víctor Martínez
Related protips
29 Responses
You can also add an ampersand to system command. It prevents lag after each commit, so you don't have to wait for camera to take a picture: system "imagesnap -q -w 3 #{file} &"
"Taking capture into ~/.gitshots/1350594122.jpg!
Error."
Got this. Really have no idea :(. #newbie
@rebyn you have to make sure ~/.gitshots already exists. If not, issue a "mkdir ~/.gitshots" before commiting.
@brunoassis Thank you. It works like a charm. I'm getting addicted to commits now.
On linux replace "imagesnap -q -w 3 #{file} &" with "fswebcam #{file} &" and assemble the video with http://www.itforeveryone.co.uk/image-to-video.html
For what it's worth, I have a similar project pre-packaged as a rubygem with a CLI enable/disable for repos:
http://mroth.github.com/lolcommits/
Mine didn't work until I did this:
chmod 777 .git/hooks/post-commit
Or use my bash variant: https://gist.github.com/3438926
Now how do we get these images to show up in the github commits when we push?
Just to prove I wasn't drunk when I made that patch.
I can't understand what's the point of this? What do you want to achieve by posting a photo of yourself after each commit? Who is going to watch them and what is the message you/your commit photo is trying to broadcast to a user/visitor?
@shoen That's up to you, of course.
@shoen That's up to you, of course.
@shoen it's silly, but it's fun and harmless. Could be good for team bonding :)
Anyone familiar with SVN post-hooks? I'd like to set this up locally for an svn repo.
I copied this idea and made a linux version: https://github.com/ashleyblackmore/beardsnapper
This is pretty cool.
This is so cool.
Sorry for the newb question but what is a post-commit and where do I put the text that it says to add as a "post-commit hook to your git repo"?
@konamax123 Git post-commit hook is at your-git-repo/.git/hooks/post-commit
. Make sure you chmod +x
it,
@knoopx, so I see my hooks directory but inside I don't have a file called post-commit. Is this a file that I create? Is this a .txt file?
@konamax123 yes you need to create it and make it executable chmod +x your-git-repo/.git/hooks/post-commit
. The content of the file is the ruby code posted on the protip.
Fun! This is a great idea to take a snapshot, but you could also imagine doing some other fun things like grabbing the weather or the currently playing song, etc.
Thanks for sharing!
great idea!
nice!
awesome
The link is not available anymore :/
Great trick
Nice!