Maintaining Sanity

I’ve been traipsing round the countryside (near and far) on entirely too many customer visits, which, coupled with the return of my sinus troubles and a massive allergy, has done little towards either mood or creativity–hence the radio silence over the past couple of weeks.

Most of my travel time was put to moderately good use by reading books, and catching up on TV shows has been an adequate way to zone out and nurse my headaches, but a few other things have snuck their way in, including instilling some sanity into writing MQTT handlers–while on one of my depressingly repetitive train trips, I picked up a Trie class, tweaked it a bit, and hacked up a quick bottle-like approach to use with hbmqtt:

class MQTTRouter(Trie):
    def __init__(self):
        super(MQTTRouter, self).__init__(wildcard='#')
    def dispatch(self, path):
            status, func, kwargs = self.get(path)
            if '' in kwargs:
            if status:
                return func(**kwargs)
        except Exception as e:

router = MQTTRouter()

def route(path):
    """Decorator for wrapping handlers"""
    def inner(func):
        router.insert(path, func)
    return inner

# some example handlers, with parameters and wildcards
def system(internal):
    print("system " + internal)

def temperature(sensor):

# test invocations

I’ve yet to tie this in with asyncio, but I can see it happening when allergy season passes. If it ever does, considering how unstable the weather is now…

A Leisurely Lunch

Near the Braga Cathedral, shown here in its gothic majesty.

Fast Train

The train to Porto, which took me to visit friends for a change.

Picking a "new" server-side language

I seldom digress about programming languages, since I believe they ought to fade into the background and be largely interchangeable as the systems you build become more complex. But there are some sweet spots that are worth delving into, and any architect/developer/engineer worth their salt should be constantly reevaluating what they know and learning new stuff.


A Personal, Heartfelt Note on macOS Reliability

I powered up my MacBook Pro with the intent of doing some writing this evening, and there was a surprising turn of events–it rebooted straight into the macOS installer, complaining that it couldn’t finish installing the OS:



A different lunch break (tinged with some blue and a cold)