👋 Welcome to my weblog of miscellany

Quiet internet person. Likes computers, digital and film photography, and very fond of tea.

Here's my setup and a list of books I've read.

Here's some old stuff.

RSS Atom Add a new post titled:

I've come to find I much prefer writing in short posts, just one or two sentences at a time during the day. I like them to be grouped under a day heading rather than having a specific title. It probably falls under the category of "pointless waffle" online but strangely I like it. The best software for this, from my perspective, has been Tiddlywiki and Drummer.

It does make me wonder about normal blogs. I've got this one and I easily get sucked in to looking at hugo themes or thinking about Ghost etc. but really all that ends up happening is I waste a whole evening looking at this stuff and then remember I don't really want it.

I keep thinking of even skipping this entirely and just going all tiddlywiki.

Posted Wed Nov 24 22:16:41 2021

I only have a tiny selection of my grandparent's photos but I enjoyed admiring the film gear in some of the shots. My nanna on the right and a friend on the left. This is 1961 in Kenya.

Posted Sun Oct 10 21:28:58 2021

I've made a few sites over the years. The past ~10 have been mainly a blog (with virtually no content 😅) but before that I had a few other sites.

I was particularly keen at making sites around 2000, whilst I was in senior school. Going to see what I can find in the Internet Archive for screenshots but for now here's what I remember:


Oh so illegal...it was an emulator and roms website. I can't remember if I had a domain or not, certainly not romsnet.com. It was probably hosted on our ISPs web hosting. I don't think I actually had any roms, the whole site was just hotlinks to other roms websites but I made a big list of them all. It was super-cheesy 1999/2000 web design with banners, spinny gifs, visitor counter, and think I was playing some Final Fantasy music in the background.

I remember one day being very excited as the visitor count went from 50 odd to about 10,000, it then jumped more over the next week but then I think it stopped or the counter went weird...perhaps it went weird when it hit 10,000...


I loved Magic: The Gathering at school...in fact I still like the idea of it now, but I don't want to invest 1,000s into paper. Anyway, I used to buy a few cards from some American guy who was selling his online and that gave me the idea of selling mine. It was a horrible effort to maintain a plain text/html table of all my cards to sell, but as a teenager I probably didn't have much else to do.

September 2000

Free-online was a dial up ISP who offered a free domain name with every account! I think you just had to use their dial-up number once a year to keep your account. So a 1 minute call once a year was all that was needed. So as the proud owner of www.blacklotus.co.uk, my MtG sales site was a premium business.

I remember getting an email from some company that demanded the domain as it was the name of their company. Not sure if I replied but they didn't get it...at least not initially. Once we moved to ADSL or maybe cable, I lost the account and the domain. I don't remember if I sold any cards or not. I see the domain is now for sale.


I loved the Gameboy Color and the new Gameboy Advance looked amazing. So much so that I made a website about it! Living at http://www.gbauk.cjb.net/ I put together a lovely purple themed site with my new found knowledge of html tables to make a "side bar". I remember making the logo and then doing a flashing star over it, not sure what I used to do it...part of me thinks macromedia software. I was also very proud of my acronym "Above any CD Game!" for Gameboy Advance.

April 2001

The site was just an excuse to use Amazon associate links. I did write a few reviews but mostly the content was just lists and links. For a while I did make some money from it..maybe £100 every other month or so, which wasn't bad!

I had a friend...well my dad's work colleague's partner...was making Gameboy Advance games and he leant me a pre-release console and games before it came out. That was pretty neat. I found the console relatively recently, think I sold it though. Bought my daughter a Gameboy DSi last year, was £15 used! She's not that interested in it and would rather play the Switch. My rose tinted glasses can't see the terrible graphics of the old DS/Gameboys. I have it sat on my desk as I'm "about to play it again".

Still living

I do want to do a history tour of my main domain, as that's had a few changes over the years. For now here are a few other sites I've made, but these ones are still going:

  • dfworlds - a django powered Dwarf Fortress worlds site where people can upload world gens. My first python programming experience!
  • df stories - a friend and I played a game of Dwarf Fortress and wrote up stories after each year
  • I used to have a minecraft map render of our world online but that seems to have disappeared. I'd like to find the picture of our original MC world from 2010.
Posted Sat Oct 2 23:24:12 2021

There are quite a few blogs that show you how to do Monte Carlo simulations using python. A very accessible one is from Practical Business Python. Always a great site for python in the workplace for non-devs. However, I couldn't find one that did just what I wanted, namely, take a model I'd already built in Excel and then apply some randomness and plot the S-curve (cumulative distribution function).

