Adding comments to Hugo using Comentario

When I migrated from Wordpress to Hugo, I gained a simpler, lighter blog, however I also lost a few functionalities. One of them is the ability to comment the posts. Fortunately, there are external solutions and Hugo allows to include such sites. There are many solutions, both SaaS like Disqus and self-hosted like Comentario. I chose the latter. Comentario provides a Docker image and a Docker Compose file for an easy deployment. While the documentation mentions the ability to run with SQLite, which would be more than enough for this blog, neither the binary nor the Docker image support SQLite. I don’t master Go so I decided to go with the alternative (PostgreSQL) rather than recompiling with SQLite support.. ...

March 29, 2025 · 2 min

UUIDv7 implementation with sub-millisecond precision in Python by ChatGPT

I am sure I am not the first to do it, but I have asked ChatGPT to implement a UUID v7 function based on RFC 9562. It did not get it right the first time, but after some back and forth, it gave me this answer: import time, random, uuid def generate_uuid_v7_fast(): ts = int(time.time() * 1000) & ((1 << 48) - 1) upper = (ts << 16) | ((7 << 12) | random.getrandbits(12)) lower = (0b10 << 62) | random.getrandbits(62) return str(uuid.UUID(int=(upper << 64) | lower)) Compared to the reference implementation, it is more than 2 times slower (+117% on my system). However, the reference implementation returns a bytearray while this version returns a string after a call to uuid.UUID(). ...

February 7, 2025 · 3 min

Migrating to Hugo

I had been thinking using Wordpress for a personal blog is kind of wasteful for a long long time. After all, I don’t have dynamic content, it’s really just a bunch of text. I wanted to migrate to a static-file CMS for a long time but I never had the courage to do so. I recently had a few days of downtime, and so finally I did it. I decided to use Hugo as it was the most popular option at the time. ...

July 24, 2024 · 3 min