SublimeText 3 & Haskell in 9 steps

There’s seems to be a little confusion as to either what’s on offer or the capabilities of Haskell IDEs, at least according to this thread on /r/haskell. Funnily enough, there’s plenty of great choice — from Atom, Leksah to SublimeText 3 and even IntelliJ.

My current favourite is Sublime Text 3, and I’ve managed to set it up very easily using the following steps on a brand new Ubuntu VM:

* apt-get install stack cabal-install
* cabal update
* cabal install happy hsdev stylish-haskell
* install ST3
* install package control in ST3
* Restart & again if instructed
* install SublimeHaskell via Package Control within ST3
* Open SublimeHaskell preferences (Preferences -> Package Settings): insert ~/.cabal/bin in add_to_PATH and set “enable_ghc_mod”: false,
* restart ST3

Now begin coding. You should have syntax highlighting & if not, just CTRL+Shift+P and type haskell, you’ll be able to set syntax as well as access SublimeHaskell’s features. When you save, ST3 will use stack to build & then report on any errors.

Here’s proof it works!

SublimeHaskell in 2016

Stumbling across SublimeHaskell one afternoon, I was surprised to learn my favourite editor besides Vim had a Haskell plugin.

You’ll need to install haskell platform, then `cabal install hsdev` and optionally stack. Then I had to tweak the settings as follows to get it working:

    "enable_ghc_mod": true,

    "auto_complete_imports": true,

    "auto_complete_language_pragmas": true,

    "enable_auto_build": true,

    "haskell_build_tool": "stack",

    "auto_run_tests": true,

    "enable_auto_check": true,

    "enable_auto_lint": true,

    "auto_build_mode": "normal-then-warnings",

    "show_output_window": true,

    "show_error_window": true,

    "inhibit_completions": false,

    "auto_completion_popup": false,

    "ghc_opts": [],

    "enable_hsdev": true,

    "lint_check_fly": true,

    "lint_check_fly_idle": 5,

    "enable_hdevtools": false,

    "enable_hdocs": false,

    "inspect_modules": true,

I now have full error/warning highlighting inside SublimeText 3 and it’s automatic on save and quick too.

A Web front-end for Docker Registry

I’ve built a grails application for local docker registry installations. It’s called “docker registry UI” and is containerized, so simply run the following in a bash shell (assuming docker’s installed):

docker run -p 8080:8080 atcol/docker-registry-ui

and add your registry location and API version and you’re all set up! Easy deleting, viewing and searching of docker images for your local docker registry.

The code’s on Github.

Docker Desktop for JEE /Grails Development

With all the hype surrounding Docker I thought it only prudent to investigate and give it a try. Holy cow it’s awesome; here’s an example of why.

I routinely want to get a decent Grails development environment up and running, and VMs seem one way of doing so. Having a clean, fresh install can be very beneficial. Short of having several VMs, Docker gives a halfway house by means of images and reusability

So, I built my very on Docker container for that very purpose: a fresh, bleeding-edge JEE & Grails development environment comprising:

  • Oracle JDK8
  • GVM for Grails/groovy environment & SDK maanagement
  • Tomcat7
  • Ubuntu

and it’s ridiculously easy to get up and running!

Once you’ve pulled the image:

docker pull atcol/giil-tomcat-jdk8

and a little setup, you can be up and running with a spanking new environment in no time! Awesome.

The code’s on Github.

ProXPN OpenVPN Addresses

I’m a ProXPN user but found it difficult to determine what the OpenVPN hostnames/IP addresses I should use for the various locations across the world. Thankfully their quick support enumerated them:


Perhaps that’ll help others.

Bitcoin Mining with Amazon EC2

My curiosity got the better of me and I decided to start playing with Bitcoins, which inevitably led to mining and then using Amazon’s High Performance Computing EC2 instances to do the brunt of the work.

It’s actually very easy to get up and running. Once you’ve found a mining pool — e.g. Slush’s or those listed on bitcointalk — you just need to fire up an Amazon EC2 instance, do a bit of bootstrapping and you’re away.

Assuming you’ve an Amazon Web Services account, browse to to the EC2 instances dashboard and click “Launch instance”. From here you’ll need to follow the “Quick launch wizard”, reuse or create a private/public key pair, select “More Amazon Machine Images” and use the Amazon Machine Instance “starcluster-base-centos-5.4-x86_64-ebs-hvm-gpu-rc2 (ami-12b6477b)”. Make sure before completing the wizard you select the type “cg1.4xlarge”.

According to htop and free -m this is an EC2 VM with 8 cores, 21GB RAM and 2 Tesla GPUs. Easy and super fun.

Install dependencies
Once connected, there will be a few dependencies that you need to install. This EC2 instance uses CentOS and thus yum for its package (software) management.

  1. Install git: yum install git
  2. Install pyserial: pip-2.6 install pyserial

Clone the bitcoin mining tools
Now you’ll need to get hold of a couple of tools.

First up, clone poclbm, the python-2.6 mining toolset that utilises your GPU for the number crunching:

git clone

You can start running your mining against the GPUs by just running python26 -d0 http://$USERNAME:$PASS@hostname:port for the first Tesla GPU and -d1 for the second. It’s best to run those in a screen session in case you disconnect.

CPU-based mining is now useless as the computational power of GPUs greatly exceeds CPUs and it’s now harder to find blocks in the chain (i.e. successfully complete the bitcoin “proof”). Most if not all mining software now has CPU features disabled. It’s a shame as 8 cores are just sitting there doing nothing!

Automatically lock your Linux machine via bluetooth

I had a requirement to lock my laptop at work automatically without having to touch it. The way devised by a friend was to enable the screensaver and its locking mechanism every time my phone’s bluetooth was out of range i.e. could not be seen via hcitool scan. It works *really well*! Now my laptop locks whenever I leave the room.

Update: It seems this was popular with, so I’ve uploaded the script to github and added unlocking support!

Here’s the code:

DEVICE=the bluetooth MAC id
DEV_NAME="The actual device's alias/name"
INTERVAL=5 # in seconds
# Start xscreensaver if it's not already running
pgrep xscreensaver
if [ $? -eq 1 ]; then
echo "Starting xscreensaver..."
xscreensaver &
# Assumes you've already paired and trusted the device
while [ 1 ]; do
opt=`hcitool name $DEVICE`
echo $opt
if [ "$opt" = "$DEV_NAME" ]; then
echo "Device found. Not locking"
echo "Can't find device $DEVICE ($DEV_NAME); locking!"
xscreensaver-command -lock