I fucking hate deploying dbs

So the third time you install the operating system…

We’re working with Rasbian Buster now. Fewer backport problems. Nothing tested personally. But I have tea. And Dalwhinnie.

You’re going to need to get rid of the old ssh trusted host entry for your server. Again.

Before you upload the key, remember to turn the server on. This is quite important if you intend to communicate with it.

Sob somewhat. Drink.

E: Repository ‘http://archive.raspbian.org/raspbian buster InRelease’ changed its ‘Suite’ value from ‘testing’ to ‘stable’
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

So we do that. apt instead of apt-get gives us a yes option, so we can use it to accept the change. ‘apt update’

I HATE apt. Give me pacman any time.

Rasbian Buster gives us dehydrated, so now we only need the config settings.

Hold my ginger beer, and watch this…

OK. apt-get install apache2 dehydrated

and then

dehydrated -c

And once you are ON Rasbian Buster, it’s relatively painless. Also, alcohol helps.

Proxy Django models for the admin

in admin.py you cannot register an admin class, and you can only register an imported class once. You CAN register an altered class, but that is an overload on the original registration, so

admin.register(MyClass) # Will throw an error and a hissy fit.

However, it is possible to create a proxied class if, for example, you want to have a full set of that class’s attributes and linked classes, and a simple version where you do not load the full set. In a database I maintain, the linked child classes take a long time to load, and are not always necessary.

# In models.py
class CharacterProxy(Character):
    class Meta:
        proxy = True
        verbose_name_plural = "Shorter Character Sheet"
# In admin.py
# define fieldsets within an AlterCharacter class if you want to reduce them.

You can also use a register decorator:

class CharacterAdmin(admin.ModelAdmin):
    list_display = ("name", "species")

class CharacterProxyAdmin(admin.ModelAdmin):
    search_fields = ["name"]

Failure to constrain a database

I was going to write a database that just kept track of a few characters in an RPG, and presented them on as HTML so I could read them off during games.

2000 lines of code, and counting, later…

It keeps tracks of the major affiliations of the gods of the universe, tracks all historical character changes by year and season, takes form input for advancement, generates characters with randomised stats, uses localised in-character geography for alterations based on social groups, includes basic art I have drawn, and has close to no sanity checking. It does output to PDF nicely, though.

Apache on Raspberry Pi, for forwarding SSL to internal port

Here I am, and my rum is upstairs, and people are TALKING to me. PEOPLE.

This is all your fault, Dominic.

So, ssh into pi, because a Desktop for people who can handle it when their rum is upstairs.

apt-get install apache2 -y

echo ‘deb http://httpredir.debian.org/debian jessie-backports main contrib non-free’ > /etc/apt/sources.list.d/jessie-backports.list

apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 7638D0442B90D010
apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 8B48AD6246925553

apt-get update

apt-get install dehydrated-apache2 -y

echo “www.marvelous_website.com” > /etc/dehydrated/domains.txt

echo “CONTACT_EMAIL=me@marvelous_website.com” > /etc/dehydrated/conf.d/mail.sh

dehydrated -c

a2enmod ssl

cat >> /etc/apache2/sites-enabled/000-default.conf <
ServerAdmin webmaster@marvellous_website.com

ProxyPass / http://localhost:4001/
ProxyPassReverse / http://localhost:4001

DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine On
SSLCertificateFile /var/lib/dehydrated/certs/marvellous_website.com/fullchain.pem
SSLCertificateKeyFile /var/lib/dehydrated/certs/marvellous_website.com/privkey.pem


systemctl restart apache2

What has it got in its pocketses?

Well, quite a lot, as it turns out…

