<!--
.. title: in with the new
.. slug: in-with-the-new
.. date: 2026-01-01 21:53:19 UTC-06:00
.. tags: photo, sunset, software, sunwait, jq, ai, astronomy, json
.. category: diary
.. description: In which a new year dawns, but I slept through it.
.. type: text
.. previewimage: assets/sunset.jpg
-->

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`](https://github.com/risacher/sunwait),
a command-line tool for predicting local sunrise and sunset times.

![A sunset.](assets/sunset.jpg)

<!-- TEASER_END -->

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.

<!--
    It's also the case that my seasonal affective garbage hit me
    really hard this fall.  I'm feeling a lot better about things now
    that the sunset is moving later again.
-->

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:

```text
# 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`](https://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`](https://jqlang.org/), 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`](https://jqlang.org/).  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.
