Ayke van Laethem

Fast antialiased polygon scanline rendering

This post describes a fast algorithm for rendering polygons on slow hardware, and gives an intuitive explanation as to how it works. The algorithm was originally based on the A-buffer algorithm but modified to work better on modern microcontrollers.

TinyGo Preview - how does it work?

I've updated play.tinygo.org to more accurately simulate hardware, and now also brought this feature to VS Code. But how does it work?

What's the int type?

The int type is present in many programming languages, but their meaning varies. Unlike what many people think, it only indirectly related to pointer size or architecture word size.

Optimizing constant bitshifts on AVR

The AVR architecture does not natively support arbitrary bit shifts. Therefore, compilers will have to be creative to make shifts short and fast. This post explores how a compiler could emit such constant shifts inline.

Garbage collection in TinyGo

An explanation of how garbage collectors work including some pseudocode how a real GC could be implemented.

What RGB and sRGB mean

What RGB really means, what sRGB and gamma are and how to correctly blend colors.

DMA on the SAMD21

How to configure DMA on the SAMD21, for example to use it with SPI.

How the TinyGo playground simulates hardware

The TinyGo playground simulates real hardware, including an e-paper display. How can it do such things? This post explains a bit about how the playground works to make this possible.

LLVM from a Go perspective

A high-level overview of LLVM IR, showing how two simple Go functions can be translated to IR.

Goroutines in TinyGo

TinyGo uses LLVM coroutines to implement goroutines. This post explains what coroutines are and how they're used to implement goroutines.

Interfaces in TinyGo

How TinyGo implements Go interfaces in a radically different way, avoiding most memory allocations and reducing code size.

Defer is complicated

The defer keyword in Go does much more than you might think, leading to performance issues in some cases. Why is this?

Internals of the MBR in Nordic SoftDevices

Nordic BLE chips contain a proprietary SoftDevice implementing the BLE stack. In this post, I will explain how the MBR region works and how to write your own.

Using PvGrub2 on Debian

Using pvgrub2 on Debian is very easy, and there is a little bit of documentation on the 'net, but not enough to cover all needs. I had to do some workarounds to enable pvgrub2 with btrfs.

Enforced STARTTLS for SMTP

While STARTTLS has traditionally been very sensitive to downgrade attacks, there are now two protocols to fix this: DANE and MTA-STS. I will take a look at how they work and how they can be implemented on your own domain.

Uploading README.rst to PyPI

My experience with making a Python package and uploading it to PyPI. Sometimes, such systems aren't as sophisticated as one might expect.

Managing phone addiction

A few tips on how to track how much you're addicted to your phone and how you can manage it. I give a short overview of how habits work. Then I describe how you can track how much you use your phone and give a few tips on breaking a few of those habits.

Using Arduino on the "blue pill" STM32F103 boards

As I gave up on Rust (for now), I tried setting up the Arduino environment to work with the "blue pill" board. It turns out to be quite easy, although there were a few small issues with the setup. You'll still need a (cheap) SWD programmer, though.

Intro to Rust on the STM32

How to write a simple Rust program for the STM32 "blue pill" board that's sold on AliExpress and Ebay for about $2. It turns out to be not too difficult.

Using AddressSanitizer and Valgrind on Android recovery

How to use memory checking tools inside an Android recovery to detect things like buffer overflows. A recovery system like TWRP is quite different from a normal Android image, so the official guides apply only partially and it needs some manual work to make these tools work. Here's how I did it.

Flashing the HM-10 firmware on a JDY-08

Use CCLoader to flash the official HM-10 firmware on a cheap Chinese JDY-08 device. Unfortunately, the process doesn't result in a working device, but at least I got somewhere.

Using the JDY-08 module

A look at the JDY-08, a cheap BLE module found on the online Chinese markets. It works, but it turns out that it isn't really useful with the original firmware.

Concise version vectors

Concise version vectors is the algorithm behind DTSync. It is a distributed algorithm with low memory complexity, with barely any overhead of adding another replica.

Safely Embedding JSON in JavaScript

How do you embed JSON in JavaScript? The naive approach turns out to have a XSS and DoS vulnerability, but this is easily fixed with a simple filter.

South: stateless authenticated sessions for HTTP in Go

I have written a Go package for stateless authentication using HMAC. I believe this system is in practice just as secure as session IDs without having to store state on the server, making authentication a whole lot easier.

:link and :visited are mutually exclusive

I discovered that the CSS pseudo-classes :link and :visited are mutually exclusive. This in contrast to what may seem more logical, that is, that :link applies to all links.