Notes on test coverage

Posted on Wed 17 October 2018 in misc • Tagged with haskell, testing, coverage, notes

These are a few quick notes to self, rather than a cogent thesis. I want to get this out while it’s still fresh, and I want to lower my own mental barrier to publishing here.

I’ve been thinking about test coverage recently, inspired by conversations that followed DRMacIver …


Continue reading

Announcing quay-admin

Posted on Fri 18 May 2018 in misc • Tagged with python, quay, devops

We use quay.io a fair bit at work—all our internal Docker images are stored there. I like it a lot, but the website makes it really hard to see who can access your repositories.

In particular, if someone ever leaves your organization, you have to click through all …


Continue reading

Site updates

Posted on Sat 05 May 2018 in misc • Tagged with devops, terraform, aws, tls

I am pleased to announce that the recent TLS certificate problems and outages to jml.io have been fully resolved.

Here are some notes on what happened and what I did about it.

Background

jml.io is a statically generated blog that’s hosted on AWS. The HTML pages are …


Continue reading

Eighty Percent

Posted on Sun 31 December 2017 in misc • Tagged with productivity

Hank Green recently shared the embarrassing secret to his productivity, which he summarises as:

Everything creative I do, I do my best to get it 80% of the way to as good as I can make it and go no further. I just don’t try to get it to …

Continue reading

Category theory in everyday life

Posted on Sat 21 October 2017 in misc • Tagged with math, maths, algebra

I was going to write a post about how knowing some abstract algebra can help you write clearer programs.

Then I saw Eugenia Cheng’s excellent talk, Category Theory in Everyday Life, which was a keynote at Haskell Exchange 2017.

It’s excellent. She says what I wanted to say …


Continue reading

SPAKE2 in Haskell: How Haskell Helped

Posted on Fri 13 October 2017 in misc • Tagged with haskell, spake2

Porting SPAKE2 from Python to Haskell helped me understand how SPAKE2 worked, and a large part of that is due to specific features of Haskell.

What’s this again?

As a favour for Jean-Paul, I wrote a Haskell library implementing SPAKE2, so he could go about writing a magic-wormhole client …


Continue reading

SPAKE2 in Haskell: What is SPAKE2?

Posted on Sun 04 June 2017 in misc • Tagged with haskell, cryptography, spake2

Last post, I discussed how I found myself implementing SPAKE2 in Haskell. Here, I want to discuss what SPAKE2 is, and why you might care.

I just want to send a file over the internet

Long ago, Glyph lamented that all he wanted to do was send a file over …


Continue reading

SPAKE2 in Haskell: the journey begins

Posted on Sat 27 May 2017 in misc • Tagged with haskell, cryptography, spake2

There’s a joke about programmers that’s been doing the rounds for the last couple of years:

We do these things not because they are easy, but because we thought they would be easy.

This is about how I became the butt of a tired, old joke.

My friend …


Continue reading

Announcing haskell-cli-template

Posted on Tue 31 January 2017 in misc • Tagged with haskell

Last October, I announced servant-template, a cookiecutter template for creating production-ready Haskell web services.

Almost immediately after making it, I wished I had something for building command-line tools quickly. I know stack comes with a heap of them, but:

  • it’s hard to predict what they’ll do
  • adding a …

Continue reading

Announcing graphql-api: Haskell library for GraphQL

Posted on Mon 30 January 2017 in misc • Tagged with haskell, graphql

Late last year, my friend Tom tried to convince me that writing REST APIs was boring and repetitive and that I should give this thing called GraphQL a try.

I was initially sceptical. servant, the REST library that I’m most familiar with, is lovely. Its clever use of Haskell …


Continue reading

Announcing grafanalib

Posted on Thu 12 January 2017 in misc • Tagged with monitoring, python, weaveworks

Late last year, as part of my work at Weaveworks, I published grafanalib, a Python DSL for building Grafana dashboards.

We use it a lot, and it’s made our dashboards much nicer to maintain. I’ve written a blog post about it that you can find it on the …


Continue reading

servant-template: production-ready Haskell web services in 5 minutes

Posted on Sun 16 October 2016 in misc • Tagged with haskell prometheus servant docker

If you want to write a web API in Haskell, then you should start by using my new cookiecutter template at https://github.com/jml/servant-template. It’ll get you a production-ready web service in 5 minutes or less.

Whenever you start any new web service and you actually care …


Continue reading

Patterns are half-formed code

Posted on Thu 18 August 2016 in misc • Tagged with programming, golang, python

If “technology is stuff that doesn’t work yet”[1], then patterns are code we don’t know how to write yet.

In the Go Programming Language, the authors show how to iterate over elements in a map, sorted by keys:

To enumerate the key/value pairs in order, we …


Continue reading

Evolving toward property-based testing with Hypothesis

Posted on Sun 05 June 2016 in misc • Tagged with intro python technical properties

Many people are quite comfortable writing ordinary unit tests, but feel a bit confused when they start with property-based testing. This post shows how two ordinary programmers started with normal Python unit tests and nudged them incrementally toward property-based tests, gaining many advantages on the way.

Background

I used to …


Continue reading

A wish for Haskell documentation

Posted on Fri 30 October 2015 in misc

A couple of weeks ago I went to the Haskell eXchange in London. I learned a lot and had a great deal of fun while I was there, and went away with my head spinning.

On the weekend after the conference, they had a hack session on Haskell infrastructure. I …


Continue reading

Debugging Python with gdb

Posted on Thu 27 August 2015 in misc

Here’s a quick reference for getting set up to debug Python with gdb, aimed at Debian and Ubuntu users.

Although I’d love to make this a full-fledged write up, it’s going to have to be a note to my future self for now.

It assumes you have …


Continue reading

Bazel! Correct, reproducible, fast builds

Posted on Wed 22 July 2015 in misc

Bazel is a build tool from Google that I used a lot during my time there. Happily, it’s been open sourced, and so I can look into using it for my own Python projects.

Let me tell you why I’m excited about it, and then follow up with …


Continue reading

Docstrings for tests

Posted on Wed 24 June 2015 in misc

https://jml.io/test-docstrings/.

I’ve made my old Google+ post on writing docstrings for tests available on this blog.

It’s a short, five-step guide to writing helpful docstrings for your tests.

Happy hacking!


Russian translation of “Your Code Sucks”

Posted on Sun 21 June 2015 in misc

Ivanka from Coupofy.com has graciously translated my old article, Your Code Sucks and I Hate You into Russian. Nice!


Isn’t it Pythonic?

Posted on Wed 13 August 2014 in misc

I really should be over this by now.

Here’s how you test exceptions in Python 2.7 and later:

with self.assertRaises(SomeException) as cm:
    do_something()

the_exception = cm.exception
self.assertEqual(the_exception.error_code, 3)

(as recommended in the unittest documentation)

Here’s how you test exceptions in earlier Pythons …


Continue reading