Skip to content

Instantly share code, notes, and snippets.

View superboum's full-sized avatar
💮
Working for Deuxfleurs

Quentin Dufour superboum

💮
Working for Deuxfleurs
View GitHub Profile
@superboum
superboum / git_ci.sh
Created March 14, 2023 14:56
git get specific commit
mkdir mydest ; cd mydest
git init
git remote add origin https://git.deuxfleurs.fr/Deuxfleurs/garage.git
git fetch origin 703ac43f1c7c0538ac72a06afc16ad182c3aaba1
git checkout 703ac43f1c7c0538ac72a06afc16ad182c3aaba1 -b branch_name
qemu-system-x86_64 -enable-kvm \
    -m 4G -smp 4 \
    -device virtio-vga-gl,xres=1280,yres=720 \
    -serial mon:stdio \
    -display sdl,gl=on,show-cursor=on \
    -usb -device usb-mouse -device usb-kbd  -device usb-tablet \
    -net user,hostfwd=tcp::8022-:22 -net nic \
    -drive format=raw,file=chromiumos_qemu_image.bin
    
foc = 45 * pow(10, -3)
conf = 0.03 * pow(10, -3)
for ouv in [3.5, 4, 5.6, 8, 11, 16]:
hyper = (foc * foc) / (ouv * conf) + foc
ppn = (hyper * hyper) / (hyper + (hyper - foc))
print(f"{ouv} {round(hyper, 1)}m {round(ppn, 1)}m")
for ouv in [3.5, 4, 5.6, 8, 11, 16]:
hyper = (foc * foc) / (ouv * conf) + foc
for p in [1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 7, 10, 20]:
@superboum
superboum / droneci-secret-dump.go
Created February 25, 2022 08:35
Decode/Dump Drone CI secrets from database
package main
import (
"bufio"
"os"
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"errors"
"fmt"
@superboum
superboum / kdbx_xml_to_csv.py
Created January 13, 2022 15:06
Convert Keeweb XML output to KeepassXC CSV
import xmltodict,collections,csv
def group(v, out):
if 'Entry' in v:
item = v['Entry']
if isinstance(item, collections.OrderedDict):
entry(item, out)
elif isinstance(item, list):
for e in item:
entry(e, out)
@superboum
superboum / rust_magic.rs
Last active December 22, 2021 13:49
A cheatsheet on how we can use Rust some features
use std::collections::*;
trait ListAcc{
// This is an associated type, a specific type of Generics
// You can also search for "Rust Associated Items" to know more about this concept
// Similarly to generics, we can set some bounds (ie. traits) on this type
// Here we chose our own Wave Trait and the std Clone trait
type E: Wave + Clone;
// Note the return type "Self::E", this is how we use an associated type
@superboum
superboum / benchmark-base.md
Last active March 9, 2024 10:12
Benchmark your disk with FIO

Install FIO on Ubuntu/Debian:

sudo apt update
sudo apt install -y fio lshw

Install FIO on Fedora:

#!/bin/sh
#
# This is a simple kernel hook to populate the systemd-boot entries
# whenever kernel images are added or removed.
# Author: https://p5r.uk/blog/2020/using-systemd-boot-on-debian-bullseye.html
# The disk containing the root partition; also see `sudo blkid`
root_disk="UUID=$(findmnt / -o UUID -n)"
@superboum
superboum / LISEZ_MOI.md
Last active May 5, 2021 18:51
Générateur de site statique depuis PHP

Générateur de site statique depuis PHP

Comment faire :

  1. Mettez le fichier moulinette.php à la racine de votre projet web PHP à convertir (dans votre dossier WAMP)
  2. Renseignez toutes les pages à convertir dans la variable $mes_pages
  3. À chaque fois qu'il faut générer le site web, ouvrir dans votre navigateur le fichier moulinette.php (par exemple http://127.0.0.1/moulinette.php)
  4. Les pages HTML sont créées à côté des pages PHP

Fichiers à la fin

@superboum
superboum / \etc\init.d\wwan0_loop.sh
Last active March 3, 2021 15:33
OpenWRT custom scripts
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
STOP=01
start_service() {
procd_open_instance
procd_set_param command /usr/sbin/wwan0_loop.sh
procd_set_param stdout 1