diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-26 12:29:47 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-12-26 12:29:47 +0800 |
| commit | 9b95f811472a15280e67f99c90c0013987b32ee2 (patch) | |
| tree | d39ab6598f164822d39e90e09c32d9434bbad547 /_log | |
| parent | 613316805da04c32b1d8088e754908ce63aed6e7 (diff) | |
| download | www-9b95f811472a15280e67f99c90c0013987b32ee2.tar.gz | |
Technical notebook style.
Diffstat (limited to '_log')
| -rw-r--r-- | _log/matrix-digital-rain.md | 52 | ||||
| -rw-r--r-- | _log/suckless-software.md | 40 |
2 files changed, 37 insertions, 55 deletions
diff --git a/_log/matrix-digital-rain.md b/_log/matrix-digital-rain.md index d3f6ab4..8512208 100644 --- a/_log/matrix-digital-rain.md +++ b/_log/matrix-digital-rain.md @@ -6,32 +6,54 @@ project: true thumbnail: thumb_sm.png --- -Fixed the Unicode issue finally. Can now mix ASCII + Katakana. +The 2022 version worked but had some loose ends. Unicode support was +inflexible--couldn't mix ASCII with Katakana; Phosphor decay was stored in a +separate array when it should've been packed with RGB; Code was harder to read +than it needed to be. <video style="max-width:100%;" controls="" poster="poster.png"> <source src="matrix.mp4" type="video/mp4"> </video> -Moved Phosphor decay level into the 4th byte of the RGB union - should’ve done -this in 2022 instead of separate array. What was I thinking. +Moved phosphor decay into the 4th byte of the RGB union--should’ve done this +in 2022. What was I thinking. -Keeping the RGB/PD union as it is. I'm aware of the portability issues, but I’m -on a little-endian machine, and I’m the only one reading this anyway. It’s -cleaner. +Keeping the RGB union despite portability concerns. All my systems are +little-endian and the code is cleaner this way. -New charset array works. UNICODE(min, max) macro packs the range into uint64. -insert_code() unpacks block and picks random char. +Fixed Unicode by introducing a charset array. UNICODE(min, max) packs Unicode +ranges into uint64--low four bytes for start, high four bytes for end. +insert_code() unpacks a random block and picks a character from it: -Full-width Katakana breaks columns. Stick to half-width (U+FF61-U+FF9F) range . -Compile with -DNOKANA to disable Katakana altogether. +``` +static uint64_t glyphs[] = { + UNICODE(0x0021, 0x007E), /* ASCII */ + UNICODE(0xFF65, 0xFF9F), /* Half-width Katakana */ +}; +``` -blend() is still good, left it alone. +Full-width Katakana breaks column alignment. Stick to half-width +(U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether. -Tossed license and automake cruft. Just `cc -O3 main.c -o matrix`. Don't need -the ceremony. +blend() simulates phosphor decay by eroding RGB channels toward +background color: -Performance regressions: none. Runs like a charm on the T490. 2% CPU. No -whirring fans. +``` +static inline void blend(matrix *mat, size_t row, size_t col) +{ + unsigned char *color = mat->rgb[index(mat, row, col)].color; + color[R] = color[R] - (color[R] - RGB_BG_RED) / DECAY_MPLIER; + color[G] = color[G] - (color[G] - RGB_BG_GRN) / DECAY_MPLIER; + color[B] = color[B] - (color[B] - RGB_BG_BLU) / DECAY_MPLIER; +} +``` + +That's still good. Leaving it alone. + +Tossed license and automake cruft. Just `cc -O3 main.c -o matrix` now. Don't +need the ceremony. + +Runs at 2-3% CPU on OpenBSD (T490). No regressions. Fans are quiet. Commit: [03f8d87](https://git.asciimx.com/matrix-digital-rain/commit/?id=03f8d87ba7c2e46bd3f3cc4c772fb3a2ac740c92) diff --git a/_log/suckless-software.md b/_log/suckless-software.md deleted file mode 100644 index 02cf88f..0000000 --- a/_log/suckless-software.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Suckless upgrade workflow -date: 2025-11-30 -layout: post ---- - -Workflow for managing suckless patches across upgrades: - -Initial setup: -- Clone from suckless -- Reset to stable tag -- Set push URL to my repo (git.asciimx.com) -- Pull from upstream, push to mine - -Config changes only: -- Edit config.h (or let make generate it) -- make clean install -- Commit, push - -dwm/slstatus installs: -- Can't replace running binaries -- Kill dwm (Mod+Shift+q) -- Switch to tty (Ctrl+Alt+F1 on OpenBSD) -- make install -- Back to X (Ctrl+Alt+F5) - -Upgrades: -- git pull --rebase -- git rebase -i to drop commits between my patch and new stable -- Keep only: my patches + new stable tag + old history -- Install, commit, push - -Example: - -Before: [my patch] -> [6.5] <br> -After pull: [my patch] -> [random commits] -> [6.6] -> [old stuff] -> [6.5] <br> -After rebase: [my patch] -> [6.6] -> [old stuff] -> [6.5] - -Note: This keeps patch history clean while staying current. - |
