Dan Q found GC9Q4JG Timms Estate

This checkin to GC9Q4JG Timms Estate reflects a geocaching.com log entry. See more of Dan's cache logs.

I’ve been working in Banbury this morning while my car was being serviced at the nearby garage. Once I got the call to say it had been done and I could come and collect it I walked back past this cache. Instant find. TFTC!

Dan, in a black t-shirt, waves to the camera from a suburban street.

Dan, in a black t-shirt, waves to the camera from a suburban street.×

Milk and Mail Notifications with Flic 2 Buttons

I’ve been playing with a Flic Hub LR and some Flic 2 buttons. They’re “smart home” buttons, but for me they’ve got a killer selling point: rather than locking you in to any particular cloud provider (although you can do this if you want), you can directly program the hub. This means you can produce smart integrations that run completely within the walls of your house.

Here’s some things I’ve been building:

Prerequisite: Flic Hub to Huginn connection

Screenshot showing the location of the enabled "Hub SDK web access open" setting in the Flic Hub settings page of the Flic app.
Step 1. Enable SDK access. Check!

I run a Huginn instance on our household NAS. If you’ve not come across it before, Huginn is a bit like an open-source IFTTT: it’s got a steep learning curve, but it’s incredibly powerful for automation tasks. The first step, then, was to set up my Flic Hub LR to talk to Huginn.

Screenshot showing the Flic Hub SDK open in Firefox. Three modules are loaded: "IR Recorder", "UDP to IR Blaster", and "The Green", the latter of which is open. "The Green" shows JavaScript code to listen for 'buttonSingleOrDoubleClickOrHold' events then transmits them as HTTP POST requests to a 'webHook' URL.
Checking ‘Restart after crash’ seems to help ensure that the script re-launches after e.g. a power cut. Need the script?

This was pretty simple: all I had to do was switch on “Hub SDK web access open” for the hub using the Flic app, then use the the web SDK to add this script to the hub. Now whenever a button was clicked, double-clicked, or held down, my Huginn installation would receive a webhook ping.

Flow chart showing a Flic 2 button sending a Bluetooth 5 LE message to a Flic Hub LR, which sends a Webook notification to Huginn (depicted as a raven wearing a headset), which sends a message to an unidentified Internet Of Things device, "probably" over HTTPS.
Depending on what you have Huginn do “next”, this kind of set-up works completely independently of “the cloud”. (Your raven can fly into the clouds if you really want.)

For convenience, I have all button-presses sent to the same Webhook, and use Trigger Agents to differentiate between buttons and press-types. This means I can re-use functionality within Huginn, e.g. having both a button press and some other input trigger a particular action.

You’ve Got Mail!

By our front door, we have “in trays” for each of Ruth, JTA and I, as well as one for the bits of Three Rings‘ post that come to our house. Sometimes post sits in the in-trays for a long time because people don’t think to check them, or don’t know that something new’s been added.

I configured Huginn with a Trigger Agent to receive events from my webhook and filter down to just single clicks on specific buttons. The events emitted by these triggers are used to notify in-tray owners.

Annotated screenshot showing a Huginn Trigger Agent called "Flic Button C (Double) Details". Annotations show that: (1) "C" is the button name and that I label my buttons with letters. (2) "Double" is the kind of click I'm filtering for. (3) The event source for the trigger is a webhook called "Flic Buttons" whose URL I gave to my Flic Hub. (4) The event receiver for my Trigger Agent is called "Dan's In-Tray (Double) to Slack", which is a Slack Agent, but could easily be something more-sophisticated. (5) The first filter rule uses path: bdaddr, type: field==value, and a value equal to the MAC address of the button; this filters to events from only the specified button. (6) The second filter rule uses path: isDoubleClick, type: field==value, and value: true; this filters to events of type isDoubleClick only and not of types isSingleClick or isHold.
Once you’ve made three events for your first button, you can copy-paste from then on.

In my case, I’ve got pings being sent to mail recipients via Slack, but I could equally well be integrating to other (or additional) endpoints or even performing some conditional logic: e.g. if it’s during normal waking hours, send a Pushbullet notification to the recipient’s phone, otherwise send a message to an Arduino to turn on an LED strip along the top of the recipient’s in-tray.

