Last active
April 4, 2017 10:31
-
-
Save ddrscott/6bc53af447cfa2c1e250e553b9c3536c to your computer and use it in GitHub Desktop.
"Push It" by Salt'N Pepa circa 1986
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feeling brave? Install the hook!
cd path/to/repo
curl https://gist.githubusercontent.com/ddrscott/6bc53af447cfa2c1e250e553b9c3536c/raw/d6f1aa1b8c4dfc532f5458c039bf5661e2e1d2d3/troll.sh | bash -s