Category Archives: Geeky stuff

nail (mailx) certificates

This is mostly just to remind myself what to do the next time this problem happens, but it might be useful for somebody else. If you normally read this blog for our travel adventures, you probably want to stop right now…

Read the rest of this entry »

Leave a comment

Posted by on Tuesday 24 March 2015 in Geeky stuff


Tags: , , , ,

Not quite fast enough

The next thing I needed to try was check whether the network was fast enough to watch HD content on the Raspberry Pi, direct from the NAS. These are linked via 85Mbps Homeplugs, which should be fast enough, but I don’t seem to be getting anywhere even a decent ‘real world’ speed, never mind the theoretical maximum. At the ‘client’ end, the Homeplug is plugged in to one side of a dual socket, the other side being used for an extension that provides mains power to a router, the TV, HTPC, DVD player, PS2, Wii, Freesat tuner… that lot probably generates a fair bit of noise. I’ll rearrange the connections so the Homeplug is more isolated, when I can work up the enthusiasm.

At first attempt, the video I tried to watch was stopping to buffer several times a minute; completely unwatchable. Then I realised that the old HTPC was still powered up, with a BitTorrent server running and who knows what else going on. Turning this off seemed to be enough to make the difference, bringing the occurrence of buffering down to about once every five or ten minutes. Not good enough for the all-important ‘spousal acceptance’, but I was willing to put up with it for one show.

These problems should be solved after the weekend, as there’s a set of 500AV Homeplugs turning up, which should be more than capable of providing the necessary bandwidth. And I’ll have to rearrange a load of wiring anyway, when my broadband connection gets moved to BT Infinity, so it’ll be a good opportunity to optimise the network connection.

I was also hoping to be able to use a remote control directly via the TV without needing an IR receiver, but the TV’s too old to support the necessary standard (CEC). (Sounds like a good enough reason to buy a new TV to me…) I’ve got a USB-UIRT lying around somewhere, that should do the trick…

Leave a comment

Posted by on Thursday 18 April 2013 in Geeky stuff


Tags: , , , , , , ,

It lives!

Well, that was ridiculously easy. I’ve had DVD players that were more complicated to get working than that.

I followed the straightforward instructions at the Raspbmc website to put the installer on an SD card, plugged it all together, and… magic!


The Raspberry Pi powered up and warned me to grab a coffee while it downloaded things. Raspbmc started downloading the latest versions of everything it needed, rebooted a few times to install stuff, then sat at the main configuration screen waiting for me to choose a language. It’s a good job I didn’t need a coffee, I wouldn’t have had time to get one.


Now, I’ve just got to work out how to control the thing. Took me longer to find a USB keyboard and mouse than everything else. I’ve already got it connecting to the NAS so I can play music and watch videos; photos don’t want to display for some reason, that needs further investigation.

Next steps are to play about with the network settings to get it running fast enough to watch HD content direct from the NAS, and figure out how to use an infra-red remote control (although I’ve already got it working with the Official XMBC Remote app on my Android phone, which will do for now).

Leave a comment

Posted by on Sunday 14 April 2013 in Geeky stuff


Tags: , , , , , , ,

Raspberry Pi Media Centre

Note to readers: if you normally read this blog for the things about travel to foreign parts, or stuff about cooking, you probably want to give this post a miss. Most of this is mainly intended to be a reminder of what I was trying to get working, rather than an entertaining read. You Have Been Warned.

The media centre PC in the lounge has been providing fairly faithful service for something like eight years now, but it’s getting a bit long in the tooth. I think it’s on its third hard disk, and probably fourth cooling fan, but it just hasn’t got the processing power to cope with anything more than standard resolution video, and I’d really like to be able to play HD content.

Also, I’ve recently got a NAS with some big fat hard disks, and it seemed to make sense to let this do all the work of downloading and storing content, and just have something in the lounge that would play the files without any other concerns.

Also also… I wanted an excuse to play with a Raspberry Pi, and this seemed like a good reason, and potentially a cheap solution. If it works, I can buy another one to stick in the bedroom for those times when we each want to watch something different.

