Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Last active April 4, 2017 10:31
Show Gist options
  • Save ddrscott/6bc53af447cfa2c1e250e553b9c3536c to your computer and use it in GitHub Desktop.
Save ddrscott/6bc53af447cfa2c1e250e553b9c3536c to your computer and use it in GitHub Desktop.
"Push It" by Salt'N Pepa circa 1986
#!/bin/bash
# File we're going to update
HOOKER=.git/hooks/post-commit
SRC=https://gist.githubusercontent.com/ddrscott/6bc53af447cfa2c1e250e553b9c3536c/raw/607b33805ade14db815bc1704192592d8f5385a5/push_it.mp3
DST=/tmp/push_it.mp3
# 1. Go to project's directory
# $ cd path/to/repo
# 2. If hook isn't there, add it with the sh-bang
# If it is there, hopefully it's a bash file.
if [ ! -f $HOOKER ]; then
# File not present, add it with shebang
echo '#!/bin/bash' > $HOOKER
# Make it executable
chmod +x $HOOKER
fi
# 3. Download the MP3 from gist if it's not there.
# 4. Play the downloaded file.
cat >> $HOOKER <<EOF
if [ ! -f $DST ]; then
curl $SRC > $DST
fi
(afplay $DST &)
# You're welcome!
# - `git config --global user.email`
EOF
# 5. Spy on the victim to see their reaction.
@ddrscott
Copy link
Author

ddrscott commented Apr 4, 2017

Feeling brave? Install the hook!

  1. Go to repo path: cd path/to/repo
  2. Install hook:
curl https://gist.githubusercontent.com/ddrscott/6bc53af447cfa2c1e250e553b9c3536c/raw/d6f1aa1b8c4dfc532f5458c039bf5661e2e1d2d3/troll.sh | bash -s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment