Observational studies #

Star Trek Red Shirt
Star Trek Red Shirt,
Wikipedia, Derek Springer, CC BY-SA 2.0

People who wear red shirts on the original Star Trek have a high mortality rate.

  1. can we conclude that red shirts caused the high mortality rate?
  2. can we solve the problem by having them yellow shirts instead?


Status codes like TODO #

I often put TODO comments into my projects, including in source code. And I'll change it to DONE afterwards. I ended up keeping a list of four-letter codes:

Diagram showing how my status codes are related to each other, e.g. TODO happens before DONE


Using an LLM to query my notes #

robot asks a question holding a book
"robot asks a question holding a book" image from stable diffusion

I occasionally play with LLMs (large language models). Last time I had tried Simon Willison's llm software to search over my notes. Today I tried amaiya/onprem to ask questions about my notes. The documentation is pretty good but I made a few changes for my configuration, so I decided to write them down here. I'm running these on my Mac M1 and not on my Linux or Windows machines.

First step, get the thing installed:

cd ~/Projects/machine-learning/
mkdir onprem
cd onprem

# need to use python 3.9 through 3.11 for torch support; 3.12 doesn't support it yet
# check the version I have installed
python3 --version
# if python3 isn't a reasonable version, then install or choose a different python
# before doing the next step

python3.11 -m venv venv
source venv/bin/activate

# install onprem itself, which also installs torch
pip install onprem
mkdir data


Emacs and shellcheck #

Julia Evans had a great talk called Making Hard Things Easy. One of the takeaways for me was that I should be using tools for parts of a system I find hard to remember. In particular, when writing bash scripts I should be using shellcheck.

It turns out Emacs 29 has support for shellcheck, and older versions of Emacs can use the flymake-shellcheck page.

To set it up in Emacs 29:

(use-package flymake
  :bind (("H-e" . flymake-show-project-diagnostics)))

(use-package sh-script
  :hook (sh-mode . flymake-mode))

I use consult for navigating my errors, and I want to make errors more noticable in the mode line, so my flymake configuration is:

(use-package flymake
  :bind (("H-e" . my/consult-flymake-project))
  (defun my/consult-flymake-project ()
    (consult-flymake t))
  (flymake-suppress-zero-counters t)
  (defface my/flymake-modeline-error-echo
    '((t :inherit 'flymake-error-echo :background "red"))
    "Mode line flymake errors")
  (put 'flymake-error 'mode-line-face 'my/flymake-modeline-error-echo)
  (defface my/flymake-modeline-warning-echo
    '((t :inherit 'flymake-warning-echo :background "orange"))
    "Mode line flymake warnings")
  (put 'flymake-warning 'mode-line-face 'my/flymake-modeline-warning-echo))

It's too early to know what other tweaks I might want, but so far it's alerted me to several errors in my shell scripts.

Update: [2023-10-07] Comments on HN pointed to bash-language-server which works with emacs lsp or eglot.


Road Archaeology, part 2 #

In a previous post I showed some examples of how railroads influenced the shape of Interstate 5 in California. In this post I have some more examples of what I call "road archaeology". Looking at the present roads, we can make guesses about the past.

In Las Vegas the major casinos are along "The Strip". Just to the west of this is the interstate highway, I-15. What is the history here? My guess, following the patterns from the previous blog post, would be that "The Strip" was the original highway, and I-15 was built parallel to it. If you look through Historial Aerials you can see that this is indeed what happened. Here's the interactive map to browse:

Las Vegas Strip vs I-15