Skip to content

Instantly share code, notes, and snippets.

@normanrz
Created January 13, 2021 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normanrz/00bfd7bee7469381024ad470395d84f5 to your computer and use it in GitHub Desktop.
Save normanrz/00bfd7bee7469381024ad470395d84f5 to your computer and use it in GitHub Desktop.
gitshots
#!/bin/bash
# For adding automatic webcam shots on every commit
if [ ! -f .git/hooks/post-commit ]; then
echo "#!/bin/sh
snap $HOME/.gitshots/\$(date -u +"%Y-%m-%dT%H-%M-%SZ").jpg &" > .git/hooks/post-commit
chmod u+x .git/hooks/post-commit
echo "Post-commit hook added"
fi
#!/bin/bash
# Making a webcam shot
if [ -z ${1+x} ]
then
echo "Usage: `basename $0` <filename>"
exit 2
fi
ffmpeg -y -loglevel quiet -f avfoundation -video_size 1280x720 -framerate 30 -i "0" -vframes 1 $1 > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment