Unmarshaling arrays of disparate items

Creating a custom UnmarshalJSON to handle arrays of disparately typed objects.
read more

Charging an EV for free - part 2

In part 1 I described the fundamental principle of the system – the inputs and outputs to the system and the concept of having a control loop to maximise the charging power without exceeding the amount of excess energy available.

I’ll let you in on a little secret – at that point I didn’t even have an EV yet. I was still waiting on delivery. I had the charger though, and I wrote a …


read more

Charging an EV for free - part 1

The solar landscape has changed in Australia.

In the boom days of solar, there were extensive and lucrative reasons to invest in solar power for the home. The FIT (Feed In Tarrifs) were so high (ludicrously so, really) with enormously long tenures, that getting solar was a no-brainer.

Not that I’m arguing that that was a bad idea. It has made us a nation where home renewable power generation …


read more

So you know X and you want to learn Go?

Learning Go, from the viewpoint of a dynamic language programmer
read more

Embedded SQL migrations with jackc/tern

tern is a powerful standalone SQL migration tool, which I’ve used quite a bit in the past.

I’ve always treated the migration as a separate step - deploy the application and then perform the migration. This requires me to potentially move the schema migrations files around, or run the migration via an ssh tunnel or similar.

One of the advantages of golang is being able to ship a single …


read more

For loops with consistent timing

“Do a thing, sleep a while, repeat” is an extremely common paradigm. Here is how that concept is typically expressed:


read more

htmx, embedded assets and html/template

htmx is a new javascript framework that tips the typical front-end development paradigm on its head. A typical webapp these days looks like:

  • backend, implementing business logic
  • a transport layer (REST endpoints, serving JSON)
  • a front-end in javascript

While this has become the defacto model for front-end development in 2022, there are some problems with this approach:

  • You need two different …

read more

SSO for your homelab

At one point all of us homelabbers (remember when there wasn’t a dedicated name for people like you and me who just wanted to run cool things at home?) want access to their web application resources from the outside world.

This is easy enough, of course. Port forward, you’re done. However these simple solutions can be pretty clunky for a variety of reasons:

  • bad URL’s like …

read more

encoding/gob with wire encryption

The various io.* interfaces (such as io.Reader and io.Writer) are often touted as a golang “killer feature”, though once you are familiar with interfaces you realise there is not much to them. The beauty is in the simplicity.

When I first looked at the encoding/gob I was slightly peturbed by the requirement to provide a io.Reader (to the Decoder) and an io.Writer (to the Encoder). It …


read more

The dawning of a new age

What a pretentious title.

In my many years on the internet I’ve had a variety of personal home pages along the way.

As usual for the tech-nerd, they are often an excuse to rewrite the blogging wheel, or as a showcase to showoff various creations.

Looking backwards on archive.org is a cringeworthy experience. And I have vague recollections of my even earlier efforts, hosted under the …


read more