Skip to content

Instantly share code, notes, and snippets.

View AdrienHorgnies's full-sized avatar

Adrien Horgnies AdrienHorgnies

View GitHub Profile
@AdrienHorgnies
AdrienHorgnies / ascii_table.py
Last active April 13, 2021 10:33
Format 2D arrays into ascii table
from typing import Any, Sequence
def ascii_table(rows: Sequence[Sequence[Any]]) -> str:
"""
Format the rows in an ascii table.
First row is considered to be the header
Numbers are right justified, everything else is left justified
See example below:
@AdrienHorgnies
AdrienHorgnies / blockchain.py
Last active December 20, 2021 12:40
Dummy implementation of a blockchain system with a single miner to display how the mining process works
import time
from collections import Counter
from dataclasses import dataclass, field
from hashlib import sha512
from typing import List
import matplotlib.pyplot as plt
import numpy as np
from tqdm import trange
@AdrienHorgnies
AdrienHorgnies / ahead.sh
Last active February 11, 2024 20:47
Scripts to create basic branching cases any dev should learn to solve
#!/bin/bash
set -e
HERE=$(dirname $(realpath $0))
rm -rf local remote.git
git init --bare $HERE/remote.git
git clone $HERE/remote.git local