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
# Build docker image to start a container using | |
docker build ./ -t <image-tag> | |
# Run/Start a docker container based on an image | |
docker run -p <port:port> <image-tag/image-id> <run with --rm to cleanup container after complete> | |
# Stop a container and its ongoing processes. Doesn't completely kill it. Still shows in docker ps -a. | |
docker stop | |
# Starts interactive shell of docker container (also starts a stopped/exited docker container) | |
docker exec -it <container-id> /bin/sh | |
# Kill a running docker container | |
docker kill <container-id> |
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
<?python | |
url = 'www.example_1.com' | |
device_type = 'mobile' | |
# Construct request url | |
contents = urllib.request.urlopen( | |
'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={}&strategy={}'\ | |
.format(url, device_type) | |
).read().decode('UTF-8') |
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
# Auto reload for helper functions file | |
%load_ext autoreload | |
%autoreload 2 | |
import sys | |
print(sys.version) | |
import datetime | |
print(datetime.datetime.now()) |