Cheatsheet

Clean repository

Clean repository using Linux shell:

find . \( -name __pycache__ -o -name build -o -name "*.egg-info" -o -name "_version.py" \) -not -path "./.venv*/*" -exec rm -rf {} \;

Clean repository using Powershell:

Get-ChildItem -Include __pycache__,build,*.egg-info,_version.py -Recurse -force | Where-Object fullname -notlike "*\.venv*\*" | Remove-Item -Force -Recurse

Git usage

Verify remaining uncommitted files:

git ls-files -o -x /.venv*

Install from a Git branch or tag (using https or ssh):

pip install git+https://gitlab.com/ipamo/zut.git@main#egg=zut
pip install git+ssh://git@gitlab.com/ipamo/zut.git@main#egg=zut

Secrets

Generate a random alphanumeric string:

tr -dc A-Za-z0-9 </dev/urandom | head -c 16

Generate a Django secret key:

python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'

Encrypt (asymmetrically):

gpg --output myfile.ext.asc --armor --encrypt -r recipient@example.org myfile.ext

Encrypt (symmetrically):

gpg --output myfile.ext.asc --armor --encrypt myfile.ext

Decrypt (symmetrically):

gpg --output myfile.ext --decrypt myfile.ext.asc

Geospatial libraries

See instructions:

sudo apt-get install binutils libproj-dev gdal-bin

For GeoIP2:

sudo apt-get install libmaxminddb0

Django/gettext translations

Make translation messages:

python manage.py makemessages -l fr -l ru --ignore '.venv*' --ignore 'node_modules*' --ignore '0-*'

Compile translation messages:

python manage.py compilemessages --ignore '.venv*' --ignore 'node_modules*' --ignore '0-*'