profile picture

Blog

Clojure Performace and the Billion Row Challenge

January 21, 2024 - 2254 words - 12 mins
I recently discovered The One Billion Row Challenge and thought i'd give it a shot using Clojure. TLDR: the solution I ended up with is ~41% faster than the Java baseline provided by the challenge. The problem is described as: Write a Java program for retrieving temperature measurement values from … read more

Pong in ClojureScript

April 23, 2022 - 125 words - 1 mins
Click to start! I'm working predominantly with Clojure at work these days, but I wanted to spend some time with ClojureScript, so I figured making a pong clone would be a fun weekend project. Every time the ball hits a paddle it increases in speed and it's direction is set to a randomized unit v… read more

Create a Clojure AWS Lambda function in Docker and deployed via AWS SAM

October 17, 2021 - 1704 words - 9 mins
In this post I will cover using Clojure to write an AWS Lambda function that will run on a schedule of once per minute. It will be deployed via the AMS SAM CLI tool and use the Docker runtime. The complete code is available at this GitHub repo. I'll start with a simple Lambda function that just writ… read more

Cats vs Dogs - Part 3 - 99.1% Accuracy - Binary Image Classification with PyTorch and an Ensemble of ResNet Models

April 12, 2020 - 1495 words - 8 mins
In 2014 Kaggle ran a competition to determine if images contained a dog or a cat. In this series of posts we'll see how easy it is to use Keras to create a 2D convolutional neural network that potentially could have won the contest. In part 1 we used Keras to define a neural network architecture fro… read more

CHIP-8 emulator in WebAssembly using Rust

January 26, 2020 - 1017 words - 6 mins
Lately I have been working on an emulator for the CHIP-8 that can compile to WebAssembly using Rust. The source code is available on GitHub. And you can play a game of pong here. I've always wanted to write an emulator for an older hardware like the Nintendo Entertainment System or Game Boy Advance… read more

Ray Tracing with Rust and WebAssembly

January 17, 2020 - 369 words - 2 mins
I have been working through the book The Ray Tracer Challenge: A Test-Driven Guide to Your First 3D Renderer by Jamis Buck. It is a fantastic book, there is almost no code (other than a little bit of pseudocode), instead there is an explanation of how to build a Whitted ray tracer and a large numbe… read more

Cats vs Dogs - Part 2 - 98.6% Accuracy - Binary Image Classification with Keras and Transfer Learning

May 12, 2019 - 1451 words - 8 mins
In 2014 Kaggle ran a competition to determine if images contained a dog or a cat. In this series of posts we'll see how easy it is to use Keras to create a 2D convolutional neural network that potentially could have won the contest. In this post we'll see how we can fine tune a network pretrained o… read more

Cats vs Dogs - Part 1 - 92.8% Accuracy - Binary Image Classification with Keras and Deep Learning

May 07, 2019 - 1614 words - 9 mins
In 2014 Kaggle ran a competition to determine if images contained a dog or a cat. In this series of posts we'll see how easy it is to use Keras to create a 2D convolutional neural network that potentially could have won the contest. We will start with a basic neural network that is 84% accurate at p… read more

MNIST Image Classification using Deep Learning and Keras

April 21, 2019 - 1027 words - 6 mins
In this post we'll use Keras to build the hello world of machine learning, classify a number in an image from the MNIST database of handwritten digits, and achieve ~99% classification accuracy using a convolutional neural network. Much of this is inspired by the book Deep Learning with Python by Fra… read more

Ray Tracing in the Browser using ReasonML

November 23, 2018 - 150 words - 1 mins
I was reading Peter Shirley's little book Ray Tracing in One Weekend which provides code in C and for fun wanted to try to implement it in Reason. Source code is available here. Above is a pregenerated image, but you can click the button below to generate a smaller lower quality picture on demand (… read more

Drawing Tilemaps on an HTML Canvas with ReasonML

