deaddabe

Status update, July 2020

Let's recap what has been acomplished since last time, as this month I have had the opportunity to work on more things that I would have thought of. Discussed topics: Rustwork, Scaleway vs. Hertzner and bonus meta script.

Rustwork

This has been a productive start of the month, as I have spent more time that I would like to admit into an editor reading and writing a lot of Rust code.

I have started to work on a graphical (GTK) plymouth theme chooser, but as the GTK and global development experience has a lot of rought edges, I actually spent a little time on the application itself and a lot of time writing auxilliary code in order to make the development easier. A lot of this work is unpublished yet, but I managed to at least publish one crate out of this mess.

Gladis is my second rust crate (after charlcd) and its role is to generate boilerplate code in order to work with the GTK Rust bindings. It has allowed me to discover the magic of procedural macros and their power. I have named its companion crate gladis_proc_macro but I already regret this name as gladis_derive would have been simpler to type and better reflects what the crate does: provide a derive macro.

I will probably have the opportunity to bounce on this mistake as I intent to publish another crate in order to interract with gtk::ListStore smoothly with the help of another derive macro.

Moving from Scaleway to Hertzner

Scaleway recently announced that they will evolve their prices (read: significantly increase) in the coming weeks in order to cover the fees for all of the new shiny services like Kubernetes that I really do not care about.

The major take of this article is that my duper tiny VPS that I use for hosting a lot of my (hand optimized) services is going from 3,59 € to around 6 € per month. This feels like a 100% price increase that I do not find justified for the service I am getting: poor IPv6 support, poor and now gone ARM support, etc..

Out of curiosity, I have checked out the Hertzner duper tiny VPS offers and they propose a 1 CPU, 2 GB RAM instance for 3 € per month. This is enough for my usage, and now I can go below the origin Scaleway prices for half the CPU count (but who needs two CPUs when the server is idle 99% of the time serving static pages like this one).

Migration has been started, and this website is already served by this shiny new server. It should not take much time to move everything as I already anticipated this scenario by updating all of my Ansible roles since Scaleway dropped ARM support and forced me to reinstall everything on an x86_64 instance.

Feels bad to drop a French provider and support the foreign companies, but we live in a globalized world now and Nuremberg is not this far from Paris (and do not get me started on OVH, their VPS are overpriced to the same level as Scaleway is getting to). At least its not AWS.

A scrit to generate status updates

One principle I try to live by (clumsy reference to Inventing on Principle) is to reduce friction for every action that will have to be repeated a certain amount of time. Trying to stick to a monthly update by writing this article is one of these actions. So I should make it as simple as possible to get started and focus on the writing instead of the formalities like creating the file in the first place.

Just before writing this article, I have coded the new-status-update.py script that will help me pursue this kind of writing. The script is short enough so that I publish it below:

#!/usr/bin/env python3

import os
import datetime

def gen_filename(date):
    """Generate filename for status update article.

    >>> print(gen_filename(datetime.datetime(2020, 7, 20)))
    2020-07-20_status-update-july-2020.rst

    """
    isodate = date.strftime('%Y-%m-%d')
    month = date.strftime('%B').lower()
    year = date.strftime('%Y')
    return f"{isodate}_status-update-{month}-{year}.rst"


def gen_content(date):
    """Generate content for status update article.

    >>> print(gen_content(datetime.datetime(2020, 7, 20)))
    Status update, July 2020
    ########################
    <BLANKLINE>
    :published: 2020-07-20
    <BLANKLINE>
    <BLANKLINE>

    """
    isodate = date.strftime('%Y-%m-%d')
    month = date.strftime('%B')
    year = date.strftime('%Y')
    title = f"Status update, {month} {year}"
    return f"""{title}
{'#' * len(title)}

:published: {isodate}

"""

if __name__ == '__main__':
    now = datetime.datetime.now()
    filename = gen_filename(now)
    path = os.path.join('content/articles', filename)
    with open(path, 'w') as f:
        f.write(gen_content(now))

    print(path)

Even doctests! Because that is a good practise to have and avoids to set up a dedicated test system but just call python -m doctest myfile.py.

Thats all for today, see you next time!