Skip to content

Instantly share code, notes, and snippets.

View Darkness4's full-sized avatar
🌃
It should be midnight all the time.

Marc Nguyen Darkness4

🌃
It should be midnight all the time.
View GitHub Profile
@Darkness4
Darkness4 / INSTALL.md
Last active December 14, 2024 01:00
Migrate raspi k3os to k3s

Install RaspiOS + k3s (sqlite)

This is assuming you did everything to move the PVC in a safe place, i.e., assuming everything is one an external storage like NFS.

Freeze and drain

Cordon and drain every nodes.

Remove Plans

@Darkness4
Darkness4 / build.sh
Created October 27, 2024 03:55
Alpine linux immutable OS build
#!/bin/sh
set -ex
rm -rf rootfs/
rm -rf squash-output/
rm -rf kernel-output/
mkdir -p rootfs/
mkdir -p squash-output/
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 6.5.5-gentoo Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Gentoo 12.3.1_p20230526 p2) 12.3.1 20230526"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=120301
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=24000
@Darkness4
Darkness4 / ipsec-vti.sh
Last active September 25, 2022 00:13
strongswan updown script for spawning VTI, with lock mechanism (a semaphore) for break-before-make strategy to avoid duplicates.
#!/bin/bash
set -o nounset
set -o errexit
IP=$(which ip)
PLUTO_MARK_OUT_ARR=(${PLUTO_MARK_OUT//// })
PLUTO_MARK_IN_ARR=(${PLUTO_MARK_IN//// })
VTI_TUNNEL_ID=${1}
@Darkness4
Darkness4 / distcc.sbatch
Created January 28, 2022 00:14
Trying to get distcc work with slurm
#!/bin/sh
#SBATCH -N 5
#SBATCH --cpu-per-task=32
#SBATCH --ntasks-per-node=1
ml gentoo
ml distcc
distccd --allow 10.10.2.0/24 --log-file /tmp/distccd.marc.log --user marc --verbose --no-detach --enable-tcp-insecure &
wget -qO- https://typora.io/linux/public-key.asc | sudo gpg --dearmor -o /usr/local/share/keyrings/typora-keyring.gpg
deb [signed-by=/usr/local/share/keyrings/typora-keyring.gpg] ....
@Darkness4
Darkness4 / denpendencyinjection.dart
Last active September 10, 2021 15:11
Manual Dependency Injection example
// -- Data layer
class Dio {
final String name;
const Dio(this.name);
}
// -- Domain/Business logic layer
class ServiceA {
final Dio dio;
@Darkness4
Darkness4 / iptables.v4
Last active April 6, 2021 23:46
StrongSwan + Scaleway Private Network + Bird BGP
# StrongSwan
# priv0 is private network
# Inspired by https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ikev2-vpn-server-with-strongswan-on-ubuntu-16-04
*mangle
:PREROUTING ACCEPT [1436:111226]
:INPUT ACCEPT [1101:80512]
:FORWARD ACCEPT [235:19214]
:OUTPUT ACCEPT [1198:137855]
:POSTROUTING ACCEPT [1667:173335]
@Darkness4
Darkness4 / create-tables.sql
Last active October 25, 2020 01:22
Database Design 25102020
-- Testé sur le docker-compose ci-dessous
CREATE TABLE Pays (
--ISO 3166-1 alpha-3
Code CHAR(3) NOT NULL PRIMARY KEY,
Name VARCHAR(255) NOT NULL
);
CREATE TABLE Ville (
ID SERIAL PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
@Darkness4
Darkness4 / flutter-install-snippets.sh
Created August 1, 2019 22:15
Snippets for individual installation
echo "NE PAS EXECUTER, FAIRE UNIQUEMENT PAR SELECTION"
exit 1
# Seulement pour Ubuntu/Debian-based
# Install Android SDK et FlutterSDK (avec PATH vers DartSDK)
sudo apt update
sudo apt install -y apt-transport-https wget curl git sed openjdk-11-jdk unzip lib32stdc++6
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
PATH=$PATH:/usr/lib/jvm/java-11-openjdk-amd64/bin