Avatar of Daniel James a.k.a. thzinc thzinc

Code

findJoeys – Interview question of the week from rendezvous with cassidoo

I needed a little code kata to jumpstart my brain today.

Hackaday Superconference 2026 – Day -1 – Supercon Scheduler

It seems like a lot of schedules for conferences I’ve attended advertise their schedules in a visually-appealing way, but don’t offer any integration with the tools I rely on for scheduling anything else. I don’t enjoy having to navigate a table with multiple conference tracks and multiple days’ worth of sessions to figure out where I want to go next. I just want it on my calendar where I schedule everything else.
Mini rack

Solving a kernel panic while booting Ubuntu 24.04 LTS from NVMe on a Raspberry Pi 5

I have been working on building a Raspberry Pi mini rack that includes a Raspberry Pi 5 with a Pimoroni NVMe Base Duo with two 2TB NVMe SSDs. I’m choosing to run Ubuntu 24.04 LTS instead of Raspbian for a handful of reasons, but I ran into a kernel panic after cloning the filesystems to the NVMe device.

Weird Web October 2025 – Blink

For today’s Weird Web October prompt, “Blink,” I present this Observation Duty-inspired game.

Weird Web October 2025 – Container

I heard about Weird Web October from Stephen at Botmakers and decided to give today’s challenge, “Container”, a try with a little click-and-drag game.

Export a CSV file of Bitly links

I’ve been working on some chores related to my domains and wanted to archive my Bitly-powered short links at l.thzinc.com. Bitly’s bulk CSV export tools aren’t available on free accounts, so I wrote a quick script with curl and jq to download a CSV of my short links.

Converting a GTFS file to a spreadsheet is now even easier!

A few years ago, I wrote a tool–mostly for myself–to convert a GTFS file into an Excel spreadsheet and back so that I and my colleagues could make quick edits with comfortable tools. The command line tool I wrote was not particularly friendly to non-developers. I really wanted to make a browser-based version of it, so I finally did!

More blinkenlights for my SAO frame!

After building the framed display for my SAO collection, I realized the last demo on the badge was running Pew! Pew!, which isn’t very interesting to look at if you’re not actively playing the game. So I made a neat little “firework” animation with shifting colors in center!

seeBuildingsLeft – Interview question of the week from rendezvous with cassidoo

I love a good use case for a reducer. Also, TIL that reducer support on JavaScript Iterators is available in the very newest browsers.

Liars’ Poker probability analysis using sampling

There’s a game called “Liars’ Poker” that I play frequently with my wife and our gamer friends. It is a bluffing game played with a deck of poker cards and a keen knowledge of standard five-card poker hands. All players in the game start out with two cards in hand. The goal is to call out poker hands that could be made with all cards in play and to avoid getting caught in a bluff.

iCalendar link for Hackaday Superconference 2024

The Hackaday Superconference 2024 schedule was released today and I’ve been very excited to see who all is speaking and what fun stuff I’ll plan to attend. However, the schedule on the site was pretty hard to conceptualize and there wasn’t a machine-readable format for calendar apps.

maxPairs - Interview question of the week from rendezvous with cassidoo

I needed something to focus on for a bit and I already used up the free puzzles on the NYTimes app.

In Balena, don't override entrypoint if you want to work with pluggable devices

I’ve been working on a Balena-managed deployment of Kerberos Agents running on Raspberry Pi 4 with the new Camera Module 3, but was having a huge issue trying to get libcamera to work inside a container. The documentation has been kind of frustrating, but I finally worked out my issues.

Quality of life improvements for SSH via AWS EC2 Instance Connect

While doing some work in AWS with EC2 instances through Systems Manager, I needed to be able to connect via SSH in a reasonable way. The AWS docs for Session Manager show off SSH’s ProxyCommand, but I also needed to use EC2 Instance Connect to send my public key ahead of trying to connect, so I wrote a small script to combine the two operations.

Hackaday Superconference 2023 – Day 2 – Leekspin

