diff options
Diffstat (limited to '_log')
| -rw-r--r-- | _log/arduino-due.md | 5 | ||||
| -rw-r--r-- | _log/e-reader.md | 6 | ||||
| -rw-r--r-- | _log/etlas.md | 6 | ||||
| -rw-r--r-- | _log/fpm-door-lock-lp.md | 7 | ||||
| -rw-r--r-- | _log/fpm-door-lock-rf.md | 8 | ||||
| -rw-r--r-- | _log/matrix-digital-rain.md | 39 | ||||
| -rw-r--r-- | _log/neo4j-a-star-search.md | 6 | ||||
| -rw-r--r-- | _log/site-search.md | 23 |
8 files changed, 72 insertions, 28 deletions
diff --git a/_log/arduino-due.md b/_log/arduino-due.md index e24666c..8176b3b 100644 --- a/_log/arduino-due.md +++ b/_log/arduino-due.md @@ -56,6 +56,7 @@ $ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -T script.ld \ $ openocd -f openocd-due.cfg -c "program a.elf verify reset exit" ``` -Commit: -[3184969](https://git.asciimx.com/bare-metal-arduino-due/commit/?id=318496925ca76668dd9d63c3d060376f489276f8) +Commit: <a +href="https://git.asciimx.com/bare-metal-arduino-due/commit/?id=318496925ca76668dd9d63c3d060376f489276f8" +class="external" target="_blank" rel="noopener noreferrer">3184969</a>. diff --git a/_log/e-reader.md b/_log/e-reader.md index 45363f7..66c262b 100644 --- a/_log/e-reader.md +++ b/_log/e-reader.md @@ -64,5 +64,7 @@ Can't think of anything else. Verdict: Functional but limited. Led to [Etlas](../etlas/). -Commit: -[7f691c4](https://git.asciimx.com/esp32-e-reader/commit/?id=7f691c46093933b67aab466c0ca582ace8ab73d4) +Commit: <a +href="https://git.asciimx.com/esp32-e-reader/commit/?id=7f691c46093933b67aab466c0ca582ace8ab73d4" +class="external" target="_blank" rel="noopener noreferrer">7f691c4</a>. + diff --git a/_log/etlas.md b/_log/etlas.md index a2458d5..6d5bd4e 100644 --- a/_log/etlas.md +++ b/_log/etlas.md @@ -101,5 +101,7 @@ via MCU. Uptime: August 2024 - January 2026 -Commit: -[a92c86a](https://git.asciimx.com/etlas/commit/?id=a92c86ac1592c2137d3d1fec1668eacc2d0ca581) +Commit: <a +href="https://git.asciimx.com/etlas/commit/?id=a92c86ac1592c2137d3d1fec1668eacc2d0ca581" +class="external" target="_blank" rel="noopener noreferrer">a92c86a</a>. + diff --git a/_log/fpm-door-lock-lp.md b/_log/fpm-door-lock-lp.md index d63131e..aed991e 100644 --- a/_log/fpm-door-lock-lp.md +++ b/_log/fpm-door-lock-lp.md @@ -54,6 +54,7 @@ unlock. No match triggers red LED. MOSFETs off, back to sleep. Total power savings: 99.9% (30.6mA → 2.9μA). Verdict: Fixed. -Commit: -[7529094](https://git.asciimx.com/fpm-door-lock/commit/?id=75290945b2fd84b3bc108fd46419ee478eaac3ca) -| Gerber: [gerber.zip](gerber.zip) +Commit: <a +href="https://git.asciimx.com/fpm-door-lock/commit/?id=75290945b2fd84b3bc108fd46419ee478eaac3ca" +class="external" target="_blank" rel="noopener noreferrer">7529094</a> | Gerber: [gerber.zip](gerber.zip) + diff --git a/_log/fpm-door-lock-rf.md b/_log/fpm-door-lock-rf.md index 87dc6b4..8fe592a 100644 --- a/_log/fpm-door-lock-rf.md +++ b/_log/fpm-door-lock-rf.md @@ -68,7 +68,9 @@ Servo inrush current exceeds 1A. 0.3mm tracks cuts it too close. Verdict: Functional but not practical. Battery dead in under 24 hours. Led to [redesign](../fpm-door-lock-lp/) with proper power management. -Commit: -[f4b0b73](https://git.asciimx.com/smart-home/commit/?id=f4b0b734a595919cf451ab9448b06274c8e609a4) -| Gerber: [gerber_back.zip](gerber_back.zip), +Commit: <a +href="https://git.asciimx.com/smart-home/commit/?id=f4b0b734a595919cf451ab9448b06274c8e609a4" +class="external" target="_blank" rel="noopener noreferrer">f4b0b73</a> | +Gerber: [gerber_back.zip](gerber_back.zip), [gerber_front.zip](gerber_front.zip) + diff --git a/_log/matrix-digital-rain.md b/_log/matrix-digital-rain.md index 78fe623..2edc7e7 100644 --- a/_log/matrix-digital-rain.md +++ b/_log/matrix-digital-rain.md @@ -7,7 +7,7 @@ thumbnail: thumb_sm.png --- 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 +incomplete--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. @@ -39,17 +39,48 @@ static inline void insert_code(matrix *mat, uint64_t blk; uint32_t min, max; - blk = glyphs[(rand() % glyphlen)]; + blk = glyphs[(xor() % glyphlen)]; min = (uint32_t)blk; max = (uint32_t)(blk >> 32); - mat->code[index(mat, row, col)] = rand() % (max - min) + min; + mat->code[index(mat, row, col)] = xor() % (max - min) + min; } ``` Full-width Katakana breaks column alignment. Stick to half-width (U+FF61-U+FF9F) range. Compile with -DNOKANA to disable Katakana altogether. -blend() is still good. Leaving it alone. +blend() for screen decay is still good: + +``` +static inline void blend(matrix *mat, + size_t row, size_t col) +{ + unsigned char *color; + + 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; +} +``` + +Left it alone. + +Optimized RNG--xorshift instead of rand(): + +``` +static inline uint32_t xor(void) +{ + /* Xorshift RNGs, George Marsaglia, Florida State University. */ + static uint32_t y = 2463534242; + + y ^= (y << 13); + y = (y >> 17); + return (y ^= (y << 5)); +} +``` + +NOTE: Non-linear variations (xorshitr+) for more speed. Tossed license and automake cruft. Just `cc -O3 main.c -o matrix` now. Don't need the ceremony. diff --git a/_log/neo4j-a-star-search.md b/_log/neo4j-a-star-search.md index db74444..ca9a563 100644 --- a/_log/neo4j-a-star-search.md +++ b/_log/neo4j-a-star-search.md @@ -53,5 +53,7 @@ private void updateCosts( Upstreamed changes: <a href="https://github.com/neo4j-contrib/neo4j-graph-algorithms/releases/tag/3.4.0.0" class="external" target="_blank" rel="noopener noreferrer">Neo4J v3.4.0</a> | -[Full -source](https://github.com/neo4j-contrib/neo4j-graph-algorithms/blob/bd9732d9a690319552e134708692acb5a0d6b37c/algo/src/main/java/org/neo4j/graphalgo/impl/ShortestPathAStar.java) +<a +href="https://github.com/neo4j-contrib/neo4j-graph-algorithms/blob/bd9732d9a690319552e134708692acb5a0d6b37c/algo/src/main/java/org/neo4j/graphalgo/impl/ShortestPathAStar.java" +class="external" target="_blank" rel="noopener noreferrer">Full source</a>. + diff --git a/_log/site-search.md b/_log/site-search.md index dab5133..4ccae3c 100644 --- a/_log/site-search.md +++ b/_log/site-search.md @@ -4,7 +4,7 @@ date: 2026-01-03 layout: post --- -Article count is growing. Need a way to search. +Article count is growing. Need search. Requirements: matches substrings, case-insensitive, fast, secure. No JavaScript. @@ -14,7 +14,7 @@ Architecture: browser → httpd → slowcgi → Perl CGI script. Perl, httpd, slowcgi are in the OpenBSD base system. Instead of secrets, file system permissions govern access. -2025-12-30: Regex search. +2025-12-30: Regex. 140-line Perl script searches 500 files in 40ms. Fast enough; O(N) pull felt at higher file counts. @@ -22,7 +22,7 @@ higher file counts. Introduces ReDoS and symlink attack vectors. Both can be mitigated. Tempted to stop here. -2026-01-03: Suffix Array (SA) based index lookup. +2026-01-03: Suffix array (SA) based index lookup. Slurping files on every request bothers me. Regex search depends almost entirely on hardware for speed. @@ -36,8 +36,8 @@ $ cd cgi-bin/ $ perl indexer.pl ``` -Indexer extracts HTML, lowercases, encodes into UTF-8 binary sequences. Null -byte sentinel for document boundaries. sa.bin stores suffix offsets as +Indexer extracts HTML, lowercases, and encodes into UTF-8 binary sequences. +Null byte sentinel for document boundaries. sa.bin stores suffix offsets as 32-bit unsigned integers, sorted by lexicographical order: ``` @@ -120,9 +120,12 @@ Resource exhaustion and XSS attacks are inherent. Former mitigated by limiting concurrent searches via lock-file semaphores. Query length (64B) and result set (20) capped. All output is HTML-escaped to prevent XSS. -Secure by default. Fast. Durable. +Verdict: Fast. Durable. Secure by default. + +Commit: <a +href="https://git.asciimx.com/www/commit/?h=term&id=6da102d6e0494a3eac3f05fa3b2cdcc25ba2754e" +class="external" target="_blank" rel="noopener noreferrer">6da102d</a> | +Benchmarks: <a +href="https://git.asciimx.com/site-search-bm/commit/?id=8a4da6809cf9368cd6a5dd7351181ea4256453f9" +class="external" target="_blank" rel="noopener noreferrer">8a4da68</a> -Commit: -[6da102d](https://git.asciimx.com/www/commit/?h=term&id=6da102d6e0494a3eac3f05fa3b2cdcc25ba2754e) -| Benchmarks: -[8a4da68](https://git.asciimx.com/site-search-bm/commit/?id=8a4da6809cf9368cd6a5dd7351181ea4256453f9) |
