Nov 15, 2020

#113

Work

I was off on Monday and Tuesday this week. It was nice to have a little break after spending a few weeks working towards a launch and then fixing post-launch bugs.

For the rest of the week I was working on monitoring and starting to think about SLIs / SLOs and autoscaling. Right now we’re using very few of our machine resources, but that’s not likely to be the case forever. Though I definitely don’t want us to fall into the GOV.UK situation, where there is monitoring and alerting for every metric conceivable: devs have been fighting a war against useless metrics for some time.

Books

This week I read:

Games

In this fortnight’s instalment of Masks of Nyarlathotep, one of the gang accidentally ended up participating in a cult ritual and went indefinitely insane, which I don’t think is what they were aiming for. They also survived a car chase, did some snooping, and impersonated a Danish princess for the third time.

They’re now divided on running away to Australia or staying back in New York to find some way to deal with the cult, leading to this session’s theme song.

Miscellaneous

Last week I slightly broke my memos, by upgrading the dependencies in the docker image and deleting the old one, only to realise that pandoc-sidenote and panflute had incompatible version constraints on pandoc. And I couldn’t revert the change to the Dockerfile and rebuild the old one because it referenced an old version of TeXlive which was now 404ing. Ho hum.

Fortunately, it turned out that replicating the bit of pandoc-sidenote I used as a panflute filter was very easy:

#!/usr/bin/env python3

from panflute import *


counter = 0


def coerceToInline(blocks):
    """Extract inlines from blocks.
    """

    paragraph_break = [LineBreak(), LineBreak()]

    inlines = []
    for block in blocks:
        block = block.walk(lambda e, _: Str("") if type(e) == Note else e)
        if type(block) == Plain:
            inlines.extend(block.content)
        elif type(block) == Para:
            inlines.extend(block.content)
            inlines.extend(paragraph_break)
        elif type(block) == LineBlock:
            for lines in block.content:
                inlines.extend(lines)
                inlines.append(LineBreak())
            inlines.extend(paragraph_break)
        elif type(block) == RawBlock:
            inlines.append(RawInline(block.text, format=block.format))

    return inlines


def sidenote(elem, doc):
    """Turn footnotes into sidenotes
    """

    global counter

    if type(elem) != Note:
        return

    content = coerceToInline(elem.content)
    number = Span(Str(str(counter)), classes=["sidenote-number"])
    sidenote = Span(number, *content, classes=["sidenote"])

    counter += 1

    return Span(number, sidenote)


if __name__ == "__main__":
    run_filter(sidenote)

So this week I got it all working again.