Skip to content

Instantly share code, notes, and snippets.

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 trashpandas/34c84ac964f7e9870f704aa3c8877fa7 to your computer and use it in GitHub Desktop.
Save trashpandas/34c84ac964f7e9870f704aa3c8877fa7 to your computer and use it in GitHub Desktop.
A hands-on workaround to avoid your laptop getting stolen in a security scanning. See http://www.echeng.com/journal/2016/5/23/tsa-gave-my-macbook-pro-to-another-passenger-at-lax-and-now-its-gone
#!/bin/bash
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
}
function voice() {
echo "Locking screen now..."
sleep 1; lockscreen
sleep $1; echo "Hit Ctrl-C to interrupt the voices."
osascript -e "set Volume 10"
while :; do
# You could be creative here!
sleep 5; say -v Bell -r 50 dong dong
sleep 1; say -v Victoria -r 100 "I don't belong to you"
done
}
function volume_off() {
osascript -e "set Volume 0"
echo; echo "Turned volume off."
exit
}
trap volume_off INT
wait=$1
if [[ $# -lt 1 ]]; then wait=180; fi
echo "Caffeinated. Waiting $wait seconds then starting voice..."
caffeinate -i & voice $wait
# caffeinate doesn't always work. InsomniaX seems to interfere.
# In such a case you have to disable sleep manually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment