21. 6. 2025
https://news.ycombinator.com/item?id=44328904
https://htdp.org/2024-11-6/Book/part_prologue.html
By “good programming,” we mean an approach to the creation of software that relies on systematic thought, planning, and understanding from the very beginning, at every stage, and for every step. To emphasize the point, we speak of systematic program design and systematically designed programs. Critically, the latter articulates the rationale of the desired functionality. Good programming also satisfies an aesthetic sense of accomplishment; the elegance of a good program is comparable to time-tested poems or the black-and-white photographs of a bygone era. In short, programming differs from good programming like crayon sketches in a diner from oil paintings in a museum.

19. 6. 2025
Let’s say words per page is in 250-300 range, averaging to 275, then
words="$(wc -w < some.txt)"
echo "$(( words / 275 ))"
15. 6. 2025
https://www.youtube.com/watch?v=HUkBz-cdB-k
Interaction of disciplines
https://youtu.be/HUkBz-cdB-k?t=2311
Science in general is interaction between 3 things.
The real world, what we observe of the real wolrd (observation) and mental models as to how we think the world works.
We can’t directly access reality. All we have are observations, which are incomplete and they have errors.
And then we have these simplified models sometimes making unrealistic assumptions (spherical cows in vacuum). Those are the mathematical models.
Mathematics is concerned with the models. Science collects the observations and it proposes the models that might explain these observations.
What mathematics does we stay within the model and we ask what are the consequences of that model? What observations, predictions would the model make of the future observations or past observations, does it fit observed data.
There is symbiosis. Math can go from conclusions to theory and also from theory to all directions.
Really novel ideas?
Real interaction is needed between things. Over time the observations and the theory and the modeling should both get close to reality.
They are always far apart to begin with. One needs to push the other…
14. 6. 2025
Get the path
# get linux path to windows %LOCALAPPDATA%
# and assume the rest is hardcoded
wslpath="$(wslpath "$(cmd.exe /c "echo %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState" | tr -d '\r')")"
# All these methods assume WSL is installed under the 'current user profile' (not as system-wide).
cd "$wslpath" || exit
pwd
head settings.json
Assumes current user profile type of installation …
Figure out the guid manually by inspecting the settings.json. (There should be a way to do this automagically, but my ‘Bookworm’ is not listed in ‘wsl –list’ for some reason)
"guid": "{1cd9302d-337e-54e1-bb87-c45069dc5a47}", < This
"hidden": false,
"icon": null,
"name": "bookworm (12)",
"scrollbarState": "hidden",
"source": "Windows.Terminal.Wsl"
etc ...
Do the jq magic
cp settings.json setting.json.bak || exit # backup
jq '(.profiles.list[] | select(.guid == "{1cd9302d-337e-54e1-bb87-c45069dc5a47}")).font.face = "Fira Code"' settings.json > tmp.json && mv tmp.json settings.json
30. 5. 2025
Proto

#!/bin/bash
# colorizeStringBasedOnHash
# Colorize some string based on its hash
debug="0"
if [ -z "$1" ]; then
string="$RANDOM-$$"
else
string="$1"
fi
hash="$(echo "$string" | md5sum | cut -d ' ' -f 1)"; (( debug )) && echo "hash=${hash}"
red=$((16#${hash:1:2})); (( debug )) && echo "red=${red}"
grn=$((16#${hash:3:2})); (( debug )) && echo "grn=${grn}"
blu=$((16#${hash:5:2})); (( debug )) && echo "blu=${blu}"
# Some protection for very dark colors needed here
echo -en "\e[38;2;${red};${grn};${blu}m"; echo -en "${string}"; echo -e "\e[0m"
So
./colorizeStringBasedOnHash "bark bark bark bark bark"
should always come out as pink. Run without parameters for random string. Not all terminals will support that (they have to be truecolor or something).
Some thoughts

For the purposes of similar brightness between generated colors one could just do:
- hue from hash (instead of rgb), getting range 0-359 (hue=$(($hash % 360)).
- make sat and light static (sat=someValue, light=someOtherValue)
- Convert that HSL to RGB (see chatgpt generated formulas for that)
Why not just use crc32, which seems to be decimal
echo "woot woot woot" | cksum | cut -d ' ' -f1 ~
3828101319 # =hash
and then just hash % 360 to get a hue.
Notes
Both md5sum and cksum are part of coreutils (should be present on any debianish system). Btw: Speed difference seems insignificant (cksum default crc32 vs md5sum).
HSL edition: sinesthesia
Synesthesia is a neurological condition where stimulation of one sense triggers an involuntary experience in another sense. For example, someone with synesthesia might see colors when hearing music or taste textures. It’s not a medical disorder, but a unique and often fascinating sensory phenomenon.
The script (sinesthesia):
https://raw.githubusercontent.com/brontosaurusrex/bucentaur/refs/heads/master/.experiments/bin/sinesthesia
Usage:
sinesthesia "bark bark"
# or
cat some.txt | sinesthesia
Change:
local sat="20" # 0-100
local light="88" # 0-100
for more/less saturated/light colors. Only hue is now derived from hash.
Usage example from another script
if command -v sinesthesia >/dev/null 2>&1; then
cat "$file" | fmt -w ${width} | sed 's/ \{1,\}/ /g' | sinesthesia
else
cat "$file" | fmt -w ${width} | sed 's/ \{1,\}/ /g'
fi
Scrot

Update: The perceptual brightness
Colors should now be more ‘perceptually balanced’ due to a new awk function added, named ‘gamma_correct’.
ChatGPT explanation:
gamma_correct adjusts RGB colors so they all have roughly the same perceived brightness by converting them to linear RGB, normalizing luminance, and converting back to sRGB.

And another script, colorize based on color names
The script (crayon):
https://raw.githubusercontent.com/brontosaurusrex/bucentaur/refs/heads/master/.experiments/bin/crayon
Usage:
cat sometext.txt | crayon tomato
crayon red "yellow"
Shortened color names should also work:
crayon mato "woot"
# would be the same as
crayon tomato "woot"
Color names sourced from this page.
29. 5. 2025
https://www.gnu.org/software/coreutils/
The GNU Core Utilities are the basic file, shell and text manipulation utilities of the GNU operating system. These are the core utilities which are expected to exist on every operating system.
https://www.maizure.org/projects/decoded-gnu-coreutils
|
|
|
|
|
arch |
base64 |
basename |
cat |
chcon |
chgrp |
chmod |
chown |
chroot |
cksum |
comm |
cp |
csplit |
cut |
date |
dd |
df |
dir |
dircolors |
dirname |
du |
echo |
env |
expand |
expr |
factor |
false |
fmt |
fold |
groups |
head |
hostid |
hostname |
id |
install |
join |
kill |
link |
ln |
logname |
ls |
md5sum |
mkdir |
mkfifo |
mknod |
mktemp |
mv |
nice |
nl |
nohup |
nproc |
numfmt |
od |
paste |
pathchk |
pinky |
pr |
printenv |
printf |
ptx |
pwd |
readlink |
realpath |
rm |
rmdir |
runcon |
seq |
shred |
shuf |
sleep |
sort |
split |
stat |
stdbuf |
stty |
sum |
tac |
tail |
tee |
test |
timeout |
touch |
tr |
true |
truncate |
tsort |
tty |
uname |
unexpand |
uniq |
unlink |
uptime |
users |
vdir |
wc |
who |
whoami |
yes |
|
|
|
|
|
|
|