RSSAmplifier

Blog

aarol.dev

Recent content on aarol.dev

aarol.devRSS feed ↗34 posts

Latest posts

Making `wc` 20x faster with parallel state machines

A few years back, I came across Robert Graham’s wc2 repository on GitHub. wc2 is an implementation of the Unix wc command that is significantly faster than the existing GNU and BSD wc implementations. It achieves its speed by using something called a state machine . The repo contains a nice write-up that explains some things, but doesn’t explain how the program actually works. I wrote…

HelloWorld("print")

Everyone knows the classic print("Hello World") program they might have written when they first started learning programming. Recently, I saw a meme version of it , where instead of print("Hello World") , it’s HelloWorld("print") accompanied by Elliot from Mr.Robot saying “Sometimes I dream of saving the world”. 
 




 

 
 
 

…

Building in-browser autocomplete for millions of entries with Radix Tries


 Recently, I’ve gotten hooked on the game Elite Dangerous , a space flight simulation game which contains a 1:1 scale replica of the Milky Way galaxy. In the game, players can use ships to jump between star systems, with a very limited range (usually around 80 lightyears). 
 There are around 400 million stars discovered by players. A small fraction, around 4.4 million of them, are…

Immutable releases on GitHub

I have an open source project which uses GitHub Releases as its binary distribution platform. I have a GitHub actions workflow which builds the Rust project using cargo , creates an installer and creates something called a “build provenance attestation”, which is a verifiable signature of the installer binary, created and managed by GitHub using SigStore . This can paired with a wordy…

IntelliSense in Expo native modules

I’ve recently been working on an app which uses Expo , a framework for React Native. It actually has a pretty nice developer experience, abstracting away many of the ugly parts of app development. 
 For the project, I needed to rely heavily on native APIs, like the Nearby Connections API , and found out that the best way was to create an Expo module with npx create-expo-module , which…

Faster substring search with SIMD in Zig

I’ve been learning a lot about low-level programming languages lately, and for a long time there has been one thing that has interested me: SIMD (or ‘single instruction, multiple data’) code. I’ve seen a lot of articles about having massive performance gains by utilizing SIMD and wanted to learn how to do it myself. 
 This article is a journey into implementing ~60%…

Arctis Battery Indicator

A small icon on the task bar, which displays the battery level of connected SteelSeries Arctis headphones.

Simple & type-safe localization in Rust

I wanted to reduce the number of dependencies in my Rust project, and I noticed that the rust-i18n crate has a lot of dependencies (a whopping 46 of them). Since I didn’t really have that many translations and they didn’t need any special logic, I figured that I could just write a very simple localization function myself. 
 First, I made an enum in a new file lang.rs to represent…

Using SFML3 with Zig

I recently saw a bunch of videos about simple particle simulations where there are thousands of tiny 2D balls interacting with each other, and it looked very fun! I wanted to do something very similar, but I also wanted to use Zig, a language that I haven’t used much before but is currently one of the trendiest languages around. This post is primarily about using the Zig build system to…

Programmatically generating my CV with Typst

It’s the time of year to start sending some summer job applications again. And is there a better way to procrastinate improve the job searching experience than to generate the CV from simple markup with Typst? 
 Typst is new 1 a typesetting system similar to LaTeX, but has much nicer syntax, and also it’s written in Rust!🤷 
 In this post I’ll show some basic features of…

How do HTTP servers figure out Content-Length?

Anyone who has implemented a simple HTTP 1.1 server can tell you that it is a really simple protocol. Basically, it’s a text file that has some specific rules to make parsing it easier. 
 All HTTP requests look something like this: 1 
 GET /path HTTP/1.1\r\n
 Host: aarol.dev\r\n
 Accept-Language: en,fi-FI\r\n
 Accept-Encoding: gzip, deflate\r\n
\r\n
 The first…

Testing my website for visual regressions with Playwright snapshot tests

Making changes to websites is tricky, because even small changes may lead to visual regressions in the page layout. For example, changing a bit of CSS to fix something somewhere may blow up in a completely different place. I could just click around and make sure everything looks okay, but that is boring and error-prone. What if I told you that there is a way to make sure that every pixel on your…

