Skip to content

Instantly share code, notes, and snippets.

@sampollard
Last active December 24, 2018 23:13
Show Gist options
  • Save sampollard/863105c6b25bd9be334a23e2be8b543d to your computer and use it in GitHub Desktop.
Save sampollard/863105c6b25bd9be334a23e2be8b543d to your computer and use it in GitHub Desktop.
Productivity Enhancer
#!/bin/bash
# usage: ./prod.sh <repository_url>
# Have no one doubt your productivity on GitHub. You must already have
# a repository and have an ssh key established for this to work.
# To get a nice solid green contribution, see
# https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile
REPO_URL=$1
git clone "$REPO_URL" ~/prod
cd ~/prod
if ! [ -f counter.txt ]; then
echo 1 > counter.txt
git add counter.txt
git commit -m "Initial commit"
git push
fi
while [ true ]; do
sleep 900
git pull
N=$(echo 1 + $(cat counter.txt)|bc)
echo $N > counter.txt
git add counter.txt
msg=$(echo $(curl -s \
http://whatthecommit.com/index.txt) \
| tr -d \"\'$)
git commit -m "$msg"
git push
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment