I have a number of AppleScript applications that need to run at odd times. These maintenance tasks often attempt to run while the computer is sleeping. Particularly those that rely on UI scripting do not function during this period.
This most flexible way of dealing with this is to manipulate the power management settings directly via the pmset(1) command.
The variety of options available using pmset is staggering and beyond the scope of this post.
After waking up this morning with my mouse locked onto the Anki icon in the dock and trying to figure out how to get Activity Monitor up and running so I could force quite my Automator application that I described yesterday I figured it was back-to-the-drawing board.
I’d like to have used the Accessibility Inspector to manipulate the PyQt objects in Anki’s windows, they aren’t exposed in a may that you can script them.
While working on a project to automatically collect statistics on my Anki databases (stay tuned…) I worked out a system for scheduling synchronization from my desktop OS X machine.
Prerequisites LaunchControl is a GUI application that lets you create and manage user services on OS X Anki is a spaced repetition memorization software system The solution relies on Automator. Normally, I don’t care much for Automator. It has too many limits on what tasks I can accomplish and workflows created with it are often fragile.
Hexo, the static blogging system that I use is very extensible and provides numerous hooks into generation pipeline.
While working on a Russian language blog that’s coming online soon, I had the opportunity to write a filter to render Cyrillic text in a different font than the rest of the body text.
Markup filter use case I wanted to set the Cyrillic text apart both in color, typeface, and font weight.
Because the blogging system that I use doesn’t apply finely grained object-level caching rules, I end up with objects such as images that cache appropriately but an index.html page that does not. I don’t want client browsers to hang on to the main index.html page for more than an hour or so because it should update much more frequently than that as its content changes.
It’s possible that I could dig around under the hood of hexo and create a version that applies customized caching rules.
Speaking of Anki, here’s a Swiss Army knife of database utilities that provides searching, moving and renaming functions from the command line.
On GitHub.
You can do things like this to rename and collect tags:
$ anki_tool mv_tags '(dinosaur|mammal)' animal Looks cool.
[N.B. 2016-03-26 Nathan Ifill pointed out that it is possible to use Anki’s built-in conditional replacement feature to do what I’m illustrating. I’ll have to work on another example!]
Anki is a widely-used flashcard application. If you’re learning a foreign language and you’re not using Anki, you should be.
If you are using Anki and are picky about the appearance of the cards, you should know that JavaScript can be used in the card template.
Trump orating “I actually called her, and she never mentioned my name. You know, I - when I sold - oh, did I get a call from one of the Environmental Protection Agency, they couldn’t find it because it comes out in big globs, right, and you say to yourself, ‘How does that help us?'"
Trump is one of the most amusing orators in the history of presidential politics in the the U.
I recently migrated this and my other blog to Hexo which is a very fast static blogging framework built on node.js. As when I used Octopress, this blog is still hosted from an AWS S3 bucket. However the deployers that I tried with Hexo failed because of dependencies that were incompatible with the OS X version I was running. Not being a node.js expert, and having no time to delve into node.
I’ve been moving to a tag-based system for organizing content in DEVONthink. All of my content for each database goes into a single group called “reference.” If I want to find something, I search the hierarchical tag structure instead of diving into some arbitrary list of groups.
But I still have groups that I’d like to collapse into the reference group. So I wrote an AppleScript to perform this action. Notably, most of the action is in the processGroup() handler which is recursive because we do not know how deep the group hierarchy goes.