Creating a battery indicator app for my SteelSeries Arctis headset

Recently, the cushions of my old headset, the HyperX Cloud Stinger, were breaking apart pretty bad. I had been using them for 5+ years at that point, so it was time for an upgrade. I bought a new wireless gaming headset, the SteelSeries Arctis Nova 7 . So far, it has been great. I was expecting to feel a noticeable delay in the audio since they are wireless, but I am happy to report that with the…

aarol/reload

Go package for soft-reloading web server assets

Useful functions when doing Advent of Code in Go


 Advent of Code is an annual set of Christmas-themed computer programming challenges that follow an Advent calendar. It has been running since 2015. 
 The programming puzzles cover a variety of skill sets and skill levels and can be solved using any programming language. Participants also compete based on speed on both global and private leaderboards. 
 – Wikipedia 
 
…

Setting up a Windows Dev Drive with Go

Dev Drive is a new type of storage volume in Windows 11 that is specially made for programming workloads. Instead of the typical NTFS filesystem, it uses ReFS (Resilient File System), which is a newer filesystem based on Copy-on-Write (COW) linking. Basically, if you have two copies of a file, only one copy actually exists on the disk. The other one exists only as a link to the first one. Then,…

Generating OpenGraph images with Hugo

Have you ever shared a link somewhere and wondered where those little preview images of websites come from? Well if you didn&rsquo;t know, they are called OpenGraph tags. Open Graph protocol was invented by Facebook and is now used by many other social media sites, like X (Twitter), LinkedIn, Reddit, Discord, Mastodon and many others. &#xA; They look like this: &#xA; < head > &#xA; < meta property…

Ylioppilaskokeet

Valmistuin ylioppilaaksi keväällä 2023. Kirjoitin viisi eri ainetta, joista sain seuraavat arvosanat: &#xA; &#xA; &#xA; &#xA; Aine &#xA; Pistemäärä / Max &#xA; Arvosana &#xA; L:n pisteraja &#xA; &#xA; &#xA; &#xA; &#xA; Äidinkieli &#xA; 80 / 120 &#xA; E &#xA; 89 &#xA; &#xA; &#xA; Pitkä englanti &#xA; 271 / 299 &#xA; L &#xA; 267 &#xA; &#xA; &#xA; Pitkä matematiikka &#xA; 105 / 120 &#xA; L &#xA; 81…

Hosting Vaultwarden on fly.io for free

After Lastpass suffered a massive data breach last year, I began looking for an alternative password manager. Bitwarden is another centralized password manager like LastPass, but with the added benefit of being completely open source ! They also allow you to spin up your own Bitwarden server and connect to them with all of their clients. &#xA; Fly.io has a generous free tier, allowing up to 3…

Writing a semaphore in Go

Compared to Javascript, Python and other single threaded languages, Go takes a very different approach to &#xA; I was having difficulties understanding how concurrent Go programs are supposed to work. Coming from single-threaded event-driven languages like Dart and Javascript, it was not easy wrapping my head around things like mutexes or channels. I recently found the Little Book of Semaphores ,…

How to get rid of the annoying firewall prompt on &#39;go run&#39;

&#xA; TLDR:&#xA; # &#xA; http . ListenAndServe ( ':8080' , nil) // bad &#xA; http . ListenAndServe ( 'localhost:8080' , nil) // good &#xA; If you are using Go with Windows, you might encounter a small annoyance when running a http server. When using go run to run the server, Windows Defender will sometimes prompt you for firewall access. Here is an example of a Gin server doing it: &#xA;…

Useful shortcuts and settings in VS Code

&#xA; Shortcuts&#xA; # &#xA; &#xA; Ctrl + Shift + K : Delete current line &#xA; Alt + Down/Up : Move selected line(s) up/down &#xA; Alt + Shift + Down/Up : Duplicate selected line(s) up/down &#xA; Ctrl + D : Select next occurrence of selection (shown below) &#xA; &#xA; &#xA;&#xA;&#xA;&#xA;&#xA; &#xA;&#xA; &#xA; &#xA; &#xA;&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; Ctrl + K + Ctrl + D : Unselect the last…

