Convert Alfred snippets (.json) to Espanso matches (.yaml)

Moving to Linux this month (Pop_OS to be specific), the biggest change was leaving Alfred behind. While almost every other tool or app had a nearly exact replacement, I could not find any launchers on Linux that had the huge number of power user features Alfred has. However, I found lots of amazing small apps that do just one feature and do it well.

One of those apps was Espanso, a light weight CLI focused text expander. Using Alfred on macOS, the global snippets where a big part of my workflow. After a bit of reading, on Linux I stumbled on Espanso which seems like one of the best text expanders available. A quick browse of the well written and maintained documentation and it’s clear why.

The UX for the actual text expanding was the exact same, however the setup was a bit different between the two apps. There’s no simple way to just import Alfred snippets into Espanso, so a bit of data massaging was required.

To do this I first exported Alfred snippets (either by browsing Alfreds preferences folder, or Exporting the snippets manually in Alfred > Features > Snippets > Export), I then jotted up and ran this script to convert Alfreds method of storing the snippets in .json to Espanso’s .yaml format, & tweaking some minor differences with cursor and clipboard variables:

A pretty simple difference and straight forward result. Then it was just copy & paste of the output to the bottom of ~/.config/espanso/default.yaml

If this doesn’t work and Espanso complains of errors, try opening default.yaml in VSCode or another editor and add YAML Syntax extension or similar. This should flag any syntax errors for manual resolving. In my case one or two regex patterns I have saved were just a bit to regex’y for my simple str_replace()’s.

All and all it wasn’t a heavy lift, & I managed to wrangle all 388 some snippets of mine over.

Customizing My iPad Magic Keyboard Case w/ the WordPress Logo

The over priced magic keyboard case is great in nearly every way. It’s a solid protective case, easy to take the iPad off of, always around the iPad for the times I do need to type, great keyboard to dock on.. it’s all the things. Except I find it hard to open. I fumble 9/10 times to open it. Without a cutout groove like the macbook, the hardest part, for me, is knowing which side is up by feel, so I know which side has the weight (as it‘s counter intuitive to and very different than macbooks we’re all used to), for which direction to force.

Pick a side any side *rolls the dice

I know, I know, there’s a giant cut out for the camera to the top iPad side, so that’s the indication thats heavy side, as well the impressions with the Apple logo and bend seams. But that just isn’t enough for me and my brain, for whatever reason.. even after a month of heavy use. Out of frustration, I nearly wrote “iPad” and “keyboard” on the two sides with a white acrylic pen, but opted to just go with a less obvious indicator, a sticker instead.

The stickers I had on hand were from work, WordPress VIP, which is a beautiful graphic that encompasses WordPress well, it’s a great sticker and has meaning close to my heart – however it just wasn’t the right fit, the black was glossy instead of matte, and it didn’t play nice covering the embossed Apple logo:

I thought about ordering developer stickers (you know the style) and putting a bunch on, but just felt weird and inauthentic buying them outright instead of collecting them from conventions and things like that (something, something, COVID). I then thought it’d be cool to use that acryclic pen for just the “W” WordPress logo, but I was fearful as I don’t have steady enough hands for that, even when tracing. So I thought about stencilling, and that’s when I remembered I own a 3d printer, am capable of creating things in CAD and have lots of spray paint!

Gearing up to design the ”W“ logo, I headed to first, just in case someone could save me the time, and wouldn’t you know it. The logo, in the cutout I wanted, was already made perfectly for a two colour coaster:

I took it into Cura, scaled it to the size I wanted for the 11” case adjusting the width and hight and lowering the depth a bit, and started printing the free design with $0.09 of material:

Beautiful logo. I tell ya, this thing looks great on it’s own.
Good size. I should of printed a nub to help peal it off when paint is on it, but I’ll manage w/ a pair of tweezers.

With the stencil printed, I grabbed a can of spray paint and headed outside. I practised the shot many times before on cardboard to ensure I got the distance and angles right.

Then after carefully finding centre, ensuring I had the right side or orientation, second guessing myself, then finding perfectly the centre again, I hit it with a splash of spray paint, and Voila:

I sprayed way too close and pooled the paint. Gahh, life needs a undo button. However, I think I got it looking alright:

