Life and times.

Oct 14 2018

Long time readers are probably wondering where I've been lately.  The answer is kind of long and is worth a post all on its own.  The short version of the story is, work's been eating me alive lately.  This is our busiest time of year and it's been all hands on deck for a couple of weeks now.  In point of fact, last week was our quarterly all-hands meeting, where everybody on my team was flown into town for a solid week of meetings.  All day, every day.  Most of my visible activity lately took the form of parts of my exocortex running on automatic with some hit-and-run posting while waiting for the coffee maker at work to top me up in between meetings.

This also means that I haven't had a whole lot of patience for interacting with people.  Not in the sense that people can feel frustrated with other people or their actions, but in the sense that interacting with people in a meaningful way - having a real conversation - takes more compute cycles than I have available right now.  After fourteen hours in a conference room with 40 other people, not only am I out of social, but I'm mentally exhausted.

Interfacing Huginn with Mastodon.

Aug 18 2018

It seems that there is another influx of refugees from a certain social network that's turned into a never ending flood of bile, vitriol, and cortisol into what we call the Fediverse, a network of a couple of thousand websites running a number of different applications that communicate with each other over a protocol called ActivityPub.  Ultimately, the Fediverse is different from Twitter and Facebook in that it's not run as a for-profit entity. There are no analytics, no suggestions of "thought leaders" you might want to follow, no automated curation of the posts you can see versus the ones you really want to see.  Socially speaking, you don't find people carefully polishing their brands or trying to game hashtag trends but instead everything from somebody kicking back after work with a cup of coffee to people carefully archiving the firmware of classic computer hardware to in-jokes about pineapples.  Rather than fame, you get people.

But that's not what I want to talk about.  I've been asked by a couple of people to post a brief tutorial of how I interfaced my Huginn instance with mastodon.social, the Mastodon instance that I spend most of my time hanging out on.

The Doctor's boot care regimen.

Jul 14 2018

Boots: 14 hole Doc Martens, black, real leather.

Unlace.

Wipe down with damp paper towels.

Wipe down with dry paper towels.

Coat with Dr. Martens Wonder Balsam using included sponge.  Be sure to work balsam into stitches and exposed edges.  I ordinarily don't like to shill for particular products, but I started using this stuff to help break in my boots (it makes the leather softer, so it adapts to your feet more readily) and I was wearing them clubbing within a month of getting them (instead of six months to a year).  It's amazing stuff.

Wait half an hour.  Get some coffee, go for a run, something like that.

Buff balsam off with a clean, dry cloth.  I use a regular washcloth set aside for doing my boots.

Prep your boot polish.  I like Kiwi Shoe Polish Paste, just make sure it's the right color for your boots.  Pop the lid and set the polish on fire with a lighter or matches.  No, seriously, I mean set it on fire.  The polish will melt faster than it burns.  When at least half the polish is burning, drop the lid back on and make sure it closes completely.

