Antihistamines, general rambling

Apparently, cetirizine hydrochloride, the root chemical in a lot of common antihistamines has, this year, developed a new side effect for me. Absolute, stunning, crippling exhaustion. So. I’ve yet to try loradatine this year, but now I’m kinda scared. Gunna have to try it on a weekend, when getting crippling exhaustion doesn’t matter. Till then, yay for itchy eyes and running nose.

Annoyingly, I did something neat with Magento the other week, and meant to post about it here. I forget what it was now though :/ When you’re doing an average of 20-30 support tickets a day, these things just vanish from the head. Note to self: Write a draft in the meantime.

Setup a ProjectZomboid server for a friend. It’s running pretty well. One thing that I did run into, it seems it eats system entropy. That’s fine on a hardware server, but commonly on Virtual Machines (like the one I run most things on), entropy starvation is a thing. When that happens, the PZ server takes a very long time to start, as it’s gathering sufficient entropy for something. A quick fix is to install an entropy generator. Currently using “haveged”. Not sure how secure that is; but it’s better than everything requiring secure random numbers choking. Anyone have any preferences for entropy generation on a VM?

Let’s Encrypt!

I signed up for the closed-beta of let’s encrypt earlier, so this blog is now encrypted. So far, so good. I’d quite like to use the SSL certificate it provides in my Jabber server, but I’d need to automate renewal.. and it’s not *quite* there yet.

Let’s Encrypt’ll hit open beta soon. Looks like the only feasible way HTTPs will be supported widespread. Even with domain validated SSLs, ssls cost too much at the moment, and are too much of a hassle.

After Death (mind-dump thoughts on digital death)

So, here’s something that’s been coming to mind of late, especially with the recent death of Leonard Nimoy.

Our digital lives varnish after our death. Oh, don’t get me wrong, they’ll last a little longer than our deaths — the server this blog is hosted on for example will stay running. However, it won’t get maintained, that’s what I do, so over time it’ll get hacked, or will break. My brother might take over maintaining it for a while, but in the end, the words and thoughts stored here (some hidden from public view) will vanish. is great, it’ll keep a copy of these words for posterity.. but who’ll ever read them?

I’m not sure if I’m morbid at the moment, or it’s just depression talking, but this all feels so.. transient. These words won’t have the lasting power of those stored on a book, in the end they’re stored on media that’ll die a lot faster than a book degrades, stored correctly. Not to mention, they’re stored in a particularly complex format, that isn’t human readable in any way without the right filter and conversions.

I guess, this is really just underlining the importance of and their ilk. Not that I suppose anyone’ll care about what’s stored here.. much as the most read post here is my brother’s posts on linux beep music 😉

Rfduino Chip vs Thermometer

Well, I’ve now debugged a few issues with my scripts from my last post.
(made them a bit more fault tolerant and actually take notice of $? exit statuses) .
Recap: Temperhum (USB) -> Raspberry Pi -> Xively chart, now also
RFDuino (bluetooth wireless) -> Raspberry Pi -> Xively chart

Tip:  If you’re struggling with the bluetooth on linux giving rx timeout errors (check the syslog if it’s not in the console),
update the software with the following commands:

sudo apt-get update
sudo apt-get upgrade

The Rfduino has been sitting next to my usb Temperature and Humidity sensor for a few weeks collecting data.

RFDuino and Temperhum

Since it had been both collecting data for a few weeks and sending them to Xively / Pachube / Cosm, I had a quick look to see how closely the readings match.

Rfduino vs thermometerr

The graphs do show correlation, thank goodness, but it looks like the RFDuino’s temperature scale isn’t right. The RFDuino is only updating the graph once a minute whereas the Temperhum is 2x a minute.

I didn’t really expect great accuracy for the RFduino thermometer seeing as it’s measuring from the chip. But this would still be useful in some more basic cases.

