August 2022 Links
In the tradition of Laurence Tratt I’ve decided to start tracking useful links per month instead of saving them in Firefox forever.
The Legend of Princess Kaguya
NES adventure which tells the old Japanese folk tale of The Bamboo Cutter. Got a translation in 2009 but also got a new one in July 2022. Looks good for a NES game, similar interface to the ICOM/MacVentures (Deja Vu, Shadowgate, Uninvited).
inotify command script
On spotty internet my VPN half-drops-out, keeping the tunnel and connection up but changing /etc/resolv.conf
back to the non-VPN nameservers. So I am running this script on desktop login:
#!/bin/bash
inotifywait -q --format '%f' -m -r -e close_write /etc/ | grep --line-buffered -E "^resolv.conf$" | xargs -I{} -r sh -c 'notify-send --expire-time=3600000 "resolv.conf changed" "$(date)\n\n$(grep nameserver /etc/resolv.conf)"'
nullprogram (Chris Wellons) Blog
This was good enough for me to start following in Feedly. Examples:
- A Tutorial on Portable Makefiles (2017)
- strcpy: a niche function you don’t need (2021)
- Improving on QBasic’s Random Number Generator - I’ve also done some hacking on QBasic’s RNG for Alphaman
- Function Pointers are Special (2010)
A random number you already have: The stack address
Due to ASLR on modern OSes. Keep the lowest 32 bits of a 64-bit stack address:
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
int main(void)
{
int32_t i = 0;
int32_t r = (intptr_t) &i & 0xFFFFFFFF;
printf("r = %" PRId32 "\n", r);
return 0;
}
ncursesw and Unicode
I was idly thinking to make something compile both in DOS with Codepage 437 and Linux with Unicode. PDCurses on DOS does support the wide functions with PDC_WIDE
.
Microsoft Ergonomic Keyboard (2019)
Update to the Sculpt seems even better than before, is wired (good), and a third cheaper (AU$100 vs AU$150). I’ll get this next.
Artistic Style (astyle)
A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI, Objective‑C, C#, and Java Source Code.
astyle --style=linux --indent=tab --suffix=none --pad-comma *.c *.h
Linux framebuffer palette switching
This works with Solarized Dark too.
Robert Elder’s blog
Another I started following. Article examples:
- Should I use Signed or Unsigned Ints In C?
- Should I use Signed or Unsigned Ints In C? (Part 2)
- The Most Confusing Grep Mistakes I’ve Ever Made
POSIX Basic Regular Expressions (BRE)
From Elder above, this is the crappy regex that happens if you don’t use grep -E
to use Extended Regex. (which you should be using because egrep
is deprecated)
Altynbek Isabekov’s blog
Some nice low-level/C/radare posts:
- A Radare2-based Analysis of Pointers to an Array in C
- Stack alignment when mixing assembly and C code - I hit this problem at work too
- “Signed Integer” behavior of “char” data type in C
- Examining Data in GDB
- Writing a Minimalistic “Hello, World!” program with Position Independent Code in assembly language
Unstripping Stripped Binaries
This guy earlier got UNIX versions of WordPerfect and Lotus-123 working on Linux too.