Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / uuid_user.py
Last active April 8, 2024 17:02
sqlalchemy uuid for sqlite
########################
# UUID for SQLite hack #
########################
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
@gmolveau
gmolveau / golang_offline.md
Last active April 8, 2024 02:54
golang mod offline dependencies download

golang offline module dependencies download

Using go mod vendor

0 - With an existing module

  • copy go.mod and go.sum files from the offline PC to the internet PC

0bis - New module

@gmolveau
gmolveau / lsiown.sh
Created April 5, 2024 21:46
linuxserver.io lsiown script (extracted with `docker run --rm -it ghcr.io/linuxserver/baseimage-ubuntu:jammy cat /usr/bin/lsiown`)
#!/bin/bash
MAXDEPTH=("-maxdepth" "0")
OPTIONS=()
while getopts RcfvhHLP OPTION
do
if [[ "${OPTION}" != "?" && "${OPTION}" != "R" ]]; then
OPTIONS+=("-${OPTION}")
fi
if [[ "${OPTION}" = "R" ]]; then
@gmolveau
gmolveau / firefox_dark_background.md
Last active April 2, 2024 15:58
Firefox dark background / theme for new tab and loading screen

Firefox Dark Background

  • How to change the background on Firefox to a dark one on new tab / loading screen ?

Procedure

  • Type about:config in the URL bar
  • Search toolkit.legacyUserProfileCustomizations.stylesheets and double-click the field to set it to true
  • Type about:support in the URL bar
  • Look for Profile folder field and click on the open button next to it.
@gmolveau
gmolveau / how_to_reverseproxy_proxypass_nginx_letsencrypt.md
Last active April 2, 2024 06:30
How to use nginx as a reverse-proxy with letsencrypt

How to use nginx as a reverse-proxy with letsencrypt

Your infrastructure

generated via plantuml

Imgur

Requirements

@gmolveau
gmolveau / cv_resume_explaining_roles_experiences.md
Last active February 20, 2024 07:53
CV/Resume - explaining your tech experiences

Different kind of roles

  1. implementer

Details : you were told how to fix a problem, and you did as told

Moved deployment from manually-managed hosts to a new Kubernetes cluster.

  1. solver + implementer
@gmolveau
gmolveau / compose.yml
Last active February 7, 2024 12:32
docker compose traefik dns resolving inter containers
version: "3.3"
services:
traefik:
image: "traefik:v3.0"
container_name: "traefik"
command:
#- "--log.level=DEBUG"
- "--api.dashboard=true"
- "--ping=true"
@gmolveau
gmolveau / envsubst.sh
Last active February 5, 2024 17:12
envsubst alternative in pure bash - replace prefixed environment variables (eg. ${XX_MYVAR}) in a text file
#!/bin/bash
usage() {
echo "Usage: $0 [OPTIONS] [file_path]"
echo "OPTIONS:"
echo " -p, --prefix PREFIX Specify the prefix for environment variables"
echo " -h, --help Show this help message"
echo "If no file_path is provided, the script reads from stdin."
exit 1
}
@gmolveau
gmolveau / recutils_tutorial_example.md
Last active January 23, 2024 21:27
A quick tutorial / example / cheatsheet of recutils https://www.gnu.org/software/recutils

recutils tutorial example

https://www.gnu.org/software/recutils/

GNU Recutils is a set of tools and libraries to access human-editable, plain text databases called recfiles.

TO install on mac : brew install recutils

add this to a new file named books.rec

@gmolveau
gmolveau / os.sh
Last active January 19, 2024 09:49
Bash/shell script detect/check OS and distribution (+WSL Windows Subsystem for Linux)
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
local DISTRIB=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
if [[ ${DISTRIB} = "Ubuntu"* ]]; then
if uname -a | grep -q '^Linux.*Microsoft'; then
# ubuntu via WSL Windows Subsystem for Linux
else
# native ubuntu
fi
elif [[ ${DISTRIB} = "Debian"* ]]; then
# debian