Welcome to the lab.

KillZapper - Click to Kill web annoyances

[Tweet : nvALT]

I whipped up a quick bookmarklet this morning that allows you to immediately remove anything on a web page that annoys you. This was inspired by a question from Patrick Ford and that was enforced by my own annoyance with the autoplay videos on Macworld.com that follow you down the page. I love you, Macworld, but those are seriously annoying.

There are extensions that do this, but this was a simple solution. Click the bookmarklet in the menubar, then click anything on the page. Once you click (or hit a key), it turns off, so you don’t risk deleting anything else. It specifically targets the tags div, video, figure, and aside, and iframe. That should cover the majority of annoyances.

The elements only disappear until you reload the page. It’s just a temporary fix to get rid of annoying ads and videos while you spend time reading a page. Instead of running away in disgust, you can just take matters into your own hands.

Unlike Bullseye, this one just uses pure JavaScript with no jQuery, so you don’t have to wait for a double-load or risk a second cross-site exception/protocol mismatch. It’s hosted on my https cloudfront instance, so it should load fine on any site. Tested in Safari, Chrome, and Firefox.

Drag the button below to your menu bar to install, then just click it to start KillZapper, click the annoyance, and presto

killzapper

Web Excursions for May 18, 2018

[Tweet : nvALT]

Web excursions brought to you in partnership with MightyDeals.com, featuring great deals on software, training, and design resources.

You’re Missing Out on a Better Mac Terminal Experience
A post from Owen Caulfield with a bunch of great tips for using Hyper, a CSS/HTML-based Terminal alternative. I’m still going to be using iTerm, but this stuff looks like fun.
Sir Winston - MacOS Customization Script Generator
A MacOS customization script generator. Choose the applications and settings you want and get a custom script to automate the entire setup process.
After 5 years and $3M, here’s everything we’ve learned from building Ghost
From Kickstarter to a successful business model, the story behind Ghost’s business model is a heartening read.
CheatSheet - Know your short cuts
I used to appreciate KeyCue when learning keyboard shortcuts for an app, but it hasn’t worked for me for quite a while now. CheatSheet does the same thing flawlessly, and for free. Just hold the ⌘-Key down for a couple seconds to get a popup with a list of all active short cuts of the current application (including custom shortcuts assigned to Services and menu items). I recommend setting it to a long__ delay, as you’ll quickly realize how much you hold down the Command key when pondering what to do next…
Retrobatch Public Beta
From the creator of Acorn, a node based batch image processor. Think Audio Hijack for photo manipulation.

For years, people have wanted me to add batch processing of some kind to Acorn […] But to do it right, it would need to be a new app. And then sometime late last summer, I decided it was time and I started working on Retrobatch.

A few keyboard helpers for AppleScript

[Tweet : nvALT]

I use a bit of UI scripting to automate some of the screenshots used in Marked marketing and documentation. One (significant) part of that scripting is sending keyboard commands, so I’ve built a few routines to help out.

The script includes 3 different routines. The base is keyCmd(_string). It takes a single key, with modifiers either typed out or defined using DefaultKeyBindings-style shortcuts, where “$” is Shift, “~” is Option, “^” is Ctrl, and “@” is Command. So you can send either “cmd i” or “@i”. Named keys are recognized, so you can also use “shift opt left” to hit ⇧⌥←. When using named keys, you need to either have a space after shortcuts (e.g. “$~ left”), or use the string versions, as in the previous example.

keySeq is a shortcut for sending a batch of keyCmds at once, e.g. keySeq("@n $~@s",1) to send Command-N followed by Shift-Option-Command-S. The second parameter is the delay between keys, 0 for none.

keyType takes a string and a delay and types each character out, simulating keyboard typing. This command doesn’t allow modifiers, just characters, and the modifier shortcuts are typed as characters. Running keyType("This will type out in whatever field is focused",.01) will simulate typing the sentence out with a very brief delay between each keystroke.

I’m just sharing these in case they’re of use in your own scripting. If I get around to it, I’ll share more of my routines for window manipulation, menu clicking, and screen capture. I’m certain I can name several readers who will know of more elegant ways to accomplish all of these. I’d be delighted to update with your genius if you share it.

