This is the blog, but if you want to know more about me and my projects, check out the Projects and About pages.

How a Developer Fell in Love with Keyboard Maestro

Do More

You may have heard that I’ve been getting more in to automation recently, specifically automating more of my work and personal macOS environments. There are countless apps and tools and plugins and widgets for this on the Mac and over my 20 years using the Mac I have ignored all of them. Why? Because I can code, dammit! I don’t need a menu bar filled with little icons that are the windows to little ram-munching services when I can just write a bash script or even my own Mac app to do what I need!

So what changed? Nothing! I can still code and I still don’t want a bunch of little specialized apps running all the time…but I have seen the light on one automation app in particular.

Why am I writing this? It turns out that I fell in love with Keyboard Maestro.

Yes, on it’s face it’s a drag and drop way to create automations, making it the Mac automation Swiss Army knife, but even if you can code, it is extremely valuable. Here are a few reasons, and after that I’ll run through a few of my favorite automations.

Little Scripts Everywhere

I’ve been writing little automation scripts for decades now and they have ended up any number of places over the years, like in Documents, or ~/bin, or in Automator, or a local git repo somewhere. Even if I was diligent about keeping everything in a single directory, over time and when switching hardware, some scripts are lost, some are kept, and some are kept but the context is lost. Scheduling scripts is also an issue. Unix systems, such as macOS can use cron jobs, but they don’t sync or migrate to the next computer or are simply forgotten.

Keyboard Maestro has become a single place for all macOS automation scripts to live. Scripts are embedded in to macros, macros can be scheduled, and it all syncs via your preferred file syncing solution.

Write Once, Run Everywhere

Having all my scripts in one place has another side benefit, which is the kismet of “Oh wait, that script I wrote for work would also work really nicely on this project too!” When all of your scripts are in one place, it’s way more likely to have those little epiphanies.

Keyboard Maestro gives you the ability to group macros in to folders. Some folders can be set specifically for a single application, other group folders can be set to only be active on one or more computers. It’s really helpful and allows you to share some scripts and not share others.

Like having all your code in a single repo, another benefit of having all the automation scripts in one place is that you can see very clearly where a macro could be broken apart and used as the base subroutine for several macros which allows you to create a lot less bash/javascript/clicks.

Chasing UX Automation

It’s one thing to write a script that copies a file to a remote server or API, but writing scripts that automate the UI of your computer can be fraught. APIs, resolution, window commands, all change and will break your script causing you to spend hours trying to figure out the new best way to position a window in the top right corner of your second monitor. Keyboard Maestro functions as an abstraction layer for interacting with your macOS UI.

Yes, you can use AppleScript but the thing is…

AppleScript Displeases Me

AppleScript is weird. To be more precise, in an effort to make a programming language more like a written language, AppleScript’s APIs are best described as unguessable and I’d like to avoid spending hours on Google to try and find out the best way to take the first element from and array and send it to a specific and less than documented Mac app.

Dropping in to AppleScript from time to time is probably unavoidable, but Keyboard Maestro allows me to limit that by letting their built in functions take care of the AppleScripting and let my logic live in Bash or Javascript blocks.


Let’s talk automation examples, shall we?

It’s impossible to write anything about automation without some segment of your readers to immediately scream out “SHOW ME WHAT YOU’VE AUTOMATED!” Everyone knows that automation people need a steady stream of automation suggestions fed to them or they die, which is terrible. Plus, after their dead no one knows how to turn off that thing they setup where the lights flash red when the doorbell rings and it’s super annoying.

Automated Setups or “Modes”

Having a keyboard shortcut, or in my case a button on my Stream Deck, open a series of windows for you is an extremely common use case, but it’s common because it’s really useful! I have several “modes” on my work and personal Macs. Below you can see an example of my “Start” mode that allows me to clear my windows and reset at the beginnning of the day to review Slack, email, my calendar, my notes, and a web browser.

KM Automation Start

(Yes, that is my current Mac wallpaper.)

Google Cast / Catt

I have three monitors on my desk and a TV mounted on the wall to the left of my desk and I really love the idea of treating that TV as a fourth monitor. I threw a Google Cast device on that TV and installed the command line tool catt. “catt” is an acronym for “Cast All The Things” and I think that’s a nice succinct description.

❯ catt -h
Usage: catt [OPTIONS] COMMAND [ARGS]...

Options:
  -d, --device NAME_OR_IP  Select Chromecast device.
  --version                Show the version and exit.
  -h, --help               Show this message and exit.

