python, conversion

Convert string to duration

I found myself wanting to convert a string to a duration (int), for some configuration.

Something you can call like this:

string_to_duration("1d", target="days") # returns 1
string_to_duration("1d", target="hours") # returns 24
string_to_duration("3m", target="hours") # returns 3 * 24 * 30

The code :

from typing import Literal


def string_to_duration(value …
python, llm, bash, sqlite

llm command-line tips

I’m using llm more and more, and today I had to find back prompts I used in the past. Here is a command I’ve been using, which allows me to filter the results based on what I want. It leverages sql-utils, a cli tool which is able to …

ZNC, Weechat, IRC

Setting up a IRC Bouncer with ZNC

It’s been a while since I’ve used IRC, but I needed to connect to it today to discuss around Peewee.

The main issue with IRC is that you need to be connected to see the answer, and to get the context of the conversation. Unless… you set up …

llm

How to run the vigogne model locally

Vigogne is a LLM model based on LLAMA2, but trained with french data. As I’m working mostly in french, it might be useful. The current models that I can get locally are in english.

The information I’ve found online are scarse and not so easy to follow, so …

Creating a simple command line to post snippets on Gitlab

I’m trying to get away from Github, and one thing that I find useful is the gist utility they’re providing. Seems that gitlab provides a similar tool.

You can use it using python-gitlab:

pipx install python-gitlab

And then :

gitlab snippet create --title="youpi" --file-name="snip.py" --content snip …

Creating an online space to share markdown files

I wanted to create a space on my server where I can upload markdown files and have them rendered directly, for them to be shared with other people.

I stumbled on the markdown module for nginx which does exactly what I want, but seemed to ask for compilation of nginx …

relations, amitié

Éloge de l’amitié

Livre où il est question d'amitié, de ce qu'elle signifie dans un monde où le devenir-parent, les sociabilités familiales et le volontaire désintérêt dans les relations est la norme.

Conversion d’un fichier svg en favicon.ico

Il y a plusieurs sites qui permettent de faire ça automatiquement, mais j’aime bien faire les choses depuis mon terminal, voici donc une commande qui permet de faire ça simplement, en utilisant ImageMagick. Merci à ce gist

convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 …

Découverte de nouveaux outils pour le développement: LLM, Helix et plus

LLM

gitlab, docker

Running the Gitlab CI locally

Sometimes, I need to change how the continuous integration is setup, and I find myself pushing to a branch to test if my changes are working. Oftentimes, it takes me multiple commits to find the correct configuration, which is… suboptimal.

I discovered today Gitlab CI local which makes it possible …