Tables | Are | Cool |
---|---|---|
col 1 is | left-aligned | $1600 |
col 2 is | centered | $12 |
col 3 is | right-aligned | $1 |
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
docker service inspect \ | |
-f='{{range $ports := .Endpoint.Ports}}Service ID: {{$.ID}}, Image: {{$.Spec.TaskTemplate.ContainerSpec.Image}}Ports: {{json $ports}}{{end}}' \ | |
$(docker service ls -q) | |
# Less Verbose | |
docker service inspect -f='{{range $ports := .Endpoint.Ports}}{{json $ports}}{{end}}' $(docker service ls -q) |
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 geojson | |
from shapely.geometry import shape | |
o = { | |
"coordinates": [[[23.314208, 37.768469], [24.039306, 37.768469], [24.039306, 38.214372], [23.314208, 38.214372], [23.314208, 37.768469]]], | |
"type": "Polygon" | |
} | |
s = json.dumps(o) |
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 tarfile | |
import time | |
import json | |
from io import BytesIO | |
import docker | |
src_code = """ | |
if __name__ == "__main__": | |
print('Hello World, From Alpine!!!!!!!!!') | |
""" |
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
# Inspect the modules in the package and loop through them. | |
members = inspect.getmembers(sys.modules[package_name], inspect.ismodule) | |
for name, data in members: | |
if name == 'models.py': | |
data.MyClass.run_function() |
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
Telnet to your server: | |
telnet 127.0.0.1 11211 | |
List the items, to get the slab ids: | |
stats items | |
STAT items:3:number 1 | |
STAT items:3:age 498 | |
STAT items:22:number 1 |
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
docker run --rm -it -v "$GOPATH":/gopath -v "$(pwd)":/app -e "GOPATH=/gopath" -w /app golang:1.4.2 sh -c 'CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o hello' |
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
# Assuming Python 3 is installed | |
mkvirtualenv --python=python3_path myenv | |
# Typical paths: /usr/local/bin/python3 or python |
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
pip install --editable . | |
same as | |
python setup.py develop |
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
req_exclusions = ['setuptools', 'pytest'] | |
def get_requirements(): | |
reqs = [] | |
with open('requirements.txt', 'r') as f: | |
for line in f: | |
add = True | |
for req in req_exclusions: | |
if req in line: |
NewerOlder