Wait.  The flame will burn itself out because the oxygen inside the container (there isn't much) will be used up.  Wait for the pressure to build up inside the tin and pop the lid off with a festive "Poing!"

(If this doesn't happen inside of five minutes, just open the tin.  No big deal.)

The shoe polish is now a thick goop instead of a waxy mass.  Apply polish to your boots with a sponge.

Wait another half hour.

Buff dried polish off with a clean, dry cloth.  I usually flip the washcloth over and use that, but do whatever works.  Rub until the finish doesn't look smoky anymore.  Mine tend to look clean but a little on the dull side.  That goes away as I wear them for a while.

Re-lace and wear for an hour or two to take advantage of the new dose of balsam soaked into the leather making it a bit softer than usual.

Repeat every one or two months, or after cleaning them if they get dirty.

Setting random backgrounds in LXDE.

Jun 28 2018

So, here's the situation:

On Windbringer, I habitually run LXDE as my desktop environment because it's lightweight and does what I need: It manages windows, gives me a menu, and stays out of my way so I can do interesting things.  For years I've been using a utility called GKrellm to implement not only system monitoring on my desktop (because I like to know what's going on), but to set and change my desktop background every 24 hours.  However, GKrellm has gotten somewhat long in the tooth and I've started using something different for realtime monitoring (but that's not the point of this post).  So, the question is, how do I set my background now?  Conky doesn't have that capability.

I tried a few of the old standbys like feh and nitrogen, but they didn't seem to work.  The reason for this appears to be that PCmanFM, which is both the file manager and the desktop... stuff... of LXDE.  By this, I refer to the desktop icons as well as the background image.  As it turns out, nothing I tried to change the background worked, and that is due to the fact that PCmanFM is a jealous desktop module and doesn't let other tools frob the settings it's in charge of.  After some tinkering, here's how I did it:

Short form: pcmanfm -w `ls -d -1 /home/drwho/backgrounds/* | shuf -n 1`

Long form (from inside to outside):

  • ls -d -1 /home/drwho/backgrounds/* - List all of the files in /home/drwho/backgrounds.  Show the full path to each file.  List everything in a single column.
  • | - Feed the output of the last command to the input of the next command.
  • shuf -n 1 - shuf is a little-known GNU Coreutils tool which randomly shuffles whatever things you give it.  It only returns one line of output, a randomly chosen image file.
  • The output of the previous two commands (captured between back-ticks) is passed to...
  • pcmanfm -w - Set the current desktop background to whatever filename is passed on the command line as a free action.

To set an initial background when I log in, I added the following command to my ~/.config/lxsession/LXDE/autostart file: @pcmanfm -w `ls -d -1 /home/drwho/backgrounds/* | shuf -n 1`

This means that the command will run every time my desktop starts up.  The @ symbol tells lxsession to re-run the command if it ever crashes.  However, how do I change my background periodically?

The easiest way to set that up was to set a cron job that runs every day.  Every user gets their own set of cron jobs (called a crontab) so you don't need any particular privileges to do this (unless your machine's really locked down).  If you've never set a cronjob before, the command I used was this: crontab -e

My cronjob looks like this: 00 10 * * * pcmanfm -w `ls -d -1 /home/drwho/backgrounds/* | shuf -n 1`

"At 10:00 hours every day, run the following command..."

And there you have it.  One randomly set desktop background in LXDE.

Incidentally, if you're curious about all the nifty things you can do with cron, I recommend playing around at crontab.guru, it's an online editor for crontab settings.  It's good for experimenting in such a way that you don't have to worry about messing up your system, and it's also handy for figuring out particularly arcane cronjobs.

Algorithm for implementing a dead man's switch.

Mar 04 2018

So, you're probably wondering why I'm posting this, because it's a bit off of my usual fare.  The reason is I think it would be useful to make available a fairly simple algorithm for implementing a general purpose dead man's switch in whatever language you want, which is to say a DMS that could conceivably do just about anything if it activated.

But what's a dead man's switch?  Ultimately, it's a mechanism that has to be manually engaged at all times if you want something to happen, and if that switch turns off for some reason, something else happens (like a failsafe).  A good example of this is the bar on the handle of a power lawnmower you have to hold down so it'll move while the engine's running.  If you let go of the bar the engine keeps running but the lawnmower doesn't keep rolling forward.  Another example can be found in locomotives; the conductor has to hold down a switch or lever so the engine will pull the train, and if that lever is ever let go (say the engineer has a heart attack or is otherwise incapacitated) the throttle closes and the train will grind to a halt.  More along the lines of what I'll be talking about are the watchdogs found in industrial controllers and realtime operating systems.  While running normally a software process inside the device flips a bit somehow - say, writing a 0 into a certain device node.  If the underlying hardware ever finds that the bit didn't get flipped within a certain period of time it reacts somehow to fix things (for example, it might reboot in an attempt to un-stick the gizmo).

Making offline backups of a Linux machine using Backblaze.

Jan 14 2018

As frequent readers may or may not remember, I rebuilt my primary server last year, and in the process set up a fairly hefty RAID-5 array (24 terabytes) to store data.  As one might reasonably expect, backing all of that stuff up is fairly difficult.  I'd need to buy enough external hard drives to fit a copy of everything on there, plus extra space to store incremental backups for some length of time.  Another problem is that both Leandra and the backup drives would be in the same place at the same time, so if anything happened at the house I'd not only not have access to Leandra anymore, but there's an excellent chance that the backups would be wrecked, leaving me doubly screwed.

Here are the requirements I had for making offsite backups:

  • Backups of Leandra had to be offsite, i.e., not in the same state, ideally not on the same coast.
  • Reasonably low cost.  I ran the numbers on a couple of providers and paying a couple of hundred dollars a month to back up one server was just too expensive.
  • Linux friendly.
  • My data gets encrypted with a key only I know before it gets sent to the backup provider.
  • A number of different backup applications had to support the provider, in case one was no longer supported.
  • Easy to restore data from backup.

After a week or two of research and experimentation, as well as pinging various people to get their informed opinions, I decided to go with Backblaze as my offsite backup provider, and Duplicity as my backup software.  Here's how I went about it, as well as a few gotchas I ran into along the way.