It’s a bit blotchy right now, I may end up roughing it up a bit with sand paper. I imagine this well wear well overtime. In retrospect as I see the image of the stencil on the case, I think I should of taken the time to design the inverse of this for that cleaner logo look instead of the silhouette/blast look – but, I’m happy with it.

I now clearly know which side is up, and customized my stuff with the best logo, that means the most to me: WordPress has been at the centre of my life in the centre of my career for well over a dozen years it’s been putting food on my table for me and my family, I’m proud to have this logo on my gear.


Much like a regrettable tattoo, I began to dislike the blast/silhouette look on this more and more each day. It was a bit extreme for me and my modest iPad. I wanted just the logo itself, in a more subtle/clean look. So I found lifes undo button and just sanded it off:

Whatever silicon/plastic/magic material this is made off, it held up well to sanding. Looked no worse off once completed.

I then designed a stencil for just the logo, opening up Shapr3d I cut out the logo and built some scaffolding to hold the floating pieces in place.

I’ve shared this stencil here:

To my surprise, it printed well enough, as I hadn’t done overhangs without supports like this before but it printed just fine:

After centering, masking, and painting (lightly this time, to avoid pooling) I finally got the look I was after:

Much better. No more obnoxious ‘blast’. Admittedly, the lines aren’t as clean as I had hoped for, I may of been able to get it a bit cleaner by pushing down on the stencil while spraying, but I think it still looks good and will wear well.

Building a Sleep Training Light with ESP8266, ESPHome, & Home Assistant

My kids, specifically the eldest, loves to wake up before 7. My wife and I, do not like to wake up before 7. My kids can’t read the time yet or understand why every month the sun seems gets up at a different time.

Our solution to help stop this was a sleep training clock: a visual way to differentiate sleeping time with awake time. Online they run about $40 and, in my opinion, are just over the top with features and buttons. A simple scheduled LED was all we were after. So I built one with an esp8266, ESPHome, & HomeAssistant:


Wiring it Together

I’ve just moved to using an iPad as my primary personal computer so I no longer have Fritzing, so my crude drawing in will have to do:

Common anaode RGB wiring to an ESP8266, pins D5, D6, D7.

Setting up ESPHome Module

In Home Assistant follow the ESPHome Add Module wizard filling in info about your ESPHome and WIFI networking settings. Editing the file once complete, mine looks like:

  name: sleep_training_light
  platform: ESP8266
  board: esp12e

  ssid: !secret wifi_name
  password: !secret wifi_pass
    static_ip: !secret sleep_training_light_ip
    gateway: !secret ip_gateway
    subnet: !secret ip_subnet

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "sleep-training-light"
    password: !secret fallback_pass

# @see
# common Anode
  - platform: rgb
    name: "Sleep Training Light"
    red: output_red
    green: output_green
    blue: output_blue  
  - platform: esp8266_pwm
    id: output_red
    pin: GPIO12
    inverted: true
  - platform: esp8266_pwm
    id: output_green
    pin: GPIO13
    inverted: true
  - platform: esp8266_pwm
    id: output_blue
    pin: GPIO14
    inverted: true


# Enable logging

# Enable Home Assistant API
  password: !secret api_pass

  password: !secret ota_pass

Add to HA

Home Assistants notification area should alert you to the new ESPHome device. You can add this entity.


At time of writing, I found the Confugration > Automattions area of Home Assistant a bit buggy, I ended up mostly setting up the automation via the File Editor. Here’s why my /config/automations.yaml looks like:

- id: sleep_training_light_night
  alias: Sleep Training Light -> Night
  description: ''
  - platform: time
    at: '20:00:00'
  - data:
      brightness: 80
      - light.sleep_training_light
      - 162
      - 116
      - 255
    service: light.turn_on
    entity_id: light.sleep_training_light
  mode: single
- id: sleep_training_light_wakeup
  alias: Sleep Training Light -> Wake Up
  description: ''
  - at: 07:00:00
    platform: time
  - data:
      brightness: 0
      - light.sleep_training_light
      - 0
      - 0
      - 0
    entity_id: light.sleep_training_light
    service: light.turn_on
  mode: single

This turns on the light at 8:00pm, and turns off the light at 7:00am.


I designed a custom case (will update this post with a link to the design shortly) for another project (IR Blaster) and reused it for this one, however I printed with clear filament and kept the RGB LED inside, giving the box a nice glow: