Skip to content

Instantly share code, notes, and snippets.

@yhancik
Last active November 24, 2017 14:14
Show Gist options
  • Save yhancik/6fd7291e6fb793bcf90bf988b65e8723 to your computer and use it in GitHub Desktop.
Save yhancik/6fd7291e6fb793bcf90bf988b65e8723 to your computer and use it in GitHub Desktop.
Script for a Raspberry Pi, checking if it's online (or more accurately if Google.com is up), says it aloud with PicoTTS
case "$(curl -s --max-time 2 -I http://google.com | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in
[23]) pico2wave -w internet.wav "Online!";;
5) pico2wave -w internet.wav "Proxy issue.";;
*) pico2wave -w internet.wav "Offline or slow?";;
esac
aplay internet.wav
#!/bin/sh -e
# Print & says the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
pico2wave -w ip.wav "My IP address is $_IP"
aplay ip.wav
fi
watch -n1 sh /home/pi/online.sh
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment