My Setup

I’ve been maintaining an up to date list of what hardware and software I use since I discovered Uses This a few years ago. It usually lives as a page on this blog, but as I’ve rewritten 95% of it today then I think it deserves to be a blog post.

The hardware I use

Work – Surface Pro 4, with a Targus dock, two generic monitors and a Microsoft keyboard and mouse.

Home – A setup that looks superficially the same as work, but is older, has more cables, and has an excellent solar powered keyboard that is far superior to the Microsoft one I use at work. It also replaces the Surface Pro with a proper laptop, and adds a server with lots of memory that runs my (internal) WordPress sites and contains a backup of all my music. I also have a variety of small laptops and Raspberry Pis that fulfill various server and media functions, and a Synology NAS for backups. I’m trying to phase out a lot of my older computers and only use newer machines with SSDs and lots of memory, but it’s hard to let go sometimes.

Work from home – As home, but with an additional VM that allows me to connect to a remote desktop. Sometimes I’ll plug the Surface in, but that is only required for certain types of work and it’s far from my default setup now.

Travel – Chromebook, Raspberry Pi Zero, iPad (sometimes), Kindle and phone. Sometimes I’ll travel with my laptop, but that is rare. I also carry bootable USB versions of Ubuntu and Tails everywhere I go (even places I don’t take a computer). Increasingly my travel hardware also includes a bike and related tools.

The software I use

At work I’m running Windows 10. It’s ok, but I would like to be able to live without it.

At home (and whilst travelling) It’s a mix of Ubuntu, iOS, LibreElec ChromeOS and Raspbian (although I also have computers running Windows 10 and Mac OS that are rarely switched on now). Some of this is the legacy of spending the first half of 2018 trying to live with each main desktop OS for at least a month, which I must get round to writing up properly soon.

I use Firefox, Chrome and Safari on a daily basis, although Firefox has always been my main browser.

Other software I use that I feel is somewhat noteworthy includes:

WordPress – All my blogs run on WordPress, including several that are only available on my home network (including an extensive knowledge base containing all IT related things I learn). I currently maintain a WordPress multisite installation and several stand alone sites.

Evernote – I use this on every device I own (largely the web version now though), mostly to take notes in meetings and training sessions, and then to revise/reflect later. A lot of my notes are now photographs of whiteboards and other hand drawn scribbles, which Evernote handles very well.

Atom – A text editor that handles Markdown well, and can preview and export to PDF. I also use Pandoc to convert to PDF, HTML and/or .docx if required (I try not to use office software until the point I have to share what I’m working on with someone else).

Trello – I use this for my to do list, and it’s a good way to visualise the planning and execution of any task based work.

Dropbox – Cloud storage and syncing software to ensure I can access everything everywhere. I also use the text editor on the Dropbox mobile app to edit on the move.

IFTTT and Buffer – To automate as much as possible. Between them they handle a lot of the seemingly clever things in my digital life, and explain why I seem to be able to post to social media sites at times when I appear to be elsewhere.

Virtualbox – Because no-one needs as many physical computers as I had before virtualisation was a thing.

Spotify for discovering new music, and Rhythmbox for playing the music I already own.

My dream setup

Maybe I’m already living the dream, but the one thing I’d really like is to go back to doing everything on one computer (ideally running Ubuntu). That was possible 10 years ago, and I’m sad that it doesn’t seem possible today. I also yearn to live the life of a nomad, with just a bike, a change of clothes, and a tiny laptop to my name.

Testing on Ubuntu

This blog post details the installation process for Ubuntu when I’m using it for testing web applications. The builds are designed to conduct meaningful tests on Oracle cloud applications but should be suitable for testing any similar web application.

Test Build 1 (all tests)

Installation

  • Installed in a VM running in VirtualBox
  • Give the VM 4Gb of Ram, a 10Gb hard drive, and enable 3D acceleration
  • Install from ubuntu-18.04-desktop-amd64.iso
  • Minimal installation
  • Download updates
  • Don’t install 3rd party software

Post installation tasks

  • Launch gnome-terminal
  • Install all updates by typing sudo apt update && sudo apt upgrade -y
  • Reboot if required

Smoke tests

  • VM boots
  • User can log in
  • User can connect to internet
  • User can open Firefox and browse to a website

