Drafts in Six Lines of Code
A few years ago, I came across a presentation1 that Brian Kernighan gave back in 2009 called The Elements of Programming Style, a title borrowed from his book of the same name. In it, he made one point which I think applies equally well whether you are writing words or code.
So, there’s a balance that you have to find between too clever and - not clever enough - being kind of dim about what you’re doing
With this in mind, I took another look at the “drafts” script I mentioned in my last post. Thinking about the problem a bit more, I’ve found that Kernighan’s observation was precisely the problem I was having all along. Although I could read the script, and understand what it was doing, I didn’t really grasp why.
My knowledge of Make is not very deep and AWK even less so. As I hadn’t thought about this for some time and it’s usually easier to deal with the devil you know than the one you don’t, I ultimately decided to rewrite it in Ruby.
5 minutes of work, 6 lines of code, and (hopefullly) the incentive to write more often.
I am always impressed by how “down to Earth” Kernighan is every time I hear him speak. ↩
With the exception of my “draft” script, I’ve moved all my shell scripts for this site into a Makefile. Originally, I used gulp-shell, but was quickly reminded of the sheer number of packages you need to do even the simplest operations in Node. At that point, I decided to find an alternative solution.
Although I hadn’t used it before, I found the process to be pretty smooth - aided by this Hacker News comment where I asked a question about it. In simple terms, a Makefile typically contains a set of “rules” in a particular format and Bash commands can map to each of them. These rules perform actions on files or directories (a.k.a, their “targets”).
Converting the “draft” script will take a bit longer, as it’s made up of multiple lines and has variables, redirection, and a sprinkling of AWK all thrown together. Most of the examples I’ve found are far simpler, which is helpful, but they are usually written with a language like C++ in mind. As a result, I’m kind of in the dark about how all of the pieces fit together.
In short, it’s the one drawback of being something of an accidental programmer. I suspect there’s more to write on this particular topic, but that’s an exercise I’ll save for another day.
Audible, Goodreads, and a Very Long List
Because all the cool kids are doing it, I’ve compiled a list of all the books I’ve read in the past year. You might think, ‘Who reads anymore’, or ‘Who has the time?’ Surprisingly, this was easier than I thought and only required 3 things:
An Audible subscription
Audiobooks have come a long way from the books on tape I remember listening to growing up. Long books felt shorter, and because there were no visuals involved, I found it easier to retain information, especially when it came to more complicated topics. Still, this approach is not without its drawbacks; The basic account only gives you 1 credit per month, and I’ve never really been tempted by the Audible Originals. However, the selection is really good and since they’re an Amazon company, the service is always up.
Well worth the $15.
A Goodreads account
I have a note in iCloud (and a Reminders list) to keep track of things, but for now, the canonical record is located here. The website may be kind of ugly, but it does a decent job keeping track of what I’ve read and what my next pick should be.
Time to listen
This is a big one — having a walkable commute in addition to a working environment where I can listen while doing other things has been a great aid to this process.
With that said, here’s what I read in 2018.
Young Money: Inside the Hidden World of Wall Street’s Post-Crash Recruits by Kevin Roose
The Big Short: Inside the Doomsday Machine by Michael Lewis
The New CSS Layout by Rachel Andrew
Going Offline by Jeremy Keith
Too Big to Fail: The Inside Story of How Wall Street and Washington Fought to Save the Financial System from Crisis – and Themselves by Andrew Ross Sorkin
Accessibility for Everyone by Laura Kalbag
Flash Boys: A Wall Street Revolt by Michael Lewis
Becoming Steve Jobs: The Evolution of a Reckless Upstart into a Visionary Leader by Brent Schlender and Rick Tetzeli
A Colossal Failure of Common Sense: The Inside Story of the Collapse of Lehman Brothers by Lawrence G. McDonald
Straight to Hell: True Tales of Deviance, Debauchery, and Billion-Dollar Deals by John LeFevre
The Accidental Billionaires: The Founding of Facebook: A Tale of Sex, Money, Genius, and Betrayal by Ben Mezrich
Steve Jobs by Walter Isaacson
Into Thin Air: A Personal Account of the Mount Everest Disaster by John Krakauer
What Happened by Hillary Clinton
The Fifth Risk by Michael Lewis
The Coming Storm by Michael Lewis
A Brief Reprieve
I don’t know how long it will remain, but the potential endgame for Safari extensions described in my last post may be further off in the future than originally thought. After all, Apple isn’t Bare Bones, who extensively document how to restore prior behaviors in their apps - usually by editing a property list. As time goes on, I would expect the number of hurdles that must jump through in order to continue use legacy extensions to increase, but the inclusion of the “unsigned” option in the Develop menu gives me hope.
For now, the search for Chrome versions of all my extensions continues apace, as I don’t know how Safari 12’s Intelligent Tracking Prevention might reduce the need for some of the customizations I’ve made.
Maybe I’m just out of touch or I’m in too deep…
The Future of Safari Extensions
In most technology circles, hearing somebody say “the Future of X” when referring to a given technology is a bad sign. It’s the death knell, usually means time is running out, and a big change is on the horizon. With this in mind, The Safari team announced at WWDC that legacy
.safariextz extensions distributed outside of the Extensions Gallery will not load in Safari 12. While they will accept new submissions until the end of this year, it’s clear that App Extensions and Content Blockers are the future of extensibility in Safari.
This wouldn’t be so bad if the app install/uninstall experience on the Mac wasn’t terrible - one thing that I actually miss from the days when I used Windows regularly. Microsoft gets flack for using a centralized database (the Registry) to handle this, but for the most part it does the job.
Of course, there’s a reason why I don’t run as many extensions in Chrome: The web store is a mess. Google doesn’t curate anything and it shows.
The 60% Keyboard
Unless there’s a change coming next week, I might need to consider something like this - or bite the bullet and dive headfirst into the Wirecutter’s keyboard reviews. My current MacBook Pro will be 5 in December, so it’s getting to the point where I should start thinking about what comes next.
With all of the hand-wringing over the reliability of Apple’s current keyboard designs, it seems appropriate to take stock of where things stand today in our house. The keyboard on the 2017 MacBook has held up well so far, but it is currently shared by my parents and doesn’t really get all that much use. However, my brother is looking to replace a truly awful HP Envy and is considering his first Mac.
I suspect that telling him a separate keyboard purchase might be something he should spend money on will not go over well.
I can almost hear the yelling now…all the way from Charlotte.
Where We’re Going, We Don’t Need Subdomains
Subdomains are out and collections are in; which means a proper linkblog can live at the same domain as the rest of the site. It took some time - reading docs, asking questions on the Jekyll Talk forum, and watching a CloudCannon tutorial - but now, interesting links have their own index (naturally, it’s
/links) and associated URLs.
This also solves a problem I was never able to find a good solution for the first time around - linking to external sites from the title of a post. Octopress, a Jekyll fork by Brandon Mathis, implemented this feature in the form of a plugin called Linkblog, but unfortunately it hasn’t seen an update since 2015 when Brandon announced he was embarking on a ground-up rewrite of the code.
Maybe, just maybe, this will be the push I need to whittle down the Siracusian number of tabs I have open on my phone.
At last count, it was 106.
SSH for Humans
Let’s Encrypt should really think about getting into the business of managing SSH keys - it would save everyone (e.g, me) the headache of looking up credentials which haven’t been used since…
Actually, I have no idea, Whoops.
While it would be nice if DreamHost supported ED25519, 4096 bits will have to do for now. Transmit 5 can use them or even generate keys on its own - thanks to the instructions in this video from @antichrista - but for whatever reason won’t import my public key.
I don’t directly SCP or SFTP all that often, so it isn’t a dealbreaker. Gulp handles my deploy script just fine.
Sites on the Cheap
As this site’s content has become a bit of a running commentary regarding its own creation, let’s continue with that theme.
I really like what @parkr did with his Stuff repo - just a simple microsite for collecting links to interesting things he finds - so I decided to do the same. I called it Links (because why not), just to avoid any namespace conflicts with other things already in my Home directory. Of course, it needs to live somewhere, and since I like to keep things as simple as possible, I decided to use a subdomain (e.g, links.chrisfinazzo.com).
I seem to remember @imathis built a plugin for doing linkblog style entries, but I don’t know if it was ever ported to Jekyll 3. Parker created a bunch of tasks for doing these kinds of things in a Rakefile, so I’ll see if that works out better. It might even give me some ideas for how to build out my Jekyll Scripts repo, which itself could use an update one of these days.
My Service Worker ended up being a few lines shorter than I thought, but it’s now live and caching a few pages on this site. Kudos to Jeremy Keith for writing a book that’s approachable, understandable, and a quick read that lays out the basics of how this all works.
Security by Deletion
I guess there’s a first time for everything, so imagine my surprise when an email from GitHub about a security warning showed up in my Inbox this past week.
Granted, the Node ecosystem has a large number of modules, each with their own dependencies which may have security vulnerabilities from time to time. Nothing really surprising about that…with one exception.
The specific vulnerability is in a sub dependency of a module I don’t control and the supposed fix is to bump the version number in
package-lock.json. However, this file is automatically generated by
npm install and is a way to ensure you install the correct version of a module. The prevailing opinion, based on what I’ve read, is that tweaking the file on your own is not recommended unless you are really confident in what you’re doing.
My fix? Remove Workbox and rewrite my Service Worker by hand. In total, it’s 63 lines of code, most of which I’d already written for Minima.
Note to self: Having invalid markup in a Liquid template makes HTTP caches go crazy. Also, service workers are still weird (and awesome).
Counting down the hours until @adactio’s book comes out tomorrow.
A Desk and a Chair
I need a new desk and a new chair. The desk I’m sitting at is at least 20 years old and the chair - which originally belonged to a child’s school desk - is even older than that.
Can it really be that hard to find a suitable replacement for each of these items? I don’t think so and I’m not even especially picky about it. At a minimum the desk should be:
a) Less than 50” wide. My current desk (a cheap, completely unremarkable Staples thing with a crack running along the underside of its surface) is 48” and in the corner of the room. I don’t have the space for something bigger.
b) Have at least one drawer. Somewhere. I don’t know who designs this kind of office furniture, but at some point in the last 20 years, somebody got it into their head that all people really need or want is just a big, wide area to put stuff on. I have 4 external hard drives, my headphones, and a bunch of other small items spread across a two level cabinet in the current desk. Do they all need to be on top of my desk right this second?
Other than that, just about everything else is negotiable. The Wirecutter’s pick of the Jarvis Bamboo is nice, and I’ve never tried a standing desk before, but I don’t know if I want to spend that much. “Writing” desks are awkward and I would like to stay away from that if I possibly can, but they’re cheaper than most other options I’ve seen.
The chair part of the equation is easier (mostly because of cost). Arms, along with reasonable back support, and that’s really all that I think I need. The HON Exposure (another Wirecutter selection - for no particular reason, that’s just where I started my search) would probably do the job, but I wonder about its durability if I’m sitting in it for long stretches of time. Although anything would likely be an improvement over the tiny cushion that is on my current chair. I don’t know the exact price, but I do know it was cheap.
Lumbar pillows exist, and might fix some of the back issues I’ve dealt with from sitting in such an awful chair, but it just feels like a Band-Aid and another excuse to not address the problem in its entirety. I’d rather pay slightly more for a chair that can be adjusted until I feel comfortable in it.
Drunk with Power Management
Just when you get to the point where you think everything is ready to go, with the “i’s” dotted and “t’s” crossed, nothing can possibly go wrong and…no.
Go home computer, today is not your day.
Adventures in rsync
As I was saying, wait…what was I saying? Oh yes, something about removing obstacles to writing.
It helps if you rsync files to the correct web root and haven’t borked secured hosting in the process. Of course it’s Friday the 13th.
Minimum Viable (Writing) Product
You say you want to write for a living, just do it.
I had a phone call recently with someone I met through networking and he said these words to me at the end of our conversation. For the longest time, I spent a large portion of my time trying to get all of the technical parts of a site together before actually putting pen to paper – or, in this case – fingers to keyboard.
This got me thinking about my Reverse Job Posting and what went into building that site. Is it the most attractive site possible? No. Far from it. However it is the smallest possible thing I could think of in order to give people a jumping off point to find programming projects and writing samples I’ve worked on. All-together, it took me a week from start to finish.
Without realizing it, trying to come up with the most technically interesting solution was a barrier that kept me from writing. Playing around with raw HTML or alternative blogging engines was an interesting exercise, but what it comes down to is that I was just “spinning my wheels”.
With that lesson in mind, I’m back to using Jekyll with a couple of scripts to make the writing process easier.
Let’s do this thing.