two penknives, a screwdriver, some dice, a penny, and a bike lightFront right pocket: The wooden and brass penknife is blunt on purpose, and I use it for cutting the glue on watercolour block. It’s a very specialised tool. It does also get used as a butter spreader in emergencies. The tiny blue screwdriver set is from tinamous, a company run by a friend of mine. It’s got three bits in. I’ve ground down the smaller flathead so that it can repair eye glasses, and the small crosshead is a size smaller than the screwdriver set you’re going to see later. The larger flathead is about the right size for small choccy blocks and anything too small for my other set. The bigger knife is one I have to leave behind or put safely in my bag if I’m going out, but when I’m opening packages or need an emergency teaspoon, it’s vital. It’s by Webley, and I bought it because it opens easily with one hand, for when my other hand is full of something that needs cutting. I’ve replaced the rubber grips on the side, after they perished, with some leather that I superglued into place and then trimmed to profile. Occasionally I put some oil onto it, and I keep it pretty blunt, because it stays in my pocket when I’m at home, and a sharp knife can ruin both your day and your ability to bend your index finger. I also keep my change in this pocket. Currently I am low on cash.

The dice are because I find them around the house from time to time, from gaming sets, and because they are a good demo piece for the Warco mill I sometimes teach on. If you can make one of those, you know a lot about how to make things.

The bike light needs repair, as the rubber band has broken. As it’s a small thing I’ve stuck it into my pocket to help me remember, and some day soon I’ll pick up a new rubber band. A rubber washer in the right size is ideal and much cheaper than the replacement part.

Keys, a square nut, a skate bearing, earphones, and a glasses clothThe left pocket has my keys, here carefully arranged so they cannot be 3D printed from an image of them, and a huge amount of data on the keyring. That silvery flash drive is pretty old now, but when I got it, it was the size of some commercially available drives. I have high quality images of paintings and I like things being backed up. The other drives do different work, and the /other/ silvery flash drive is usually a disk image, so I can deal with broken computers wherever I go. Not that I’ll admit to this, of course. Then, the glasses cloth is very useful for my specs, and I like being able to see. The headphones were a surprisingly good buy. In not having them tangled up and annoying me, and because they have a hard case that protects them, they have lasted literally for years. When the last set fell apart I took them back to the Apple store and explained the problem, and they just gave me a new set, so one purchase has lasted five years or so, and saved me a lot of money and aggro along the way. That’s a really good example of a thing I would buy again. The nail clippers are a single-use tool. I have very soft nails, and it’s worth having a thing to shape them so they don’t keep on breaking.

Things like nuts tend to accumulate in my pockets as I find them after I’ve tidied up. When I am in the right place and I remember, I unload them to wherever they go. The skate bearing is sort of a fiddle toy. The headphone package does the same thing for me, letting me keep my fingers busy while I stare at them and think. I don’t like fidget spinners, because the idea of spending money on things I already have annoys me. I’ll probably tidy away the bearing at some point, but I don’t have any that match it, and it’s not a size I tend to use, so I’ve got to find a place for it, and in the mean time it can keep me company.

Brass spork, drill bit collection in holder, cloth bagIn summer I wear cargo pants, meaning I have thigh pockets. The right hand thigh has my brass spork in it. It’s more of a sp’rk, as it’s very short. I made it myself, and I think I should probably make a steel one, but the brass is fine for the moment. In the winter I’m in jeans and the sp’rk fits exactly over my right hip-bone, in the mini pocket there. The drill bits are 1/4″ and they come in a packet that has an impact driver protector with them – the green and black part. That will help protect the bits from the slamming action of a drill. I tend to use these as part of a hand screwdriver, but it’s worth keeping them in the packet and thus I keep the impact protector with them. The cloth bag is for a moon cup, because sometimes I’m female while on duty, but it’s not usually part of my carried kit.

When I carry sharpies on me, they sometimes go in the right thigh pocket, hooked over the top, but I’ve never yet mastered not losing sharpies, so that doesn’t always happen. I tend to keep art-based things in a separate pencil case.

Gerber suspension multitoolThe rear pockets keep my wallet and my phone. In winter, when I am usually in jeans, that’s one in each pocket, but the cargo pants have room for both, which is lucky, as they only have one rear pocket. Then, we’re done with pockets and onto the right hand side of the belt. Gerber Suspension. It’s the nazz. All people who need spring-loaded pliers near at hand should have them, and it’s part of the mini tool kit that I carry. I can do a lot of things with what is on my belt, and that’s a big part of the reason why. The pliers are a fantastic size for my hands, and I can keep a constant grip on them because the spring does the work. I don’t use most of the other bits on the tool, with the notable exception of the bottle opener and the occasional exception of the scissors. It’s got a couple of magnets nestled onto it, because I thought they might come in handy, but they haven’t really been needed yet, and they’ll probably get put back in the pile of good ideas. The screwdriver attachments used to get used a bit but I shouldn’t need to any more because of…