Second day of Hackaday Superconference 2023 was a bunch of fun. I had the delightful surprise of unknowingly chatting with Benedetta Lia Mandelli and Emilio Sordi the day before only to see them on stage presenting the Soft Actuator Orthosis talk. They seem like neat humans working on ways to help folks with spinal cord injuries.

Hackaday Superconference 2023 – Day 1 – How do I JPEG?

First day of Hackaday Superconference 2023 down and I’ve had some time at home to tinker with the code on this year’s badge. The badge itself has some nifty analog-ish oscilloscope-like features that I’m sure I’d understand and enjoy more if I knew more about electrical engineering. However, I do know plenty to futz around with the cool round TFT display and buttons!

isIsomorphic - Interview question of the week from rendezvous with cassidoo

Wow, I haven’t done one of these for a few months. Let’s see how this goes!

maximumProfit - Interview question of the week from rendezvous with cassidoo

If I’m going to use Elixir, I might as well make use of its pattern matching!

explodeString - Interview question of the week from rendezvous with cassidoo

I’m doing some work in Elixir now, so I figure I’d take a shot at this week’s question with Elixir.

missingLetters - Interview question of the week from rendezvous with cassidoo

Simple, no-frills solution to this week’s question.

trimArray - Interview question of the week from rendezvous with cassidoo

There’s a really simple one-liner for arrays, but what about using this with generators? (i.e., the iterator pattern where a length is not known until reaching the end of the iteration)

mmmPie - Interview question of the week from rendezvous with cassidoo

How can I write a piece of code that can be written quickly and trivially understood? I think it’s mostly good variable names in this case. (And I handle infinite pie!)

binaryPal - Interview question of the week from rendezvous with cassidoo

What’s faster: a typical JavaScript implementation of .toString() and some basic string manipulation or clever bit shifting? (TL;DR: It’s bit shifting, but it’s uglier code.)

oddSquareSum - Interview question of the week from rendezvous with cassidoo

In this case, writing tests to prove the solution was far more interesting than the solution itself.

removeZeroes - Interview question of the week from rendezvous with cassidoo

The simple case wasn’t hard, but the low-memory iterator pattern was a fun, self-imposed challenge.

rollDice (by ChatGPT) - Interview question of the week from rendezvous with cassidoo

I decided to tinker with ChatGPT while working on an answer to this week’s question. While each implementation was passable and useful as a starting point, it became almost immediately clear that ChatGPT’s contextual understanding of its own output is fairly limited. Iterating with ChatGPT on its own technical output is not terribly reliable. After ten attempts at implementing iterating on rollDice, I decided to take a break and share the results here.

scramble - Interview question of the week from rendezvous with cassidoo

The tests were harder than the implementation 🥴

numBalanced - Interview question of the week from rendezvous with cassidoo

This one was fun to think about the minimal amount of processing needed to produce the result. In this case, the question is carefully worded to allow naive processing that’s really fast.

A1 Reference Style Spreadsheet Column Names - Interview question of the week from rendezvous with cassidoo

Nice little brain teaser involving number base conversion 😄

missingBits - Interview question of the week from rendezvous with cassidoo

Nice, bite-sized algorithm question.

Spin the Wheel - Interview question of the week from rendezvous with cassidoo

Well, I spent quite a bit more time on this tonight than I’d originally anticipated. It’s not pretty, but it does work and has a little bit of viable game theory.

sumEveryOther - Interview question of the week from rendezvous with cassidoo

This was a fun, light interview question this week.

Updated Flipper Zero CO2 Monitor

Well, I finally got around to updating my CO2 Monitor to take advantage of the latest APIs in the Flipper Zero firmware. (It wasn’t quite as bad as I thought it would be 😅) Now it even has its own application icon!

Guidelines for backlog refinement sessions

Formerly referred to as “backlog grooming,” backlog refinement is the process of defining pieces of work and estimating the amount of effort required to complete them. Backlog refinement requires buy-in from developers, testers, and stakeholders (product managers, business folks, etc.). Doing this refinement work results in a clearer understanding of the work to be done.

