Skip to content

Instantly share code, notes, and snippets.

View AdrienHorgnies's full-sized avatar

Adrien Horgnies AdrienHorgnies

View GitHub Profile
@AdrienHorgnies
AdrienHorgnies / fake.json
Created July 13, 2024 09:15
An invoice template using Typst
{
"Draft": true,
"Number": "123456789",
"IssuedOn": "01/01/1970",
"Due": "15/01/1970",
"Introduction": "Please receive this invoice with joy and cheerfulness.",
"Issuer": {
"Name": "Big D Energy",
"Address": "Rue de la Gaufre 777\n1234 Ville",
"Country": "Belgique",
@AdrienHorgnies
AdrienHorgnies / makew
Last active July 11, 2024 15:04
Continuously make and run an artifact, ignoring files according to git and make.
#!/bin/bash
# --- NEEDLE-HELP-START ---
# NAME
# makew - makew continuously run make upon source files changes.
#
# SYNOPSYS
# makew [TARGET ...] [--cmd <command|file>] [--no-cmd] [--no-git] [--gitignore] [--exclude <regex>] [-h|--help]
#
# DESCRIPTION
# makew calls make with the provided TARGET(s) (or none), and continue doing so whenever a source file changes.
@AdrienHorgnies
AdrienHorgnies / Dockerfile
Last active May 31, 2024 20:26
Find Dockerfile's recursively and report on possible upgrades.
FROM docker.io/fluent/fluentd-kubernetes-daemonset:v1.16.5-debian-elasticsearch7-amd64-1.0
FROM docker.io/postgres:15.2
FROM foo:15.2
FROM envoyproxy/envoy:v1
@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
@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 / 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 / README.md
Last active April 14, 2020 08:54
Playing with Iterable and Iterator

Java Iteration Design Pattern

Some classes to showcase Java Iteratable<T> and Iterator<E>

I've put everything in the same file by simplicity and declared inner classes static but I wouldn't recommend to do that in production code (separation of concerns).

@AdrienHorgnies
AdrienHorgnies / DynamicCompilationTest.java
Last active May 11, 2020 17:37
A class to run dynamic tests
package be.unamur.info.b314.compiler.main;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
; A set of scenario to record in training mode.
; place focus on button to start record then press shortcut for given scenario
F11::Suspend, Toggle
jump(direction)
{
if (direction = "left")
{
Send, {Left Down}
@AdrienHorgnies
AdrienHorgnies / metadata.py
Created November 20, 2019 14:17
base to build an etl music tagger
#!/usr/bin/env python3
import argparse
import re
from pathlib import Path
from subprocess import run
DEFAULT_PATTERN = re.compile(r'^(?P<track>\d+)---(?P<title>.+) - (?P<album>.+)---(?P<video_id>.+)\.opus$')
def extract_meta_from_path(full_path, pattern):
tentative_match = pattern.match(full_path.name)