📜 ⬆️ ⬇️

Photograph after each commit (Linux, OSX)

The imagesnap program (OSX) allows you to take photos with a webcam from the command line. For example, it can automatically take a picture of the programmer after each commit to the git repository, just add the following code to .git/hooks/post-commit .

 #!/usr/bin/env ruby file="~/.gitshots/#{Time.now.to_i}.jpg" puts "Taking capture into #{file}!" system "imagesnap -q -w 3 #{file}" exit 0 

Then the frames are collected in a video program tlassemble .

Under Linux, the command-line imagenap program is easily replaced by the fswebcam utility.

 #!/usr/bin/env perl use strict; use warnings; unless ( -d $ENV{"HOME"}."/.gitpix" ) { mkdir $ENV{"HOME"}."/.gitpix" or die "$!\n"; } my $file="~/.gitpix/pic-".time.".jpg"; print "Saving image from webcam to $file.\n"; system "fswebcam $file" or die "$!\n"; 

The video is then compiled using avconv .
')

Source: https://habr.com/ru/post/146418/


All Articles