Maybe if I'd searched more I'd find one but instead I just got on with it. I also used to have some software at work that did this for me, it was an add-on to Excel but work stopped paying for it and I found it hard to justify it (it's an Oracle product so no doubt pricey). Plus I always love an excuse to try and learn a bit more python.



If you don't know, Monte Carlo simulation is a way to capture uncertainity. If a friend is driving to your house, 50 miles away, and they travel at 50 mph it'll take then one hour right? Well, not always. Maybe they are keen on the gas and drive faster, or maybe there's an accident and they get stuck. You just never know. So you could use monte carlo to say that their average journey speed could be from 40-60 mph, then you randomly sample many many times from that range and work out the time it takes. Do it 10,000 times and you then have 10,000 results that you can draw estimates from, e.g. the average time. You can also plot the results and show the whole range.


The main python tools to get this working is numpy for the random sampling and xlwings for interacting with Excel. Like all python libraries, these tools do way more than just what I need. I also used pandas, seaborn and matplotlib. Probably unnecessary but they're quick to work with as I already know the gist of them.

Then of course there's Excel, which needs no introduction. I'd already built my deterministic model in Excel, where all my inputs were in one table that could be changed and then the outputs were in another to be read.

There's always going to be the choice of what do you do in python and what do you do in Excel. As I'd started in Excel I didn't want to waste time recreating stuff in python so all the calculations are in Excel. This is slow (but still fast enough for my use case). Depending on how advanced or complex your model becomes it may be better to move more of it to Excel. The trade off with this is now only you can use it or understand it.

Before I forget, there's also VS Code. I use it at work as it's free, I can install it without Admin rights and IT department haven't questioned me on it (yet!), unlike PyCharm 🤔. I like to make use of the #%% cell divider in it. Partially as I'd been using this for a long time with Spyder (before VS Code existed) and also as it seems like a better way to work vs. notebooks. At least for me.

As always the documentation of the libraries is a great place to start - often the best place before you jump to tutorials.

The Randomness

Your uncertainity takes shape in many different ways. Sometimes is a continuous range, like our speed example before, or it's discrete, like picking your starter Pokémon. In fact whatever the uncertainity is, numpy has a method to help you represent it. I actually think working out what your uncertainity looks like is the hardest part of all of it. Perhaps you could even have uncertainity on the uncertainity...Generally you want to ask an expert, maybe yourself, maybe someone else in your company, or whatever you can find online that seems reasonable. You can, of course, just try different ones in your model and see if it actually makes a difference to the decision you're trying to make.

I ened up using choice and uniform distributions. Choice being my starter Pokémon, and uniform distribution being a range of numbers but they're all equally likely to be picked.

My choice was actually choosing a range of numbers in Excel which would all change depending on what choice was picked.

The Code

So in all its glory:

import pandas as pd
import numpy as np
import seaborn as sns
import xlwings as xw
import matplotlib.pyplot as plt


# Setup
excel = r"myexcel.xlsx"

wb = xw.Book(excel)
sheet = wb.sheets['Control Sheet']

rng = np.random.default_rng()
iterations = 1000
CO2_OPTIONS = [1, 2, 3]

npv = []

for i in range(iterations):
    power_price = rng.uniform(low=POWER_LOWER, high=POWER_UPPER)
    capital_cost = rng.uniform(low=CAPITAL_LOWER, high=CAPITAL_HIGHER)
    co2_price = np.random.choice(CO2_OPTIONS)

    sheet.range('B3').value = power_price / 80
    sheet.range('B4').value = capital_cost
    sheet.range('B9').value = co2_price
    npv_new = sheet.range('B7').value


results = pd.DataFrame(data={'NPV10 £MM': npv})
P90 = results.quantile(0.9)[0]
P50 = results.quantile(0.5)[0]
P10 = results.quantile(0.1)[0]
EV = results.mean()[0]

# %%
sns.displot(results, kind="ecdf")
# %%

print(f"EV: £{EV:.1f}MM, P10: £{P10:.1f}MM, P50: £{P50:.1f}MM, P90: £{P90:.1f}MM")

I made a few controls at the top so I could adjust the ranges of things. Fairly basic stuff otherwise, which I'm sure can be done better but was good enough for me. Being so simple makes it pretty easy to understand, even if you've never used these libraries before.

The whole thing is a loop that does the random sampling, insert those values into excel, excel then recalculates, then it takes the answer out and appends it to a list. Repeat that iterations times and there's my data.

I create a pandas dataframe (probably lazy and it could be done in numpy but as I said, lazy.) from the list and then calculate some metrics from it. The P values are commonly used at work to express the range. Where P90 meaning 90% probability that the value is ≤ X. Or often viewed as most optimistic result, with P10 therefore being the most pessimistic result. Actually, I've seen companies define these in reverse so check before you confuse people.

Seaborn has a handy empirical cumulative distribution function (ecdf), that saves me thinking anything whatsoever (that's the whole objective whilst at work right?). So I make one of those for the PowerPoint, and print out the final numbers in a nice line.

Example ecdf plot

The other nice thing with VS Code is the data viewer. I can save the plot to a file and copy and paste the table of results straight from it without having to write it to a file first. Tiny things like that make life so much easier.


So pretty straight forward to make your deterministic Excel model into a fully probabilistic model capturing all the uncertainity and demonstrating all the potential outcomes that can happen. For free, in about 30 minutes of work.

I think probabilistic models should be used more often. Very rarely is it that everything is always known exactly and whilst your calculation isn't wrong, it's only one possible outcome. Better to give your decision maker (or yourself) a range of outcomes than just one. Tell them "they're buying the curve". Then hope the final result actually lands on the curve 😅

Posted Fri Oct 1 20:37:37 2021 Tags:

Like all favourites the real favourite always depends. It depends on the intent, at least for me. I suppose you could do a "of all time" or "best overall" style favourite. I think a common distinction is form over function. There are a lot of things that look great but are practically useless, even if - like a teapot - they should be used, they still may remain annoying.

So having said all that...I present the Sabichi classic stainless steel teapot.

It comes in a variety of sizes 720ml, 1300ml, and 1900ml, so big enough for even the largest tea drinking family. It's also very reasonably priced at £16 for the medium sized one.

So why do I like it so much? It does the job very well: It has good capacity, it has a classic, timeless look and most importantly, it pours well. So many teapots have terrible spouts that drip or splash tea everywhere. I enjoy filling it up with 1.3 litres and then having several good sized mugs of tea. A teapot for one is fine but when visitors are around you don't want to have to decide between a teabag per mug or tiny cups to use the tea pot.

It has been perfect for working at home when the children are also home. I could make a good amount of tea and hide away in the office working, and not be worried about coming out and upsetting whatever is going on because I'm parched.

I just worry that I should maybe buy a spare in case this one breaks...

Posted Mon Sep 27 22:37:22 2021