Commands:
  add           Add a video to the queue (YouTube only).
  cast          Send a video to a Chromecast for playing.
  cast_site     Cast any website to a Chromecast.
  clear         Clear the queue (YouTube only).
  del_alias     Delete the alias name of the selected device.
  del_default   Delete the default device.
  ffwd          Fastforward a video by TIME duration.
  info          Show complete information about the currently-playing video.
  pause         Pause a video.
  play          Resume a video after it has been paused.
  play_toggle   Toggle between playing and paused state.
  remove        Remove a video from the queue (YouTube only).
  restore       Return Chromecast to saved state.
  rewind        Rewind a video by TIME duration.
  save          Save the current state of the Chromecast for later use.
  scan          Scan the local network and show all Chromecasts and their IPs.
  seek          Seek the video to TIME position.
  set_alias     Set an alias name for the selected device (case-insensitive).
  set_default   Set the selected device as default.
  skip          Skip to end of content.
  status        Show some information about the currently-playing video.
  stop          Stop playing.
  volume        Set the volume to LVL [0-100].
  volumedown    Turn down volume by a DELTA increment.
  volumeup      Turn up volume by a DELTA increment.
  write_config  DEPRECATED: Please use "set_default".

I then made a series of macros that are based on bash scripts that make catt commands targeting my Office TV:

  • Take the URL on my clip board, and if it’s YouTube or Vimeo send the URL to the TV to play as a video, otherwise send it to the TV to be displayed as a webpage.
  • Display the Studio71 system status page on the TV
  • Shuffle and play my YouTube Watch Later playlist on the TV.
  • Pause, Stop, and Skip
  • Display a cyberpunk “pew pew” map on my TV.

Quick File Sharing

There are times when I need to fill my role as “typical engineering manager” and send a screenshot of a broken application with “This doesn’t work.” written on them in pink Comic Sans font. When I do, I take a screenshot and then I need to open a browser or Slack to drag it in a few times throughout the day. I simplified this workflow by making a Keyboard Maestro macro that I have assigned to the right click menu of images via Service Station. When you click the action, my macro takes the file, generates a hash, uploads it to the Studio71 asset server (I have a different version of this for my personal files), and then puts the link in my clipboard, which I can immediately paste in to anything.

KM Automation Assets

I have so many more macros and I have a list of others I want to experiment with, but I’d love to hear your automation ideas, successfully implemented or otherwise.

Hit me up: @thatmikeflynn

My Bat Phone Holiday Project

With three kids I don’t need a holiday break project to give me something to do like I used to, but I do still like to find something on my list and give it a time limit so I can use the time to accomplish something fun and improve some non-day job skills.

This year, I decided it was time to make myself a Bat Phone.

The Batphone

As those of you have have been in a Zoom meeting with me know, I have a shelf filled with things as my office backdrop and part of that shelf is dedicated to Batman.

The Shelf

On that shelf I have a rewired Bat Signal, Legos, and prop recreations from the Michael Keaton Batman era, the Christian Bale batman era, and the animated (Kevin Conroy) Batman ear, but the Adam West Batman era was sadly underrepresented. What if I made a replica Bat Phone that actually rang (aka flashed a red light), and when you picked it up Commissioner Gordon talked to you?! Yes x 1000. With that, the “working” Bat Phone became my Holiday Break project for 2021.

A little while ago I had purchased a cheap classic looking red analog phone off Amazon for this project, so I had that already, but with supply chain and shipping issues the rest was going to half to come from what I could find in my workshop. I found a Raspberry Pi for the brains, wire, resistors, a red led, a glowing button that sort of worked for a power button, and I was going to try to use a cheap little momentary switch to handle the receiver being hung up (more on that later). I briefly thought about how I could use the receiver with the phone cord that came with the phone, until I remembered I had a corporate gift from a few years back that was an “old” looking phone that you can plug in to your cellphone…and it just happened to be the perfect shade of red. Huge timesaver.

I grabbed a breadboard and quickly hacked together some sloppy Python to make a proof of concept.

Prototyping

I then took apart the phone, put the guts to the side and removed the dial in the front. To fill the hole where the dial was and where the red flashing light would need to be I had to model and 3D print a custom piece. Here’s an early version:

Printed Insert Test

