Custom error pages in CodeIgniter

September 27, 2016

The simplest way to create custom error pages is to edit the files at /application/views/errors/html/error_*.php such as error_404.php (for 404s), error_db.php (for database errors) and error_general.php (for most other errors).

Read More

Deleting remote git tags

September 12, 2016

A reminder for when you really want to destroy a whole bunch of stuff...

Find out what tags you have locally:

david$ git tag

Delete them all:

david$ git tag -d v1.0.0 v1.0.1 v1.1.0

Push all those deletes to the remote system:

david$ git push origin :refs/tags/v1.0.0 :refs/tags/v1.0.1 :refs/tags/v1.1.0

That's it. Destruction complete.

Read More

How to join multiple mp4 files together using ffmpeg on OS X

April 11, 2016

Sometimes I need to concatenate several mp4 files together. ffmpeg is a good tool for this job.

On OSX, it's easy to install using Homebrew:

brew install ffmpeg

If you have MP4 files, these could be losslessly concatenated by first transcoding them to mpeg transport streams.
Source –

Say we have 2 mp4 files to concatenate or join together, first we transcode each of these into an intermediate format:

ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts

After that we can concatenate these together using the following:

ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

For more files, just pipe separate the additional files here:

Read More

IBM Connect 2016: 1402 - Getting Technically Cozy with IBM Connections Cloud APIs and App Dev

February 9, 2016

Last week, whilst at IBM Connect 2016 in Orlando, Florida, I gave a presentation with Patrick Li from AppFusions. The slides from the presentation are below:

The full code examples from the presentation are hosted on GitHub here:

Read More

Adding styles to the Confluence editor

November 25, 2015

I've tried to add styles to the Confluence editor. It wouldn't take them. Perhaps one of Atlassian's values is "Don't f@@k the editor".

<web-resource name="editor-scripts" key="editor-scripts">
<resource name="editor-templates.js" type="download"
location="assets/js/editor-templates.js" />
<!-- // TODO: Check whether I need a context here -->

<web-resource name="editor-styles" key="editor-styles">
<resource name="css/confluence-editor.css" type="download"

<!-- // TODO: Check whether I need all the dependencies here --> </web-resource>

My confluence-editor.css styles just wouldn't be accepted. Javascript injection worked just fine though. Perhaps I could use JS to inject my styles?

Yup. Adding this to my editor-templates.js file worked a treat:

var editorCss = AJS.params.staticResourceUrlPrefix
+ '/download/resources/me.davidsimpson.confluence.addon.awesome-addon'
+ ':editor-styles/css/confluence-editor.css';

if (AJS.params.isDevMode) {
editorCss = editorCss + '?_=' +;

'<link type="text/css" rel="stylesheet" href="' + editorCss + '" media="all">'

Note the cache busting timestamp for local development.

Read More

Why is my machine contacting

November 16, 2015

I've been looking at the network traffic and noticed a lot of calls from one machine to an address I'd never heard of:

Screen Shot 2015-11-16 at 00.59.42

Information on this seemed somewhat sketchy until I spotted this page on Multicast Addresses

ALL-SYSTEMS.MCAST.NET All systems on the local subnet.

What? All the machines on my local network? Really?

Pinging it confirmed this:

$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.103 ms
64 bytes from icmp_seq=0 ttl=64 time=14.788 ms
64 bytes from icmp_seq=0 ttl=64 time=239.376 ms
64 bytes from icmp_seq=0 ttl=64 time=256.191 ms
64 bytes from icmp_seq=1 ttl=64 time=50.762 ms

The machine accessing is running a DLNA server, so it appears to be broadcasting its presence to all the machines on the local network. Panic over.

Read More

Installing OpenWRT on a Linksys WRT1900ACS

November 14, 2015

Linksys recently released their WRT1900ACS router. Linksys said it collaborated with Marvell to ensure full open source support in the latest version of OpenWrt's Chaos Calmer release (15.05) at launch. I've not seen many OpenWRT compatible routers on the market in the UK, so my interest was piqued. It seems like a decent (though expensive) router, so I thought I'd give it a go and install OpenWRT.

The WRT1900ACS page on the OpenWRT wiki was a little vague about which version of the firmware to install, but stated that the router had Marvell Armada 385 & Shelby hardware, so I used the openwrt-mvebu-armada-385-linksys-shelby-squashfs-factory.img image to flash the firmware. This worked, so I've document it here for others.

This merely documents what worked for me. If you brick your router following these instructions, I'm sorry, but you do so at your own risk.

Installing OpenWRT

Download the OpenWRT firmware: openwrt-mvebu-armada-385-linksys-shelby-squashfs-factory.img

Connect to the router with the supplied network cable.

Login to The password is admin. Don't use the setup wizard. Specify manual setup.

Browse to Connectivity and in Router Firmware Update click on Manual > Select File


Select the previously downloaded openwrt-mvebu-armada-385-linksys-shelby-squashfs-factor.img, then click on Start.


Click on Yes in the Unrecognized file name modal:


Click on Yes in the Update firmware modal:


Click on OK in the Reboot Router modal:


Almost immediately, you'll be able to browse to and see that OpenWrt has been installed:


It should ask you to set a password at this point. (I forgot to get a screenshot of that).

By default, the wifi is disabled, but it's really straightforward to enable and secure in the admin UI.

You'll also be able to ssh into your router. This is where the fun begins...


Secure your internet access with a VPN

The next sensible step is to setup your VPN connection. I use Private Internet Access as my VPN provider, so my VPN setup is tailored to PIA. This is incredibly easy to configure, thanks to previous work by Logan Marchione and Andrew Brereton.

Follow the script and you'll be done in a couple of minutes.

Reboot nightly

Sometimes it's best to just restart regularly. Here's how:

Start & enable cron as it's not enabled by default.

/etc/init.d/cron start
/etc/init.d/cron enable

Add this line to the crontab to reboot every day at 3am:

0 3 * * * * reboot

Save your eyes, enable the Bootstrap theme

One last thing, go into System | System | Language and Styles and enable the Bootstrap theme. It means that your admin UI is no longer an eyesore.

It turns this:

Screen Shot 2015-11-16 at 00.30.14

Into this:

Screen Shot 2015-11-16 at 00.32.48

Read More

Older posts