Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / how_to_reverseproxy_proxypass_nginx_letsencrypt.md
Last active July 17, 2024 04:53
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 July 10, 2024 18:08
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 / diff-so-fancy-install.sh
Last active July 7, 2024 15:15
ubuntu/debian diff-so-fancy install
LATEST_VERSION=$(curl -s https://api.github.com/repos/so-fancy/diff-so-fancy/releases/latest | grep -Po '"tag_name": "v\K[^"]*')
sudo curl -L -o /usr/local/bin/diff-so-fancy "https://github.com/so-fancy/diff-so-fancy/releases/download/v${LATEST_VERSION}/diff-so-fancy"
sudo chmod +x /usr/local/bin/diff-so-fancy
@gmolveau
gmolveau / docker_quick_run.sh
Last active June 14, 2024 20:34
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 / golang_offline.md
Last active May 29, 2024 19:23
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 / recutils_tutorial_example.md
Last active May 22, 2024 14:16
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 / exercice_numerotation_text.py
Last active May 8, 2024 10:32
exercice_numerotation_text.py
text_input = """a
b
c
d
e
f
"""
text_output = """1. a
1.1. b
@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 / 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"