Test Build 2 (all tests that fail on Test Build 1)

  • Installed in a VM running in VirtualBox
  • Give the VM 4Gb of Ram, a 10Gb hard drive, and enable 3D acceleration
  • Install from ubuntu-18.04-desktop-amd64.iso
  • Normal installation
  • Download updates
  • Install 3rd party software

Post installation tasks

  • Launch Software & Updates
  • Under Ubuntu Software ensure that all 4 repositories are enabled (main, universe, restricted, multiverse)
  • Under Other Software enable Canonical Partners
  • Launch gnome-terminal
  • Install all updates by typing sudo apt update && sudo apt upgrade -y
  • Reboot if required
  • Install some software by typing sudo apt install ubuntu-restricted-extras adobe-flashplugin browser-plugin-freshplayer-pepperflash chromium-browser

Smoke tests

  • VM boots
  • User can log in
  • User can connect to internet
  • User can open Firefox and browse to a website
  • User can open Chromium and browse to a website
  • User can open LibreOffice Calc
  • User can open LibreOffice Writer

Setting up a Raspberry Pi media centre

A couple of years ago I built a media player using a Raspberry Pi and OpenELEC. I’ve made a few changes since I wrote that blog post (not least moving to LibreELEC), and have also made a smaller version of the same device that I use in hotels when I’m travelling.

Hardware

There are two hardware choices for this sort of project – Any model of full sized Pi, or a Pi Zero (which is more portable, but harder to get media on to).

Preinstalled SD cards can be bought directly from Pi Hut (or just buy blank ones from Amazon which is what I do).

You’ll also need a mouse (for setup), the TV you’re going to plug it into, a HDMI cable, and some way of getting media on to the device if you’re using the Pi Zero (more about that later).

For my Pi III based device I still use the same case as before, and also have small USB drives plugged into each spare USB port to give more storage. I also have it networked now to allow easier streaming from my NAS.

For my Pi Zero I use a case that I can’t find a link for now, but really anything that allows access to all the ports will be fine.

Software

LibreELEC is one of the installation options on the NOOBS image, and can also be bought preinstalled on an SD card. The first option requires an internet connection (which might be tricky on the Pi Zero), and both options require a mouse.

Once installation had finished the device boots into the default Kodi interface. A web-based remote can be accessed by browsing to the device’s IP address on port 8080, and it can be accessed as network based storage from other computers on the same network.

Full details on how to download and install later verions of the software as they become available can be found on the LibreELEC wiki.

Content

Adding content is straightforward if the device is networked. It’s simply a case of browsing to the device and copying files across, or by pointing it at a network share.

For ther Pi Zero I’ve found the best way to do this is to use a USB ethernet adaptor (mine doesn’t have wifi), but I suspect that the newer model linked to above might work on wifi which would reduce the need for a further piece of hardware.

Addons

The original plan for this project was that I’d end up with something that could play movies and music on my TV, and that could handle storing a small amount of content locally so that when I end up in a hotel room with a few hours to kill I have something interesting to watch. The solution I’ve built ticks all those boxes, but I was curious to explore what else LibreELEC could handle.

After exploring the interface and available software for a little while I found channels for Last.fm scrobbles, BBC iPlayer and TED talks. All of these installed and worked fine, and I’ve not found myself needing anything else on these devices.The larger one is used every day, and is definitely my prefered platform for interacting with iPlayer. The smaller one travels with me, and I just copy a variety of films to the internal SD card and use the one USB port for a mouse.

Building the Debian Handbook

What follows is instructions for creating a local HTML copy of the Debian Administrator’s Handbook (which is a very useful source of information for anyone working with any Debian derivative including Ubuntu and Raspian). All work related to this project was done on a Raspberry Pi Zero running Raspian, so I suspect it will work on anything running any Debian derivative (although Ubuntu 16.04 is the only other system I’ve tested this on so far).

Open up a terminal, and issue the following commands to get hold of the source code:

sudo apt install git
sudo git clone
git://anonscm.debian.org/debian-handbook/debian-handbook.git

Install the packages required for building:

sudo apt install publican publican-debian

Build the html files:

cd debian-handbook/
sudo ./build/build-html

It might take a while to build, especially on the sort of hardware I’ve been using. This might be the point to make a cup of tea.

Copy the HTML files into the root of your web server:

sudo cp -R publish/en-US/Debian/8/html/debian-handbook/ /var/www/html/

At this point you should be able to browse to the home page of the directory by navigating to the hostname or IP address of your web server.

