Skip to content

Instantly share code, notes, and snippets.

View BSoDium's full-sized avatar
🎯
Focusing

Elliot Négrel-Jerzy BSoDium

🎯
Focusing
View GitHub Profile
@BSoDium
BSoDium / bws-env.sh
Last active March 5, 2025 18:41
A script that creates a .env file containing all the secrets for the provided project name
#!/bin/bash
# Function to display help message
show_help() {
cat << EOF
Usage: ${0##*/} [-h] [PROJECT_NAME] [OUTPUT_PATH]
Retrieve secrets for a given project using 'bws' and write them to a .env file.
Arguments:
@BSoDium
BSoDium / useSearchParamState.ts
Created January 7, 2025 09:28
A convenient hook that allows using search parameters of the URL as if they were component states.
import levenshtein from "fast-levenshtein";
import { useCallback, useEffect, useState } from "react";
import { NavigateOptions, useSearchParams } from "react-router-dom";
export type SearchParamState<T> = [T, (value: T) => void];
/**
* Read the value of a search parameter, or return undefined if it does not exist.
* This wrapper is necessary because URLSearchParams.get() returns null if the
* search parameter does not exist.
@BSoDium
BSoDium / emoji-fix.sh
Created October 31, 2024 10:32
A simple command to fix emoji picker lag on MacOS
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
@BSoDium
BSoDium / extra.js
Last active November 26, 2024 18:54
A simple script to add the mkdocs material sponsors only system theme feature
/**
* Set the data-md-color-scheme property on the body element to "slate" or "default"
* depending on the browser's preferred color scheme.
*/
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", function (e) {
var colorScheme = "default";
if (e.matches) {
colorScheme = "slate";
@BSoDium
BSoDium / nextcloud.css
Last active February 4, 2024 20:12
Nextcloud GitHub custom CSS
.theme--dark {
--color-main-background: rgb(13, 17, 23);
--color-main-background-translucent: rgb(13, 17, 23);
--color-background-dark: rgb(13, 17, 23);
--color-background-hover: #21262c;
--color-primary-light: #21262c;
--color-border: #21262d;
--input-form-background: #010409;
--btn-primary: #238636;
--btn-primary-hover: #1b6e2b;
@BSoDium
BSoDium / CIWS.md
Last active April 4, 2022 22:08
CIWS Phallanx-like weapon software (besiege replica) created thanks to the LogicExtensions mod by Lambda & fanzhuyifan

CIWS controller software

Close-in weapon system "Sentinel"

Defined PIOs

PIO Value
00 5001
01 5000
02 6024
03 E
04 Alpha3
@BSoDium
BSoDium / acc-convert.sh
Last active September 19, 2021 21:45
A simple nextcloud flow script to convert ac3 audio codec to acc in .mkv files
# When [ File created ] and [ File name ] matches [ /[[:ascii:]]+\.mkv/i ] run following script (tested on nc 21.0.1)
ffmpeg -i /var/www/nextcloud/data/%n -vcodec copy -acodec aac -strict -2 -ab 320K /var/www/nextcloud/data/$(dirname %n)/$(basename %n .mkv)_temp.mkv;
rm /var/www/nextcloud/data/%n;
mv /var/www/nextcloud/data/$(dirname %n)/$(basename %n .mkv)_temp.mkv /var/www/nextcloud/data/%n;
/var/www/nextcloud/occ files:scan --path="$(dirname %n)";
chown www-data:www-data /var/www/nextcloud/data/%n;