Variable fonts helper

Self host variable fonts from Google Fonts

Running Stable Diffusion locally on Windows

&#xA;&#xA;&#xA;&#xA;&#xA; &#xA;&#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; &#xA; ATTENTION: there are now several forks of SD that offer web GUI&rsquo;s and can install on Windows in one click (most notably sd-webgui ). If you want to run Stable Diffusion programmatically and don&rsquo;t mind some extra steps, read on. &#xA; &#xA; &#xA; Prerequisites&#xA; # &#xA; In order to…

Building a SPA with Fly.io and Caddy

Fly.io is a cloud service that can be used to easily deploy fullstack applications on the web. You only pay for what you use, and servers can be scaled up and down easily. Fly.io supports lots of frameworks and Docker images, which will come in handy. I&rsquo;ll show how you can deploy a Caddy web server serving a single page application with a Go backend. &#xA; &#xA; Getting started&#xA; # &#xA;…

Why I can&#39;t use linux on the desktop yet

&#xA; X11 doesn&rsquo;t support monitors with variable refresh rates: When using one 60hz monitor and one 144hz monitor, the shell (Gnome, KDE etc) will run at 60hz on both monitors. Wayland might fix this, but: &#xA; Wayland is not enabled on Nvidia GPUs by default. Even if it is possible to use Wayland with the proprietary drivers, it&rsquo;s not stable enough to be the default, for example in…

Don&#39;t copyWith a ThemeData in Flutter

While reading the code of flutter apps, I&rsquo;ve seen this particular piece of code repeated way too many times: &#xA; return MaterialApp ( &#xA; theme : ThemeData.dark().copyWith(&#xA; textTheme: ...&#xA; ) , &#xA; home : ...&#xA;)&#xA; This is problematic for a couple reasons that become clear when we take a peek at how ThemeData works. &#xA; This is taken directly from the material…

Units in SpeedCrunch

There are a lot of units to remember in physics. I often make errors because I forget to multiply by something, or I&rsquo;m mixing up meters and kilometers by mistake. Wouldn&rsquo;t it be convenient to not have to worry about that and make the computer to it instead? I recently found out that SpeedCrunch , which is a fast & minimal open-source scientific calculator, happens to support units…

Getting the actual screen height in Flutter Android

The app I&rsquo;m currently building has a feature which displays a custom wallpaper on the home screen. It involves the user choosing an image from their gallery and cropping it to their device&rsquo;s aspect ratio. The app then modifies the image and sets it as the background. &#xA; There&rsquo;s just problem: How do I get the pixel dimensions of the screen? &#xA; &#xA; Screen height in…

First post

This is the first post on my website. I made this website to host anything that I want to publish. My number one goal is to write about things that atleast one person somewhere might find useful. Solutions to problems that I have encountered, guides on languages/frameworks or just something cool I want to share. &#xA; &#xA; Static site generation&#xA; # &#xA; Static site generators output plain…

Goclean

A small utility to delete folders easily

About me

&#xA; 👋 Hi, I&rsquo;m Aaro&#xA; # &#xA; I&rsquo;m a Finnish undergraduate CS student at Aalto University . &#xA; I am very interested in software architecture, performance optimizations and designing scalable, reliable software. &#xA; There are a lot of open-source projects on my Github , including reload , a Go middleware package and arctis-battery-indicator , a Windows task bar program written…

I can&#39;t stop thinking about the Tomorrow Corporation tech demo

A couple years ago I was recommended a video called &ldquo; Tomorrow Corporation Tech Demo &rdquo;. This is a 14-minute video by Allan Blomquist, a low-level programmer and one of the 3 people at indie game studio Tomorrow Corporation . In the video, he showcases the debugging tools built around their game-engine and code editor. I highly recommend watching the video yourself. It&rsquo;s one of…

Privacy policy

This app does not collect, use, store, or share any personal or sensitive user data.