Skip to content

Instantly share code, notes, and snippets.

View Lenormju's full-sized avatar

Lenormand Julien Lenormju

View GitHub Profile
import random
import time
import threading
import traceback
import sys
import prometheus_client
MY_REGISTRY_WITHOUT_DEFAULTS = prometheus_client.CollectorRegistry() # without GC, platform and process information
@Lenormju
Lenormju / monte_carlo_square_vs_hex.py
Created May 16, 2025 06:09
Monte-Carlo simulation for error rate when distretizing/quantizing two GPS coordinates at 5 meters distance in square versus hexagonal grid
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "tqdm",
# "h3",
# "haversine",
# ]
# ///
import math
import random
@Lenormju
Lenormju / repro_bug_easy_yaml_lib.py
Last active September 24, 2024 23:15
Issue report for an unnamed Python lib posted on StackOverflow (https://stackoverflow.com/a/71560949/11384184), whose GitHub repository seems to have been deleted : https://github.com/didlly
from pathlib import Path
from yaml import safe_load as pyyaml_load
from easy_yaml import load as easy_load # <-- https://stackoverflow.com/a/71560949/11384184
yaml_file_path = Path("./demo_bug_easy.yml")
print(yaml_file_path.read_text())
# the file is :
#
@Lenormju
Lenormju / rot13-encode.sh
Created January 11, 2023 08:55
Shell one-liner to ROT13-encode with Python
python3 -c 'import sys,codecs; print(codecs.encode(sys.argv[1], "rot13"))' abc123xyz
# nop123klm
@Lenormju
Lenormju / .bashrc
Created December 15, 2022 07:45
Python3 one-liner to check if all files passed as arguments are equal (fail early)
#!/bin/bash
alias check_files='find where/to/search -type f -name "filename.txt" | xargs python3 -c '\''import sys, pathlib, itertools; contents = [pathlib.Path(filepath).read_text() for filepath in sys.argv[1:]]; [print(f"{sys.argv[1]!r} and {sys.argv[argc]!r} differ") or sys.exit(1) if content1 != content2 else "ok" for argc, (content1, content2) in enumerate(zip(itertools.repeat(contents[0]), contents[1:]), start=1+1)]'\'''
@Lenormju
Lenormju / reasons.md
Last active March 22, 2023 13:26
Why BitBucket sucks (mainly compared to GitLab)

Repositories :

  • no stats on repositories and their contributors
  • there is no list of tags for a repository, you can only browse the branches graph and squint your eyes (and if the commit title is too long the tag isn't even displayed !)
  • you can't restrict write access to a repo without losing read access
  • the authorization to force-push is per-repo, not per-branch

Security :

  • the UI does not display that a commit is signed or not

Merge requests and code reviews :

@Lenormju
Lenormju / index.html
Created August 10, 2020 15:26 — forked from sylvaindesve/index.html
Sauvegarde Reactive
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sauvegarde Reactive</title>
</head>
<body>
<h1>Sauvegarde Reactive</h1>
<p>Types d'accidents</p>
<input id="typesAccidents" type="text" />
@Lenormju
Lenormju / qt5-fusion-dark.cpp
Last active October 13, 2016 04:31 — forked from skyrpex/qt5-fusion-dark.cpp
Qt5 Fusion style (dark color palette)
qApp->setStyle(QStyleFactory::create("fusion"));
QPalette palette;
palette.setColor(QPalette::Window, QColor(53,53,53));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(15,15,15));
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(53,53,53));