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 May 6, 2024 17:55
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 / flask_gunicorn_download_fails_30s.md
Created May 3, 2024 08:24
flask/gunicorn/apache2 download/upload fails/closes/stops after 30 seconds

flask/gunicorn/apache2 download/upload fails/closes/stops after 30 seconds

Keywords : flask, gunicorn, apache2, send_file, werkzeug, requests, httpx, curl

Errors encountered

  • curl: (18) transfer closed with 9895632 bytes remaining to read
  • urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(206700544 bytes read, 789007589 more expected)', IncompleteRead(206700544 bytes read, 789007589 more expected))
  • httpcore.RemoteProtocolError: peer closed connection without sending complete message body (received 290521088 bytes, expected 995708133)
@gmolveau
gmolveau / how_to_reverseproxy_proxypass_nginx_letsencrypt.md
Last active May 2, 2024 19:19
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 / firefox_dark_background.md
Last active April 30, 2024 21:38
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 / configure_firefox.sh
Last active April 30, 2024 12:58
Configure firefox profile with bash cli
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# set -o xtrace
if [ -d "${HOME}/.mozilla/firefox" ]; then
FIREFOX_PROFILES="${HOME}/.mozilla/firefox"
elif [ -d "${HOME}/snap/firefox/common/.mozilla/firefox" ]; then
FIREFOX_PROFILES="${HOME}/snap/firefox/common/.mozilla/firefox"
@gmolveau
gmolveau / golang_offline.md
Last active April 24, 2024 09:29
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 / docker_quick_run.sh
Last active April 14, 2024 06:56
Quickly run a temporary docker container and execute bash to try things (like a CI script)
docker run --rm -it -v $PWD:/tmp debian:10-slim /bin/bash
# --rm : remove after exit
# -it : interactive TTY
# -v : mount folder : current folder to /tmp folder of the container
# debian:10-slim : docker image https://git.io/JJzfy
# /bin/bash : run bash in this container
@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 / 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"