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
''' | |
Borg kind of singleton | |
Supraclass for add monostate (all objects share state) properties a class | |
''' | |
class BorgObj(object): | |
_shared_state = {} | |
def __new__(cls, *a, **k): |
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
def results(a_list, columns): | |
for row in a_list: | |
yield {k: v for k, v in izip(row, columns)} | |
my_generator = results(result, columns) |
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
* Screen into the Docker VM | |
$ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
$ umount /var/lib/docker/overlay2 | |
* Remove /var/lib/docker | |
$ rm -rf /var/lib/docker | |
* Restart Docker via the widget |
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
git rev-list --objects --all \ | |
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | |
| sed -n 's/^blob //p' \ | |
| sort --numeric-sort --key=2 \ | |
| cut -c 1-12,41- \ | |
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest |
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
function load_env(){ | |
if [ -f $1 ] | |
then | |
export $(cat $1 | sed 's/#.*//g' | xargs) | |
else | |
echo "Can't find file" | |
fi | |
} |
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
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short | |
type = cat-file -t | |
dump = cat-file -p | |
publish = "!git push --set-upstream origin \"$(git rev-parse --abbrev-ref HEAD)\"" | |
refresh = "!git pull origin \"$(git rev-parse --abbrev-ref HEAD)\"" |
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
#!/usr/bin/env python3 | |
import csv | |
import argparse | |
TRANSLATION = { | |
"First Name": "First Name", | |
"Last Name": "Last Name", | |
"Company": "Current Company", |
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
clean: ## Remove all pyc and caches | |
@find . -name '*.py[co]' -exec rm -f {} + | |
@find . -name '\.pytest_cache' -exec rm -fr {} + | |
@find . -name '\.mypy_cache' -exec rm -fr {} + | |
@find . -name '__pycache__' -exec rm -fr {} + | |
@docker ps -aq | xargs -r docker rm -f | |
@docker volume ls -q | xargs -r docker volume rm -f | |
@docker images | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi -f | |
@docker builder prune -f |
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 argparse | |
def parse_args(): | |
log_levels = { | |
"info": logging.INFO, | |
"debug": logging.DEBUG, | |
"warning": logging.WARNING, | |
} | |
parser = argparse.ArgumentParser() |
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
local v1 = import "v1.libsonnet"; | |
local env = import "env.libsonnet"; | |
local params = v1.params; | |
local sentry_params = v1.valuesForEnv( | |
"prod", {creds: "874c6f6d8b51422b9bfc2f6524a7b5b0", uri: "/11"}) | |
.defaults({creds: "f980cfda63194d869e7ca5e0c9bb48cb", uri: "/14"} | |
); | |
local processes = v1.valuesForEnv("prod", "8").defaults("2"); |
OlderNewer