chronoskin

guest@tty1

~ $ whoami

Notes on small tools and old machines.

I write programs that fit in one file and keep computers running longer than their makers planned. This is where the notes go.

~ $ wc posts/*.md | tail -1

  • 38 posts
  • 61,204 words
  • 7 years
  • 0 trackers

~ $ ls -lt posts/ | head -5

total 38

34 more in posts/

~ $ ls projects/

tally/

Counts things in text files. 300 lines of C.

C | since 2020

lantern/

A status line for any shell, in forty lines.

shell | since 2026

ledgerline/

Plain-text accounts and the script that sums them.

awk | since 2024

dotfiles/

What I carry from machine to machine.

mixed | since 2019

~ $  

  1. ~
  2. /
  3. posts

posts/

38 files, 2019 to 2026, newest first.

~/posts $ ls -lt --year 2026

datefiletagwordsmin
Mar 02a-status-line-in-forty-lines.mdshell1,4807
Feb 11the-laptop-from-2011.mdhardware9605
Jan 20make-is-enough.mdmake1,9109
Jan 04what-i-kept-from-2025.mdplain-text7204
2025, last three of eleven
Dec 03plain-text-accounts.mdplain-text6403
Nov 15a-serial-console-for-the-router.mdhardware2,23011
Oct 28sixteen-colours-are-plenty.mdshell1,1055

~/posts $ ls drafts/

ls: drafts/ is empty. Nothing is half written at the moment.

suggest a topic
  1. ~
  2. /
  3. posts
  4. /
  5. a-status-line-in-forty-lines.md

~/posts $ cat a-status-line-in-forty-lines.md

updated Mar 05: the script now also works in a shell without arrays.

broken: the version in the first listing fails when the path holds a space. Use the second.

A status line in forty lines

Every few years I install a prompt framework, admire it for a week and remove it when the shell takes half a second to start. This time I wrote down what I actually read in a prompt. It was three things.

What a prompt has to say

  • Where I am, shortened to the last two directories.
  • Whether the last command failed, as its exit code.
  • The branch, when there is one, and nothing when there is none.

That is one call to pwd, one read of $? and one small file under .git. No process has to start.

The whole of it

lantern() {
  code=$?
  dir=${PWD#"${PWD%/*/*}/"}
  [ $code -ne 0 ] && err=" [$code]" || err=""
  printf '%s%s $ ' "$dir" "$err"
}

The remaining thirty lines read the branch and choose colours. They are in the repository.

related

  1. ~
  2. /
  3. about.txt

about.txt

Who writes this, on what, and how the pages are made.

~ $ cat about.txt

I repair and program computers for a small workshop. In the evenings I write the tools I wished I had during the day, and then I write down how they work, because in two years I will have forgotten.

What you will find here

  • Short programs, explained line by line.
  • Repairs of machines that were meant to be thrown away.
  • Opinions about plain text, held loosely.

Everything here may be copied. A link back is kind but not required.

~ $ column -t uses.tsv

whatwhichsince
machinea laptop from 20112019
editorthe one that was installed2012
shellplain sh, with lantern2026
sitemake, awk and 60 lines of sh2020

colophon

Set in whatever monospace your system has. No scripts, no fonts to fetch, no pictures. The whole site is 412K.

  1. ~
  2. /
  3. contact

contact

A correction, a question or a machine that will not start.

~ $ mail -s "hello" author

mail: "reader at example" is not an address.

Plain text. End with a line holding a single dot, or press send.

copy:

~ $ rm draft.txt

Answers usually take a few days. The address is never passed on and the form sets no cookie.