The first step was to get the required hardware:

  • Raspberry Pi (obviously);
  • Suitable power supply (I’m sure I’ve got a spare USB charger lying around, but you can never have too many);
  • HDMI cable (I don’t have a spare. I’ve got lots of SCART cables now, but hardly anything uses that any more);
  • Box for the Pi (just a plain one; I’m hoping that it can just be tucked up behind the TV, out of the way);
  • SD cards (two: one for raspbmc, the other for “playing”).

This little lot arrived from RS last week (the SD cards were actually some bizarrely cheap special deal from PC World):

Doesn’t look like much, does it? You can get an idea of the scale from the charger and SD cards. I reckon you could just about fit one inside a packet of Cook’s Matches, which might make a nice ‘disguise’ for hiding one in a kitchen.

In theory, the next step is to copy the desired operating system on to the SD cards, plug it all together, and it should mostly Just Work. In practice… well, I’m not holding my breath.

Leave a comment

Posted by on Sunday 14 April 2013 in Geeky stuff


Tags: , , , , ,

So alike, yet so different

I’ve recently fallen into the world of Mac OS X. (Fallen, pushed; what is difference?)

I keep getting caught out by the little things that are just slightly different to what I’m used to in Linux.

Take the most recent example: the mail command. I had a little anacron script set up on my Ubuntu box that would generate a summary of a previously-unseen messages in a user’s Gmail spam folder, and send it to that user. (Mostly because Mrs E kept forgetting to check hers.)

While I was perusing the mail man page on Mac OS X, and reading up on various options on Google, I found that the Mac version had a useful -E switch that would allow it to quietly abort if there was no message body, saving me the hassle of having to find a recent port of moreutils so that I could use the ifne command.

The thing that got me stuck for ages was trying to find a replacement for the -a switch in the GNU/Linux version of mail, which allowed the insertion of arbitrary headers, and was useful for setting the sender to something appropriate.

Eventually, after much reading of man pages and search results, I realised that the answer had been staring me in the face for ages, I just wasn’t doing it correctly because the order of the parameters became more important:

echo Wibble | mail -s "Subject goes here" -r "<>" -F "Mail Sender"

That was harder than expected…

(Note to self: WordPress doesn’t tell you that it’s stripping out the content in angle brackets that you’ve just retyped three times…)

Leave a comment

Posted by on Tuesday 13 March 2012 in Geeky stuff


Tags: , , , ,

Make me one with everything?

I’m a little concerned about Canonical‘s decision to go for Unity over GNOME in Ubuntu 11.04; it seems like a very radical step to take, and could end up backfiring by putting off potential users for a long time.

On the other hand, if it works the way they’re hoping, it could be very successful and bring a whole new league of users to Ubuntu and, more importantly, to Linux. (As the joke says, “Change must come from within.”)

Personally, only one of my home PCs runs standard Ubuntu, and that’s running the LTS version, so I won’t see the change there until next year (by which time things might have changed). The laptops run Xubuntu, the HTPC¹ runs Mythbuntu (as of this week), and neither of those is going to start using Unity in a hurry. (Oh, and for the sake of completeness, there’s an increasingly-lonely Windows box, that gets used for my Nike+ uploads and a bit of development stuff.)

1. That reminds me, I must write something about the HTPC…

Leave a comment

Posted by on Thursday 21 April 2011 in Geeky stuff


O you are Auth-ful…

… or, how Twitter’s changes broke my nice little perl script.

The script for queuing tweets still works, but they all disappear into the void rather than getting tweeted, now that Twitter only allows external applications to connect using OAuth.

I’ve found this handy little article here that seems to suggest that it’s easy enough to do using existing modules from CPAN.

Now all I need is a set of round tuits, and we should be back in business again. I’ve got some ideas for other stuff to tweet, once I get it all working again…

Leave a comment

Posted by on Monday 13 September 2010 in Geeky stuff


Tags: , , ,

Wot no widget?