June 17, 2018 - 1277 words - 7 mins
I was curious about using Reason to draw 2D tilemaps in the browser using a Canvas element. If you need an overview of tiles, tilemaps, etc. there is a great introduction over at developer.mozilla.org. We will end up drawing this level of what could be a roguelike game, with an adventurer, monster… read more

Exploring Geospatial data in Elixir with Phoenix, D3, and PostGIS

January 28, 2016 - 1887 words - 10 mins
I noticed that Kaggle has started hosting some publicly available datasets. One of which is Ocean Ship Logbooks (1750-1850). I thought it would be interesting to visualize Captain Cook's travels on the HMS Endeavour using the Phoenix Web Framework, the D3 JavaScript library, and PostGIS. Source code… read more

Getting started with OpenGL in Elixir

January 03, 2016 - 701 words - 4 mins
I was curious about using OpenGL with Elixir and couldn't find much very information. Other than a kludge for working with constants defined in Erlang .hrl files it turned out to be not too difficult. The final result draws a triangle on the screen and looks like this: wxWidgets and Erlang Erlang/O… read more

Erlang clustering on the Raspberry Pi and BeagleBone with Elixir

December 11, 2015 - 707 words - 4 mins
I have been looking at Elixir/Erlang clustering with credit card sized computers and using the Phoenix web framework to communicate from the cluster to an Android tablet in realtime. I am pleasantly surprised at how easy it has been and how little code I had to write for this demo. In the above vid… read more

Elixir on the Raspberry Pi - Blinking an LED

December 10, 2015 - 1244 words - 7 mins
In this post we will see how to run the "Hello, World" of embedded devices, blinking an LED on a breadboard. We will be using the Elixir programming language and a Raspberry Pi. I have also written up similar instructions for the BeagleBone Black. The final result will look like this: Eli… read more

Elixir on the BeagleBone Black - Blinking an LED

December 09, 2015 - 1178 words - 6 mins
In this post we will see how to run the "Hello, World" of embedded devices, blinking an LED on a breadboard. We will be using the Elixir programming language and a BeagleBone Black. I have also written up similar instructions for the Raspberry Pi. The final result will look like this: Eli… read more

Creating an Apache Commons Daemon using Component with Clojure

October 29, 2015 - 1029 words - 6 mins
Introduction One way to write a long running server application that runs on the JVM with proper start/stop semantics is to the the Apache Commons Daemon. In this post we'll see how we can do so in Clojure and also use the Component framework to structure our application. The full source for this po… read more

Exploring Stack Exchange data with Clojure using Apache Spark and Flambo

