Skip to content

Instantly share code, notes, and snippets.

@hannes-angst
Last active February 2, 2020 11:13
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 hannes-angst/aa105dc10c4bfcddbfeb3344bfa9db94 to your computer and use it in GitHub Desktop.
Save hannes-angst/aa105dc10c4bfcddbfeb3344bfa9db94 to your computer and use it in GitHub Desktop.
Random bytes as hex
#!/bin/bash
while :
do
COLOR=`head -c3 </dev/urandom|xxd -p -u`
NOW=`date +%Y-%m-%dT%H:%M:%S%z`
echo -n "${NOW} - ${COLOR}"
mqtt_pub -t "/angst/devices/0017EF8C/led" -m '["'${COLOR}'"]'
echo
sleep 1
done
@hannes-angst
Copy link
Author

head -c3 </dev/urandom|xxd -p -u generates a 3-byte hex string for RGB LEDs.

BEEF33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment