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.

Green Veg a quick way

1) Chop off all inedible bits
2) Cut up
3) Put into covered microwave bowl with splash of water
4) Nuke for 4 minutes
5) Remember they are in there and don’t leave them for a week

A nice correspondent has written in to say that plastic takeaway containers make splendid microwave bowls. Just leave the lid loose.

If you use a ceramic bowl you will need longer than 4 minutes because the material absorbs heat.

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

Packaging electron for other users

Notes from a small Laptop…

Finding instructions for packaging election apps turned out to lead me, moment by moment, inexorably through the madness that is youtube. So, here is my typed version of Things That I Did, picked up from youtube and https://ourcodeworld.com/articles/read/365/how-to-create-a-windows-installer-for-an-application-built-with-electron-framework .

First of all, I moved all electron-based folders into an electron workspace. Into that workspace I hit npm install electron-winstaller.


cd whatever-your-app-folder-is


npm install electron-squirrel-startup

and wait a bit. Now is a good time for a cup of tea. Frankly any time is a good time for a cup of tea, but during downloads and installation you should be stretching your legs anyhow.

Now we alter the main.js file to handle events from squirrel.

After the const app module to control application life, we add some code snippets from ourcodeworld.

Then we find a link to electron-packager, and then we cry.


npm install electron-packager -g // The -g switch gives us a global install

We roll back npm 5.3.0 to 5.2.0 because otherwise the build breaks.

npm i -g npm@5.2 // On my ARCH installation I tried out 5.4 instead. Results as yet unknown.

We add a script to package.json and we run it, and it works, and we launch the app, and it dies.

Well, crap.

OK, so there are unexpected tokens, which means it’s borking on the not-JavaScript bits, which means it needs to be part of Webpack. So we use webpack-electron-packager instead, and there are tutorials for that so here, gentle reader, I leave you.

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.

GNU Embedded Toolchain for ARM on Rasbian Jessie Lite

Shoot me. Shoot me now.

And if you don’t, don’t blame me.


I dislike GUIs for holding my coding environment, because they present me with new and therefore terrifying technology. So, I elected to put the mbed cli onto Raspbian Lite. This is already devoid of a GUI, and nothing could go wrong.

Gentle Reader, it went wrong. Mostly because the instructions for compiling from source were in a pdf which I couldn’t read without downloading it elsewhere, and by the time I had done that the schnapps I was taking medicinally had betrayed me.

Once I’d opened that, the instructions started with ‘install Ubuntu’ so I swore a bit and didn’t install Ubuntu. But I did apt-get install software-properties-common and that nearly worked. I didn’t have 7z on Rasbian Lite, and when I managed to get p7zip, I had to amend ./install-sources.h by hand, to take out mentions of 7z and add p7zip -d which got me to the point where I had everything installed and could start the build. At which point, more stuff broke.

‘This does not look like a tar archive’ is a bad message to get when you believe you are messing with tar archives. So, it was into build-common.sh to have a look-see.

I had a curious error that tar -cf – . which should – I thought – have compressed stuff, wasn’t. As far as I could read from the error message it was decompressing instead. Obviously I was not drunk enough. But there was a failure to find zlib, and that was the only thing that was compressed as a .tar.gz instead of a .tar.bz2. So I could do that by hand, right?

cd src
tar -xf zlibwhatever
cd -

Now we’re cooking with Calor.

Until there’s no usable m4 in $PATH. And I have no idea what m4 is.

So I install that:

apt-get install m4
sudo !!

!! is the most useful shortcut I have ever found. It’s the entire last line you typed. sudo !! is the thing I probably type most.

Then I attempt another build. I’m on a roll here!


And I wait. Clouds of text pass upward. My pi light blinks. I drink more. More scroll happens. I have no desk. I have no keyboard. The world is an illusion. I experience sudden horror as the scrolling stops but it is only a momentary pause for a large file. I recognise fragments of names. The word ‘pedantic’ catches my eye and I laugh. The ‘caution something or other about make check’ board scrolls past. I drink again. Makefiles are made. I hug the bottle. The scrolling is giving me a headache. Or else I am hung over. The lighting waxes and wanes as text pauses and passes on. I am at one with the Schnapps. The Schnapps is at one with me, but is also precariously balanced on the tin of shoe polish I am using as a coaster. Now we are checking the locale and it isn’t saying Drowned Ys or Property of Randolph J Carter, so I think we’re OK. ‘Making all in .’ is a travesty of grammar, but a wonderful statement from the command line. More drink. Sacrifice a goat to the old ones. Eat raw goat liver. I finish a conversation online and start another. The dragons drift by. I click things with a useless mouse. There is more scroll. The C compiler works. We check together, the computer and I, whether we are cross-compiling. … And then .configure aborts.

