2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-24 11:27:12 +00:00

add smack-my-bitch-up and hangover shell scripts

This commit is contained in:
Nihad Abbasov 2015-11-22 01:55:54 +04:00
parent 8869a094c9
commit 1ab8c5e17b
2 changed files with 77 additions and 0 deletions

39
hangover.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/sh -e
DAYOFWEEK=$(date +%u)
# Skip on weekends
if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
exit
fi
# Exit early if any session with my_username is found
if who | grep -wq 'my_username'; then
exit
fi
# Phone numbers
MY_NUMBER='+xxx'
NUMBER_OF_BOSS='+xxx'
EXCUSES=(
'Locked out'
'Pipes broke'
'Food poisoning'
'Not feeling well'
)
rand=$[ $RANDOM % ${#EXCUSES[@]} ]
RANDOM_EXCUSE=${EXCUSES[$rand]}
MESSAGE="Gonna work from home. "$RANDOM_EXCUSE
# Send a text message
RESPONSE=`curl -fSs -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
-d "From=$MY_NUMBER" -d "To=$NUMBER_OF_BOSS" -d "Body=$MESSAGE" \
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/SMS/Messages"`
# Log errors
if [ $? -gt 0 ]; then
echo "Failed to send SMS: $RESPONSE"
exit 1
fi

38
smack-my-bitch-up.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh -e
DAYOFWEEK=$(date +%u)
# Skip on weekends
if [ "$DAYOFWEEK" -eq 6 ] || [ "$DAYOFWEEK" -eq 7 ]; then
exit
fi
# Exit early if no sessions with my_username are found
if ! who | grep -wq 'my_username'; then
exit
fi
# Phone numbers
MY_NUMBER='+xxx'
HER_NUMBER='+xxx'
REASONS=(
'Working hard'
'Gotta ship this feature'
'Someone fucked the system again'
)
rand=$[ $RANDOM % ${#REASONS[@]} ]
RANDOM_REASON=${REASONS[$rand]}
MESSAGE="Late at work. "$RANDOM_REASON
# Send a text message
RESPONSE=`curl -fSs -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN" \
-d "From=$MY_NUMBER" -d "To=$HER_NUMBER" -d "Body=$MESSAGE" \
"https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/SMS/Messages"`
# Log errors
if [ $? -gt 0 ]; then
echo "Failed to send SMS: $RESPONSE"
exit 1
fi