Skip to content

Instantly share code, notes, and snippets.

View toloco's full-sized avatar
🎯
Focusing

Tolo Palmer toloco

🎯
Focusing
View GitHub Profile
@toloco
toloco / shello.sh
Created November 2, 2021 13:42
Load .env file in shellscript
function load_env(){
if [ -f $1 ]
then
export $(cat $1 | sed 's/#.*//g' | xargs)
else
echo "Can't find file"
fi
}
@toloco
toloco / list_files_small_to_big.sh
Last active December 27, 2021 15:37
List GIT files and sort by size
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
@toloco
toloco / gist:937481eb0fc1ecc0424339950fff55af
Created May 3, 2017 12:48
Fix docker for Max weird errors
* 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
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)
'''
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):