Wera Kompakt screwdriver kit, adjustable spanner, 3D printed mini bit holderMy newest buy, and a very happy person I am too. The Wera Kompakt kit sits on the left hand side of my belt. It has screwdrivers and a handle with 1/4″ drive, meaning those bits I already have in my pocket are suddenly very useful. There is a little overlap in sizes, and some torx drivers that I find useless and will probably be replaced with flat heads, but that doesn’t have to happen immediately. I’ve got Posidrive and Philips, and that covers most modern situations. It’s a great kit, improved by there being room to shoehorn a couple more things in. I’ve got a Bahco adjustable spanner, which is fantastic for holding nuts while the screwdriver is deployed. There’s also a 3D printed case which holds some Allen bits.

Silver 3D printed Allen bit case, open to show 3 1/4" drive Allen bits.I have a lot of use for the smaller Allen key sizes, and given how tiny they are, I do keep dropping and fumbling them. Fishing a 2.5mm Allen key out of a full cup of tea was made all the more amusing by the fact that other people saw it happening and laughed as well, and I ordered a solution the next day. The drive bits are fantastic, but they are tiny so I 3D printed a case for them. The bumps that help it to fasten close also keep the bits at either end from drifting, meaning I can open it and there is only ever one loose one. I lever the thing open with a fingernail, but the next version of it will probably have some opening bumps. The case sits inside an elastic loop in the Wera case, and completes my on-me tool kit, at least for the moment.

It would be hard to fit more on, as an other belt fittings would stop me from getting to pockets easily, or stop me from sitting down. However, with what I have on me I can do a lot of my tasks without even having to reach out for a tool. The main usefulness comes because I know where everything is, so I can reach for it automatically.

Making a Cat5 o’ Nine Tails

A cat of nine tails made from cat 5 cableThe traditional naval ‘cat’ was made of a thick piece of rope which had been unwound into its nine constituent strands, and knotted. It’s pretty hard to knot Cat 5, which usually bends in a radius 4 times its width. However, we can add modular connectors. To make this a really painful piece of kit, we’ll leave the protective boots off the connectors, but if you’re going to want to soften the blows, then remember to put a pair of boots onto each length of wire before you crimp the ends.

You will need a scalpel or Stanley knife, side clippers, a Cat 5 crimp tool, cable, and modular connectors. Most crimp tools have a cutter on them, but we’ll need the side cutters to tidy up the last end of cable anyhow, and they are less unwieldy than the whole big tool. Optionally, you may want a flat screwdriver or awl to help tighten the big end knot. First, grab several lengths of cable. Four will be about the length of your full two-arm span, and the fifth should be at least three times that, depending on how long you want your handle to be. The crimp tool cutters are ideal for cutting these. I have chosen black, but there is no reason you shouldn’t use another colour, or a mix of colours. You will definitely want see-through modular connectors, as you need to see inside the block while you are building it. Start with the shorter pieces of wire, and add ends to each.

Cat 5 cable with stripped end.The outer coloured layer is softer than the inside. Strip off about half an inch of outer cable by scoring lightly around with a sharp knife. It should then pull off easily. If there is fibre inside the cable, trim that off. Untwist the wire pairs inside, and flatten them into the order in the photo. (This is not the only order, but it’s one standard to prevent cross-talk.) This order, T568A Wiring, is Green-and-White, Green, Orange-and-White, Blue, Blue-and-White, Orange, Brown-and-White, Brown. The wires are stiff, but you can flex them forward and back in the fan, and that will help to straighten them. There is no need to strip them, because the crimp tool will punch metal through to the inner wires.

