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

Labels:

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

Labels:

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))
  :preface
  (defun my/consult-flymake-project ()
    (interactive)
    (consult-flymake t))
  :custom
  (flymake-suppress-zero-counters t)
  :config
  (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.

Labels:

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

Labels:

Mac keyboard with hidutil #

[Update: 13-Apr-2023 with some of the background context and some things I learned from hackernews]

[Update: 18-Dec-2023] This hidutil stopped working for me in MacOS 13.6 and 14.2. Also see other people having problems too.

[Update: 28-Jan-2024] Some people say hidutil works again in Mac OS 14.3.

On my Mac, I've used KeyRemap4Macbook, Karabiner, Karabiner Elements, and FunctionFlip for some of my key remapping needs. The main things I want:

  1. On the laptop keyboard, some media keys should be function keys but other media keys should stay media keys. When using fn I want to get the other version of the key.
  2. On external keyboards, make the function keys act like the laptop keyboard.
  3. On external keyboards, the numpad should act like "numlock off". For example, 4 should be Left Arrow.
  4. On external keyboards, the Windows key should act as Option, and the Alt key should act as Command. This can usually be set in the System Preferences. (Except it doesn't work on one of my keyboards)
  5. I also use those same external keyboards with my Windows and Linux machines, so I prefer to make these changes through software rather than firmware.

Labels: ,