Skip to main content

Posts

Row a Concept2 on Zwift with a $10 Raspberry Pi!

Despite there being a clear appetite for rowing in Zwift, the reality is that a rowing machine is not a bicycle. A Concept2 rower will not connect to Zwift out of the box. The Zwift team occasionally hint at a future rowing mode, but it has been “coming soon” for years. I would not hold your breath. That said, people do row in Zwift. So how are they doing it? The key challenge is that Zwift expects to see a bicycle. To make this work, you need a way to translate data from the rower’s performance monitor, the PM5, into something Zwift recognises as a bike. This means inserting a device between the rower and the device running Zwift that can perform that translation. There are already solutions available. Some are relatively expensive, such as the NPE CABLE, which costs around £90 in the UK. Others are technically free, like the RowedBiker app. The downside with RowedBiker is that it needs to run on an additional device separate from the one running Zwift. If you already have a compati...

Precaching Moodle Theme CSS

I've run into a few issues recently with my Moodle site ( moopi.uk ) due to the amount of time it takes for Moodle to compile the CSS cache for the new default theme, Boost. For most this is may be a one off issue that will go away once the CSS is compiled for the first time. This however really affects me as my site runs on a Raspberry Pi and so is lacking the raw grunt most servers will have to take this initial hit. On moopi.uk it takes over 10 mins to run this CSS compilation and as such does not finish within my PHP max_execution time. I could just raise my timeouts above this, but this still would mean my first visitor will probably never see a page load . While this may actually be a bug  it's still very much a general problem for me running on such minimal resources. My solution is to run a CLI script to precache the Moodle CSS after an upgrade and before I leave maintenance mode. Now any downtime is graceful and CSS compilation and caching occurs without being affe...

Moodle on Centos or Red Hat 7 (with SELinux!)

Why the need for another 'Installing Moodle' guide? Two reasons, Systemd and SELinux. The steps are presented as a Bash script, which may be run on a virgin system, installing a complete working Moodle stack in one go, including enforcing SELinux. In addition to the absolute basics it also includes adding ClamAV virus for file uploads and Memcached for sessions and 'MUC'. It does not cover any extras you will need to get your site up to production, e.g. securing your database  or updating your virus definitions automatically. Neither does it do any extra PHP configuration (upload limits, execution time etc.) or any extra complexities that might be desirable. For all of this you should goto  docs.moodle.org .

Moodle on a Raspberry Pi 2 - moopi.mrverrall.co.uk

I've occasionally wondered if it was at all practical to run a small functional Moodle site using just a Raspberry Pi and whenever I've been half tempted to try I've came to the swift conclusion that the answer was most likely 'No'; and I think this is still probably the case today. We are now however in the brave new era of the Raspberry Pi 2 where we have more cpus and RAM to play with, and after my friend Moodle Fairy asked if it was at all possible or indeed worthwhile to do such a thing I decided it was time to give it a real shot and put to task my experience in optimising Moodle at work hosting a Moodle site on the decidedly lightweight Pi 2. So what is the answer? Can you run a useful Moodle on a raspberry Pi 2? Well, yes you can! And not only that I have been rather impressed with the sites overall performance which has exceed all reasonable expectations. Your average page load time is well under a second. Rather than go into more details her...

Raspberry Pi A2DP Bluetooth Audio Receiver

I wanted to use a Raspberry Pi to act as a Bluetooth audio receiver or my Hi-Fi so that I could connect a phone/tablet easily to some proper speakers wirelessly. Rather than reinventing the wheel 'kmonkey' has already achieved most of what I set out to do over here ; check this out first. The only issue now is the manual intervention needed to connect up a new Bluetooth source to the output sink. I initially created a simple bash script to poll pulseaudio (every 5 seconds) and run the necessary commands as and when a new device is connected. You can see the script here and all the pertinent commands are explained over in kmonkey's blog. This is all good, but will need to be run manually using something like, # nohup ./bt_audio_attach & This is a bit rubbish and you'll be pleased to know there is a better way to get this done, UDEV! Over at the Raspbery Pi forums   there's some discussion on using UDEV scripts to auto...

