Bash (2)

Pulling Colours From The CheerLights API on Linux

I’m trying to do a new project associated with the CheerLights project every year, and this time, I’m using a Raspberry Pi to pull the last set of colours from the ioBridge server.

I’ll be putting a full write-up about the project itself up on here soon, but I’m still waiting for a few parts for it to be complete, but the bash one-liner is handy in and of itself, so I’ll put it here for now, in case there are others who want to start a CheerLights-based thing this year.

curl | jshon -e feeds -a -e field1 -u

This handy one-liner returns a nice list of the last 25 colours set by the API.

Random Web Radio Station

To pull a random radio station from my stream list, using vlc, jshon and curl on the terminal, enter the following:

cvlc $(curl -s | jshon -e $(shuf -i 0-`curl -s | tr -cd ‘{‘ | wc -c` -n 1) -e stream -u)

It’s not terribly efficient, but what the heck, it’s only ran once per radio station 🙂