Posts in Category: Tech

Custom macOS keyboard

On my quest to do everything on the Mac conveniently with minimal mouse use, I made stickers for the extra function keys on the Apple keyboard using printable clear address labels. I found a template for Avery 5630 labels and some appropriate icon images. I didn’t varnish over the printed label, but I’ll try that if these ones end up wearing out.

The keys are:

F16 quaver – opens the Alfred app mini music player, a convenient keyboard driven UI for selecting albums and songs in the Music app.

F17 calendar – opens ItsyCal, a small and fast calendar program that lives in the menubar, can be navigated from the keyboard, and which syncs with the system calendar and Google calendar. ItsyCal it great and giving it a dedicated launch key is definitely the way to go.

F18 bell – opens the system notification panel with weather and Todoist reminders, among other notifications

F19 screen – show the desktop. I don’t use this very often, but it’s nice to have a key for it when I need to grab a file quickly.

Perhaps some explanation is in order of the other ways I’ve customized the Mac for keyboard-first navigation. The main-mast is Alfred app, a wonderful tool for quick launching apps, navigating to folders, opening server sessions, running calculations, launching web searches, and on and on. It’s a bit like Apple’s Spotlight search, but both more powerful and more customizable. Almost everything I need to do regularly that isn’t on a shortcut or function key can be reached with a short command abbreviation in Alfred.

Karabiner Elements is another program needed to make keyboard bindings that aren’t possible using the macOS keyboard preferences panel. ‘Key bindings’ is just a programmerish way of saying that you want to customize which keys do what. For example I have the Caps Lock key bound as the hot key to open Alfred. This is huge, probably my favorite customization, because it takes an almost useless key and makes it very useful!

macOS has a slightly schizophrenic view of the purpose of function keys, many of which have a default system-wide function printed on the key (e.g. screen brightness, volume, etc.). These are useful, but if you want to also use the function keys for a particular application specific purpose, you have to use a different mode which replaces those default key bindings with the application specific function keys. There’s a key marked fn that lets you access the other set, but it’s awkwardly placed for use as a key modifier and so doesn’t much help. Karabiner Elements finesses this dilemma by letting you choose on a key by key basis whether you want the default system behavior or to pass the key through to the current application.

Finally I use a program called AltTab to customize the task switcher. In macOS the command-tab key combination is good for switching between programs, but it won’t switch between windows within a program. For that purpose the default binding of command-backtick does not work well. Each time you hit the key it cycles to the next window, but it doesn’t re-order the window stack to put the new top window first. So you can’t just hit command-backtick repeatedly to flip between the top two windows. You have to cycle through all of the app’s windows in sequence, which is tedious, or alternate command-backtick and command-shift-backtick, which is hard to reach and to remember which one to press next. AltTab fixes this by letting you cycle through windows in the style of the Microsoft Windows alt-tab switcher, which does keep the most recent window first. I have it configured to flip between windows in the current app (command-backtick) and between all windows in the system (option-tab). With the default command-tab binding to switch between apps, that makes three different ways to switch windows from the keyboard. That may be overly complicated, but I don’t see a simpler way that still works for all common situations. I suspect one could write a customized switcher that improves on AltTab by providing access to all three types of navigation from a single interface, but that’s a job for another day.

Phone Resurrection

I have a three year old Motorola phone that has gone rather suddenly from working fine to stuttering badly on many simple actions. I thought the problem was caused by running out of memory, but looking at the “memory use” report (accessible when “developer options” is turned on) shows that memory (RAM) is only half used, so that’s not it.

What else would cause a phone to slow down drastically? It’s a bit of a puzzle. I tried running the CPDT storage performance report app. An interesting result! Writing to the internal flash storage is very slow, less than 10 megabytes per second, slower than the benchmark result for any other similarly aged device. There’s plenty of flash space available, but it’s very slow. There are periods of several seconds where almost no data is being written.

Why would old flash memory be slow? I’m not exactly sure, but I think it’s to do with allocation. Flash memory uses blocks and can only write a whole block of data at a time. Parts of a block that are no longer in use can be reused by consolidating unused space, but that requires effective communication between the operating system and the flash controller hardware about data that’s no longer in use. If the flash controller doesn’t have a clear picture of what data the operating system has discarded it gets busy finding space to move data from partially used blocks whenever it has to write new data.

What to do? I backed up my data and factory reset the phone. Ta-da! CPDT now reports a five times improvement in sequential flash write speed (50 megabytes per second) and the long pauses are gone. The phone is now quite usable and I don’t have to replace it. Great!

But, my goodness, getting all my apps working again … sigh. The Android backup/restore managed to install most of the apps and some of the configuration automatically, but it’s very incomplete.

I had a dozen or so web pages open in Firefox, but that data wasn’t sync’d, so those are gone. I remembered to save the Nova launcher config so I didn’t have to rebuild the launcher pages. I copied my eBooks off to Google Drive. I have to login again with every other app attached to a service (social media, messaging, readers, recommender apps, music, tv, etc., etc.), dozens of apps in total.

I have three multi-factor authentication apps needed for various high security accounts (Google Authenticator, Duo Mobile and Symantec VIP Access). Each one had a different account recovery process. I don’t think I’m locked out of anything I care about, but … sheesh.

The biggest pain was backing up and restoring Signal. You need to manually save and restore the data file and then hand copy and type a thirty digit security code. For real. It may have great security, but this app’s usability is terrible for people who want to keep their contacts and messages across phones (i.e. everyone). I’ll have to write another post about messaging apps.

Blocking Hackers

How to prevent password guessing attacks against SSH

Remote SSH login access is pretty much a necessity for administering and managing Unix/Linux servers. But how to allow access for the admins without also letting in the hacker hordes? VPNs are one solution, but they can be a pain to use and to setup, especially if you’re working with machines on several different networks.

Servers that allow direct SSH access, are going to attract plenty of remote login attempts. You need to ensure that the hackers can’t just keep beating on your door presenting different passwords until they get lucky. On one fairly typical server I administer there are around 2,800 failed login attempts per day or roughly one attempt a second. Installing a blocker for brute-force password hacking has been on my todo list for a while. This week I finally got a round tuit.