Shallow Thoughts

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sat, 21 Feb 2026

A More Time Zone Tolerant datetime Class

Yesterday I signed in to the billtracker, and got an error page when trying to display my bill list:

[ ... ]
   File "/var/www/nmbilltracker/billtracker/app/models.py", line 766, in location_html
     if self.last_action_date > self.scheduled_date.replace(tzinfo=None):
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 TypeError: can't compare offset-naive and offset-aware datetimes

Python's datetime class drives me crazy.

Any given datetime object might or might not have a timezone. Those that do are called "timezone aware" or just "aware" datetimes; those without a timezone are called "unaware" or "naive". Any given function might or might not return a timezone-aware datetime. If you ever mess up and call a function that returns a timezone when you didn't expect one, or vice versa, or if a function you call changes in that respect, now you have a hidden time bomb that will crash your program the next time you do any sort of comparison with or subtraction from another datetime, and by then, you may have no idea way of finding out where the problematic time came from so you can guard against it happening again.

Read more ...

Tags: , ,
[ 18:53 Feb 21, 2026    More programming | permalink to this entry | ]

Tue, 17 Feb 2026

Porcupines!

[A porcupine, unfortunately dead, lying on the ground]

We had business in Albuquerque yesterday, and the weather was nice, so we brought our bikes along to explore the trails along the Rio Grande bosque.

It was a beautiful, relaxing ride. The trails were packed with happy, friendly cyclists, hikers, runners, plus people on scooters and a couple of those one-wheel, self balancing skateboards (which I'd never seen on a trail before). I think we saw more other trail users than in the cumulative past year hiking in our usual spots.

There were lots of cranes on the river and in the sky, and a roadrunner who ran across the trail in front of us, then slowly made its way up the branches of a tree before gliding across the canal then running up to the top. Dave and I never get tired of watching roadrunners — the most Velociraptor-like birds there are. I wish they were more common in White Rock.

Read more ...

Tags: , , ,
[ 15:02 Feb 17, 2026    More nature | permalink to this entry | ]

Tue, 27 Jan 2026

A "Purple" Map of the 2024 US Presidential Election

(This is Part 1, a single state.)

[A screenshot of a red/blue/purple voting map, by precinct,
           of New Mexico, with a popup showing details for one precinct] I went looking for a "purple map" of the 2024 presidential election — one of those maps that colors areas from red to blue depending on how they voted.

And I couldn't find one! Well, I found lots of JPEGs and PDFs and such, but I couldn't find a single map that was interactive and let me zoom in and actually see the county-level data I was interested in.

Getting Data

It's not for lack of data. I'm happy to report that this year, searching for 2024 presidential election county data got several useful hits. I settled on the MIT Election Lab data, which has a GitHub repository with a bunch of state-level files (that, weirdly, are all zipped, so you have to unzip each one individually).

Read more ...

Tags: , , , , , , , , ,
[ 12:41 Jan 27, 2026    More programming | permalink to this entry | ]

Wed, 21 Jan 2026

Sewing Project: A Helmet Cover with Ear Flaps

[the author on a bike, wearing a bike helmet covered with a blue and tan cloth cover, not completely finished, with fleece ear-warmers attached] With the weather getting cold, I need a way to keep my ears warm while biking.

Many years ago, I had some fleece earwarmers that velcroed around a helmet strap. I bought them in a bike store and they worked wonderfully, but I've been unable to find anything quite like them online. I've knitted triangular cozies to go over a helmet strap, but they don't stay up, so they sag and don't cover my ears.

I tried making something like that, but they didn't come out well,

Read more ...

Tags: , , ,
[ 12:58 Jan 21, 2026    More bike | permalink to this entry | ]

Sat, 10 Jan 2026

Visiting the Santa Fe Moon Tree

[Three Douglas fir trees growing together, just below a concrete balcony. The moon tree is the middle one.] The Radiolab podcast (or actually, their "Terrestrials" spinoff for kids) recently had an episode about Moon Trees.

Stuart ‘Smokey’ Roosa went to the moon (well, at least to lunar orbit) in 1971 as the Command Module Pilot for Apollo 14. He was an ex-firefighter, ex-smoke jumper, and he loved trees. So for the small personal item that astronauts are allowed to carry on missions, he brought along a canister of 500 tree seeds of various types. After almost getting destroyed (listen to the episode for more detail on Stu and his seeds), the seeds ended up back on earth, where they were planted in a variety of locations, from the White House lawn to private yards.

And then ... everyone forgot about them for a while, until their rediscovery by a third grader (again, listen to the episode, it's a great story). More recently, Natalie Middleton wrote an article about Moon Trees, including a map of the currently known moon trees.

I checked the map to see if there were any in New Mexico. There's one in Silver City, a sycamore, and some day I'll get down there to visit — but wonder of wonders, there's also a Douglas fir Moon Tree in Santa Fe! It's at the Roundhouse (the state capitol). I had to go see it.

Read more ...

Tags: , , , ,
[ 14:45 Jan 10, 2026    More travel | permalink to this entry | ]

Thu, 01 Jan 2026

Best Books I Read in 2025

Happy New Year!

Time for an annual "Best Books of the Year" list. As always, these aren't all new books this year; they're just new to me. (Or even a beloved re-read, but this year I'm not listing any of those.)

Read more ...

Tags:
[ 12:34 Jan 01, 2026    More misc | permalink to this entry | ]

Tue, 30 Dec 2025

Making a Place Names Overlay in QGIS

[Screenshot of QGIS showing features labeled in large font bold letters slanted to match canyons and mesas]

Flipping through Craig Martin's old book

, I noticed that in the maps at the beginning, he has a rough map of some of the topographic names for local canyons and mesas.

We were just talking about that on a hike last week — looking out at the canyons north of Rendija and trying to get the names straight. Most maps don't label canyons, mesas, or even watercourses, which is endlessly frustrating for hikers who like geography.

I wondered how hard it would be to make a place names layer in QGIS based on Craig's map (and, of course, other sources too) that I could export as an overlay for use in OsmAnd or PyTopo. And it's always good to learn a little more about how to use QGIS effectively.

Read more ...

Tags: , ,
[ 14:28 Dec 30, 2025    More mapping | permalink to this entry | ]

Fri, 19 Dec 2025

A Homebuilt CO2 Meter as a Virus Risk Proxy

[A sensor and small microcontroller, connected by a cable, sitting on pink anti-static bubblewrap. The microcontroller is also plugged in to a USB cable and a battery; it has a built-in display that reads: CO2: 470 ppm, Temp: 77F, Hum: 18%, BAT 65%] Despite most of the world deciding that COVID is over, I continue to be cautious about it. (My one bout of COVID resulted in congestive heart failure which I'm still dealing with, so I'm fairly anxious not to get it again.)

That means that I'm cautious about indoor gatherings. Some places say they've upgraded their ventilation, but can you believe them? I've long read about people using CO2 meters as a proxy, to tell you how well the air is circulating and how high the virus load might be in a crowd, and I've wanted to get one of my own.

You can buy CO2 meters, of course. But making a custom one sounds so much more fun! Reading Wired's story about New Zealand's Kawaiicon cybersecurity convention that provided CO2 trackers inspired me to finally order some parts.

Read more ...

Tags: , , ,
[ 18:06 Dec 19, 2025    More hardware | permalink to this entry | ]