Skip to content

Instantly share code, notes, and snippets.

View CMCDragonkai's full-sized avatar
🚀
Lightspeed

CMCDragonkai

🚀
Lightspeed
View GitHub Profile
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active January 20, 2026 04:59
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active January 13, 2026 23:59
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CMCDragonkai
CMCDragonkai / nix_inputs.md
Last active January 11, 2026 09:04
Understanding Nix Inputs #nix

Understanding Nix Inputs

Every Nix derivation produces a Nix store output that has 3 things:

  • Executables
  • Libraries
  • Data

Executables are always exported using the PATH environment variable. This is pretty much automatic.

@CMCDragonkai
CMCDragonkai / free_monad_interpreter_pattern.md
Last active January 7, 2026 14:35
Haskell: Free Monad + Interpreter Pattern

Free Monad + Interpreter Pattern

It's like creating the front end and back end of a compiler inside Haskell without the need of Template Haskell!

Write your DSL AST as a Free Monad, and then interpret the monad any way you like.

The advantage is that you get to swap out your interpreter, and your main code

@CMCDragonkai
CMCDragonkai / linux-trust-root.txt
Last active December 30, 2025 08:46
Linux Trust Root
+------------------------------+
| Hardware / OS |
| (TPM/FIDO2, kernel keyring) |
+---------------+--------------+
|
v
(system services / daemons)
+----------------------+ | +------------------------+
| systemd-credentials| | | Polykey agent |
| (LoadCredential=, | | | - JWK root keys |
@CMCDragonkai
CMCDragonkai / history_data_structures.md
Last active December 26, 2025 00:22
History Data Structures

History Data Structures

For stateful applications, there are 5 different ways of managing the history of state:

  • No History - Living in the moment. - Examples: Any stateful application that doesn't discards all previous states upon mutation.
  • Ad Hoc Snapshotting - Allows restoration to manually saved snapshots. - Examples: Memento Pattern.
  • Singleton - Only remembers the previous snapshot, where undoing the undo is just another undo. - Examples: Xerox PARC Bravo.
  • 1 Stack - Allows linear undo. - Examples: AtariWriter.
  • 2 Stack - Allows linear undo and redo. - Examples: Browser History, Microsoft Word, Adobe Photoshop.
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active December 24, 2025 06:08
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@CMCDragonkai
CMCDragonkai / nix_string_and_path_concatenation.md
Last active December 15, 2025 22:44
Nix: String and Path Concatenation #nix #nixos

Nix String and Path Concatenation

From Bas van Dijk:

To understand these things I would recommend using nix-repl:

$ nix-repl
Welcome to Nix version 1.11.2. Type :? for help.
@CMCDragonkai
CMCDragonkai / wework_wifi_on_linux_with_nmcli.md
Last active December 15, 2025 08:11
WeWork WiFi on Linux with `nmcli`

WeWork WiFi on Linux

When using nmcli device wifi connect 'WeWorkWiFi' password '...', you'll get something like:

Error: Failed to add/activate new connection: Failed to determine AP security information

To actually use it, you need to create a connection first and configure it: