Skip to content

Instantly share code, notes, and snippets.

View ArthurDelannoyazerty's full-sized avatar

Arthur Delannoy ArthurDelannoyazerty

View GitHub Profile
@ArthurDelannoyazerty
ArthurDelannoyazerty / prefect-docker-compose.yaml
Last active August 21, 2025 09:59
Do not use the given URL (like a `0.0.0.0`) but use the serrver URL for fast loading
name: compose-name
services:
# -------------------------------------------------------------------------- #
# PREFECT #
# -------------------------------------------------------------------------- #
postgres-prefect:
image: postgres:14
environment:
POSTGRES_USER: prefect
@ArthurDelannoyazerty
ArthurDelannoyazerty / .vscode.md
Last active August 19, 2025 10:02
My .vscode

.vscode/launch.json

Be sure to have installed the extension Commmand Variable to have access to advanced variables (like command:extension.commandvariable.file.relativeFileDotsNoExtension)

{
    "version": "0.2.0",
    "configurations": [
        
 {
"""from . import FileUtils"""
from pathlib import Path
import os
import re
__all__ = ["FileUtils"]
class FileUtils:
@ArthurDelannoyazerty
ArthurDelannoyazerty / timing_function_decorator.py
Last active August 12, 2025 14:36
EASY TO USE. LONG FILE. EXAMPLE AT THE BOTTOM. A decorator that time functions, and have advanced features : options to print to the console, to a default file, to a custom file. Can dynamically group functions by a tag. Can display a complete timing summary in the console. Can create chart that compare functions or compare whole groups.
"""
```
from . import timefunc, timing_manager
```
This module provides a comprehensive and thread-safe toolkit for performance monitoring
in Python applications. It is designed to be both easy to use for quick debugging
and powerful enough for detailed performance analysis.
The module is built around two core components:
@ArthurDelannoyazerty
ArthurDelannoyazerty / zip_utils.py
Last active August 12, 2025 13:44
functions to scan the file of a zipfile and load a selected image or move a file to a folder
"""from . import ZipUtils"""
import zipfile
from pathlib import Path
from typing import Callable
import numpy as np
from PIL import Image
import shutil
@ArthurDelannoyazerty
ArthurDelannoyazerty / async_interface_sql.py
Last active August 5, 2025 15:58
Utils async class that connect to a DB (or create on) and send queries
import asyncio
import logging
from typing import Optional
import psycopg
from psycopg.sql import SQL, Identifier
from psycopg_pool import AsyncConnectionPool # pip install psycopg[binary] psycopg_pool
from tqdm.asyncio import tqdm
try:
@ArthurDelannoyazerty
ArthurDelannoyazerty / nb_line_project.sh
Created July 31, 2025 09:48
Count the number of line in a project (pure bash) (excluding files/folders)
# For all files in project root folder with some filters
find . \
-name '*' \
-not -path "./.venv/*" \
-not -path "./docker/DBvolumes/*" \
-not -path "./logs/*" \
-not -path "./.git/*" \
-not -path "*__pycache__*" \
-not -path "./uv.lock" \
| xargs wc -l \

Class Diagram

Abstract class

  • A class that cannot exist by itself. They are meant to be subclassed
  • They can contains both abstract and concrete methods
  • When used, can be understood as an identity ("is-a X")
  • Designed to share code and state
  • Prefer the interface if possible
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from pathlib import Path
import matplotlib.colors as mcolors
# --- Configuration ---
# Define file paths using pathlib

Terminal / Keyboard

localectl list-keymaps
loadkeys fr
# setfont ter-132b
kdbrate -d 500 -r 10

INTERNET