OSX Fish Functions to open Chrome from the Shell

These functions are quite handy, and allow you to do things such as copy and paste errors and google for them without having to manually open a browser. You have to enclose arguments to both functions in single quotes, e.g. ‘chrome ‘http://www.google.co.uk’ and google ‘one two three four’. You should add these to your config file at ~/.config/fish/config.fish and make sure Google Chrome is already installed.

function chrome
  /usr/bin/open -a '/Applications/Google Chrome.app' $argv[1:]
function google
  /usr/bin/open -a '/Applications/Google Chrome.app' "https://www.google.co.uk/search?q=$argv[1]"

Working with Fish Shell, ffmpeg, MP4Box and sox to generate audio files

More adventures with Fish shell. I have scripted the generation of a bunch of test asset audio files in mp4 format suitable for dash streaming. I have used the audio file commandline tools ffmepg MP4Box and sox in this script, they are pretty powerful and worth installing via homebrew on OSX.

Thoughts: I think that instead of quoting you can just output $variable, which is probably better coding style. I’m still working out good way to return variables from functions, it seems that you need to echo out the output and that gets picked up by the calling function, which is a bit messy.

#!/usr/bin/env fish
# move to the asset output directory..
cd ..

# Generate .m4a file for file, and all the associated .mp4 dash assets
function generateDash
  set bitrate $argv[1]
  set input_filename $argv[2]
  set output_filename "$input_filename"-"$bitrate".m4a
  ffmpeg -i "$input_filename" -ab "$bitrate"k "$output_filename"
  MP4Box -dash 10000 "$output_filename"

# Generate 3 second sine wave in a specified bitrate at a specified frequency
function generateWav
  set bitrate $argv[1]
  set filename $argv[2]
  set frequency $argv[3]
  set wavfilename "$filename"-"$bitrate".wav
  sox -n --norm=-3 -b "$bitrate" "$wavfilename" synth 3 sine "$frequency"
  echo $wavfilename

# Main loop, generate 128,192 and 320 bitrate dashed .mp4s for 16bit and 32bit 3 second sine waves
for i in (seq 24)
  set freq (math "$i * 64.5")
  set wavfilename (generateWav 16 "output$i" "$freq")
  generateDash 128 "$wavfilename"
  generateDash 192 "$wavfilename"
  generateDash 320 "$wavfilename"
  set wavfilename (generateWav 24 "output$i" "$freq")
  generateDash 128 "$wavfilename"
  generateDash 192 "$wavfilename"
  generateDash 320 "$wavfilename"

Fish Shell Scripting

A few months ago I switched across from Bash onto the Fish shell, on my main development machine. I can’t get enough of its fast autosuggestions and its sane scripting language. Compared to Bash it is very fun to use.

Today I wrote a script to automate the backup of my development workspace onto a private bitbucket account. Bitbucket is good because it allows unlimited private repositories, but it caps the size of these repos at 2GB max, with some features disabled after 1GB. This means that I want to find out the size of my repo before automatically backing it up. This script does this:

#!/usr/bin/env fish

set size (du -sm . | awk '{print $1}')
echo "Workspace is $size MB"
if math "$size > 1000"
  echo "Workspace too big to commit!"
  echo "Workspace is under 1GB, OK to commit"

git add .
git commit -m "Automated backup"
git push origin master

Each individual directory additionally usually has its own git config which is synced to the separate repos for the code I’m actually working on. But if my development machine is stolen or somehow destroyed, or I want to quickly replicate my environment on another machine with access to the original repos, then I can regenerate the associations between the different directories. It also makes me mindful of not committing images or other video assets.

Top 5 Recommended Upgrades for your PC

