Use foam tape or M3 bolts to attach.
I use 40 way male - male header cables stripped down. These fit better on 0.1" pitch than the round end type, can be used to make custom IDC cables and are a lot cheaper then buying packs of singles. They’re also good for mounting sensors off-board, either into proto-board or soldered into a PCB. Buy a couple of 10cm cables and a couple of 20cm cables and you’ll have enough link wires for the rest of your life.
(Now added version 2 with endstop, to be mounted other way up.)
That could benefit my desk.
I used to think that free male and female cables mate in the chaos of my desk, to spawn lots of mini jumper wires, but sadly it didn’t happen.
Not a good idea.
Silux, cable husbandry has to be carefully managed, otherwise you’d end up with strange hybrids such as mains plug to RJ45 cables hanging around the place.
Breeding jumper cables
I have had some success by keeping the males in one compartment and and the females in another. When I need extra cables I pour some beer in the male and wine in the female compartments plus a little of each for me. Wait twenty minutes and shake vigorously. Usually it takes about 3 postal delivery days but the young wires arrive by mail. What I can’t explain is the charge on my PayPal account. I’m in the US and noticed that it takes about 15 extra days if the parents are of Asian descent.