‘Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).’

Well, there’s lovely.

I don’t know how to remove that, because I don’t know why or where it was set in the first place. Somewhere in the haze of alcohol I remember that I must already have the GCC working to make all this stuff, and I sigh and look up the error message because that’s the sensible thing, and sleeping could stop me from thinking.

A stack exchange discussion of this problem has something that cheers me up. “The compiler is too harsh simply because there is no compiler…” At least my problem is not that.

In looking up what might be going wrong I have scrolled away from the error messages and I don’t want to look for logs so I run this again. There is a pleasing object with the word polyhedron in the file name. And now we have found warnings. Makefile.in seems to ignore the datarootdir setting. Is that bad? And then a bit of scroll later we bork.

I read back up a bit. pushd allows one to play with the directory stack. So in one of those directories, perhaps, there is a ./configure.

ls build-mingw/zlib has a configure file. There is a configure log. The configure file tells me that
else .

So now I try to remember what try means. I scroll up to find what options $CC has. The irony of me doing the scrolling makes me smile. I have the horrible feeling that this is using CC not GCC and I have no idea what that means. The bottle is calling me again. I comment out the line that is forcing me to leave, because errors are fine because it is midnight and I am drunk. I do not expect this to go well, but I am interested in what will work. Probably that file will not be regenerated and this is all safe. Perhaps I should have checked at least the start and end of the configure log before I began. The cloud scrolls past again. I can smell hamsters. long long ints exist. doubles exist. I play with the refresh rate of the scroll by blinking. I converse online about novelty fish. I open up a different terminal to rest my eyes. I scroll back in time to find out that CC=gcc. I reach the point where we make all in . The tension is acutely bearable. I have no expectations. Hope is a deceiver. I lie to myself about not hoping. The conversation about novelty fish turns to gravel and rakes. I consider Phlebas, who was tall, and is now dead. I consider how I could have learned to get along with a GUI, but no, I had to do it my way. I look lovingly at the screen, now showing me built objects that will die when ./configure fails. I love these things. They do not know that hopes are liars. Maybe once I was like them.

Everything dies. I look up the ./configure, and sure enough it’s a generated file so I cannot change it. I’ve learned a thing. I look in the configure log and I’m apparently building some cross-compiling something-or-other for the windows toolchain so I re-start without that. I can live without windows. The pain of the GUI is enough that I am doing this to avoid windows.

./build-prerequisites.sh --skip_steps=mingw32

The temperature warning for the Pi comes on. I blow over the CPU, with the tenderness of Achilles teasing Patrokleos. The air is warm. I have enclosed the main board in too many breakout boards.

The objects are created again. They never complain about this. The temperature warning has not returned. .io files click in orderly procession down the screen. More scroll. Is this further than I have gone before?… exit 0. No errors. The little coloured directory indicator is a checkpoint flag. They are playing my tune.

Ladies and Gentlemen, we are halfway!

./build-toolchain --skip_steps=mingw32 holds no fears for me now. I believe!

I take a moment to marvel at the complexity of the compiler building a compiler. So many people worked on this. Hardly any of them need to be destroyed. I blow on the CPU again. I wonder if I have built this in the wrong place. Awww. Error 2. recipe for target failed up above somewhere. I can hear the Glory. I should probably sleep. The Pi can cool down overnight.

Dear reader, I came back to it in the morning, and tried again with TeX installed. Why TeX, I do not know. It seems to have been making make all fail, even though it was almost certainly optional in the minds of the writers. I added flex to give me gengtype-lex.c, and ran into what was probably a memory issue. So, I increased the swap file from 100MB to 400MB. df –total showed that I still had 10% of my space free. (At this point, I decided to build the toolchain on my desktop machine as well, to find out if it was just the Pi being awkward. It’s the Pi being awkward, *and* I failed to build on ARCH.) I installed bison, and increased the swap file to 800MB. The temperature warning light stayed on, meaning that the CPU was being throttled. However, finally, I ran out of space on the device. One last gambit was to decrease the swap file to 600, because I didn’t know if the installation of bison could fix the earlier issue. Again, I ran out of space. More in next week’s exciting episode, folks.