This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
def progress(iterable, length=None, bar_length=40): | |
def format_time(seconds): | |
m, s = divmod(seconds, 60) | |
h, m = divmod(m, 60) | |
d, h = divmod(h, 24) | |
return f"{d}d {h}h {m}m {s:0.0f}s" if d else f"{h}h {m}m {s:0.0f}s" if h else f"{m}m {s:0.0f}s" if m else f"{s:0.0f}s" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Model | |
def __get_instances( | |
self, | |
instance: Model, | |
processed_instances: set[Model] = set(), | |
) -> set[Model]: | |
"""Get all instances from a model instance. | |
Recursively get all instances from a model instance, including related objects. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.2.1/deploy/static/provider/cloud/deploy.yaml | |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.2/cert-manager.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
COMMIT_MSG=$1 | |
COMMIT_MSG_TEMPLATE="type(context): message" | |
COMMIT_MSG_REGEX="^(build|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z\-_]+\))?: .+" | |
egrep "${COMMIT_MSG_REGEX}" $COMMIT_MSG | |
if [[ $? != 0 ]]; then | |
echo "The commit message format is not respected." | |
echo "[FORMAT] ${COMMIT_MSG_TEMPLATE}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Python: Django", | |
"type": "python", | |
"request": "launch", | |
"program": "${workspaceFolder}/src/manage.py", | |
"console": "integratedTerminal", | |
"args": [ |
By default on my computers the functions keys are not working.
Run this to install it :
wget https://gist.githubusercontent.com/Couapy/e5cdf2078f5978fd4ddde98d09f1ca24/raw/fea4085a070202a3221c66c1ef370528697fa1eb/keychron.service
sudo cp -r keychron.service /etc/systemd/system/
sudo systemctl enable keychron && sudo systemctl start keychron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install: | |
@pip3 install . | |
archive: | |
@python3 setup.py sdist | |
upload: archive | |
@python3 -m twine upload dist/* | |
clean: |