rectangleSum - Interview question of the week from rendezvous with cassidoo

This one was tricky to stay mindful of the number of iterations.

verticalSlashes - Interview question of the week from rendezvous with cassidoo

I do enjoy getting Cassidy’s newsletter late Sunday/early Monday and trying my hand at the “interview [questions] of the week.”

A story about protocols and documentation

In April 2021, I had a problem at work: I didn’t understand how our on-vehicle application communicated with the text-to-speech appliance to make next stop announcements.

Using Excel to make changes to GTFS feeds

Updated December 5, 2024

How I Built a Twitter Bot Using Auth0 Webtasks and Data.gov

I wanted to build something small, fun, and socially-engaging. I have been following Darius Kazemi (@TinySubversions) and the community of bot makers at Botwiki (@Botwikidotorg), and I decided a Twitter bot was the way to go. I have also been following the US Executive Order 13792 pretty closely. The order directs the US Department of Interior to review whether to downsize “certain national monuments” or sell their oil and mineral rights for profit. The Department has an open “Opportunity for Public Comment.” I thought this would be a good chance to tinker with lightweight sentiment analysis of the public comments.…

MQTT, Mono, and ARM

I wrote a .NET program to test building and cross-compiling an application to run on a Sierra Wireless AirLink RV50 gateway.

Figure out what columns in a table are required upon insert

Quick query to determine which columns of a table must be assigned values on INSERT:

Straight-up JavaScript – Array.prototype.some() and Array.prototype.every()

“I just want to know if there’s anything in this array.”

All Right Gentlemen!

Don’t let this happen to you! Look at the details of how your indexes are being used. If you have plain ol’ “predicates” and not “seek predicates” on your index, you’re scanning your index, despite the seek!

Using RAISERROR instead of PRINT for informational messages

Here’s a neat tidbit I found recently while working deep in some ETL scripts written in T-SQL: You can use RAISERROR with a severity of 0 as you would use PRINT in order to print out informational messages, and RAISERROR has a nifty option to write the message out immediately to the client. (Unlike PRINT, which waits for various things before printing messages.)

This is madness! This is CONVERT_IMPLICIT!

I, like a few others I know around here, enjoy getting the semantics of things right. Even if two things are functionally equivalent, correctly identifying each of the things makes me feel warm and fuzzy. Take for example, SQL Server User Defined Types. No, not the SQL Server 2005 CLR-based User Defined Types. Just the plain ol’ SQL Server 2000-style User-Defined Types. The ones that are just a friendly alias over a system type. Here’s an example of what I’m talking about:

“But, IIS, I want to return useful content for my errors!”

Sometimes I think of IIS as a big, dopey guy with a mostly-likable personality. He really wants to help with anything and everything, but he’s not very good at any of it.

HttpResponse.Filter: Mucking about with the response since .NET 1.1™

Davis and I set about a journey together into the nether regions of the ASP.NET request lifecycle to solve an issue: Insert a script into the header of an ASP.NET page, whether that page has a <head runat=”server”/> element or not. After trying several different approaches, we dug a little deeper and found HttpResponse.Filter.

.ToString() or not .ToString()

Every object in C# has it: .ToString(). That supposedly handy little method that “converts” the object into some string representation of the object. Sometimes it does just what you want, but sometimes it causes developers to go mad.
Think LINQ

Think LINQ – .SequenceEqual()

Up until March 26, I had come up with a number of crazy concoctions to test whether one IEnumerable<> was equal to another. Some of them chained together .Intersect() with .Count(), comparing the count of the elements in the intersected set with the count of the elements in each of the two sets. (If the count of A∩B is equal to the count of A and the count of B, then A and B are equal.)
Think LINQ

Think LINQ – .Skip() and .Take()