Cutting Cat5 EndsAt this point, the wire lengths will be different. Once all of the wires are aligned and held easily in one hand, trim the ends. You’ll want to push the whole wire as far as it goes into the connector, so the ends need to be the same length. If the wires are still trying to escape you, bend them back and forth gently until they ease into their new positions, before clipping. Take off as little as you can in squaring up, because you’re going to need much of that half inch inside the connector.

Uncrimped Cat5Now take the connector and push it gently over the coloured wires. There are channels inside the connector and each wire will, with only a little wiggling, go into a single channel. I’ve found it’s best to angle them very slightly, so they go in one at a time, but as long as they are all straight you shouldn’t have a problem. Push in gently at first, but make sure the whole wire beds down to the end, for the best electrical connection. Then push the coloured wire sheath up into the plastic housing. This will also be crimped down, but needs to be shifted up a little around the inner wires.

Crimp ToolThe cable will bed down into the crimp tool. Here you can see the ridges on the tool are pushing down on the metal that is part of the connector. That forces the metal into the inner wires, right through their coloured sheathing. If you have a crimp tool with a ratchet on, this is much easier. Otherwise, you’ll need a little dexterity in with your strength. Keep pushing the outer soft sheath into the connector while you close the crimp tool as far as it will go. The connector below has not yet been crimped, but shows how far the sheath needs to be for a decent bite.

Once you have the crimps finished for the shorter pieces, take the longer piece of Cat 5 and put a decorative knot most of the way towards one end. Leave one length that we will crimp later. A monkey’s fist knot is ideal. Start this by winding the wire three times around your fingers. You want it to be loose. Take the winding off your fingers and, again loosely, run the wire around the winding three times, to make a cross shape. Now feed the end inside your first loop, but outside your second loop, three times. Image below is courtesy of Wikipedia.

Monkey's FistTighten it slowly and carefully, by feeding the wire through the whole knot, repeatedly. Don’t try to close it all at once, or the knot will become shapeless, and don’t close it all the way yet. Get it most of the way closed, and arrange it as a rounded ball. As a purely decorative knot it can take a centre to ensure a spherical shape, but we’re going to rely on the strength of the cable to hold the shape for us.

Before you tighten the knot completely, feed the four shorter lengths of cable through it so they sit centrally. Arrange the shorter end of the uncrimped piece so that it is as long as the other tails, feeding the spare wire through the knot, and the reshaping it. The long bit, the working end, should still be considerably longer than the rest.

Take a hitch around the base of the whip with the working end, and then wind it loosely around the nine other strands, to make a handle. Take another hitch at the end then feed the working end back down as a tenth strand, inside the windings, and then tighten them until everything is held snug. As with the monkey fist knot, you may have to tighten and move the wires repeatedly, but the end result will be a tight, comfortable handle. Use the side clippers to take off any extra length from the working end once you’ve tightened it. Put on the last connector, and you’re done.

Cat CaseI made a presentation case for my Cat out of an ABS wall box and a laser cut front with hex bolts, but equally you could add a clip to the decorative knot, or have the whip unadorned. Just remember that if you do put pressure on the knot, you’ll be deforming it, as there was no room for an inner core once we passed the wire through it. If you do decide to add a core, let me know in the comments how that went, so I can update this post.

Happy Making!

Colour Clock.

A set of small, lit LEDs used as a clockBlinki the Clock works. Red for 0, Yellow for a bit more than 0, back around to red for nearly 0 again. It’s sort of hard to look at it. Mostly the colours can be seen changing on the seconds, but it’s really cool when the hour ticks round and for a moment everything is different.

I have some of the maths wrong in a way I can’t put my finger on. (I have put my finger on this, to get the …. oh, divide by 6, not 10, there. Back in a sec.)

Yeah, it helps if you feed the correct values in. But anyhow, the maths is right now.

Kettle Failure

Apparently that was a sodding toggle switch. And 0 means off.

I’m still not entirely convinced it wasn’t all mocking me – I toggled it and waited and toggle it and…

Yeah, no matter how I cut it, I was defeated in single combat by a kettle that I use just about daily. Pre-tea Diana is a very slow beastie.