I think next on the roadmap for the RFduino is connecting sensors/remote controls (it would be cool to attach my RelaySockets to this and control the 2 connected relays via bluetooth from my Pi and Android smartphone!


My Humidity and Temperature sensor

A Temperhum from PCSensor.

A great little bit of kit – once you work out the conversion values for the C++ USB/i2c/HID code that lets linux talk to the thing!

Getting Rfduino working with Linux


I ordered this nifty ‘RFduino’, an arduino-compatible device which was also my first ever kickstarter purchase over a year ago now.
However, when the device arrived, the company behind it seemed exclusively interested in the iPhone handset to the detriment of all other platforms.
Personally, the lock in monopolistic attitude of Apple and its customers really gets my goat, but I digress.

The lack of support and that the device arrived half a year late left me with a sour first taste of Kickstarter.

Since then, I’ve played with the Rfduino using JT’s iGear (no, I don’t know why fell into the Apple pit either) using the only app available to use the sketch it comes with – the internal thermometer

But that’s rather limiting!! I bought this device with plans to build a Wireless ‘Internet of Things’ sensor network for my house.

I have designs on talking to every platform available using protocols such as mqtt, backends like rrdtool and web interfaces for my housemates to see and control the action.

This is something I’ve been dreaming and sketching out  for years, because lets face it, who doesn’t think having the lights turn out when you leave is super cool?

So without further ado, how do we get the RFduino to talk to a linux machine, in my case a Raspberry Pi running Raspbian.



You will need

  • Internet connection to download tools
  • Bluetooth packages installed (bluez-tools)


Power on the  RFduino and linux machine. I used two Alkaline AA batteries to power the RFduino although Rechargeables do work.

Install the Bluetooth 4 usb adaptor on the linux machine
Install the necessary bluetooth programs:

sudo apt-get install bluetooth bluez bluez-utils bluez-firmware

(you may need to reboot the machine afterwards, I don’t believe I did)

Bring up the bluetooth interface:

sudo hciconfig hci0 up

Run a Low Energy scan to find the address of your RFduino:

sudo hcitool lescan

Should elicit results similar to this:
EA:BA:20:48:37:80 (unknown)
88:D8:CD:08:12:FA (unknown)
99:D8:CD:10:66:FA (unknown)
DD:AF:13:17:23:80 RFduino

Select and copy the MAC address given for the RFduino on your system.

(I have no idea why you have to scan as root, someone please leave a comment if you do, and if theres a way to run as a normal user…groups?)


Read the temperature attribute from the RFduino using gatttool. Paste your devices MAC address in instead of mine of course.

sudo gatttool –device=DD:AF:13:17:23:80 –interactive
[   ][DD:AF:13:17:23:80][LE]>
[   ][DD:AF:13:17:23:80][LE]> connect
[CON][DD:AF:13:17:23:80]][LE]>char-read-uuid 2221
handle: 0x000e value: 00 00 a8 41 00 00 00 00 00 00 00 00
[   ][DD:AF:13:17:23:80][LE]>quit

Now from that exchange with the RFduino, we have gained a long hexadecimal string.
From a post on the RFduino forum, I learned that the value we want is always after the ’00 00′ string (in bold above).
This is the temperature read from the RFduino’s internal sensor * 8.
So we need to convert this to Decimal and divide by eight to retrieve the temperature value in celsius (American readers, why aren’t you on SI units yet? :P).

Convert the hex value to decimal temperature

echo $decimal

The above method returns an integer value. This is because Bash has limitations working with numbers that are not whole (decimals).
Workarounds use the command bc to interpret string inputs as decimal numbers. I think there is a method to define variable types in bash, but I didn’t get very far with this.

My attitude is that once you start hitting the limitations of a shell scripting language, it’s time to migrate to a proper programming/interpreted language (at least python).
Spending hours and using multitudes of additional programs make it work is often pointless.

Just think, if you had to run the script on a embedded system without most of those commands, wouldn’t it just be better to do it in C++?


Next time:

Now that I’ve successfully read the values being sent by the RFDuino I need to figure out how to automate the process – in non-interactive mode.

These commands do the same thing but respond differently

sudo gatttool -b [MAC] –char-read  –handle=0x000e
Characteristic value/descriptor: 00 00 a8 41 00 00 00 00 00 00 00 00

sudo gatttool -b [MAC] –char-read –uuid=2221
handle: 0x000e   value: 00 00 a8 41 00 00 00 00 00 00 00 00

Simple bash script to read temperature in celsius (accuracy is lost here as the decimal is converted to an integer)

stringZ=$(gatttool -b [MAC] –char-read  –handle=0x000e)
echo $decimal