I have made a lot of different upgrades and modifications to my PC, as you can see here. Some of the upgrades have made more of a difference than others though. Here is what I think you should be concentrating on, if you’re looking to upgrade.


  • Solid State Hardisk (SSD) – Solid State hard drives use flash memory instead of the moving disk platters of traditional hard disks. It is the same type of storage as your USB stick. This type of storage is a lot faster to access compared to magnetic storage. Upgrading will result in a huge performance increase for most systems if you are changing from a traditional hard disk. Get as big a size as you can afford. If you play computer games or do a lot of media production work, then the added space will be useful. They have reduced in price over the years, the first SSD I bought was £120 for 120GB SSD back in 2012, in 2015 I just bought a 250GB SSD for £50. So it’s definitely affordable now.
  • Large Monitor – If you can get a 27″-32″ monitor then do so. It has made so much difference to the day to day usage of my PC. I would recommend 1440p if you can. 1440p is half the resolution of 4K. I wouldn’t recommend a 4K monitor yet in 2015 as I don’t think they have enough software support, and the cost is considerable for a decent screen. If you’re a gamer, then you might want to aim for a higher refresh speed, but I’d say this should be a secondary consideration to the screen space. Look on TFTCentral for reviews and guides to the different screen types available.
  • Good Soundcard and Surround Sound Speaker System – Headphones are OK, but even a basic surround sound soundcard and speaker system is going to be so much better. I have a Asus Xonar Phoebus Solo which I recommend, it’s a 7.1 surround sound card. I have a cheap £60 set of surround sound speakers, Logitech Z506 Surround Sound Speakers. Surround sound really makes a difference in gaming and movies. I think it’s the seperate subwoofer that has the most effect, so if you are not that convinced by surround sound, you could get a 2.1 (two speakers and a subwoofer) setup for a bit less.
  • Ergonomic Mouse and good mousemat – Chances are, most of the time you’re at your PC, you will be using the mouse. It is therefore really important you have a good mouse that won’t damange your hand after a few years use and is comfortable to use. Modern mice use laser scanners to track the position of the mouse on a flat surface. A higher resolution laser (measured in DPI – dots per inch) means that you can get more accurate tracking. Therefore look for high DPI mice for gaming or fine detail work as well as an ergonomic fit and lots of buttons. I recommend Logitech mice, after having had several Razer mice that didn’t last very long. I would also pick up a steel mousemat, as they never get tangled up in your mouse like the fibre mousemats do.
  • Recent Graphics Card – If you are into gaming or 3D modelling work, you would often prioritise this over any other upgrade. A new graphics card means that your existing games will run faster on higher detail settings, and you can play new games on higher settings with better framerate. I don’t think it matters too much whether you go for Nvidea or AMD as long as you can run the games you want to run. If you are not interested in running the latest games, then perhaps you don’t need this, but you may be missing out in the future.

Too much Scrolling! – Tips for Dealing with Mouse-Wheel Finger Repetitive Strain Injury

Recently I had noticed I’d been having quite bad problems with my fingers based on the fact that I had been scrolling the mouse wheel too much when scrolling through web pages. Here are a number of options you can take if you are in a similar situation as me:

Change OS’s scrolling speed to its maximum

This is the easiest change on most modern OSs, and will result in less scroll movements made by your fingers, because each scroll movement will move the screen down by a full screen height, (equivalent to a page down). This can be a bit annoying though as you lose accuracy when you want to just scroll down a small amount, it takes a bit of getting used to. Also you are still using the same muscles, just not as often.

Use keyboard shortcuts for scrolling

Space and shift-space should perform scrolling up and down in Firefox and Chrome on OSX and Windows. The more you avoid using the mouse and use the keyboard, the less you will use the same muscle in your fingers each time. Of course you may develop keyboard-related RSI, but so far I haven’t been affected by this.

Change to an Ergonomic Mouse

At work I now use an ergonomic Logitch mouse which has a responsive scroll wheel, and an option to ‘unlock’ the movement of the scroll wheel, allowing it to freely spin which results in greater comfort. Before I was using a work mouse which had a scroll wheel which you had to press down very hard to get it to do anything.

Use a Touchpad

You can get freestanding touchpads for Windows and OSX, which operate like a laptop’s touchpad. This has the advantage that you can also use trackpad gestures – Windows 8 onwards and modern versions of OSX have their own sets of handy gestures for speeding up use. I recommend the Logitech T650 Wireless Touchpad for Windows 8 onwards, and the – expensive but very impressive – Apple Magic Pad 2 for OSX . You can also get the Apple Magic Pad 1 which is half the price, but the feedback and gesture support isn’t quite as good. A trackpad is not much use for gaming but for normal browsing and office use it’s fine.

Biggest Disappointment Purchases for PC – Razer Tiamat + Lightpack

As you can see, I buy a lot of bits and pieces for my PC. Occasionally though, I buy something that I feel was a disappointment, or not worth the investment. This post is meant to caution against other people making the same mistake.

