Skip to content

Instantly share code, notes, and snippets.

View ArthurDelannoyazerty's full-sized avatar

Arthur Delannoy ArthurDelannoyazerty

View GitHub Profile

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

Script execution

Shebang

List env variables

env
printenv

Shell variable VS Environment variable

Shell

@ArthurDelannoyazerty
ArthurDelannoyazerty / earth_grid.py
Last active July 7, 2025 15:41
Generate a earth grid and display them in a folium intercative HTML page
import folium
import s2geometry as s2
from folium.plugins import Draw
def get_grid_coords(min_lat, max_lat, min_lng, max_lng, level, max_cells=0):
"""Generate S2 cells covering a specified region at a given level."""
region = s2.S2LatLngRect(
s2.S2LatLng.FromDegrees(min_lat, min_lng),
s2.S2LatLng.FromDegrees(max_lat, max_lng)
@ArthurDelannoyazerty
ArthurDelannoyazerty / geometries_to_html.py
Last active July 7, 2025 14:55
Display geojson/geometris on a earth map and save it as html interactive page
import folium
from pathlib import Path
from folium.plugins import Draw
def display_geometries(list_geometries:list, output_filepath:Path, inverse_lat_lon:bool=True):
"""
Save the geometries on a map on a html page with an Earth background.
Args:
list_geometries (list[dict]): List of geometry dicts to plot.
output_filepath (Path): Path to save the output html file.
@ArthurDelannoyazerty
ArthurDelannoyazerty / .gitignore.md
Last active March 26, 2026 09:39
My .gitignore
# IDE
# .vscode/      # commented to share info with others

# MacOS
*.DS_Store

# Virtual env
.venv/
venv/
@ArthurDelannoyazerty
ArthurDelannoyazerty / f_strings.md
Last active July 1, 2025 16:29
Python f strings examples

Center text

heading = "Centered string"
print( f'{heading:=^30}' )      #| = is for the char to print | ^ Is to center the text | 30 is the total length of the final string

'=======Centered string========'

Align text