don’t forget:
chmod +x [whatever you called the script]

and run it as root:
sudo [whatever you called the script]


I won’t pretend to understand the naming conventions of Bluetooth 4.0/LE.
I don’t! I spent a whole day looking into it and could not find a single source that easily explained the structure, naming, and profiles. If someone has seen something good, please post in the comments!

It’s frustratingly close, like I can see there is a neat logic to it, but I just don’t care to spend any more time trying to figure it out, when all I want to do is use it. This does make it slightly more hacky and less neat and quick of course, but that’s life!



gattool commands to read the sensor:

howto convert hex to decimal on the command line:

howto do calculations on the command line:

Hacked up way of using gatttool non-interactively, using ncurses and a python script:

Bash string manipulation:


Linux Beep Music #2

So I just noticed that our beep music post has become popular enough to have been reddited, and used as a source in a video!

So thanks for that guys and girls of the interwebs! I almost feel appreciated!

In recognition, I thought I’d list our referrers, and possibly some beep music. Maybe we can become a repository for this kind of stuff.


#0 So you have a shiny new Raspberry Pi, and you want to make some noise?

You can in fact make beep music on the raspberry Pi!
All you need is a Piezo thingy (transducer or beeper or whatever it’s called)
(Available from Maplin in the UK: 3v ceramic Piezo transducer only £1.29 as of 2/2/14!!)

Thanks to Kronalias (is that a linux reference there? `alias kron=’crontab’`)?


#1 Here’s a video from smeezekitty on youtube:

From the comments: running beep music on a 486!

Yep that’s code from our last post being run!

Reminds me of this old beastie of JT’s:

IBM Thinkpad 380z
Still working in 2014! I am in fact a IBM Thinkpad 380z with a PII processor, 64mb of ram, and most inexplicably a 40GB hard drive. I also have a very loud beeper which will hurt your ear if you are next to me when it goes off. Lucky i have a volume knob.

I will definetely try all the beep codes that have been submitted in the comments so far on this awesome machine, and I promise to make a video of it if I get three more beep-songs to add to our beep music tracks. (I might even make an Album…on tape cassette [if i can find one haha], or maybe just put it onto a floppy disk if and mail it to you guys [if i can find one that works ROTFL])

#2 The redditors of the web have heard of us!

It must be true if there’s a screencap of it!

Popularity!! and i'm certainly condering repository of beep music. Probably a wiki though.
and i’m certainly condering repository of beep music. Probably a wiki though.

#3 We were linked to on Stackoverflow

I can’t be figged to give you that link or clip an image, so here’s a link to another source posted.

Ubuntuforums: What is your favourite ‘beep’ song?

#4 Bleep music in the Blogosphere: Blog post: Davidak is playing with beep music

I have no idea what he’s playing as my laptop speakers are bust! I can’t be held responsible it’s rude, honest!

Musik mit BEEP (Linux) from davidak on Vimeo.


#5 Axel Foley – Beverly Hills cop

Credit to ? Øyvind Hvidsten at Bolt Blog for his post – fun with beep
He has both the Axel Foley theme tune (listed below) and also Beethoven’s Für Elise.

beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460


#6 And finally, some beep music. From the comments on Linux Beep Music, ‘Easy Mitrontix Billing’

(I have no idea how that passed the spam filter, but I’m glad it did).
He submitted the following, including note frequencies – now I can translate any song!!!
Maybe I’ll write a bash script to automatically do that given the notes interactively.

“Mission Impossible Song.

#Note Frequency



beep -f $G -l 250
beep -f $G -l 500
beep -f $G -l 250
beep -f $G -l 250

beep -f $A1 -l 250
beep -f $C -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $F -l 250
beep -f $F1 -l 250
beep -f $G -l 500
beep -f 10 -l 500

beep -f $G -l 250
beep -f $G -l 500
beep -f $G -l 250
beep -f $G -l 250

beep -f $A1 -l 250
beep -f $C -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $G -l 250
beep -f $F -l 250
beep -f $F1 -l 250
beep -f $G -l 500
beep -f 10 -l 500



(i’ve been writing too many technical document recently!)

I couldn’t find Chop Suey in beep music, but with the work done in #3, it shouldn’t be too hard to translate!

Next time I’ll have to compose something entirely new!!