Fellow Prismo: AeroPress Espresso(ish)

[Tweet : nvALT]

Very recently I discovered the Fellow “Prismo” (via Tools & Toys). It’s an attachment for the Aerobie AeroPress that makes espresso. Well, not technically espresso, but it has all of my favorite qualities of espresso and beats the “Doppio” order at Starbucks for quality and flavor1.

Ever since I discovered it, my coffee consumption has increased significantly (and possibly problematically), but it’s so good I can’t stop using it. It’s sealed with a pressure-actuated nozzle, so you can brew upright without any drip. Which is kind of cool, though I have the inverted technique so ground into my muscle memory that I forget half the time. It also uses a built-in metal filter, so if you haven’t already, you can leave the paper filters behind.

You start with super-fine coffee grounds. I’ve gotten the best results with the grind that’s so fine that it clogs up the chute to the reservoir of my 12-setting grinder.

Use 20g of grounds in the AeroPress. Given I usually brew with 15g, this means I’m now going through beans faster, but on the plus side, I’ve found that the taste is so strong that I can use less expensive beans (local roasters that sell for about half the price per pound vs. Thrasher, my usual beans of choice). So it’s evening out, price-wise. I can even fit a full pound of ground coffee into my 32 Oz Airscape. (Which, admittedly, I also discovered via Tools & Toys. Really, you should probably just be reading that.)

You want water at a full boil. 212° when it hits the grounds. You only need 50-60mL, anything more than that degrades the flavor. Stir well. The directions specify a one-minute brew (including stir time). I’ve experimented with one, two, and three minute steeps. I’ve achieved some great results with a two-minute brew, but one minute is enough and anything more than two changes the flavor in undesirable ways.

Side tip: My Zojirushi water boiler has lasted almost a decade now, and I can have water at a full boil any time in about a minute and a half (I keep it at 208° most of the time). I finally had to replace the top assembly after some chipping/corrosion of the plastic seal, but that’s $30 and it’s good as new, hopefully for another 10 years.

I’ve experimented with using additional grounds, either for a stronger single or to attempt to pull a double, but the 20g/50mL ratio definitely yields the best results.

Pressing takes a bit more effort than you’re likely used to. Fellow says you can press directly into an espresso cup, but between the pressure required and the fact that it’s an even bulkier cap, you probably won’t want to press it directly into a glass demitasse. The Presto cap actually won’t fit directly into some of my regular-sized coffee mugs, but it does fit perfectly in the hexagonal funnel that comes with the AeroPress.

Whereas I usually slow and stop pressing when it starts to hiss, with this you want to keep pressing all the way through. It will sound, fittingly, like an espresso machine. The result is a single, delicious shot of espresso(ish) that’s strong enough to mix into a latte, but delightful to sip on its own. It always has a layer of crema, but you can get an even frothier one if you do a quick bloom2 on the grounds before steeping and the full press all the way down to the grounds.

As you would expect, you can achieve different results with different roasts. You can go dark and oily and get a strong pungency and bitterness3, and the slower the roast, the better. I’m loving a medium dry roast for a smooth and slightly sweeter result. The static cling when doing a fine grind on dry beans is a pain, but the result is worth it. You didn’t get into coffee nerdery because you wanted easy, right?

A couple more tips:

  • The filter usually just takes a quick rinse under the tap, but for a full cleaning I’ve been rapping it on the counter to get the filter out for a full rinse. I’m hesitant to do any prying that might damage the seal.
  • Remove the Prismo from the Aeropress before it cools down. It can get tough to get off if it dries while still attached.

If you love your AeroPress but miss espresso, this is $25 well spent. By the way, it can also do cold brew, though I haven’t tried that yet.

  1. Side story, Aditi (my ex) and I once fostered two chocolate pit bull puppies and named them Solo and Doppio. The story has a really sad part, so I won’t tell the rest of it, but they were great names.

  2. Moisten all of the grounds with just enough water to make a dry paste and let it sit for 10 seconds (usually 30, but it’s a shortened brewing process).

  3. These aren’t bad things at all, it’s just espresso parlance.

