Skip to content

Instantly share code, notes, and snippets.

View ArthurDelannoyazerty's full-sized avatar

Arthur Delannoy ArthurDelannoyazerty

View GitHub Profile
@ArthurDelannoyazerty
ArthurDelannoyazerty / TableWithCodeTipsAndExamples.md
Created June 20, 2025 13:58 — forked from MarcoEidinger/TableWithCodeTipsAndExamples.md
Master GitHub markdown tables with code blocks

Master GitHub markdown tables with code blocks

  1. Use HTML tags to define the table to get the best layout result
  2. Use either backticks (```) or the HTML pre element with attribute lang
  3. Keep a blank line before and after a code block for correct formatting and syntax highlighting

Good

Example: nice looking table to show HTTP Responses

@ArthurDelannoyazerty
ArthurDelannoyazerty / listen.py
Created January 27, 2025 11:05 — forked from kissgyorgy/listen.py
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ArthurDelannoyazerty
ArthurDelannoyazerty / confusion_matrix_pretty_print.py
Last active May 13, 2024 13:03 — forked from shaypal5/confusion_matrix_pretty_print.py
Pretty print a confusion matrix with seaborn
def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=14):
df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names)
fig = plt.figure(figsize=figsize)
try:
heatmap = sns.heatmap(df_cm, annot=True, fmt="d")
except ValueError:
raise ValueError("Confusion matrix values must be integers.")
heatmap.yaxis.set_ticklabels(heatmap.yaxis.get_ticklabels(), rotation=0, ha='right', fontsize=fontsize)
heatmap.xaxis.set_ticklabels(heatmap.xaxis.get_ticklabels(), rotation=45, ha='right', fontsize=fontsize)
plt.ylabel('True label')
@ArthurDelannoyazerty
ArthurDelannoyazerty / extract_images_from_tensorboard_log.py
Last active April 19, 2024 14:26 — forked from hysts/extract_images.py
Extract images from Tensorboard log
import pathlib
import numpy as np
import cv2
from tensorboard.backend.event_processing import event_accumulator
event_filepath = 'runs/Apr19_11-02-02_RNSCWL0127/events.out.tfevents.1713517322.RNSCWL0127.15332.0'
output_dir = 'images/img_train'
event_acc = event_accumulator.EventAccumulator(event_filepath, size_guidance={'images': 0})