Setting up Datasette, step by step

To build a Datasette, just stack these three boxes on top of each other Source.

Last week, I showed off how I exported my Goodreads data to SQLite, and you can see the data at I use Datasette to make the data available to browse, query, plot, export, etc. Datasette is a brilliant project, because it makes data available to you in an interactive way, and allows you to share original data and analysis in a transparent bundle.

I think I deployed this Datasette to in about five minutes – but that's because I have plenty of templates for the deployment of Python web applications, and I only copied two files and executed a couple of commands. Since I vividly remember being incredibly frustrated more often than I can count when I didn't have these templates, let me share the process with you.

Read more…

Goodreads → SQLite

Books! Disappearing into books is great, and I have well-founded suspicions that it's occasionally the only thing that keeps me fit for human company. I like to share my opinions of the books I read – mostly so that I can look it up in a couple of months or years, but also for the small-but-steady troupe of interested people. This usually takes the form of my monthly book blog post – but now, you can see the raw data, too!

Using goodreads-to-sqlite Source.

Read more…

Books: 2019-09

September was great – I finally found the time and energy to go back to reading. I finished Anathem, which kept me reading for a whole month in between attending and organising events. (That's why there was no blog post in August – “currently reading Anathem” didn't seem like enough content to go on).

This month was a good mix of a bunch of fiction that I loved (my first Jo Walton book, and getting back to Dorothy Sayers), non-fiction about emotions and about writing and software, and relatively few books I didn't enjoy. Also, some short stories that are available for free online.

Read more…

Books: 2019-07

July was a strange mix of books I absolutely adored, and books I didn't like at all. Also, I spent at least half of the month stuck in Dhalgren.

Read more…

Advice for a bad speaker

Speaking of which. Source.

The internet is full of advice on how to give good presentations, and convince an audience of whatever the speaker thinks it needs convincing of. In contrast, there is a remarkable lack of advice on how to give bad presentations or talks. Luckily, the German author Kurt Tucholsky sensed this need ninety years ago, and provided his advice for bad speakers (and, incidentally, good speakers, too).

Kurt Tucholsky was a brilliant German journalist, satirist, writer, and sometimes-poet in the 1920s and 1930s. The bulk of his work consists of contributions to the newspaper Weltbühne (“World Stage”) – he produced so many published texts that he wrote under a total of five names.

His writing is always to the point, cutting away unnecessary bulk and showing the reader the world as it really is, sometimes using a mirror. The trademark Tucholsky dry humor and sharp judgement is hard to translate, but I gave it a go anyways.

Read more…

Exporting Bookmarks from FBReader

Carrying all those books is something I sure don't miss. Source.

I read a lot, and I read a lot across different devices. Usually, I have at least a book open on my Kindle, and one on my mobile phone. I also like to highlight passages that make me laugh, or think, or that touch me in some way. I collect some of those quotes in a fortune(6) file for further usage: Put it on login shells, share it with friends, use it as a tongue-in-cheek Patreon reward.

The Kindle just drops your highlights into a plain text file with a very readable structure, which is very pleasant to work with. It turned out that my Android reader app, FBReader isn't nearly so cooperative, so this post documents how to extract the data from an unrooted phone.

Read more…

127.257 and other fun legacy IP addresses

I think I'm taking up a coat of arms. Source.

IPv6, the addressing scheme of the future, has been lacking adoption for decades now. Its complexity is an often cited reason: What's with the different kinds of addresses? What's fe80 supposed to be? And you can't even compare them properly, what with those pesky :: contractions!

Though … did you know that 127.257 is interpreted as a valid IPv4 address by programs such as ping and your browser? Let's look into this.

Read more…

Books: 2019-06

June was long, and hot, and not terribly filled with reading. I managed to read six books, and then I got stuck on Delany's Dhalgren. That one might take up a complete month …

Read more…

Mobile Zammad notifications with Pushover

Both for my standalone work and for, I use the Zammad ticket system. Sadly, it includes neither a mobile app nor a usable mobile layout – but since I usually have my phone around, even when my laptop sits in my backpack/the next room/somewhere else, I wanted to see new tickets on my phone as they come in. Dismissing tickets I can look up later isn't particularly stressful for me, and well worth the opportunity to react to urgent tickets as fast as possible.

Read more…

Using the Django shell with django-scopes

If you have a project where multiple tenants/users/groups share the same database, but should never interfere with one another, you're going to worry about making sure to prevent data leaks. I know, because I run this kind of setup with multiple projects, most notably pretalx, which uses Django.

As one measure of separating tenants, pretalx uses the new and wonderful django-scopes, which makes sure that models identified as scoped are only accessed in an active scope context. If this sounds interesting to you, please read the blog post introducing django-scopes – it explains the principles and limitations very well.

We started using django-scopes with pretalx, and we were pretty happy. Then, one day, I needed to look up some data that is not directly exposed in the frontend, for debugging purposes.

Read more…

Index HTTP statūs numeri

Last night, when talking with a friend, I quipped

Django est omnis divisa in partes tres, quarum unam incolunt moduli, aliam visus, tertiam templates, qui exempli gratia DTL aut jinja2 appellantur.

This is a modification of the opening sentence of Cæsar's “De Bello Gallico” regarding the Gallic war, where he explains that Gaul was at the time divided into three parts. Django, often described as a MVT (Model View Template) framework was a natural fit for this sentence and my late-night desire to find a practical application for my long and not always pleasant years of Latin.

Read more…

Books: 2019-05

May was a very generic month. Did the working, did the volunteering, did the reading. Noticed that I am unhappy and figured out what to do about it, as you do. I didn't read as many books as I'd like, and none of them stood out too much.

Read more…

Books: 2019-04

April was a travelling month: I spent all of five days at home, and the rest of the time I moved between Berlin, Copenhagen, Vienna, and Berlin again. While this was fairly stressful, it gave me plenty of time to read on the various trains and ferries I travelled on.

Read more…

A @context decorator for Django

Even the happiest Django developers with the most ardent love of class-based views can get tired of writing super().get_context_data(**kwargs), only to add a couple of already-implemented properties or methods to the template context.

django-context-decorator provides, as the name may hint at, a decorator named @context. You can wrap it around both methods and properties, including Django's cached property, and it will add the property's value or the method's return value to your template context:

Read more…