July 07, 2015 - 1861 words - 10 mins
Introduction Apache Spark is a is a fast and general engine for large-scale data processing (as in terabytes or larger data sets), and Flambo is a Clojure DSL for working with Spark. Stack Exchange is a network of question and answer websites with a variety of topics (the most popular one being Stac… read more

Adventures in Clojure with core.async - Part 2 - Timeouts and Working with Multiple Channels via Parking and alts!

May 27, 2015 - 847 words - 5 mins
Introduction In part 1 of this series we looked at the basics of core.async via channels and messages. In part 2 we will explore timeouts and working with multiple channels using examples of calling out to web APIs. We will be using the example of a web site that wants to display weather informati… read more

Adventures in Clojure with core.async - Part 1 - Channels and Messages

April 15, 2015 - 1067 words - 6 mins
Introduction In part 1 of this series we will look at the basics of core.async via channels and messages. In part 2 we explore timeouts and working with multiple channels using examples of calling out to web APIs. core.async is a Clojure/ClojureScript library to facilitate asynchronous programming… read more

Visualizing Twitter Connections with D3 and ClojureScript

February 19, 2015 - 495 words - 3 mins
Introduction I was curious about the connections between some of the people I follow on Twitter and wanted to try visualizing it using D3 and ClojureScript using a force directed graph. The end result looks like this: force_directed_graph.core.main('/js/d3-force-directed-graph.json'); Not a lot… read more

Writing a Kafka Producer and High Level Consumer in Clojure

January 14, 2015 - 985 words - 5 mins
Introduction Kafka is a platform for handling real-time data feeds. In some ways it is like a database that exposes semantics of a messaging system. The Kafka documentation provides an excellent overview which I have provided an extract from: Kafka is a distributed, partitioned, replicated commit lo… read more

Running a Dockerized Clojure Web App on CoreOS

December 06, 2014 - 1628 words - 9 mins
Introduction In the previous post we created a Clojure web service and ran it in a Docker container. Here we will deploy that container on a 3 node CoreOS cluster running in Vagrant on a local development machine. CoreOS CoreOS is a minimal version of Linux meant for large scale server deployments. … read more

Dockerizing a Clojure, Compojure, and HTTP Kit Web Application

November 29, 2014 - 583 words - 3 mins
Docker is "an open platform for developers and sysadmins to build, ship, and run distributed applications. With Docker, developers can build any app in any language using any toolchain. Dockerized apps are completely portable and can run anywhere - colleagues’ OS X and Windows laptops, QA serve… read more

Geospatial queries with elasticsearch

October 24, 2014 - 268 words - 2 mins
Recently I was investigating the geospatial capabilities of elasticsearch for a project (in this case I am using version 1.3.4). While I ultimately ended up not using it for this project I thought I would write up an example using the command line. Create a mapping First we need to create a mapping… read more

Clojure on the BeagleBone part 4 - Digital Input with ClojureScript

October 23, 2014 - 1000 words - 5 mins
Intro In part 1 of this series we saw how to install Java and Leiningen on a BeagleBone. In part 2 we used the BeagleBone to blink an LED on a breadboard using Clojure. In part 3 we blinked an LED using ClojureScript. In part 4 we read digital inputs via polling and interrupts. The BeagleBone is a… read more

Clojure on the BeagleBone part 3 - Blinking an LED with ClojureScript

July 14, 2014 - 778 words - 4 mins
Intro In part 1 of this series we saw how to install Java and Leiningen on a BeagleBone. In part 2 we used the BeagleBone to blink an LED on a breadboard using Clojure. In part 3 we will blink an LED using ClojureScript. In part 4 we will read digital inputs via polling and interrupts. The BeagleB… read more

Clojure on the BeagleBone part 2 - Blinking an LED with Clojure

May 25, 2014 - 492 words - 3 mins
Intro In part 1 of this series we saw how to install Java and Leiningen on a BeagleBone. In part 2 we use the BeagleBone to blink an LED on a breadboard using Clojure. In part 3 we will blink an LED using ClojureScript. In part 4 we will read digital inputs via polling and interrupts. This is insp… read more

Clojure on the BeagleBone part 1 - Installing Java, Leiningen, and Emacs 24

May 24, 2014 - 568 words - 3 mins
Intro In part 1 of this series we see how to install Java and Leiningen on a BeagleBone. In part 2 we use the BeagleBone to blink an LED on a breadboard using Clojure. In part 3 we will blink an LED using ClojureScript. In part 4 we will read digital inputs via polling and interrupts. The BeagleBo… read more

Blinking an LED with the MSP430

November 06, 2013 - 206 words - 2 mins
I recently bought a MSP430 Launchpad from Texas Instruments. The MSP430 is a family of low power, low cost microcontrollers. To make sure my development environment was setup correctly I wanted to start with one of the simplest things to do, blink a LED. I have a wire connected to P1.0, another co… read more

Querying Stack Exchange database dumps with Cascalog

August 11, 2013 - 1353 words - 7 mins
Cascalog is a fully-featured data processing and querying library for Clojure. The main use cases for Cascalog are processing Big Data on top of Hadoop or doing analysis on your local computer from the Clojure REPL. Cascalog is a replacement for tools like Pig, Hive, and Cascading. We will use Cas… read more