Skip to content

Instantly share code, notes, and snippets.

View aagnone3's full-sized avatar
😸
so make it

Anthony Agnone aagnone3

😸
so make it
View GitHub Profile
@aagnone3
aagnone3 / pr.md
Created June 26, 2018 19:28 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

# create and activate environment
virtualenv pandas_like_ml
source pandas_like_ml/bin/activate
# install your desired libraries
pip install --upgrade pip
pip install scikit-learn==0.21.1
pip install pandas==0.19.1
# the main event
# an example Dockerfile
# you can specify a base image as a foundation to build on
FROM ubuntu:16.04
# make a partition, and specify the working directory
VOLUME /opt
WORKDIR /opt
# install some base system packages
docker build \
-t my_first_container \
-f Dockerfile
docker run \
--mount type=bind,source="$(pwd)",target=/opt \
--mount type=bind,source=${CORPORA_DIR},target=/corpora \
-p ${JUPYTER_PORT}:${JUPYTER_PORT} \
-ti \
--rm \
my_advanced_container \
jupyter-lab \
--allow-root \
--ip=0.0.0.0 \
# the "graph.png" target specifies "graph.dot" as a dependency
# when "graph.png" is invoked, it invokes "graph.dot" only if necessary
graph.png: graph.dot
dot graph.dot -Tpng > graph.png
# the "graph.dot" target specifies "make_graph.py" as a dependency
# so, this command is only re-run when...
# 1) make_graph.py changes
# 2) graph.dot is not present
# base image
FROM tensorflow/magenta
# set partition and working directory
VOLUME /opt
WORKDIR /opt
# install base system packages
RUN apt-get update && apt-get install -y \
vim \
jupyterlab
seaborn
scikit-learn
matplotlib
pyaudio
# use the name of the current directory as the docker image tag
DOCKERFILE ?= Dockerfile
DOCKER_TAG ?= $(shell echo ${PWD} | rev | cut -d/ -f1 | rev)
DOCKER_IMAGE = ${DOCKER_USERNAME}/${DOCKER_REPO}:${DOCKER_TAG}
$(DOCKERFILE): requirements.txt
docker build \
-t ${DOCKER_IMAGE} \
-f ${DOCKERFILE} \
.