Brown sugar and Norway

Two years of frustratedly hunting around in shops has lead to the realisation that ordinary brown sugary (i.e. not demerara, just normal) does not exist in Norway. I can’t even find it in the small independent ethnic shops in Oslo. What do the Norwegians have against it? I can understand them refusing to have anything to do with marmite, but surely brown sugar is fairly innocuous?

How to make the best FREE DIY cat toy ever in just 5 minutes

I feel like the cat toys you buy in pet shops are made, not to attract cats, but to attract humans. After all, the toys are there to be sold, and it’s the human who has the money, not the cat. So the manufacturers make the toy look like something the human thinks a cat might like, something cute with bright colours and perhaps a cheeky little face or something, and of course cats couldn’t care less about that kind of thing.

The last few cats I’ve either looked after or owned have ranged from an incredibly hyperactive 1 year old (who once got so excited about a sunbird hovering over the water of the lake that he jumped into the lake itself) to a un-neutered male Norwegian forest cat who at about 2 years old was as much like a surly teenager as it’s possible for a cat to be, to a stout and dignified 14 year old lady.

The only thing all three of them have had in common is that they’ve absolutely LOVED the toy I’m about to describe. Even the old lady cat whose expansive belly made it quite hard for her to run around.

First of all, you need a short piece of string, some black thread (and scissors to cut it) and two elastic bands. I got the elastic bands off some bunches of asparagus that I bought, so if you don’t have any right now just save the ones you get when you buy vegetables.

Then you need to go for a walk in your local park, and pick up all the feathers you can see (unless they are old and yucky, and a stick (long and straight is better, but it needs to be reasonably strong).
Final step: Add cat!

Depending on how much spin you get on the toy you might find the cotton thread gets wound round a bit, so you’ll need to let it dangle somewhere to unwind it periodically. The cats also seem to like chewing the toy and kicking at it, so the rubber band is ideal but don’t be tempted to add anything metal to it to weigh it down or anything.

Once play time is over you’ll need to hide the toy away, don’t leave it anywhere the cats can access it or they might eat it and choke or something.

Hair wars

I put out some of the remnants of my haircut for the birds for nesting material, and it’s proved a hit!

First there have been some very sweet little bluetits, diligently hauling away beakfulls of hair every few hours. Everything was peaceful, until…
Dum dum DUM! Have you ever seen a more menacing pair? These are great tits, you can tell the difference by their black heads.
They were also very keen on my hair, but they were interested in the seeds I put out for them too.
The poor little bluetit could only look on in disgust, but this wasn’t the end of her troubles!
Seagulls and magpies! The real bullies of the bird world were soon to follow.

Including qrencode generated QR codes in a PDF using prawn / ruby

I’m porting an old app into docker, and trying to avoid using stuff where the end of life has been and gone so I’ve updated ruby, and the version of linux they were using. And now I find that reason prawn doesn’t render qrencode generated QR codes any more. I think it might be because qrencode adds an alpha channel to the border of the png.

Install imagemagick and inspect a qrencode png which doesn’t work:

Colorspace: sRGB
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none

Whereas if run the same png through imagemagick with convert test.png newtest.png:

Colorspace: Gray
Background color: gray(255)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)

Causes newtest.png to render in your prawn pdf.

Coronavirus hits Oslo

I’ve been meaning to post about some of the strange things in this country – one of them is how they have a hairdresser on every corner. I mean, within a 5 minute walk from my flat there are at least 4 I can think of, probably more. B and I get uneasy if we don’t see one on a street we’re walking through “Are we still in Norway??” we say to each other in mock alarm.

Anyway, so I got an email from my work (the University of Oslo) explaining it was stopping all physical lectures and lessons – ‘fine, probably sensible’ I think. Get told we are cancelling our international workshops and that all the schools in the country are closing – ‘oof, but still it’s probably necessary’, you know? But you know things are serious when they close the hairdressers, which is apparently the latest measure. Yikes!

A series of peculiar things that I’ve seen Norwegians put their children into

I’ll add to these when I spot more of them out in the wild.

18 degrees C: Cape Town (left, winter) vs Oslo (right, summer)

Yesterday it hit 18 in Oslo, and as is completely usual here everyone around me threw off their clothes, stripped down to their underwear and spreadeagled themselves in the sun (yes when it first happened I was extremely surprised). I should have taken a photo of myself too – I was wearing jeans and a fleece and got some very funny looks. Anyway, a few hours later a friend of mine in Cape Town sent me a message complaining of how cold the winter was. I checked and CT was 1 degree warmer! There’s a lot of variation in body’s tolerance of heat/cold I suppose.

The frozen North

I don’t like posting personal things on this blog, but I’ve had one of the most stomach droppingly horrible times of my life in the past few months, and I am struggling to put into words everything I want to express. I sort of feel like I should write something. I’ve had this blog since I was a teenager and I regret not having written something about the most momentous events in my life which have happened since then. But I just don’t seem to be able to, I’m not one of nature’s tweeters or bloggers. So instead I’m posting a couple of pictures, and they’ll have to stand in for everything I want to say about sadness, love, isolation, the spirit of adventure and restlessness.

Serverless User: arn:aws:iam::etc is not authorized to perform: dynamodb:PutItem on resource

When following the serverless tutorial here I got an error message which was really hard to debug. Running the following:

AWS_PROFILE=rukaya serverless invoke local --function create --path mocks/create-event.json --aws-profile rukaya

gave an error message like this: “User: [some ARN] is not authorized to perform: dynamodb:PutItem on resource”.

I set up a role for my user, I gave the role almost every permission under the sun, I gave the user account itself the permissions directly, but no joy.

I have two aws accounts set up on this machine – one for my personal stuff and one for work. The personal one is called ‘rukaya’, the work one has my company’s name in it. It took me quite a while to explicitly check the arn number realise that AWS was using my work account even though I was setting AWS_PROFILE and using –aws-profile in the serverless command.

The reason serverless was ignoring my commands is not because it hates me (my theory for the past half hour), but because I had forgotten I was setting AWS_SECRET_ACCESS_KEY=worksecret and AWS_ACCESS_KEY_ID=workkeyid in my environment variables for a script. Unsetting that sorted the problem. It’s pretty silly that your environment variables override your explicit commands, but *shrug*.

Anyway, nobody else on the internet seems to have had this issue so perhaps I’m the first, but I’m posting this on the off chance someone else encounters this.

Automate screenshot scraping with watir and ruby

require 'watir'

def resize_browser(browser)
 height = browser.execute_script("return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);")
 browser.window.resize_to(1200, height)

# Load from external csv
app_ids = [41109, 41110, 41112]
browser = :chrome, headless: true
app_dir = 'apps' 
FileUtils.rm_rf(app_dir) if Dir.exist?(app_dir) 

app_ids.each do |app_id|
 dir = "#{app_dir}/#{app_id}"
 tabs = ['one', 'two', 'three'] 
 tabs.each do |tab|
 browser.element(:css, "div[data-tab='#{tab}']").click