Getting up and running with a CHIP

Tonight I finally received two CHIP boards (sort of a cross between a Raspberry Pi and a Pi Zero). I’d kickstarted these about a year ago and totally forgotten about it, so it was a nice surprise. Whenever I get my hands on something like this the first challenge is to power it up, boot an operating system, and see what it will do.

What follows is one way to get one of these devices powered up, connected to a wifi network, and with access to a graphical desktop. These instructions will work on macOS and Linux, for Windows there may be a need to consult the manual to get the relevant type of terminal access.

The only thing you’ll need (apart from the CHIP itself) is a microUSB cable. As an avid Raspberry Pi enthusiast I have quite a few of these lying about so there was no additional expense. Plug the small end of the cable into the relevant slot on the CHIP and the other end into a spare USB port on your computer. You’ll then need to see what device name your computer has assigned your CHIP by issuing the following command in a terminal window:

ls /dev/tty*

Find the output that looks something like /dev/tty.usbmodemFD1223 and make a note of it. Then issue the following command (replacing my device name with whatever yours is):

screen /dev/tty.usbmodemFD1223 115200

At that point you should get a login prompt. Log in as user chip with password chip (yes, I know). At that point you should find yourself logged into a fairly minimal Debian installation.

As yet there is no network, but as the CHIP has wifi then we can set this up fairly easily. In the logged in terminal session enter the following:

sudo nmcli device wifi connect '(your wifi network name/SSID)' password '(your wifi password)' ifname wlan0

The output should be something like:

Connection with UUID 'e9e45ce8-9961-4116-a7eb-d526e60af3ee' created and activated on device 'wlan0'

At this point you should have a network connection. Test it by doing some software updates:

sudo apt-get update && sudo apt-get upgrade

When you’re done (it might take a while) install xrdp to allow you to initiate remote desktop connections to the CHIP:

sudo apt-get install xrdp

Once that is done, create a new RDP connection using your client of choice. Find out the IP address using ifconfig or just use the name chip.local, enter the username and password, and you should see a graphical desktop with an application menu and a fair few applications.

I’ve also had some success plugging an ethernet adaptor into the CHIP’s USB port and connecting via ssh, but on most occasions the device powered down before I could do anything useful with it. This is the same setup I use with my Raspberry Pi Zero, so I know it theoretically works, but I need to investigate how much power the adaptor is drawing as it looks like the device is struggling to power it.

An updated guide to using Pandoc for document conversion

I wrote about Pandoc last year, but I’m using it more and more and I’ve found myself editing the original post a fair few times. This is the updated 2016 version that gathers together useful commands I’ve learned so far.

Last year I found myself needing to do a lot of document conversion, and maintaining documentation that needs to be available in a variety of formats (HTML, Word documents, Markdown and PDF). My tool of choice for this sort of thing is Pandoc, which is available for Windows, Mac OS X and Linux, although most of my usage so far has been on Linux and Mac OS X (it’s a command line package that can output to Dropbox, so it doesn’t matter where it runs really).

There are instructions for installing Pandoc on quite a few platforms. I’ve found that following these is generally enough, although it’s worth installing the latest version of the .deb packages rather than the one in the repositories.

On Debian/Ubuntu I also add the texlive-latex-extra package, but that’s largely because it gives me a specific Beamer theme I like to use.

If you’re using Pandoc on Mac OS X there is one more command you’ll need to issue prior to the first time you want to create a PDF file:

sudo ln -s /Library/TeX/texbin/pdflatex /usr/local/bin/

This will ensure Pandoc knows where to find pdflatex. If this step isn’t followed then you’ll likely get an error message along the lines of pandoc: pdflatex not found. pdflatex is needed for pdf output.

Pandoc works for me because I write everything in markdown, and Pandoc is great at taking markdown and converting it into almost anything else. It’s also good if you need to create a PDF, a Word document and a slide show from the same document. The syntax is fairly simple for most document types:

For example:

pandoc input.md -s -o output.docx
pandoc input.md -s -o output.html
pandoc input.md -s -o output.epub

Conversion to PDF works the same, although I’m not a fan of wide margins, so I tweak it slightly:

pandoc -V geometry:margin=1in input.md -s -o output.pdf

For a Beamer slide show you’ll need something like:

pandoc -t beamer input.md -V theme:metropolis -o output.pdf

