Sam's Blog entries for June 2012
Shell-quoting future me, printf -v "%q" is what you're looking for
Date: Friday, 15 June 2012, 12:59.
Categories: bash, shell-scripting, note-to-future-me.
Note to future me: Are you trying to remember how to shell-quote/escape the contents of a variable to avoid going utterly insane from the nested double-quotes and backslashing?
printf -v escaped_var "%q" "$var"
is the command
that you can never remember, and never find the documentation
for until you've wasted a morning of your life.
Don't forget it next time. Or at least, remember that you wrote this note, kthxbai.
Bash-itunes plugin tutorial
Date: Friday, 15 June 2012, 11:03.
Categories: bash-itunes, itunes, cli, bash, shell-scripting, apple-script, tutorial.
In v1.2.0 of bash-itunes, my project to control iTunes from the command-line, I've added plugin support for sub-commands.
This allows you, or anyone else, to add new commands to the basic script without needing to alter the script itself.
Read below the cut for details and a walkthrough of creating a new plugin.
Controlling iTunes from the command-line: bash-itunes
Date: Friday, 8 June 2012, 16:44.
Categories: bash-itunes, itunes, cli, bash, shell-scripting, apple-script.
A year or so ago I got myself a sound mixer, letting me mix the sound from all my computers into a single set of headphones and speakers. I'd been meaning to do it for years, and eventually settled on a Behringer XENYX 1002. It's a great little bit of kit, ideal for grabbing the sound from four machines and isn't too huge.
Of course, this then left me with another problem.
I tend to just play music on iTunes on my old laptop, and that means I have to physically use the old laptop if I want to skip tracks or adjust the volume, or mute, or whatever.
That's not a big deal when I'm sat at the desk, but a bit more annoying if I'm sitting back with my feet on the desk and my work laptop in my lap, comfortable and living my rockstar-developer lifestyle - leaning forwards is such a concentration-breaker.
So, uh, yeah, whatever. I found a need for controlling iTunes from the command-line over SSH. I had a look around at the existing command-line clients for iTunes and didn't really like most of them and decided to write my own.
Sad to see this in the news Author Ray Bradbury dies, aged 91.
One of the sci-fi greats, to me he was one of those authors who gave sci-fi a kick up the ass and showed that it could go in a different direction than the rut the Golden Age had got stuck in, doing so a surprising number of years before New Wave got its act together to do the same thing.
He was also often willing to challenge the artificial boundaries of genres, writing works that could be equally well classified as fantasy, horror or sci-fi; producing a seamless blend of "its all just story-telling" in the truest tradition of genreless speculative fiction.
RIP Ray Bradbury, a pioneer and inspiration to many, you will be missed.