Skip to main content

Low-level · Systems · Security

Bare-metal knowledge, minus the boring parts.

Hands-on deep dives into Assembly, C/C++, parallel programming, eBPF and security. Packed with detail, written so you don't tune out halfway through.

// blog

Latest articles

Deep dives, primers and the occasional rabbit hole.

NeoVim: reconfigured, reworked and re-headached

 Remember my Neovim quickstart guide ? The one with 18 plugins, a Lua file called init.lua that wasn't actually the init file, and a <C-f> mapping to FZF that I, a professional, never installed? Yeah. Neovim 0.12 came out and made about two thirds of that config obsolete. So this post does four things: it revisits what changed, reconfigures everything from scratch, reworks half my plugins into built-in features, and, naturally, re-headaches me in the process. I kept count. You'll see. Neovim 0.12 ships a plugin manager , as-you-type completion , a one-liner LSP setup , an undo tree , a diff tool and a decent statusline out of the box. My config went from 18 plugins to 3 , and it does more than before. The whole thing is below, tested on Neovim 0.12, ready for you to steal. Every red box titled Re-headache is a wall I hit while testing it, so you don't have to. Revisited: what on earth changed?  Short answer: Neovim kept eating plugins. Long...

An OpenMP primer

A preface  Some time ago I started tinkering with OpenMP and forming a rough idea of how it worked when I discovered something that caught my eye. Of course, I tweeted it in a thread without missing a beat. 🧵 (1/6) I just made an interesting discovery in #OpenMP that, if you think about it, it makes total sense. So, if you parallelize a loop, it's actually slower than making it sequential: pic.twitter.com/CJCu4c3Agb — Mr. RattleBrain (@Mr_RattleBrain) November 24, 2024  A quick discovery I made: using a directive (I'll explain this in time) called #pragma omp parallel for can sometimes be less efficient than running a loop sequentially. Instead, there’s another directive we should be using, #pragma omp for , which works as expected for parallelizing this particular case.  Now, this isn’t some obscure revelation I stumbled upon at 3 a.m. while sipping cold coffee. It’s ( should be ) actually pretty common knowledge for anyone who works with OpenMP regularly—or e...

NASM: A Stack to rule them all

Introduction  Merry Crhistmas my fellow nerds! Here's my gift to you, I hope you enjoy. If you recall, in the last post, Your first NASM program we learned a very few basic concepts about Assembly like interruptions, codes and the role of some registers when executing an interruption. Well, interruptions are very common in this kind of programming. They basically tell the CPU to stop everything, shout to the operating system for help, and wait for a task to be done. Want to print text to the screen? You’re going to need an interruption. Need to read from a file? Time for another system interruption  The thing is, these interrupts aren’t the only way to modify the execution flow. You have two more tools in your toolbelt: functions and procedures . These are essentially two fancy names for the same concept. Both are ways of altering the regular flow of execution, and both can take in parameters and perform operations that you code. The main difference is that functions return ...

Your First NASM Program

Previously on NASM...   Some time ago I posted a blog entry called A Gentle Introduction to NASM: Why and How to Get Started where I explained why I think NASM is so cool and some of the best parts of learning Assembly language. Since my laptop runs on an Intel i5 Coffee Lake, the ISA I use is x86. I explained this in more detail in said post. All this basically means that NASM is a really nice option to get started with this and that it's how I'll be showcasing the basics of x86 Assembly.   I'm well aware that this architecture is falling behind in recent times due to events such as the Rebirth of ARM (which might be a later post) and the even more recent RISC V release. In case you are interested in reading about this, I'll link this RISC V post , where you can dive a bit deeper on this new ISA.   So if it's becoming outdated, why is it I choose it to teach you? Because it's powerful, mainly. It's relatively easy to grasp and still, a high percentag...

Neovim Quckstart Guide

Introduction   In the previous post we talked about how to set up Vim quickly so you could start doing some real work, instead of wasting time configuring it. Now it's time for Neovim. I said before that this is the editor I use the most of them all for a variety of reasons. One of the main ones is that Neovim is compatible with Lua, which allows you to script how you want it to behave more easily. This could also be done in Vim, to an extent with its language Vimscript . Neovim is also compatible with Vimscript, but Lua is still a much more modern approach and more powerful.  Another major advantage of NeoVim is its focus on performance and extensibility. NeoVim has been designed to be more efficient with memory and faster in execution , which is particularly noticeable when working with large files or multiple plugins. The built-in plugin manager and the ability to asynchronously execute commands mean that your editing experience remains smooth, even when performing comple...