Pandoc does a lot more, but the documentation is great, and the commands above should be enough to get you started. If you want to try out the functionality in a web browser then http://pandoc.org/try/ should be able to handle most types of conversions.

Setting up new Ubuntu machines

I’ve had to set up a few Ubuntu desktop machines recently (for my own use), and I thought it was worth documenting what I install on each one, and how I automate those installations as much as possible.

Add a script to make updating software easier

Create a new file called updateall

#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get clean -y
sudo apt-get autoclean -y
sudo apt-get autoremove -y
sudo purge-old-kernels -y

Move it to /usr/local/bin/ then make it executable with sudo chmod -X updateall.

Add some software from the Ubuntu repositories

updateall
sudo apt-get install git gimp byobu vlc ubuntu-restricted-extras build-essential hexchat openssh-server unity-tweak-tool youtube-dl

Install Spotify

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update
sudo apt-get install spotify-client

Install atom

cd Downloads
wget https://github.com/atom/atom/releases/download/v1.7.3/atom-amd64.deb
sudo dpkg -i atom-amd64.deb

The version number may be different – get the latest version from https://github.com/atom/atom/releases/.

Install dropbox

wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2015.10.28_amd64.deb
sudo dpkg -i dropbox_2015.10.28_amd64.deb

The version number will be different, but hit tab after typing dropbox and it should autocomplete. If that doesn’t work, download the latest version from https://www.dropbox.com/install?os=lnx.

Install tails-installer

wget --continue http://dl.amnesia.boum.org/tails/stable/tails-i386-2.3/tails-i386-2.3.iso
sudo add-apt-repository ppa:tails-team/tails-installer
sudo apt update
sudo apt install tails-installer   

Install pandoc

wget https://github.com/jgm/pandoc/releases/download/1.17.0.2/pandoc-1.17.0.2-1-amd64.deb
sudo dpkg -i pandoc-1.17.0.2-1-amd64.deb
sudo apt-get install texlive

See here for more on how I configure and use Pandoc, and also for a fix for a Mac OS X related bug to do with rendering PDFs.

Cosmetic tweaks

Go to System Settings --> Appearance
Change theme from Ambience –> Radiance
Reduce Launcher size to 24
Change desktop wallpaper
Enable workspaces

Open Unity Tweak Tool and configure so that hot corners work, with the top left and right corner doing a window spread (largely because that’s how my Macs are set up, and also how Gnome 3 works).

Go to System Settings --> Security and Privacy and turn off all “phone home” functionality.

Building a media centre with a Raspberry Pi and OpenELEC

My project for the Easter vacation has been to build a media player using a Raspberry Pi and Open ELEC. Setup was fairly straightforward, but I thought it was worth writing up anyway – especially as I’m probably going to make further changes to the setup as I find new features to add.

Hardware

I went with the new Raspberry Pi III, which is plenty powerful enough for this project. I also used a 16Gb SD card (the largest unused one I currently have), and a case that looked like it would handle being jostled around in my bag. The device also requires power and HDMI cables (which I already had), and a keyboard/mouse/monitor/ethernet cable for setup.

Software

OpenELEC is one of the installation options on the NOOBS image, so I simply downloaded that, copied it to the SD card, and installed it from there. It requires a network connection to install, but is a lot easier than having to copy the image using dd. I went with the default options in all cases, although it’s worth noting that if you enabled ssh access then it’s not possible to change the root password at all, so you’ll need to disable it after setup (not that setup, or anything else, requires shell access).

Once installation had finished the device booted into the default Kodi interface. A web-based remote could be accessed by browsing to the device’s IP address, and it could be accessed as network based storage from all of my computers. Then it was simply a case of dropping some media files (movies and music) into the respective folders and testing that content could be played. I copied across some MP3, MP4 and AVI files, all of which played fine.

Addons

The original plan for this project was that I’d end up with something that could play movies and music on my TV, and that could handle storing a small amount of content locally so that when I end up in a hotel room with a few hours to kill I have something interesting to watch. The solution I’ve built ticks all those boxes, but I was curious to explore what else OpenELEC could handle.

After exploring the interface and available software for a little while I found channels for Last.fm scrobbles, BBC iPlayer and TED talks. All of these installed and worked fine. Adding iPlayer started me thinking about other free to view TV channels, and at this point I remembered that the last edition of Linux Format had an article on using a Pi Mini for a similar project, and that there were instructions for adding a whole host of other services. Their instructions for adding ITV player were as follows:

