-
Remove stoppped containers
docker rm $(docker ps -a -q --filter status=exited)
-
Delete all 'untagged/dangling' () image
docker rmi $(docker images -q -f dangling=true)
-
Remove ALL unused images > docker rmi $(docker images --format={{.Repository}}:{{.Tag}})
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
ещё один вариант решения проблемы из | |
http://limansky.me/posts/2015-12-16-Batch-cherry-picking-in-git.html | |
# создаём новую ветку, которая будет содежать только один комми со всеми изменеиями в по фиче | |
$> git check -b feature_backport master | |
$> git merge --squash --no-commit feature | |
$> git commit -m "Backport mega-feature from master to old-crappy-release-0.0.1" | |
# переносим ветку с одним коммитом на новую базу с помощью rebase | |
$> git rebase --onto release feature_backport^ feature_backport |
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/bash -x | |
set -e | |
# https://www.digitalocean.com/community/tutorials/how-to-use-floating-ips-on-digitalocean | |
DESTINATION_IP=$1 | |
shift || (echo "E: Destination IP is not provided. Aborting"; exit 1) | |
ANCHOR_GW=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/gateway) |
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 | |
set -x | |
set -e | |
exec docker run --rm -ti \ | |
-v /etc/letsencrypt:/etc/letsencrypt \ | |
-v /var/www/acme:/var/www/acme \ | |
certbot/certbot $@ |
Use API of http://ipaddress.com
- curl http://api.ipaddress.com/myip?format=json
- echo $(curl http://api.ipaddress.com/myip?format=json 2>/dev/null)
- http http://api.ipaddress.com/myip format==json
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
''' | |
Run as | |
> python3 gil_vs_threads.py 2> /dev/null | |
''' | |
import threading | |
import sys | |
the_value = 0 |
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
# Example with https://github.com/eagafonov/json_schema_helpers | |
import json_schema_helpers as jsh | |
heading_loc_schema = { | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "heading_loc object", | |
"type": "object", | |
"additionalProperties": False, # properties must contains a complete list of supported languages | |
"properties": { |
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 functools import reduce, wraps | |
def dec1(func): | |
print("dec1: Decorating", func) | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print("dec1: Calling {}(args={},kwargs={})".format(func.__name__, args, kwargs)) | |
return func(*args, **kwargs) |