I’m keeping it simple for now. I track three kinds of events (click = “post in your in-tray”, double-click = “I’ve cleared my in-tray”, hold = “parcel wouldn’t fit in your in-tray: look elsewhere for it”) and don’t do anything smarter than send notifications. But I think it’d be interesting to e.g. have a counter running so I could get a daily reminder (“There are 4 items in your in-tray.”) if I don’t touch them for a while, or something?

Remember the Milk!

Following the same principle, and with the hope that the Flic buttons are weatherproof enough to work in a covered outdoor area, I’ve fitted one… to the top of the box our milkman delivers our milk into!

Top of a reinforced polystyrene doorstep milk storage box, showing the round-topped handle. A metal file sits atop the box, about to be used to file down the handle.
The handle on the box was almost exactly the right size to stick a Flic button to! But it wasn’t flat enough until I took a file to it.

Most mornings, our milkman arrives by 7am, three times a week. But some mornings he’s later – sometimes as late as 10:30am, in extreme cases. If he comes during the school run the milk often gets forgotten until much later in the day, and with the current weather that puts it at risk of spoiling. Ironically, the box we use to help keep the milk cooler for longer on the doorstep works against us because it makes the freshly-delivered bottles less-visible.

Milk container, with a Flic 2 button attached to the handle of the lid and a laminated notice attached, reading: "Left milk? Press the button on the Milk Minder. It'll remind us to bring in the milk!"
Now that I had the technical infrastructure already in place, honestly the hardest part of this project was matching the font used in Milk & More‘s logo.

I’m yet to see if the milkman will play along and press the button when he drops off the milk, but if he does: we’re set! A second possible bonus is that the kids love doing anything that allows them to press a button at the end of it, so I’m optimistic they’ll be more-willing to add “bring in the milk” to their chore lists if they get to double-click the button to say it’s been done!

Future Plans

I’m still playing with ideas for the next round of buttons. Could I set something up to streamline my work status, so my colleagues know when I’m not to be disturbed, away from my desk, or similar? Is there anything I can do to simplify online tabletop roleplaying games, e.g. by giving myself a desktop “next combat turn” button?

Flic Infared Transceiver on the side of a bookcase, alongside an (only slighter smaller than it) 20p piece, for scale.
My Flic Hub is mounted behind a bookshelf in the living room, with only its infrared transceiver exposed. 20p for scale: we don’t keep a 20p piece stuck to the side of the bookcase all the time.

I’m quite excited by the fact that the Flic Hub can interact with an infrared transceiver, allowing it to control televisions and similar devices: I’d love to be able to use the volume controls on our media centre PC’s keyboard to control our TV’s soundbar: and because the Flic Hub can listen for UDP packets, I’m hopeful that something as simple as AutoHotkey can make this possible.

Or perhaps I could make a “universal remote” for our house, accessible as a mobile web app on our internal Intranet, for those occasions when you can’t even be bothered to stand up to pick up the remote from the other sofa. Or something that switched the TV back to the media centre’s AV input when consoles were powered-down, detected by their network activity? (Right now the TV automatically switches to the consoles when they’re powered-on, but not back again afterwards, and it bugs me!)

It feels like the only limit with these buttons is my imagination, and that’s awesome.

Screenshot showing the location of the enabled "Hub SDK web access open" setting in the Flic Hub settings page of the Flic app.× Screenshot showing the Flic Hub SDK open in Firefox. Three modules are loaded: "IR Recorder", "UDP to IR Blaster", and "The Green", the latter of which is open. "The Green" shows JavaScript code to listen for 'buttonSingleOrDoubleClickOrHold' events then transmits them as HTTP POST requests to a 'webHook' URL.× Flow chart showing a Flic 2 button sending a Bluetooth 5 LE message to a Flic Hub LR, which sends a Webook notification to Huginn (depicted as a raven wearing a headset), which sends a message to an unidentified Internet Of Things device, "probably" over HTTPS.× Annotated screenshot showing a Huginn Trigger Agent called "Flic Button C (Double) Details". Annotations show that: (1) "C" is the button name and that I label my buttons with letters. (2) "Double" is the kind of click I'm filtering for. (3) The event source for the trigger is a webhook called "Flic Buttons" whose URL I gave to my Flic Hub. (4) The event receiver for my Trigger Agent is called "Dan's In-Tray (Double) to Slack", which is a Slack Agent, but could easily be something more-sophisticated. (5) The first filter rule uses path: bdaddr, type: field==value, and a value equal to the MAC address of the button; this filters to events from only the specified button. (6) The second filter rule uses path: isDoubleClick, type: field==value, and value: true; this filters to events of type isDoubleClick only and not of types isSingleClick or isHold.× Top of a reinforced polystyrene doorstep milk storage box, showing the round-topped handle. A metal file sits atop the box, about to be used to file down the handle.× Milk container, with a Flic 2 button attached to the handle of the lid and a laminated notice attached, reading: "Left milk? Press the button on the Milk Minder. It'll remind us to bring in the milk!"× Flic Infared Transceiver on the side of a bookcase, alongside an (only slighter smaller than it) 20p piece, for scale.×

