Pony devcontainer.json

Here’s a bare bones VS Code devcontainer.json for Pony, mostly so that I can easily copy and paste it in the future. { "name": "Pony", "image": "docker.io/ponylang/ponyc", "settings": {}, "extensions": [ "npruehs.pony" ] }

Advent of Code 2021 in Kotlin - Day 3

Day 3’s problem has us work out what the most common bit is per column concatenating them to find the gamma value. The epsilon value is the inverse. Given the following input, 00100 11110 10110 10111 10101 01111 00111 11100 10000 11001 00010 01010 we’d have a gamma of 10110 and epsilon of 01001. The result is the product of the gamma and epsilon. buildString provides a string builder as an expression, letting us yield characters and strings.

VSCode dev containers with Podman

Developing with containers is now simple with VSCode’s Remote Development extension. Any serious project where I use VSCode now has a devcontainer.json (including this blog), yet I’ve never been happy about using Docker on my personal machines. The install process is a little invasive, containers run as root by default, and I never liked the daemon running on my laptop all of the time. I recently switched my desktop and laptop from Fedora to Ubuntu, as my wife is very close to trying a Linux over Windows and I wanted to see what the state of the world was like for non-technical folk (quick summary - once setup, it’s pretty good), and with a nice clean system I wanted to see if I could avoid using Docker and do everything with Podman.

Advent of Code 2021 in Zig - Day 1

Recently on Hacker News I saw that Zig 0.9.0 was released and it rekindled my interest in this language. Besides reading the Why Zig When There is Already C++, D, and Rust? page and a few other pages from the docs I’ve never tried to use it, so instead of moving on to day 3 in Kotlin I thought I’d start again (at least for one day) in Zig. I haven’t read all the docs yet, so there’s no doubt that what I’ve come up with is not ideal.

Advent of Code 2021 in Kotlin - Day 2

It’s the 14th and I’m just writing about day 2, which is pretty much what I expected to happen. If the trajectory is linear it’s not too bad, I’ll at least be done in time for AOC 2022. Day 2’s problem has us read commands and update our position with the following rules: forward X increases the horizontal position by X units. down X increases the depth by X units.

Advent of Code 2021 in Kotlin - Day 1

Advent of Code seems to be very well put together, but I’ve never had a go before. I’ve also been meaning to learn a bit of Kotlin, so I figured I’ll put the two together. At least for one day, no promises on doing all 25. Part 1 The first problem is here. We’re given a list of depth measurements and need to work out how many measurements increase from the day before.

Insertion Sort

This implementation is pretty much straight out of the book and we’re required to use the Copy trait as a result, limiting T a great deal.

Longest Substring Without Repeating Characters in Rust

Given a string, find the length of the longest substring without repeating characters.

Two Sum in Rust

What a great example of an interview question; there are a few levels of difficulty making the problem accessible to many, a fairly obvious naive O(n2) approach with an oportunity for optimisation, and the curious will find that you can do it in O(n) as well. If I ever run another tech interview training course I’ll probably break apart and analyse this problem with the class. It is, however, quite easy and not ideal for an actual interview.

AsyncArrow - The Talk

In January 2017 I spoke at NDC London about async arrows. The video is below. Enjoy!