in with the new

I thought it would be cute to follow last night's post with a dawn … but I slept through it. So, another dusk.

I learned the other day about sunwait, a command-line tool for predicting local sunrise and sunset times.

A sunset.

I'm interested this year in reconnecting with naked-eye astronomy, and I thought it might be useful to have a table of sunrise and sunset times. Such tables are things I used in past years to plan bicycle rides, so that I wouldn't be out on the road in twilight. But web interfaces take a lot of clicks (especially if you want data for multiple days), and opening a web browser is an opportunity to forget what I'm doing.

This is one of the few cases where I find artificial-intelligence chatbots useful: as natural-language search engines with the ability to filter by semantics, rather than by keyword. I got three recommendations, of which sunwait was the most directly useful.

sunwait is a tool that's been around forever, whose idea is to be able to schedule things on your computer to happen at a particular stage of twilight:

# Generate a crummy calendar of rise and set times for January
$ ./sunwait list 31 d 01 m 01 36N 86W | cat -n
 1  06:56, 16:43
 2  06:56, 16:44
 3  06:56, 16:45
 ⋮    ⋮      ⋮
30  06:49, 17:11
31  06:48, 17:12
$ ./sunwait poll 36N 86W
 NIGHT
# Pause until local dawn, then exit
$ ./sunwait wait sunrise 36N 86W

Another recommendation was to fetch some JSON object from api.sunrise-sunset.org. I've used their tracker some of the time, and I didn't know there was a public API. But more interestingly, the chatbot recommended a tool called jq, which is "like sed for JSON data." That seems dead useful as well.

The "easy solution" was also an apparently-to-me undocumented query string to wttr.in. That website sends a pre-formatted web page to a browser, but an ascii-box drawing to curl, probably with some User-Agent matching.

A rare AI success for me. But a strategy that might be useful to other people: not asking for a fact, but asking for a tool that will help me find the fact myself. The way to avoid AI hallucinations is to ask for sources which address your question, rather than just asking for the answer to your question directly. A wrong answer pollutes the memory; a wrong citation just wastes a few minutes.

It occurs to me that asking "who do you know who could help me with my question?" is a very graduate-degree approach to learning things, perhaps not shared by other folks.