Some tips on observables
You can download …
You can download …
If you use Python, you probably already know of super to call a method from the base class. You probably also know you can use a function as a method if it takes the instance as 1st parameter. What you cannot do, is call super().my_method() directly in such a …
While wandering how to run some tests with JavaScript, I discorvered that deno, a JavaScript runtime like NodeJS, has support for jupyter notebooks thanks to this article. It works perfectly. Install deno (probably available in your distribution repositories), run deno jupyter --install and you are good to go!
To get …
I’ll give some tips to reuse field and model validators and serializers. All my examples will use validators, but it works exactly the same for serializers.
Assign the validator to a variable like so:
def _is_above_ten(value: int): if value > 10: return value raise ValueError(f"{value …
You can export a notebook directly from the interface under File > Save and Export Notebook As. You can also do it in CLI with:
jupyter nbconvert --execute --to <FORMAT> my_notebook.ipynb
The --execute will execute the notebook to make sure all output cells are up to date. Many export formats …
As part of my work to uniformize my server setup around systemd, I decided to make nginx log everything with journald. By default, it logs accesses and errors in log files under /var/log/nginx. I already had one log file per vhost.
To do the change, I changed my …
I recently learned while reading psycopg’s documentation (a Python driver for PostgreSQL), that you should use WHERE id = ANY(:values) instead of WHERE id IN :values when filtering over lists. That’s because the ANY operator works with empty list while IN doesn’t. Psycopg will also correctly adapt …
Let’s encrypt recently announced they will stop sending emails when certificates must be renewed. Following this announcement, I created a small script to monitor the status of my certificates and receive an email if they are not renewed in time. Since it can be handy, here it is!
The …
You can run scripts (written in Python or any other language) directly on a server if the proper interpreter is installed. I recently used it to run a Python script over several servers without the need to copy the relevant script on the server. It all relies on the following …
Commits that change formatting are a pain in git because they make using git blame much harder. It turns out, you can ask git to ignore these commits when running git blame with the --ignore-rev option and passing it a commit hash. You can even do things better and create …