Edit: after a lot of trial and error I discovered that JB Weld works amazingly well for this. You want the original two-part epoxy that comes in two completely separate tubes (not the newer stuff that comes in a single double-plunger tube) since it has a ~4 hour set time. If you mix the two parts and then load it into a syringe and hook it up to an air compressor driven solderpaste dispenser (called a "glue dropper") you can plug holes really really fast and the results are great. Dries rock-hard. Keep in mind that JB Weld is ferrous (dried epoxy will stick to magnets, but that doesn't matter for my application. Also JB Weld is electrically conductive, so if you're plugging more than one hold you can't use this for hot-pluggable devices since an incorrect insertion would make electrical contact on the pair of plugged holes, by way of the JB Weld. Otherwise it's ideal. You'll have to throw away the syringe and tip but they only cost a dollar or so.
Everybody's familiar with the ubiquitous 2.54mm box header (image below).
One common way of preventing reversed or misaligned insertion is to get the male header with a shroud and the female header with a corresponding key (second image below). However this isn't always mechanically practical. It also requires buying the headers in exactly the size you need instead of cutting them down from larger sizes.
An alternative way to prevent flipped/offset insertion is to omit one of the male pins (they can be pulled out of the header with pliers pretty easily prior to soldering; only pressure holds them in place) and plugging the corresponding hole of the female header. However the plugging has to be done with a glue or epoxy that dries VERY hard, otherwise you can mis-insert the connector by pushing a bit too hard and deforming the glue. I've been looking at electronics epoxies and there seem to be a dizzying array of them!
Can anybody recommend an epoxy that dries very hard, hard enough to prevent a pin being driven through it? Preferably a one-part, air-dry (not bake-dry), pneumatic-needle-dispensable epoxy if possible.
A pneumatic-needle dispenser (like the kind used for solder paste) would make it really easy to key a whole bunch of headers at a time; just stick the needle in the correct female header position, press the footswitch, move on. Unfortunately I've found a lot of these headers use plastic that can't withstand reflow ovens, so an epoxy that doesn't require oven drying would be preferred (although even the heat-dried epoxies use much lower temperatures than reflow).