Colorize some string based on its hash

Proto

scrot

#!/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

actually

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

sinesthesia

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.

The GNU Core Utilities

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    
         

Oxidise Your Command Line

Rust.

Rust is a general-purpose programming language emphasizing performance, type safety, and concurrency. It enforces memory safety…

https://www.youtube.com/watch?v=rWMQ-g2QDsI

Packages mentioned, find them all on lib.rs:
Fish        (shell)
Nushell     (shell)
Ripgrep     ✓
Fd          ✓
Bat         ✓
Eza         ✓
Zoxide      (using j instead)
Xh
Zellij      ✓
Gitui
du-dust     ✓
dua
starship    (prompt)
yazi        (file manager)
hyperfine
evil-helix  (hx with vim bindings?)
bacon
cargo-info
fselect
ncspot
rusty-man
delta       (fancy diff for git?)
ripgrep-all (like rg, but goes deeper)
tokei       (lines of code)
wiki-tui    * Interesting
just
mask
mprocs
presenterm
kondo
bob-nvim
rtx
espanso

Client side search

The Solution

Funny little client-side search added @ /search
The fusion of custom jekyll powered search.json generator and fuse.js.

Big thanks to chatGPT and deepseek for helping here.

Additionally, the SVG logo now includes two links. If you click on the head, it should navigate to the new search page.

p.s.

  • gziped /search.json is around 260k (and expands to 860k), which I think is more than good enough. Data taken from chrome Network/Headers in Developer tools.
  • SVG logo with 2 links doesn’t show transparency correctly when called via object tag, so it’s now FAT part of _layouts/default.html, not so good.

word2vec engine from scratch: https://bernsteinbear.com/blog/simple-search/ (Also about sqlite running client side as Wasm compile.)

Persuasion methods for engineering managers

Insider tips to drive results, accelerate decisions, and build consensus from a former Google Engineering Director

https://news.ycombinator.com/item?id=43970104
https://newsletter.manager.dev/p/5-powerful-persuasion-methods-for

After Effects - Sequence layers

https://www.youtube.com/watch?v=mrwcy_OT8eo

  1. Shorten the layers, say to 5 frames
  2. Select layers in order you want them to appear (Can do shift selection as well)
  3. rmb on selected layers, Keyframe assistant > Sequence layers

(Overlap with some fading may look good)

Lisp on Debian

Install common lisp and rlwrap

sudo apt install sbcl rlwrap

rlwrap runs the specified command, intercepting user input in order to provide readline’s line editing.

Run lisp repl

rlwrap sbcl

Test

Add 3 numbers

(+ 1 2 3)
; should return 6

Hello world (~% stands for newline)

(format t "hello world~%")

Hello world as a function

(defun hello-world () (format t "hello world~%"))
(hello-world)

Hello world as a selfpropeled script with shebang that works on Debian

#!/usr/bin/sbcl --script
(format t "hello world~%")

Books

https://gigamonkeys.com/book/

Practical Common Lisp published by Apress These pages now contain the final text as it appears in the book.

IDE

Can’t figure out how to install/setup ‘alive’ for vscode, don’t want to deal with emacs. Slimv does something interesting for vim: https://susam.net/lisp-in-vim.html#get-started-with-slimv-and-sbcl
In zellij or tmux run

sbcl --load ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp

Open vim test.lisp or something, type ,c for start and ,e for eval. ctrl+ww to switch to repl, i to edit it.

vimlisp