Skip to main content

Elixir

Tip of my Dictionary

A “20 Questions”-type game implemented on the Pimoroni Picosystem - a Raspberry Pi Pico packaged like a tiny game console. I got some inspiration from the original patent, prototyped the system in an Elixir Livebook and implemented the game itself in C++. The livebook stores the bulk of its data on an instance of CloudNativePG deployed to my home kubernetes cluster. The cluster was also useful for feeding the game logic with data - I obtained the reference answers by querying a local Ollama instance using ollamex, which is basically an Elixir implementation of a local-model friendly LiteLLM.

Rexbug

A thin Elixir wrapper for :redbug production-friendly Erlang interactive tracing debugger. It tries to preserve :redbug’s simple and intuitive interface while making it more convenient to use by Elixir developers. nietaki/rexbug A thin Elixir wrapper for the redbug Erlang tracing debugger.

Elixir string operations seem slow (and why it's a good thing)

·1597 words·8 mins
I personally hate it when people post clickbait titles and take their sweet time getting to the point, so let’s do this first: TL;DR: Some Elixir string operations, most notably String.at/2 work in linear time, as opposed to constant time, like the intuition might suggest. This is because the String module is UTF-8 aware. UTF-8 encodes characters outside of ASCII with more than one byte, so in order to find the n-th character in a string you need to process it from the beginning, you can’t just use an offset in memory.

How to use data spanning multiple data sources in Elixir

·1199 words·6 mins
Below is a reprint of the article I wrote for the Rekki Medium page. REKKI builds tools that help people along the restaurant supply chain do their jobs better. We have a free mobile app that lets restaurants order and chat with suppliers, and a web-based tool for suppliers that helps them process orders, manage product codes and catalogues, and communicate more easily with their customers. The majority of REKKI’s backend is written in Elixir, working hand in hand with services written in Go and Node. The Elixir services handle most of what the user sees in the app like the real-time communication with the supplier and the status of the orders.

Trust issues: trouble in package paradise - Code BEAM STO 2019 talk

·65 words·1 min
Earlier this year I gave a talk at Code BEAM STO about a proposed solution to the ever more real risk of hidden malicious code in our library dependencies. You can watch the whole thing here: UPDATE: I have since dropped active development of the Hoplon project, but I hope something like it will become reality when the tech community is ready for it :)

String​.to_existing_atom​/1 is a double-edged sword

·1143 words·6 mins
I’d argue Elixir has relatively few gotchas. It’s a simple and consistent language and when you first learn it there’s only a few things that are genuinely counter-intuitive and catch you by surprise. One of the examples could be the difference between binaries and charlists and why iex sometimes seems to do weird things to your lists: iex> l = [19, 7, 16, 119, 97, 116] [19, 7, 16, 119, 97, 116] iex> Enum.drop(l, 1) [7, 16, 119, 97, 116] iex> Enum.drop(l, 2) [16, 119, 97, 116] iex> Enum.drop(l, 3) 'wat' One of the other ones comes when you start working with atoms and get a little too trigger-happy with them. What you could hear from your more experienced teammates is something like this:

I'm stealing API keys from your site

·132 words·1 min
Earlier this year I presented my latest project - Hoplon - at the London Elixir meetup. I’m thinking of putting some more work into it over Christmas, so I figured I might gather the materials about it in one place: Hoplon is an Elixir developer tool that helps you validate your dependencies contain no hidden malicious code. Motivated by horror stories from the JavaScript community such as this hypothetical one and this very real one.

Introducing Rexbug - tracing on the shoulders of giants

·76 words·1 min
Towards the end of November I gave a flash talk at the London Elixir Meetup. This time I was talking about the journey from println debugging to proper tracing and bringing Erlang tools to Elixir programmers. You can watch the talk here: …and here are the slides: The resulting Rexbug project is ready to be used but there’s still some issues I could use some help on - some should even be suitable for Elixir beginners.

Crawlie - Elixir London Meetup presentation

·283 words·2 mins
Last year, I saw José Valim give his keynote at the ElixirLive conference in Warsaw, where he talked about the motivation for his new Elixir libraries: GenStage and Flow. Even though I heard about those before, it was the keynote when I “got” what the libraries were good for and why they were neat - and I decided to play around with them.