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 / Dockerfile
Last active August 12, 2024 18:27
Reproduce vite error 'Uncaught SyntaxError: The requested module X does not provide an export named 'default' '
FROM node:22
WORKDIR /srv
COPY rep.sh .
RUN chmod +x rep.sh
RUN ./rep.sh
WORKDIR /srv/vite-bug
CMD [ "yarn", "dev", "--host", "0.0.0.0" ]
@superboum
superboum / Cargo.toml
Created April 28, 2024 07:32
Example of a custom Hickory Rust DNS server (custom Authority)
[package]
name = "dns"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1", features = ["full"] }
hickory-server = "0.24.1"
@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 November 2, 2024 14:58
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)"