xlatfq
94.11K
· June 2012 ·
Ecc4d502278ae77354564beb97bdff10

Take a photo of yourself every time you commit

Download imagesnap from https://github.com/alexwilliamsca/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>

Sign in or sign up to add your response.

27 Responses

23
Photo on 08.01.2013 at 04.15

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} &"

over 1 year ago ·
563
3

"Taking capture into ~/.gitshots/1350594122.jpg!
Error."

Got this. Really have no idea :(. #newbie

over 1 year ago ·
915
B0366e26e202332ad265ea3f6e259f55

@rebyn you have to make sure ~/.gitshots already exists. If not, issue a "mkdir ~/.gitshots" before commiting.

over 1 year ago ·
1019
3

@brunoassis Thank you. It works like a charm. I'm getting addicted to commits now.

over 1 year ago ·
1158
C630f26c1d202baa5af6bde5b7eeb8bb

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

over 1 year ago ·
1243
D1d602879470aa96563c6ed345121d59

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/

over 1 year ago ·
1263
Fc3bc471d76939fd21a8adf12fcd34da
over 1 year ago ·
1351
60e85e0d1c0d115fdce4c1ecf33bc79c

Mine didn't work until I did this:

chmod 777 .git/hooks/post-commit
over 1 year ago ·
2094
Blackbeard pirate movie crop

Or use my bash variant: https://gist.github.com/3438926

over 1 year ago ·
3178
3e0b5461e0e5c733af00292ec2d15c83

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.

over 1 year ago ·
5712
30d7d4c13abcce7567310133134b829c

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?

over 1 year ago ·
6326
47e7831147948fdc5cf46abe4c88a235

@shoen That's up to you, of course.

over 1 year ago ·
6327
47e7831147948fdc5cf46abe4c88a235

@shoen That's up to you, of course.

over 1 year ago ·
6369
0e2e822d32a7ab3d7f0b7098d03b1d16

@shoen it's silly, but it's fun and harmless. Could be good for team bonding :)

over 1 year ago ·
7598
2013 05 19 17.29.51 1

Anyone familiar with SVN post-hooks? I'd like to set this up locally for an svn repo.

over 1 year ago ·
9836
2a25a00e186906cd06947ce403e8c0d2

I copied this idea and made a linux version: https://github.com/ashleyblackmore/beardsnapper

over 1 year ago ·
11695
Avatar

This is pretty cool.

over 1 year ago ·
12038
0fbb3826166cbd58fb8c3f44a021d511

This is so cool.

over 1 year ago ·
12584
12cad0fa676a4668fb4fed8587cd6e06

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"?

over 1 year ago ·
12585
Ecc4d502278ae77354564beb97bdff10

@konamax123 Git post-commit hook is at your-git-repo/.git/hooks/post-commit. Make sure you chmod +x it,

over 1 year ago ·
12586
12cad0fa676a4668fb4fed8587cd6e06

@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?

over 1 year ago ·
12587
Ecc4d502278ae77354564beb97bdff10

@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.

over 1 year ago ·
12849
Fef2d4be2097d10e2fbe652dd1c71ea5

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!

over 1 year ago ·
16807
David

awesome !!!

over 1 year ago ·
17776
None

great idea!

over 1 year ago ·
17918
Screen shot 2014 11 20 at 9.32.15 pm

nice!

over 1 year ago ·
24744
None

awesome

9 months ago ·