Blocking Adverts from the Roku Menu

UPDATE: 18 May 2013 - A new firmware (v5) has changed the way ads are handled on the Roku such that this guide is no longer relevant.  Roku are are a pretty neat little media streaming box but one thing that I think lets them down are the trashy and mostly irrelevant adverts on the home page. Wouldn't it be great if you could get rid of these? The ads are served by the third party ad platform,  ZEDO . You can block the ads from displaying by simply blocking this domain entirely or by being more targeted and blocking the specific sub-domain serving the Roku ads. A TCPDUMP of my Roku shows that the ad images currently come from 'd7.zedo.com' (although this may change). I block them by adding a custom DNS record for this sub-domain to my home router pointing to the loopback address (127.0.0.1). There are or course many other ways you could do this, but the best way will largely depend on your own set-up and resources.

An Exercise in Form Validation using JavaScript Prototyping

Form validation is an important part of most websites and more specifically client side validation is an important contribution to the the user experience. In the brave new world of "Web 2.0" we have access to tools like JQuery to help developers to do this sort of jazz with AJAX and the like. This however (regardless of how straight forward it actually is) is still scary and complicated for anyone not already familiar with JavaScript. The code I want to talk about here is of my own creation. I'll be the first to admit that "I am not a developer", and so the code itself may not be technically perfect, for this I make little apologies. What I set out to do is create a reusable code class; a class which can be reused to validate any form without modification or an excess of additional javascript. I also took the opportunity to tinker with 'prototyping' to take a true object orientated approach to the code; this makes it fast and hopefully easy to fo...

If you were an animal what would you be and why?

Recently I was asked to be involved in the recruitment process at my place of work and had to, with the help of two of my team members, spend half an hour interviewing prospective job candidates. Now I've had a few interviews in my time and seem mostly to do quite well in that kind of situation, but this would be my first experience on the other side of the table. I remember having read interview guides before now that had warned me to be prepared for silly questions like 'If you were an animal what would you be and why?'. So with the simple intention of using this very question as an icebreaker (and partly becaused I'd enjoy using such a cliché) we decided I could kick off with it. We weren't hoping to get anything useful out of it at all, but in hindsight the animal question proved way more valuable than I could have ever expected, not because of any in depth analysis into the answers, such as lions as leaders or any crap like that, but purely on how the inte...

Spawning many VirtualBox machines from a single VDI

What I'm taking about here is a way to have many VirtualBox machines based upon a single hard drive image. There are many reasons why you might like to do this, but the most compelling is probably saving time by not having to install an OS over and over again, especially useful if you do anything like software testing. Our goal is a single vdi (virtual disk) file which contains a vanilla installation of our favourite OS which we can then use to conjure up a fresh new machine in a jiffy. Assuming you already have VirtualBox installed our first step is (maybe for the last time ever!) to install our OS into a new virtual machine. Now I shan't go through this as it's pretty straight forward and if you're reading this it's the sort of thing you have probably done a hundred times before. One thing of note during the initial setup is the 'Virtual Hard Disk' configuration. Be sure to allocate enough space to allow for all potential applications of the image. It wou...

Cloning VMs with Multiple Snapshots in VirtualBox

I'll keep this short and sweet. I needed a way to backup a VirtualBox machine with multiple snapshots to a single detached VDI. ' VBoxManage ' is the command line tool with all the useful VirtualBox tools, and I had used its ' clonehd ' to good effect before now to clone existing VDI files. However as you may already know, when you snapshot a VirtualBox you end up with multiple VDI files; so how can we consolidate these into one VDI without having to mess around merging existing snapshots on a live service? Quite simply use the UUID of the state you wish to clone, this will create a new VDI of the associated snapshot, merged with ALL previous states... cool huh? You can get this out of the virtual disk management tool in the gui, or from the XML definition file for the machine, it'll look a bit like: c6804c54-a8ca-4829-9eaf-132f8b1dd38a So to make a spanking new single VDI for this saved state, run: $ VBoxManage clonehd c6804c54-a8ca-4829-9eaf-132f8b1dd38a MyN...