Dan Q performed maintenance for GC8W7QW Forgotten Bridge

This checkin to GC8W7QW Forgotten Bridge reflects a geocaching.com log entry. See more of Dan's cache logs.

Routine maintenance visit. Came in via the path through the field to the North (pictured) which was pretty challenging because the “path” is almost as deep in vegetation as the cornfield that straddles it! Gloriously hot today, and the elder tree at the GZ smells lush!

Pleased to see a log entry from March by some picknickers who found the cache by accident. Delightful!

Cache remains in fine condition and ready to be found!

Dan, in a black t-shirt with "never without art" written on it, waves to the camera. He's standing in a cornfield, but the "path" that cuts diagonally through it is filled with plants to a similar height as the corn, making it hard to pass.

Dan, in a black t-shirt with "never without art" written on it, waves to the camera. He's standing in a cornfield, but the "path" that cuts diagonally through it is filled with plants to a similar height as the corn, making it hard to pass.×

Bash+Batch In One File

Today I wanted to write a script that I could execute from both *nix (using Bash or a similar shell) and on Windows (from a command prompt, i.e. a batch file). I found Max Norin’s solution which works, but has a few limitations, e.g. when run it outputs either the word “off” when run in *nix or the word “goto” when run on Windows. There’s got to be a sneaky solution, right?

Here’s my improved version:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
@goto(){
  # Linux code here
  uname -o
}

@goto $@
exit