Needing to page through a collection is nothing new, and LINQ handles this nicely with two different methods: .Skip() and .Take(). The .Skip() method will skip over a specified number of items in an IEnumerable<>. The .Take() method will iterate over a specified number of items of an IEnumerable<> and then stop.

ManualResetEvent and the .NET Task framework

I’ve recently dived in to the .NET 4 Task framework, and was trying to deal with the issue of having a thread sleep for a specified period of time–unless a cancellation has been requested. This led me to discover ManualResetEvent, which is awesome for what I needed. Without further ado, here’s some code!
Think LINQ

Think LINQ – .Any() and .All()

“I just want to know if there’s anything in this List.” “Do any of the strings in my array start with ‘q’?” “How can I be sure all of the Rectangles in my IEnumerable<> have a width of 10?” These are the types of questions .Any() and .All() can answer.
Think LINQ

Think LINQ – .SelectMany()

I recently came across a beautiful example of .SelectMany() used to find all types that implement a particular interface in all currently loaded assemblies. With minor alterations, here is how I used it:
Think LINQ

Think LINQ – .ToLookup()

There is an class in the .NET generic collection framework that is often overlooked: Lookup<>. In effect, a Lookup<> functions like a Dictionary<> whose value is an IEnumerable<>. Though Lookup<T,U> is an implementation of IEnumerable<IGrouping<T, U>>, it functions with a similar efficiency to Dictionary<T,IEnumerable<U>>. Part of the LINQ extension methods include .ToLookup(), which works very similarly to .ToDictionary().
Think LINQ

Think LINQ – .ToDictionary()

There are a number of reasons to use Dictionary<> objects. Aside from the obvious name-value pair uses, Dictionary<> can also be used to essentially “index” an IEnumerable<> of objects. In testing with my colleague, Ryan Davis, we found that for IEnumerable<> collections that we intended to search through on a common field multiple times, converting the IEnumerable<> to a Dictionary<> provided a new gain in performance in most cases. Here’s an example of how this might be used, recalling the PersonEnumerable from an earlier post:
Think LINQ

Think LINQ – .Cast()

Personally, I find that .Cast() is an often overlooked part of LINQ. Of course, .Cast() is handy when casting each element of an IEnumerable<> from one type to another. However, one detail in its method signature brings to light a much more interesting use: .Cast() extends IEnumerable, the non-generic interface, but returns IEnumerable<>. This is significant because it becomes a gateway for non-generic collections to take advantage of the whole LINQ library. Collections that may have been developed for .NET 2.0 get .Where(), .Select(), etc.
Think LINQ

Think LINQ – The Wonder of IEnumerable<>

Language INtegrated Query, or LINQ, is a .NET feature that makes possible a powerful and extensible query on objects and collections thereof. LINQ is really a combination of a few key components: extension methods and generic collections. Understanding these two key components makes it much easier to “Think LINQ” when solving problems.

Table-Valued Parameters

Have you ever found yourself working in T-SQL and thought, “Query parameters are great for individual values, but what I really want is a way to pass an array–or even a table–into my query.” I have, and I was pleased to discover that starting in SQL Server 2008, a feature called Table-Valued Parameters (TVP) exists.

Interesting ASP.NET bug…

Just came across a most peculiar issue in the ASP.NET 4.0 HttpContext. It seems that postbacks ceased to work when the HttpRequest.Form member was accessed (in a read operation) from within a module’s AuthenticateRequest event. Reading cookies, querystrings, and server variables all appear to function without issue, but accessing the Form member seemed to alter the request in such a way that the postback no longer worked.

Follow-up to Interesting ASP.NET bug…

Previous post: Interesting ASP.NET bug…

Attack of the killer page

I have spent the last few days tackling a truly gnarly mess of ASP.NET code that was brought to my attention because of its poor performance. The page is intended to be a working view of people involved in a project, allowing the user to interact with people in a dozen different ways. The page went through three developers over a couple of years before it got to me, and each of the devs before me had a particular business problem they were trying to solve, as is the case with most business software. However, what probably started as an…