Navigate to System > File Manager. Select ‘Add Source’ followed by ‘’, enter http://www.xunitytalk.me/xfinity and select ‘Done’ followed by ‘OK’. Hit Esc then choose System > Settings > Add-ons > Install from ZIP file. Select xfinity from the list of locations, select ‘XunityTalk_Repository.zip’, hit Enter and wait for it to be installed. Now select ‘Install from repository’ followed by .XunityTalk Repository > Video add-ons, scroll down and select ITV. Choose Install and it should quickly download, install and enable itself.

This worked fine, and also gave me access to a lot of other channels that I could add.

There are a lot of things I’ve not explored on this device yet, but at the time of writing I’ve got BBC and ITV channels (live and catchup), TED talks, and a variety of locally stored media. Music I play scrobbles to Last.fm, and I can drop new media onto the device from my computer. I figure that all I’ll need to travel with is a power cable, a HDMI cable and a small mouse (all of which I already have), and I should be sorted. I also tested a trick I’ve used before which involves sharing a wifi connection via ethernet on my laptop to get the two devices to talk to each other long enough to add/remove media, which might also prove useful.

Updating Ubuntu

I’ve been using Ubuntu a fair bit over the last few weeks, both at work and at home. I have a number of projects on the go, and I’ve found myself needing to maintain a few different machines (both LTS and current) to run experiments on, and to built live servers and services.

One thing I’m very big on is keeping software up to date, and I thought it was worth sharing the script I use to update my Ubuntu machines (and then to delete anything that is no longer required, like old kernels).

#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get clean -y
sudo apt-get autoclean -y
sudo apt-get autoremove -y

I create this on each machine (in a file called updateall), move it to /usr/local/bin/ and then make it executable with sudo chmod -X update all. I then run it when I want to update software (or even better, add it as a scheduled job so it runs once a day).

If I end up with many more machines I’ll need to find something more elegant, but for now this will suffice.

Building a budget computer

I’ve been meaning to set up a low-powered Linux machine for a while, but developing a new Ubuntu-based service at work made me realise that having something at home to experiment with would be useful. I wanted something with real hardware, but also something that wouldn’t use too much power or cost me too much money.

After a bit of research, I settled on a Gigabyte Brix BXBT-2807, which is a bare bones solution that requires a hard drive, memory, and an OS to complete. Amazon says that this model now costs £94.98, although with my Prime Now discount and another voucher it cost me just over £60. I chose this model because it’s got a USB3 port (as well as 2 USB 2 ports), and it outputs to both HDMI and VGA meaning I can use it with both my existing monitor and my TV. Size-wise it’s a roughly square black box that doesn’t look big enough to be a real computer, and which takes up about the same space as a Mac Mini (being much narrower but slightly taller).

I decided to make this machine as powerful as it could be, just in case I ever needed to use it to do anything more taxing than web development and a little light browsing. I already had a 128gb SSD (which would have added about £40 to the cost), but neither of the sticks of memory I had were suitable (one was too higher voltage, the other was only 2Gb and I wanted more than that). I ended up buying an 8gb stick for around £30, which maxes out this particular case as it only has one memory slot.

Assembly was straightforward, and just required a phillips screwdriver. Once I’d fitted the hard drive and memory I connected the computer to my existing monitor, plugged in a keyboard and mouse and booted it from an Ubuntu installation USB. It booted from the USB fine, and installation didn’t take too long at all. I went with 14.04 LTS because it’s what the machine at work is running, and I do enough software updates on my other machines without having something else that was on the bleeding edge.

All in all this machine is working well (and very well for the price). I needed to add a bluetooth adaptor to get my solar powered keyboard working (but I carry a couple of these with me anyway), and this computer seems incapable of connecting to a 5MHz wireless network, but these are the only two things that are sub-optimal, and are easily fixed with a bluetooth adaptor and an ethernet cable. I’m also very impressed with how fast this machine is, and even how quickly it will perform processor-intensive tasks like ripping DVDs.

So far I’ve set up a minimal Plex server on it, plus a LAMP development environment and the tools for making Ubuntu live USB installers. I’ve also used it for a couple of days for email/web browsing, and didn’t really notice that I was on a much less powerful machine.

I’m very pleased with how quick this was to set up, and it’s good to see that it’s possible to have a fully functional computer for under £150.