Advent of Code 2021: A Julia Journal - Part 2

Advent of Code 2021: A Julia Journal - Part 2

Advent of Code is an advent calendar for programming puzzles. I decided to tackle this year’s set of 50 puzzles in Julia and journal my experiences along the way. I’m a beginner in Julia so I thought this would help me improve my skills. This post covers days 9 through 16. Day 9: Bracket matching Syntax error in navigation subsystem on line: all of them I over-engineered the heck out of this puzzle.
Advent of Code 2021: A Julia Journal - Part 1

Advent of Code 2021: A Julia Journal - Part 1

Advent of Code is an advent calendar for programming puzzles. I decided to tackle this year’s set of 50 puzzles in Julia and journal my experiences along the way. I’m a beginner in Julia so I thought this would help me improve my skills. This post covers days 1 through 8. All of my solutions are available on GitHub. Day 1: Increasing sequences Count the number of times a depth measurement increases from the previous measurement
Animated Unicode Plots with Julia

Animated Unicode Plots with Julia

I love Julia’s UnicodePlots.jl, a package for making pretty, colourful plots directly in the terminal. While playing around for Advent of Code I wrote a function to animate a sequence of Unicode plots. It’s not much, but I couldn’t find anything similar on Google so I thought I’d share. The move_up helper function is the fiddly part; it moves the cursor to the start of where the plot begins so that a new plot can be printed right on top.
Serverless, On-Demand, Parametrised R Markdown Reports with AWS Lambda

Serverless, On-Demand, Parametrised R Markdown Reports with AWS Lambda

I have a URL with a colour parameter, like “https://example.com/diamonds?colour=H”. When I go to this URL in my browser, an AWS Lambda instance takes that parameter and passes it to rmarkdown::render, which knits a customised R Markdown report. My Lambda returns the knitted report as HTML, which my browser displays. If I change the parameter to “colour=G”, I get a different report, knitted on-demand. This is all serverless, so I only pay each time a report is requested (around $0.
I Tried to Improve how Metaflow Converts R to Python (and I Failed)

I Tried to Improve how Metaflow Converts R to Python (and I Failed)

Metaflow is one of my favourite R packages. Actually, it’s a Python module, but the R package provides a set of bindings for running R code through Metaflow. Recently I’ve spent a good amount of effort trying to improve the way that R data is translated to the Python side of Metaflow, but I just can’t get it to work. So I thought I’d post about what I’ve learnt. Maybe someone will have an answer.
Over-engineering an Environment Sensor with Kubernetes and Prometheus

Over-engineering an Environment Sensor with Kubernetes and Prometheus

One of the joys of keeping a personal blog is that I don’t have to justify a post. If I want to hook up 4 Raspberry Pis into a Kubernetes cluster just to monitor the humidity of my living room, then I can. And it’s pretty cool to open up a browser and go to starfleet:30001 to see this: I’ve explored Kubernetes once before, when I used it to host an R API made with Plumber.
Identifying Custom Australian Licence Plates

Identifying Custom Australian Licence Plates

In case this saves anyone some time, here’s a quick bit of regex and Python code for identifying if a given licence plate is standard or custom (personalised) in a given state. I can’t promise that this logic is correct or up to date. Some of the rules used are a bit more general than they need to be. I also tended to ignore rules before 1970. The rules come from:
Everybody Loves Raymond: Running Animal Crossing Villagers through the Google Vision API

Everybody Loves Raymond: Running Animal Crossing Villagers through the Google Vision API

Animal Crossing: New Horizons kept me sane throughout the first Melbourne COVID lockdown. Now, in lockdown 4, it seems right that I should look back at this cheerful, relaxing game and do some data stuff. I’m going to take the Animal Crossing villagers in the Tidy Tuesday Animal Crossing dataset and combine it with survey data from the Animal Crossing Portal, giving each villager a measure of popularity. I’ll use the Google Cloud Vision API to annotate each of the villager thumbnails, and with these train a a (pretty poor) model of villager popularity.
Some Dockerfiles for Building R Package Binaries

Some Dockerfiles for Building R Package Binaries

R
I went down a strange path recently, trying to compile binaries of R packages for Linux. I’m not sure why — this area is pretty much covered by the RStudio Package Manager. I’ll leave my Dockerfiles here in case they’re of any use to a future wayward R programmer. The intention here is to build a Docker image that can build an R binary with the below command. I’m trying to build x86 binaries on my ARM Macbook, so I’m specifying the platform during both build and run.
Machine Learning Workflows with Julia

Machine Learning Workflows with Julia

I have a simple machine learning workflow that I recreate whenever I’m testing something new. I take some interesting data and a target, throw in some pre-processing, tune hyperparameters with cross-validation, and train a random forest. It’s all the basic ingredients for a machine learning model. Since I like Julia so much, I’ll recreate my simple machine learning workflow with Julia’s MLJ package. MLJ is like R’s parsnip, in that it unifies many machine learning packages with disparate APIs under a single syntactic umbrella.