Created
November 21, 2015 21:43
-
-
Save 2ec0b4/1abf76bc2fed60dad49f to your computer and use it in GitHub Desktop.
KITT grill visual from Knight Rider
This file contains hidden or 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 | |
vNbLights=9 | |
vWidth=3 | |
vSleep=0.5 | |
function sendRequest() { | |
nc -w0 -u lights.climagic.com 45444 <<< $1 | |
} | |
echo "Go to http://lights.climagic.com/ and start the video stream" | |
while true; do | |
read -p "Do you want to see KITT in action? [y]/n" | |
case $yn in | |
[Nn]* ) exit;; | |
* ) break;; | |
esac | |
done | |
echo "Turn off all the lights" | |
sendRequest CLEAR | |
echo "And GO" | |
sleep 1 | |
vStart=1 | |
vEnd=$(echo "$vNbLights + $vWidth" | bc) | |
while true; do | |
for i in $(seq $vStart $vEnd); | |
do | |
vPrev=$(echo "$i - $vWidth" | bc) | |
if [ $i -le $vNbLights ]; then | |
vLights="$i" | |
if [ $vPrev -gt 0 ]; then | |
vLights="$vLights$vPrev" | |
fi | |
else | |
vLights="$vPrev" | |
fi | |
sendRequest $vLights | |
sleep $vSleep | |
done | |
vTmp=$vStart | |
vStart=$vEnd | |
vEnd=$vTmp | |
sleep $vSleep | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment