/usr/bin/dockerd -H tcp://127.0.0.1:2736 \
--tls --tlsverify \
--tlscacert /path/to/ca.pem \
--tlscert /path/to/server.pem \
--tlskey path/to/server_decrypted.key
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 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) |
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
# 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 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 |
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 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 $@ |
-
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 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) |