-
to rebind capslock into fn:
- fn + alt + k for 5 seconds
- press caps once, it should turn blue press esc
- done
- to use caps normally in that mode pres caps + tab
-
function lock (all keys working like holding fn):
- hold fn (also hold to exit)
-
record macro:
This file contains 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 | |
export SERVER1="192.168.0.201" | |
export SERVER2="192.168.0.202" | |
export SERVER3="192.168.0.203" | |
export SERVER4="192.168.0.204" | |
export HOST1="g3w.dell.baza" | |
export HOST2="g50.dell.baza" | |
export HOST3="h3m.dell.baza" |
This file contains 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/bash | |
# kubernetes delete objects | |
kubectl get crd -o=json | jq -r '.items[] | .metadata.name' | grep cert-manager.io | xargs kubectl delete crd | |
# helm get chart latest version | |
helm search repo jetstack/cert-manager --versions --output=json | jq -r '.[0].version' | |
# docker delete exited containers | |
docker ps -q -a --filter status=exited | xargs docker rm |
This file contains 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
$ curl https://github.com/web-flow.gpg | gpg --import | |
$ gpg --edit-key noreply@github.com | |
gpg> trust | |
gpg> save | |
$ gpg --lsign-key noreply@github.com | |
to delete | |
$ gpg --delete-key noreply@github.com |
This file contains 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 json | |
import os.path | |
import timeit | |
from collections import namedtuple | |
from PIL import Image | |
SizeUnit = namedtuple('SizeUnit', ['size', 'name']) | |
KB = SizeUnit(1024, 'KB') | |
MB = SizeUnit(1024*1024, 'MB') |
This file contains 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
getnode: | |
mkdir venvnode || true && wget -c https://nodejs.org/dist/v18.13.0/node-v18.13.0-linux-x64.tar.xz -O - | tar --strip-components=1 -xJ -C venvnode | |
This file contains 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 functools import wraps | |
import django.http | |
import django.views.static | |
def no_cache_static(f): | |
@wraps(f) | |
def static(*a, **kw): | |
response: django.http.response.HttpResponse = f(*a, **kw) # type: |
This file contains 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
class CascadeOnRelatedChangeForeignKey(models.ForeignKey): | |
""" | |
ForeignKey that deletes all instances of the "related_name" | |
whenever the related instance changes. | |
For example while using this field in a token model, if the user | |
changes, all the tokens will be deleted. | |
""" | |
def contribute_to_related_class(self, cls, related): |
This file contains 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.core.exceptions import ValidationError | |
from django.db import models | |
class ViolationFieldNameMixin: | |
""" | |
Mixin for BaseConstraint subclasses that builds custom | |
ValidationError message for the `violation_field_name`. | |
By this way we can bind the error to the field that caused it. | |
This is useful in ModelForms where we can display the error |
This file contains 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 .logging import GunicornLogger, gunicorn_logconfig_dict, gunicorn_access_log_format | |
wsgi_app = "conf.wsgi" | |
bind = "0.0.0.0:8000" | |
workers = 2 | |
proxy_protocol = True | |
proxy_allow_ips = "*" |