Skip to content

Instantly share code, notes, and snippets.

View heather-ea's full-sized avatar

heather-ea

  • Ayima
View GitHub Profile
@heather-ea
heather-ea / docker_commands_cheatsheet.sh
Last active September 1, 2020 06:42
List of useful Docker commands to refer back to
# 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>
@heather-ea
heather-ea / wordpress_test
Created March 8, 2019 18:05
test for wordpress embedding
<?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')
@heather-ea
heather-ea / jupyter-notebook-setup
Created February 22, 2019 18:21
Typical jupyter notebook initial setup and imports (instead of looking into previous notebooks)
# Auto reload for helper functions file
%load_ext autoreload
%autoreload 2
import sys
print(sys.version)
import datetime
print(datetime.datetime.now())