Marked 2.5.11 is live

[Tweet : nvALT]

Marked 2.5.11 has (finally) been birthed, available via automatic update for the direct version, Mac App Store update, and on Setapp. This is a big release, and has been in development for over a year1. Long pregnancy, but this release includes over 30 improvements/fixes, as well as a slew of new capabilities (full changelog). It’s the fastest, most powerful release of Marked 2 yet. I’d be grateful if you left a review on the MAS (or updated one)!

Side note: This pregnancy metaphor gets weird fast. It sounds like there might be something wrong with the child, but consider it a new step in human evolution. A superhuman that’s really good at multitasking and Markdown rendering. I apologize in advance, please bear with me.

New Features

I offered an ultrasound of some new features back in August. Those included:

  • Support for IA Writer file include syntax (/filename on its own line, with automatic file type detection for code, tables, text/markdown, and images)
  • Embed CSV files using any of Marked’s supported file include syntaxes and have them instantly converted into Markdown tables in the Preview (and also in the Markdown export)
  • A new Edward Tufte inspired preview style: Ink (replaces Antique, which was starting to look, I dunno, dated?2)

Fast forward 9 months and the baby is finally born. It’s grown the following extra limbs in utero:

  • New and updated app compatibility:
    • MarsEdit 4
    • Scrivener 3
    • Highland (and updated Fountain.io support)
    • TextPack (compressed TextBundles) handling
  • Full screen mode for table of contents, fixed to left (automatically enabled when switching to full screen, and can be manually switched from a button on ⌘T TOC popup)