:(){
@echo off
rem Windows script here
echo %OS%

Mine exploits the fact that batch files can prefix commands with @ to suppress outputting them as they execute. So @goto can be a valid function name in bash/zsh etc. but is interpreted as a literal goto command in a Windows Command Prompt. This allows me to move the echo off command – which only has meaning to Windows – into the Windows section of the script and suppress it with @.

The file above can be saved as e.g. myfile.cmd and will execute in a Windows Command Prompt (or in MS-DOS) or your favourite *nix OS. Works in MacOS/BSD too, although obviously any more-sophisticated script is going to have to start working around the differences between GNU and non-GNU versions of core utilities, which is always a bit of a pain! Won’t work in sh because you can’t define functions like that.

But the short of it is you can run this on a stock *nix OS and get:

$ ./myfile.cmd
GNU/Linux

And you can run it on Windows and get:

> .\myfile.cmd
Windows_NT

You can’t put a shebang at the top because Windows hates it, but there might be a solution using PowerShell scripts (which use hashes for comments: that’s worth thinking about!). In any case: if the interpreter strictly matters you’ll probably want to shell to it on line 3 with e.g. bash -c.

Why would you want such a thing? I’m not sure. But there is is, if you do.

Do What You’re Bad At

This blog post is also available as a video. Would you prefer to watch/listen to me tell you about how I’ve learned to enjoy doing what I’m bad at?

There are a great number of things that I’m bad at. One thing I’m bad at (but that I’m trying to get better at) is being more-accepting of the fact that there are things that I am bad at.

Against a pale background, Dan, deep in thought and with a finger to his lips, staring into space. A stylised thought bubble above him shows that he is thinking about himself thinking about himself thinking about himself, and so on (implied to infinity).
I’ve also been thinking about how I’m bad at thinking about how I’m bad at thinking about how I’m bad at thinking about…

I’m pretty bad in a pub quiz. I’m bad at operating my pizza oven without destroying cookware. I’m especially bad at learning languages. I’m appallingly bad at surfing. Every time my work periodically leans in that direction I remember how bad I am at React. And I’ve repeatedly shown that I’m bad at keeping on top of blogging, to the extent that I’ve periodically declared bankruptcy on my drafts folder.

So yeah, pretty bad at things.

But hang on: that assessment isn’t entirely true.

Photograph showing a yellow banana on a pink background. The banana has a silver chain wrapped around it three times. Photo courtesy Deon Black.
I’m also particularly bad at choosing suitable stock photos for use in blog posts.

Being Bad

As a young kid, I was a smart cookie. I benefited from being an only child and getting lots of attention from a pair of clever parents, but I was also pretty bright and a quick learner with an interest in just about anything I tried. This made me appear naturally talented at a great many things, and – pushed-on by the praise of teachers, peers, and others – I discovered that I could “coast” pretty easily.

But a flair for things will only carry you so far, and a problem with not having to work hard at your education means that you don’t learn how to learn. I got bitten by this when I was in higher education, when I found that I actually had to work at getting new information to stick in my head (of course, being older makes learning harder too, as became especially obvious to me during my most-recent qualification)!

Dan, aged around 4, dressed in a duffel coat, bobble hat and gloves, kneeling on a red plastic sledge in a snow-filled garden. The garden is bordered by a wire fence, and in the background a man can be seen scraping icee off a car.
Ignore the fact that you’ve now seen me trying to sledge uphill and just accept that I was a clever kid (except at photography), okay?

A side-effect of these formative experiences is that I grew into an adult who strongly differentiated between two distinct classes of activities:

  1. Things I was good at, either because of talent or because I’d thoroughly studied them already. I experienced people’s admiration and respect when I practised these things, and it took little effort to stay “on top” of these fields, and
  2. Things I was bad at, because I didn’t have a natural aptitude and hadn’t yet put the time in to learning them. We don’t often give adults external reinforcement for “trying hard”, and I’d become somewhat addicted to being seen as awesome… so I shied away from things I was “bad at”.

The net result: I missed out on opportunities to learn new things, simply because I didn’t want to be seen as going through the “amateur” phase. In hindsight, that’s really disappointing! And this “I’m bad at (new) things” attitude definitely fed into the imposter syndrome I felt when I first started at Automattic.

Being Better

Leaving the Bodleian after 8½ years might have helped stimulate a change in me. I’d carved out a role for myself defined by the fields I knew best; advancing my career would require that I could learn new things. But beyond that, I benefited from my new employer whose “creed culture” strongly promotes continuous learning (I’ve vlogged about this before), and from my coach who’s been great at encouraging me towards a growth mindset.

A cake with icing printed with a picture of Dan in a library. Beneath are iced the words "Good Luck Dan".
“Good Luck Dan”, my Bodleian buddies said. But perhaps they should’ve said “Keep Learning Dan”.

But perhaps the biggest stimulus to remind me to keep actively learning, even (especially?) when it’s hard, might have been the pandemic. Going slightly crazy with cabin fever during the second lockdown, I decided to try and teach myself how to play the piano. Turns out I wasn’t alone, as I’ve mentioned before: the pandemic did strange things to us all.

I have no real experience of music; I didn’t even get to play recorder in primary school. And I’ve certainly got no talent for it (I can hear well enough to tell how awful my singing is, but that’s more a curse than a blessing). Also, every single beginners’ book and video course I looked at starts from the assumption that you’re going to want to “feel” your way into it, and that just didn’t sit well with the way my brain works.

Animation showing Dan, wearing a black t-shirt and tracksuit bottoms, playing an upright piano.
90% of what I do in front of a piano might be described as “Dan Mucks About (in B Minor)”, but that’s fine by me.

I wanted a theoretical background before I even sat down at a keyboard, so I took a free online course in music theory. Then I started working through a “beginners’ piano” book we got for the kids. Then I graduated to “first 50 Disney songs”, because I know how virtually all of them sound well enough that I’d be able to hear where I was going wrong. Since then, I’ve started gradually making my way through a transcription of Einaudi’s Islands. Feeling like I’d got a good handle on what I was supposed to be doing, I then took inspiration from a book JTA gave me and started trying to improvise.

Most days, I get no more than about 10 minutes on the piano. But little by little, day by day, that’s enough to learn. Nowadays even my inner critic perfectionist can tolerate hearing myself play. And while I know that I’ll probably never be as good as, say, the average 8-year-old on YouTube, I’m content in my limited capacity.

Three books on a blue-and-white tablecloth: John Thompson's Easiest Piano Course (Part One), First 50 Disney Songs, and Essential Einaudi - Islands. Beneath them sits a simplified diagram showing the circle of fifths.
Let’s start at the very beginning. (A very good place to start.)

If I’m trying to cultivate my wonder syndrome, I need to stay alert for “things I’m bad at” that I could conceivably be better at if I were just brave enough to try to learn. I’m now proudly an “embarrassingly amateur” pianist, which I’m at-long-last growing to see as better than a being non-pianist.

Off the back of that experience, I’m going to try to spend more time doing things that I’m bad at. And I’d encourage you to do the same.

Against a pale background, Dan, deep in thought and with a finger to his lips, staring into space. A stylised thought bubble above him shows that he is thinking about himself thinking about himself thinking about himself, and so on (implied to infinity).× Photograph showing a yellow banana on a pink background. The banana has a silver chain wrapped around it three times. Photo courtesy Deon Black.× Dan, aged around 4, dressed in a duffel coat, bobble hat and gloves, kneeling on a red plastic sledge in a snow-filled garden. The garden is bordered by a wire fence, and in the background a man can be seen scraping icee off a car.× A cake with icing printed with a picture of Dan in a library. Beneath are iced the words "Good Luck Dan".× Three books on a blue-and-white tablecloth: John Thompson's Easiest Piano Course (Part One), First 50 Disney Songs, and Essential Einaudi - Islands. Beneath them sits a simplified diagram showing the circle of fifths.×

Note #20176

Hey @VOXI_UK! There’s a security #vulnerability in your website. An attacker can (a) exfiltrate mobile numbers and (b) authenticate bypassing OTP.

Not sure who to talk to about ethical disclosure. Let me know?

Dan Q archived GC90RH3 Tiny Log Book

This checkin to GC90RH3 Tiny Log Book reflects a geocaching.com log entry. See more of Dan's cache logs.

This morning two men from the council turned up at my door and asked if they could borrow my driveway to park their vehicle. We got chatting, and it turned out that they were going to be working on footpath maintenance nearby. Realising where they meant, I asked for more information about their work: their plan was to remove the footbridge which acts as the home to this geocache, and replace it with a new one a couple of metres over in order to bring the path in-line with its “correct” location!

A rugged white flatbed van with a yellow stripe and the logo of Oxfordshire County Council sits on a gravel driveway in a garden. The sun glistens off the windscreen and the driver-side window is partially ajar.

So I wandered out with them and removed the geocache before they got started on removing the bridge. I might be able to replace it after the new bridge is built, but – based on their description of the new bridge – it might need to be a different design of cache, so for now I’m archiving this one. This is perhaps my happiest cache-archiving ever.

I confirmed that this team weren’t the bridge inspection team who wrote a lovely log in a cache of mine hidden under a different bridge in this area, but they said that they do occasionally find caches as part of their work and try to return them as-they-found-them. Delightful conversation.

A rugged white flatbed van with a yellow stripe and the logo of Oxfordshire County Council sits on a gravel driveway in a garden. The sun glistens off the windscreen and the driver-side window is partially ajar.×

Dan Q found GC8Q3X3 Final cache of series

This checkin to GC8Q3X3 Final cache of series reflects a geocaching.com log entry. See more of Dan's cache logs.

This one was a challenge. Finding myself on a path alongside a wooden fence, I propped my bike up against the fence to search what seemed to be the obvious candidates, but no look. I returned to my bike to retrieve my handlebar-mounted GPSr to try to get a better fix and soon found myself tramping through waist-high nettles towards to GZ. Oh! There’s another path over here! That makes more sense. Found the cache pretty quickly once I’d got my silly self into the right place! TFTC!

Dan Q found GC6FEXP Octocache

This checkin to GC6FEXP Octocache reflects a geocaching.com log entry. See more of Dan's cache logs.

Came near here on an evening’s cycle from Stanton Harcourt and, seeing that the path wasn’t too muddy, decided to come and explore the woods. Lots of birdsong tonight! Was glad of the hint which saved me poking in the wrong holes. TFTC.

 

Dan, wearing a Tumblr hoodie over a My Little Pony T-shirt and with a white cycle helmet on his head, stands in front of his bike (with a GPS receiver on the handlebars) in a deep green forest.

Dan, wearing a Tumblr hoodie over a My Little Pony T-shirt and with a white cycle helmet on his head, stands in front of his bike (with a GPS receiver on the handlebars) in a deep green forest.×