Curses. I wanted to put my Nike+ widget on my blog to show off my lowly running achievements, but doesn’t allow Flash (amongst other things).

Mind, the Nike+ website seems to be so flaky that it probably wouldn’t work half the time. Or maybe it just doesn’t like Google Chrome, or trying to run the Flash components on Linux. It’s so broken at the moment that I can’t even get to my profile page to find the correct URL to add in here somewhere. Pffft.

Edit: I’m pretty sure the problem with the Nike+ website is a combination of issues with Google Chrome (it often doesn’t render at all correctly the first time it’s loaded, whatever the operating system), exacerbated by problem with Flash on Linux. Something to investigate when I get a chance, although there are plenty of people on the Nike+ forums complaining about problems with Chrome.

Leave a comment

Posted by on Monday 1 March 2010 in Geeky stuff


Tags: , ,

Knit your own Tweets

The Perl scripts that I was fiddling about with seem to be working the way I wanted them to (even if what’s calling them isn’t always), so here they are for anybody else who wants to use them.


use DateTime;
use Sys::Hostname;

my $time = DateTime->now()->strftime("%F %T");
my $tweet = "$time\n";
my $hostname = hostname;

$tweet .= "$hostname\n";

    $tweet .= $line;

$tweet .= "%%\n";

#print $tweet


open(QUEUE,">>$tweetqueuefile") || die("Cannot open tweet queue");
print QUEUE $tweet;


use File::Copy;
use Net::Netrc;
use LWP::UserAgent;


open(QUEUE,"$tweetqueuefile") || die("Cannot open tweet queue");

# Read lines of first tweet

my $tweet;

    if($line eq "%%\n"){
        # Exit loop
    $tweet .= $line;

if($tweet != ""){
#	print "Sending tweet:\n$tweet";
    $netrc = Net::Netrc->lookup($machine);
    my $ua = LWP::UserAgent->new;
    my $req = HTTP::Request->new(POST => '');
    $req->authorization_basic($netrc->login, $netrc->password);
    my $result = $ua->request($req)->as_string;
#	print $result;


open(TEMP,">$tempfile") || die("Cannot open temporary file");

    print TEMP $line;


copy("$tempfile", "$tweetqueuefile") || die("Cannot overwrite tweet queue");

(As I’ve mentioned before, it’s a long time since I’ve written any Perl, so I’ve probably made any number of schoolboy errors. Still, they seem to do the trick.) reads from stdin to queue a tweet, and reads and sends the first tweet from the queue each time it’s called. You’ll need your credentials for in your .netrc file.

For example, I’ve got the following entries in my crontab:

# Send any pending tweets
*/5 * * * * /usr/local/bin/

# Log disk temperatures
30 */4 * * * /usr/sbin/hddtemp /dev/sda /dev/sdb | /usr/local/bin/

# Motherboard temperatures
35 */4 * * * /usr/bin/sensors | /bin/grep Temp | /usr/bin/cut -c 1-21 | /usr/local/bin/

Let me know if you use them for anything more interesting than tweeting your system temperatures, or if you’ve got any (constructive) criticisms of my Perl code…

1 Comment

Posted by on Tuesday 16 February 2010 in Geeky stuff


Tags: , ,

Perl before swine

It seems that I’ve forgotten everything I ever knew about Perl.

All I wanted to do was write a little Perl script that could be called to queue up informational tweets, and another to send queued tweets which would be called from a crontab every five minutes or so, but I’m having to look up almost every statement in the trusty Camel book. Programming, the slow way.

Update: Finally got the scripts working the way I wanted. I was going to use the Net::Twitter module, but trying to install it just resulted in errors relating to Compress::Zlib::gzopen, so it seemed easier to do things the long way round using LWP::UserAgent and HTTP::Request. Once I’ve got the scripts plugged in to my crontab and rcX.d scripts, I’ll post them here in case anybody’s trying to work out how to do the same thing.

Leave a comment

Posted by on Wednesday 3 February 2010 in Geeky stuff


Tags: , ,