I’ll need to document this one further, but there’s also a new method in the URL handler that lets you add a new Custom Style to Marked via a link (x-marked://addstyle?name=My+new+style&css=[url encoded CSS]). Just pass a name and the url encoded CSS and a new file is generated and added to the Custom Style menu automatically. This should make sharing styles even easier. I’ll be sharing an updated StyleStealer bookmarklet very soon to allow a one-click way to duplicate styles from your own sites into Marked for previewing.

Also, the multi-lingual Spelling and Grammar add-on (detects language per-paragraph, so you can use it in documents containing multiple languages) is no longer an add-on. Due to complications with providing parity between the Mac App Store and direct versions, I’m just including it for all users. If you paid the $1.99 for it and now feel robbed, I can refund your purchase. Or you can consider it a “thank you” for not making Marked a subscription-based app…

Other Improvements and Fixes

Other complications that were resolved during the final trimester.

  • Multiple improvements to Fountain support are included, including better handling of title pages and dual dialog.
  • CriticMarkup support is improved and the word count feature updates properly between the Original, Markup, and Edited tabs.
  • The MathJax library is updated as well as the CDN links included in export (because MathJax is discontinuing their own CDN).
  • The help documentation is updated and improved, as well as the internal Help Viewer in Marked 2.
  • Emoji no longer break the spellcheck.
  • Including metadata within HTML comments is more flexible.
  • Leanpub Aside icons are fixed
  • A couple dozen other things

Thanks

Thanks to the beta tester doulas for their help in making the new features actually work. And thanks to everyone who’s been submitting bug reports and improving Marked along the way. My apologies for fixing all this stuff and then allowing the release to be so delayed.

I’m sure there will still be bugs, and I’ll be putting a week or two into expedited fixes and rapidly releasing incremental updates. But in between those and immediately following, it’s BitWriter time. I swear on all that is sacred that it’s coming.

Grab the free trial of the latest version from the Marked 2 website. Marked 2 is also available on Setapp and the Mac App Store.

  1. Not entirely due to time spent on Marked, of course. There was also time dedicated to Bitwriter and other projects, medical issues, and a divorce, and a move.

  2. Not that Tufte’s styling is cutting edge modern, but I think it has more of a place in document presentation.

Web Excursions for May 09, 2018

[Tweet : nvALT]

Web excursions brought to you in partnership with MindMeister, the best collaborative mind mapping software out there.

#OpenWeb
An RSS-reader-ready collection of independent publishers. I’ll be honest, I discovered this list when I was notified I was on it, but was pleasantly surprised by the collection. If you’re not using an RSS reader to take back control of your online news, download the OPML file and import it into something like Reeder 3, ReadKit, or Feedbin!
86% of Passwords are Terrible (and Other Statistics)
As a long-long-time 1Password user, having 20-character gibberish passwords unique to every account is easy for me. But at the rate that compromises are happening, having a strong, unique password is only half the battle. And you don’t even get to fight the other half of it… but do your half and bulk up your passwords.
CatchUp - Keep in Touch
A free app with no ads, CatchUp simply reminds you to keep in touch with the people you want to. Add a contact, set an interval, and CatchUp reminds you to reach out. This is ideal for people like me who can go years without hearing from someone and still consider them great friends, but who learn in the harshest ways that not everyone else reacts the same way.
Gitea
A self-hosted Git platform for running your own local GitHub-style repository manager. This project is a fork of Gogs with an apparently more group-focused approach to project maintenance.
Automation Orchard
Rosemary Orchard is an automation wiz. She’s put together Automation Orchard as a central repository for automation articles from across the web. A great stopping place for automation nerds, whether you’re looking to create workflows on your iOS device or automate your home. It’s all here.

Check out MindMeister and start brainstorming, collaborating, and boosting productivity.

A drag and drop PodTagger for easy MP3 podcast tagging

[Tweet : nvALT]

Over the weekend I made some updates to PodTagger. This is one project that I’m not certain anybody else is using, but it’s one I’m finding really useful.

Recap: PodTagger lets you set up default tags for your podcast(s) and then add custom fields to Markdown show notes to automatically tag your MP3 files for upload. Title, summary, description, artist, network, image… all ready to go. I use a TextExpander fill-in to include the headers in my show notes file, so finalizing my podcast files is just a quick Terminal command.

I wanted drag and drop, though, so I’ve updated the downloads with an app version you can keep in your Dock and drag to (or call with Alfred/LaunchBar). It’s just a simple wrapper made with Platypus and some changes to the script to make the output nicer. As a bonus, the app version has mutagen embedded, so there are no external dependencies. It still uses a YAML configuration file, now located in ~/.config/podtagger/podtagger.yaml.

Additional details for the update are in the changelog on the project page.

Shell Tricks: quick start scripts

[Tweet : nvALT]

Here’s another little Bash function. It makes it possible to create a new script in one command, creating the file with shebang, making it executable, and opening it in your editor.

Just run newscript scriptname.rb to create a new ruby script with a /usr/bin/env ruby shebang. It also recognizes Python, Perl, and bash extensions, add more as needed.

You can also create a directory with “skeleton” scripts. If you have a list of includes that you always use in your shell scripts, add a ext.txt file to that directory (e.g. rb.txt or py.txt). By default that directory is ~/.newscript_defaults, but you can modify it in the config section. As an example, you might have a sh.txt file that sources a file of common functions you use in bash scripts, or an rb.txt file that includes contains # encoding: utf-8 to be appended after the shebang.

Just add this to ~/.bash_profile, or wherever you source your shell functions from. You’ll need to edit your script location in the scriptdir variable at the top.

Neat.

Shell Tricks: what to do when you can’t do internet

[Tweet : nvALT]

Ok, so your home internet connection is down. Well, not right now, obviously. But your ISP has you on a waiting list for a service call, and you’re thinking you’ll just spend some time cleaning your office today. You’d love to know if your connection came back up in the meantime, though, right?

This trick is an evolution of one from OSXDaily. The idea is to just keep pinging a DNS server until we get a response, and then send an alert. For my working environment, I wanted something that would ensure I got the message.

Here’s the base function, imdown (I’m Down!):

# Wait for internet connection to come back up and notify
imdown() {
	until ping -W1 -c1 1.1.1.1; do
		sleep 10;
	done
	# notify somehow
}

I’m pinging the new 1.1.1.1 DNS Resolver. You could ping a website, but pinging the DNS resolver directly is faster. It won’t work if the connection problem is at the DNS level, but I’m only concerned with knowing when my modem is back online.

The ping command in this function uses 2 flags, -W1 and -c1. The -W is how long to wait for a response. We just want quick pings, so 1 second is enough. The -c1 is how many sweeps to do in a pass (with no -c it will just keep pinging forever), meaning we’ll just ping once and then sleep for 10 seconds before we try again. When it gets a successful ping, it moves on to the next step: notifying…

Insistent, nagging alerts

I made a really annoying loop for this. If the machine you’re running it on has sound, this is really effective. Assuming you’re around to shut it off, I suppose, because it would drive everyone else nuts and they’d end up smashing your speakers. But if you’re working around the house and want to know, turn up your volume and this will do the trick.

nag() {
	while true; do
		for phrase in "$@"; do
			afplay /System/Library/Sounds/Ping.aiff
			say -v Alex "$phrase"
			sleep 5
		done
	done
}

It takes one or more arguments, each being a quoted phrase to speak. It will enter into an infinite loop of playing a ding (the system “Ping” sound) and then speaking each phrase supplied to it (one at a time, in succession, or just one over and over if there’s only one argument) until you end it with CTRL-C.

Side note: If you want a female voice, changing say -v Alex to say -v Samantha works well. I miss the old voices… there used to be a bunch of funky voice modulations like “Bells” and creepy robot voices. Oh well.

So now my imdown function looks like this:

# Wait for internet connection to come back up and notify
imdown() {
	until ping -W1 -c1 8.8.8.8; do
		sleep 10;
	done
	nag \
	"internet connection is back up\!" \
	"Skynet is thinking" \
	"your tribulation is over, the internet is here" \
	"Praise what gods may be, we have internet\!" \
	"O M G we're online" \
	"In the words of Dr. Frankenstein, it's alive\!" \
	"rejoice, for the internet is risen"
}

It will cycle through these phrases, ad nauseam. It will get your attention, and those who share your space will hail you as a hero of great cleverness. That’s what those dirty looks mean, I swear.

Push It Real Good

If you have other means of getting notifications, such as a home automation system that can blink lights via script (I do :P), great. One option is to use Pushover, a free service that allows you to send push notifications to your iPhone (and Apple Watch) or Android device.

You can get various Pushover libraries for different languages, but it’s a really simple REST API, so you can just ping it from a script. Here’s how to set it up:

  • Create an account at Pushover
  • You’ll see your “User Key” prominently displayed after you log in. Copy that and save it
  • On your dashboard under “Your Applications”, click “Create an Application/API Token.” Just create one called “CLI”
  • Your application will get a token, copy that and save it, too

You’ll also need to install the Pushover app on your iOS or Android device for this to do much good.

Now, with your token and key in tow, you can ping the API. You could do it ugly with curl… the data needs to be passed as url encoded form data (percent encoded), like so (with your token and user key substituted in):

curl -X POST --form 'token=xxxxxxxxxxxxxxxx&user=xxxxxxxxxxxxxxxxx&title=Internet%20Connection%20Restored&message=Your%20internet%20connection%20is%20back%20online.&priority=1&sound=spacealarm' 'https://api.pushover.net/1/messages.json'

That would mean you could just create a bash function to send notifications. You can use this function to encode the strings:

# If you don't already have this in your bash profile
urlenc () { #url encode the passed string
	echo -n "$1" | perl -pe's/([^-_.~A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg'
}

pushnotify() {
	local token=xxxxxxxxxxxxxxxx
	local key=xxxxxxxxxxxxxxxx
	local formdata="token=${token}&user=${key}&title=$(urlenc $1)&message=$(urlenc $2)&priority=1&sound=spacealarm"
	curl -X POST -d $formdata 'https://api.pushover.net/1/messages.json'
}

Add something like pushnotify "Internet Connection" "Stop what you're doing, your internet connection is back up." to the imdown script (or replace the infinite loop of annoying voices entirely, but really, why limit yourself?).

Now you’ll get a notification on your phone and/or watch when your internet comes back up.

Here’s a gist with all the fun all in one place.

And here’s one that Alex Chan converted for Fish (with randomized phrase selection).

That was a lot of work for a minor convenience, I know. I happened to have all but the imdown function already in place, so really, I just did all the work for you. You’re welcome.