Banana Bread!

Just for a delicious change from geek speak, here is my recipe for Banana Bread (more of a cake really). 225g self raising flour ½ teaspoon salt 100g butter or margarine (unsalted) 170g soft dark brown sugar 75g raisins (or sultanas) 2 ripe bananas ½ teaspoon vanilla essence 1 egg, beaten 3 tablespoons milk (or dark rum!) Oven: 160 oC, 325 oF, Gas Mark 3 If you have time, or are prepared far enough in advance, it's extra tasty if you can soak the raisins overnight in dark rum, any rum that doesn't get adsorbed can substitute the milk in the recipe. 1)Line the bottom of a loaf tin with greaseproof paper and grease it up. 2)Put the flour and salt into a bowl, cut the butter up and add. Rub in until it resembles fine bread crumbs. 3) Stir in sugar and raisins. Mash banana with a fork (Well duh) and add to the mixture with the vanilla essence, egg and milk. Beat. 4) Put in tin. 5) Sift or sprinkle some of the dark sugar over the top of the mixture to give it a delicious sweet crisp...

Getting Debian to email with exim4 and Google Mail

There are may reasons why would might like to run a headless Debian server on your home network. I have mine primarily as as file-store, serving video, music and pictures to my Windows MCE PC (you see I'm not one of these Windows hating Linux nerds, use the right tool for the right job I say!). Being headless and tucked away in a dark corner it's important to be able to manage the system with little fuss, and I use ssh to login and administer the system remotely. The question here though is 'When do I know that I need login and do something?'. I ideally want to know asap if there are some important security updates ( apticron ), or that the raid ( mdadm ) has run into some trouble or if some important cron job has spewed some helpful output. Lucky for me is was fairly straightforward to configure the server to email my google mail (gmail) account whenever it has something important to say, and here's how I did it! I have this working on both Lenny and Squeeze. ...

USB Flash Drive Encryption

Securing data on a USB pendrive can allow you to carry around useful, yet sensitive data with very few concerns. This post outlines a way of cryptographically securing a USB pendrive using crypsetup and LUKS in such a way that a drive may be unlocked on most Linux system without the addition of extra software (e.g. TruCrypt). As an added bonus it's possible to mount the drive in a Windows environment as well. Hurrah! The first thing to decide is how you are going to partition your drive. I find it useful to have an unencrypted partition as well as the encrypted as this affords the convenience and functionality as well as offering security. The primary consideration here is that natively Widows will only recognise the first partition on the pendrive, so if you wish to have an open data partition let it be the first. Below shows how an 8GB pendrive (in this case the device is /dev/sdh) is split roughly is half with an ~4GB FAT32 partition at the front. Use you favorite partition...

Getting eduroam to work with wpa_supplicant

Having spent some not inconsiderable time trying to get my Linux based laptop to connect to the eduroam wireless network at Lancaster University I thought the nice thing to do would be to share my toils with the world. There were various other blogs and the such I drew inspiration from, but no one provided a total solution. Now if you are using a desktop manager like Gnome or KDE the built in network-manager should do most of the magic for you, however if you want a minimal setup without relying on gui tools this may be useful to you. I use a Debian derivative on my laptop as it has better hardware support for the wireless (intel 5100). I'll assume you have the necessary packages installed as that is outside the scope of this discussion (otherwise the Debian Wiki may be a good place to start). First off you'll need a wpa_supplicant configuration file, " /etc/wpa_supplicant/eduroam.conf " would seem to be the logical choice and mine looks just like this: #############...