Once I found a way to get everything mounted inside the phone I painted the insert (now on version #3) to match the phone.

Painting

I put the LED in place, resealed the phone, and thought I was done for a hot second until I realized that I didn’t like how it felt when you hung up the phone. The switch I was using was pushing back too much, which would release the button and the code would read accidental pick ups. What I needed was a switch that wouldn’t push back, but I didn’t have a switch like that. I took the receiver apart and added weight to it, and that helped a little but not enough. How did the analog phone handle that? They use a lever style switch that doesn’t push back at all. Could I find a way to cut that out of the old phone and somehow wire that to the Pi in a way that I could use the same Python libraries to talk to it? After an hour or so the answer was: Yes!

The Switch Switch

After taking the phone back apart and swapping out that switch, the receiver felt perfect and the project was done.

The Bat Phone now sits on the shelf behind me and rings by flashing it’s red light randomly throughout the day. If I catch it and pick it up, Commissioner Gordon talks to me, and…it’s awesome! (If you pick it up when it’s not ringing you get a dial tone, because of course you do and even Gotham City has quiet moments.)

I made a short demo YouTube video (volume up if you want to hear the sound from the phone, it’s pretty quiet) if you like that sort of thing, and if anyone is interested I have the code, STL files, and parts list (though you might not want to use exactly what I found and made work from my shop inventory) all documented in a GitHub repo. If you’re interested, ping me via email or Twitter (@thatmikeflynn) I can share the link.

Ringing On Shelf Whole Shelf

I Fell in Love with the Stream Deck

Image.jpeg

I shift gears a lot throughout the day both at work and at home between various projects as things pop up, and while I miss the days when I could just put headphones on and chip away at a single project all day, it’s just not an option for me in any of my roles (CTO, Dad, etc). Over the holiday break I discovered Stream Deck, which is a piece of hardware from Elgato that is targeted for live streamers, but it’s also for anyone that loves automation and I’m completely obsessed with it.

In 2020, in an effort to solve the “Is Dad on a Zoom call right now?” issue I created a Home Office DND Button with a spare Arduino board, an LED light bulb, a button, and a 3D printed case. I love making things like that about as much as I like automating and customizing my home office, so it was fun and solved a problem in a fun way. Since then I’ve been kicking around the idea of expanding on the idea by making a small panel of buttons that can do other functions such as activate the electronics built in to my office shelf, or run automations on my computer. While looking in to this idea further, I ran across Jason Snell’s “2021 Favorites: Hardware” post on Six Colors and saw his blurb on the Stream Deck.

I was absolutely a Stream Deck skeptic when I first heard about it. I have a keyboard, full of keys and modifiers! Why do I need _more keys_when I already have an impossible number of combinations ready to be assigned to macros, obscure commands, whatever.

But I’ve come around. The Stream Deck is transformative because it’s got a programmable LCD display under its keys, allowing you to program actions and visually represent them with an icon. And if you need more buttons, just add more pages, or set a page full of buttons to appear automatically in particular apps.

I’d heard about the Stream Deck before (it’s essentially a keyboard where each key is a little screen and you can use their software to set each key to do anything you’d like via their software, related software like Keyboard Maestro, or writing code) but until I was thinking about building a version of this while reading Jason’s glowing review, I didn’t put it together.

I bought one later that week and it’s been a game changer.

Here’s a sample of what I’ve configured my Stream Deck to do (so far):

  • My top row is all home automations for my office: turning on lights, activating my shelf, and turning on the DND light.
  • I have a button that toggles my VPN.
  • You can have buttons that trigger multiple functions in sequence, and I use that feature to for a button that powers down my office at the end of the day: turning off all lights, the shelf, and puts my computer to sleep.
  • I have a whole folder of buttons that automatically connect to different computers I have locally or remotely.
  • There is another folder of buttons that open apps, but also include extra functions such as positioning the window right where I want it, adjusting audio settings, etc.
  • I have a whole profile with Zoom settings (mute, toggle video, etc) that turn on automatically when Zoom is in use.
  • I have a sound board that plays sounds that make me laugh like this one.

I also have a long list of ideas I’d like to try and implement and this list doesn’t even include all the automation ideas I have for my work computer:

  • Opening our server status page on my office TV
  • Controlling Zoom
  • Buttons for each of my commonly used scripts.
  • So many more servers that need buttons for quick connections!
  • Setting up buttons to toggle VPNs or SSH tunnels.
  • A button to start my local development environment and open the code editor.
  • So many Slack automations…

Yes, you can do all of this with keyboard shortcuts (that you’d have to remember) or an app that sits on your computer desktop with buttons (that takes screen real estate), but there’s something about the Stream Deck that makes automations easier to remember, trigger, and is fun enough that is sparks new automation ideas in my brain.

If this appeals to you, I highly recommend taking a look at the Stream Deck even if you have no interest in live streaming. I’d also love to hear any great automation ideas you have. Hit me up on Twitter: @thatmikeflynn

Apple's App Store Policy Solution is Staring Them in the Face

Apple App Store Demo

Apple has a problem with their App Store. It’s potentially a big problem if it turns in to an official antitrust case, but at best it’s a problem with developer relations and looking like a bunch of greedy jerks. You may say that Apple has lots of problems, but this is problem I’m referring to: Payments on the App Store and the forced 30% cut of purchases.

There is been an ocean of ink (and podcast chatter) spilled over the last few weeks talking about this problem, but briefly, Apple forces everyone who has an app on the iOS App Store to use the Apple payment system, and part of that system is that Apple takes a 30% cut of your purchase [Note: It’s a bit more complex in that subscriptions can earn a drop in Apple’s cut, but generally, 30% is the requirement]. This isn’t illegal (yet) but developers are starting to get more than a little annoyed about the whole thing.

Apple has dug in on changing the price or bending the rules, so what can they do to fix this? Let’s put a pin in that question, and let me tell you about the latest Apple service that was rolled out and mandated in the App Store: Sign in with Apple

Sign in with Apple is…a way to sign in…with Apple. Meaning you can use your Apple ID to sign in to an app rather than making a new account or using other similar solutions from Facebook, Google, GitHub, etc. Apple has baked privacy forward features in to their login to make it attractive to Apple’s customers, and they required that Apple login be an option on all apps that use other login solutions (Facebook, Google, etc.). While a lot of eye-rolling occurred over yet another Apple mandate, it has been successful. Apple isn’t stopping developers from using the login they want, Apple is offering choice for users, and with their login’s feature set, they can appeal to users on the merits of their solution and get people logging in via Apple. Most importantly? No one is complaining about “Sign in with Apple”.

So just do that with iOS purchases.

If Apple just tweaked the requirement on iOS purchases to match the Apple login things could clear up pretty quickly. What would that look like? Well, the mandate would change to say that if you offer purchases in your app, one of the options must be Apple Pay and the other options are up to the developer. This means that Epic could have their own payment method for Fortnite, but it has to be right along side the Apple option. If users’ use the Apple payment option, and for only the Apple payment option, Apple gets their cut. Yes, some payments would drop off, but my hunch is it wouldn’t drop off much because Apple’s option would be faster, more focused on privacy, and would integrate better in to iOS so it would still be very appealing. Plus, smaller developers don’t have another option and won’t support multiple paths anyway so there would be no change for the vast majority of apps. If Epic can convince it’s users to go through it’s slower payment system and user’s understand the trade-offs then good for them. While Apple won’t be seeing 30% of that, I bet they see far less of the inside of a court room as well.

Yes, there’s a lot of details here. Apple could require that the price difference between the payment options has to be within some range (or non-existent). They might also want to mandate the initial buy screen so that the options are all clear, such as they require with the “Sign in with Apple” mandate. Regardless, this seems like the best way for Apple to trade some revenue for good will and not seem like they are walking back the rules they have been fighting to protect. The announcement on stage at a keynote could not be easier: “Today we are standardizing our iOS requirements in an easy to understand way and to give both developers and users greater flexibility in how they sign in and pay for products within the apps they love.” …swoopy slide action…wait for thunderous applause…then move on to those touch screen iMacs they’ve been working on.

DEFCON 28 Wrap Up

Devil Cold Caller

DEFCON, the world’s largest hacking convention and always one of the highlights of my year, was last weekend and, of course, remote. I missed being in Vegas with tens of thousands of hackers, but there were still some fantastic talks and conversations over Discord.

A quick “Top Five” highlights:

  1. If your password is eight characters or less, you essentially don’t have a password. With a small amount of money and a few hours, eight character passwords can be broken with a fair amount of ease. Your password should be at least 12 characters.

  2. That wifi security camera you bought off Amazon for $40 is completely insecure and shares your video, credentials, and even location, with other cameras unencrypted.

  3. Two-factor authentication is an important security measure for every account you have, but it can be beaten with a good phishing attempt. You can’t sleep on phishing just because of 2FA!

  4. The disinformation campaign to instill doubt in mail-in voting is real and huge. Researchers have seen preparations for “time and place” digital attacks since 2017 that can shut off internet or power to voting locations on election day…but then COVID-19 hit and those kinds of attacks don’t work if everyone voted by mail! Since the pandemic has started various nation states launched campaigns to poison the public’s belief in mail-in voting so they can get people back to the polls on election day and back in the target radius of their attacks.

  5. I passed my FCC radio Technician exam!

mikeflynn @ GitHub thatmikeflynn @ Twitter