Following on the first part of the Blync hack, I want to be able to control the color from a terminal.
Blync
There is funny little usb gadget called the Blync identified by VID: 0x1130, PID: 0x0001.
It's a glowing RGB cube, but it has two defects for me:
- the driver is only available for Windows
- only 7 colors are available
Let's fix it.
Pretty Check
Code
#!/bin/sh
function prettycheck {
local TPUT='tput'
local RED='1'
local GREEN='2'
local BLUE='4'
#man 5 terminfo
[ ! -f $(which $TPUT) ] && TPUT=true
cmd="$@"
echo "$> $cmd"
$TPUT cuf $((`$TPUT cols` - 8)) # move the end-of-line minus 8 cols
$TPUT cuu 1 # move on line up
msgerr=$($cmd 2>&1 1> /dev/null)
if [ "$?" -ne 0 ]; then
$TPUT setaf $RED # change front color
echo "[FAILED]"
$TPUT setaf $BLUE # change front color
echo "$msgerr"
else
$TPUT setaf $GREEN # change front color
echo "[ OK ]"
fi
$TPUT reset
}
Close Encounters of the Third kind
Re, Mi, Do, Do, Sol
beep -l 500 -f 392 -n -l 500 -f 440 -n -l 500 -f 349.2 -n -l 500 -f 174.6 -n -l 500 -f 262.6