Razer Tiamat – 7.1 Surround Sound Gaming Headset, with microphone (http://www.razerzone.com)


This was a big dissapointment in a couple of ways. The first, and most obvious in hindsight now I’m actually working on spatial audio for a living at BBC R&D, is that 7.1 surround sound headsets are a joke. There is no way you can get enough seperation between the different speaker drivers when your ears are so close to the speakers. If you have a soundcard or motherboard that supports surround sound, do yourself a favour and get a surround sound speaker set.

The second problem is that the Razer Tiamat has issues with electrical hum from the unshielded cables it uses. I replaced it with the ROCCAT Kave XTD 5.1 Analog surround sound headset which is better, although still not anything like the surround sound speaker setup which I now have.

Lightpack – Backlight kit with adaptive lighting for games (www.lightpack.tv)


I took a risk on this, it was a kickstarter idea which offered the promise of an ‘intelligent’ backlight which changed colours depending on what was on the screen. And it did work pretty well.. back when I was running Windows 7. Since upgrading to Windows 10, I haven’t been able to get it to work properly when playing games with Playclaw, which is my main use for it. I even had to purchase Playclaw, as the software which comes with Lightpack doesn’t work well. It still has limited use for me in terms of a colour spectrum effect for music when I throw a party, through using third-party software such as Ambibox. But the company really should improve its software to work with Windows 10 gaming. It didn’t even work well for me under Windows 8.

My Favourite OSX Apps for Development

I’ve just recently bought a Macbook Pro for myself, after having used a MBP at work for 4 years. I find it to be a really powerful development environment for the development I do, in languages such as Java, PHP, Ruby, Python and JS. Here is what I use day-to-day:

OSX El Capitan

I haven’t found anything not to like about this upgrade. I don’t use a lot of external devices, for which Bruce has found problems with El Capitan’s new restricted driver management for Arduinos and others. I like the fact I can use split screen functionality to side-by-side two windows easily, a feature that I very much like in Windows 10 too.

iTerm 2

This is an awesome terminal, better than OSX’s terminal. Nothing much more to say about it.

Fish Shell

This shell has fast and smart command-line completion which is very handy and I’d highly recommend it if you use the commandline a lot and are not totally won over by Bash. It looks nice too.


This is pretty much essential for command line OSX. It is a package manager which downloads and compiles the latest version of open source packages on your Mac. If you don’t use it already, get used to it.

IntelliJ WebStorm

WebStorm is great for debugging JavaScript applications, which I seem to be doing a lot of lately. I recommend the IntelliJ IDEA family of IDEs, once you get use to them, they are a great help in productive development. There are also vim and Emacs keybindings.


If you are a fan of vim you will know what I mean when I say I can’t be without it. My Dotfiles show my .vimrc and plugin configuration.


Thankfully the BBC has moved over to Github, meaning all my coding uses Git. It is so useful, and not just for storing code, you can store anything.


I use Apple Music, and iTunes Match, so iTunes is a must. It annoys me at times, but I just have to live with it.


Alfred is a replacement for Spotlight search in OSX. It has a lot of functionality that I’m still getting my head around, but it speeds up my OSX workflow a lot when undertaking frequent tasks such as Google searching.


Evernote is so useful for making and sharing notes on my phone, mac, work computer.. anywhere


This is something someone only recently recommended to me. It seems very useful from what I’ve seen, great way to share images files, screenshots, webcasts.. anything. Also it has as expiry policy for media, like Snapchat, so it doesn’t exist on the internet for generations to come.

Use Siri, Apple Earphones and Apple Music Together

This requires you to have a subscription to Apple Music and a 3G/4G/wireless data connection, but it is so useful! Using this tip, you can be walking along with your iPhone in your pocket and your Apple earphones in, and then change music just by pressing a button on the earphones remote control and saying ‘Play (your favourite band)’.

blog post image

1. Activate Siri and subscribe to Apple Music. I used to subscribe to Spotify so I switched to Apple Music when I realised the advantages of the integration on my phone, and the wider selection of music. You will also need to set Siri to stream music over your cellular network, this can be done in the ‘Music’ section of iOS settings.

2. Put the iPhone in your pocket with the standard Apple Earphones plugged in. With the standard Apple Earphones, there is a remote control on the cable with one button on it. To activate Siri, hold that button down for a couple of seconds until you hear the ‘Siri’ ‘bleep’.

3. Say ‘Play The Prodigy’ if you want to listen to The Prodigy, for example. This may require a couple of tries occasionally, but usually it just works.

4. Siri should look up The Prodigy on Apple Music, find their most popular songs, put them in a playlist, start streaming them and playing them through your earphones. To skip a song, press the remote control button twice in quick succession. To adjust the volume, press the edges of your remote control, the top edge to increase volume, the bottom edge to decrease. To pause all music playback, just press the remote control button once. To resume playback, press the remote control button once again.

A limitation of this is that you have to be in an area with good reception, enough to stream your tracks from Apple Music. You shouldn’t have a problem if you live in a city like Manchester, I usually get 4G across the whole city.