All Notes (25)

I was in need of importing a big SQLite database inside of DuckDB and I found the documentation of the sqlite extension of duckdb (Archived) but I couldn't find any reference to how to import an SQLite database.

Last week I presented my first paper "An Empirical Verification of Wide Networks Theory" at BMVC 2022 in London. The experience has been fantastic, both because of the beautiful venue, a cricket field called the Kia Oval, and because of the stimulating discussions I had with other participants.

In this post I will briefly explain what my paper is about and appropriately link to all of its material (a video presentation and a poster).

In the latest months, I've been dealing with interviews from multiple companies. In these, I was frequently asked complex probability brainteasers, which are however quite easy to solve using generating functions, so I thought that I could detail the gist of the method in a post, even though the method is obviously contained inside the standard reference on the matter: generatingfunctionology (Archived).

I had some troubles in past days in setting up MikroORM (Archived) with SvelteKit (Archived) so that I would like to share how I finally managed to do it.

After the note on my Bachelor's thesis, I decided to talk about my Master's thesis in computational complexity. The thesis concern is the complexity of solving certain kinds of infinite games on finite graphs, with special emphasis on Parity Games (Archived) and Mean-Payoff Games. For parity games a breakthrough in their solution complexity was obtained some years ago, while mean-payoff games are thought to be much more difficult to solve, and only subexponential algorithms are known.

In the thesis, together with my supervisor Marcello Mamino, we defined a new type of graph game which is of intermediate complexity between parity and mean-payoff games, and we presented algorithms to solve it.

I like the way dvc (Archived) allows you to manage the reproducibility of pipelines, but for my PhD I found myself multiple times in the need to execute a single pipeline multiple times with different parameters and to collect data in an homogeneous way during the multiple runs, so I ended up abusing dvc a bit for my goals.

Raising the issue with a friend, he told me that he uses an SQLite (Archived) database stored under git and an ORM (Archived) to write records in it. I liked the solution, except for the part that makes you store binary data inside of git.

So I searched for a way to make the databases behave like plain text files under git, but to be fully functional on checkout. It turns out that it is possible, as well as easy to do, and you also enjoy line-wise diffs of your databases!

Simple Rules

How to Thrive in a Complex World
Series: Book Reviews (2/2)

Today I want to talk about a book that I read recently and that I really enjoyed. The book is Simple Rules, How to Thrive in a Complex World by Donald Sull and Kathleen M. Eisenhardt; the central idea is the realization that complex problems can have simple solution schemes, and that we can elicit ways to collect simple rules that work effectively for the problem at hand, thus making the rules also more easy to communicate and to follow.

Series: Book Reviews (1/2)

During my Bachelor's and Master's degree I had almost literally no time for other activities, and so I cut off completely my reading habits, which I had had since I was a child, when I was an avid reader of investigative stories and fiction.

Having regained my leisure time, I quickly found out that narrative was no more as appealing as it had been before. After a bit of wandering I stumbled casually on an online recommendation for the book How to take smart notes by Sönke Ahrens, which I started reading not expecting too much, given its hyped title.

Instead I found very valuable suggestions for how to structure intellectual work and notes, and I must admit that I have been using the techniques productively for more than two years since. In this note I will try to briefly summarize the main topics in the book and I hope this will intrigue you enough to read it and to adopt the system (Archived).

In the first months of this year, from January to April, I was in Paris for a period of study abroad at INRIA (Archived). During these months I had time to visit the city in some depth, and I would like to suggest some places to visit if you have the opportunity to stay in Paris for some days.

Dopo aver pubblicato qualche tempo fa il materiale della mia tesi triennale, ho deciso di mettere online anche il colloquio del mio quarto anno in Normale (Archived), che tratta della derandomizzazione dei giochi di Arthur-Merlin (Archived).

Today I would like to share this snippet of a svelte store that synchronizes with a key in the localStorage, adapted from the fractils (Archived) library.

I realized that it was possible to create polyglot files1 when I searched for the details of the structure of a zip file (Archived) and found that the file header in this case is at the end of the file, and thus can easily coexist within an executable file, whose headers are usually at the start.

Footnotes

  1. Files that are valid in more than one format. For example, a file may be both a valid ZIP and a valid PDF (Archived).

Dopo qualche anno sono incappato nel materiale che avevo prodotto per la mia tesi triennale, e ho deciso di renderlo disponibile online. L'argomento della tesi è l'equazione di Pell (Archived) e i metodi di soluzione basati sulle frazioni continue (Archived), sia nel caso classico sugli interi che nel più recente caso polinomiale.

Some months ago I was trying to build a very simple JIT compiler in Zig. I eventually gave it up since building a decent one is quite a challenging task, even though I was glad that I learned a bit more about how a JIT really works.

Today I found out this little piece of code for executing a shellcode in Zig: I remember I had to ask how to do it since I couldn't figure it out from the stdlib documentation, so I will share it here in the hope it is useful to others.

In this tutorial we are going to show how to produce a simple static PWA using SvelteKit (Archived) which we make installable by providing a correct manifest.json file and a service worker.

Every time I need to produce a Python package I spend a lot of time searching for what should be put in a modern setup.py file, since there is so many old examples that still use distutils. I thus decided to put here a decent example of such file, in the hope that it is useful to my future self and to others.

I struggled a lot during my life to exercise regularly because I didn't feel the motivation to do it. Some months ago I realized that I don't actually need to be motivated to do something, I just have to do it.

GitLab (Archived) offers a fairly complete experience with the ability to run Continuous Integration jobs and the ability to store produced artifacts. In this small note I will show how to use the CI to build a docker (Archived) image stored in our repository.

An updated list of some interesting projects that I have discovered over the years. The projects contained here are either very functional and complete, and vastly superior to everything I have used in their domain of competence, or have a strong vision of what things should look like.

In this tutorial I will show how to configure integration of our K3S cluster with GitLab using GitLab Agent.

In this tutorial I will show how to install Longhorn (Archived) to manage persistent storage requirements of the kubernetes cluster.

In this tutorial I will show how to configure automatic SSL certificates for K3S using Let's Encrypt (Archived).

In this tutorial I will explain how to configure and expose an external DNS server for a K3S cluster using k8s_gateway (Archived).

K3S (Archived) is a lightweight kubernetes distribution which is extremely easy to install and to use. In this tutorial I will explain how one can set up a basic kubernetes cluster in a single self-managed server.

Embed this Perl snippet in your bash scripts to configure files based on environment variables!