Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / singlefile_config.json
Created November 30, 2024 08:40
Singlefile personal config (remove characters, FS friendly)
{
"profiles": {
"__Default_Settings__": {
"removeHiddenElements": true,
"removeUnusedStyles": true,
"removeUnusedFonts": true,
"removeFrames": false,
"blockScripts": true,
"blockVideos": true,
"blockAudios": true,
@gmolveau
gmolveau / python_312_pip.md
Created September 23, 2024 13:40
python3.12 ModuleNotFoundError: No module named 'distutils'

If you have this error using python3.12

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
@gmolveau
gmolveau / set-thunar.sh
Created September 18, 2024 06:56
Set thunar as default file-manager on ubuntu
sudo apt-get install -y --no-recommends thunar
xdg-mime default thunar.desktop inode/directory application/x-gnome-saved-search
@gmolveau
gmolveau / pip_upgrade_all_dependencies.sh
Created September 3, 2024 08:48
bash script to upgrade all outdated dependencies with python/pip
pip list --disable-pip-version-check --outdated --format=columns | tail -n +3 | awk '{print $1}' | xargs -n1 pip install -U || true
# explanations :
# pip list --disable-pip-version-check --outdated --format=columns : print as a column format only the outdated dependencies, and suppress the warning if pip is outdated as it messes up the output
# tail -n +3 : keep only the lines after the first two
# awk '{print $1}' : keep only the first column
# xargs -n1 pip install -U || true : install each dependency, never fails via the || true (to use in a CI or script env)
@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 / 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 / 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"
@gmolveau
gmolveau / envsubst.sh
Last active November 15, 2024 06:59
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
}