<commit_before>#!/bin/sh

docker run \
  --rm \
  -p 8888:8888 \
  -v $PWD:/usr/src \
  insighttoolkit/simpleitk-notebooks<commit_msg>Update to improved run script from MICCAI tutorial<commit_after>#!/bin/sh

which docker &> /dev/null
if [ $? -ne 0 ]; then
	echo "Error: the 'docker' command was not found.  Please install docker."
	exit 1
fi

_OS=$(uname)
if [ "${_OS}" != "Linux" ]; then
	_VM=$(docker-machine active 2> /dev/null || echo "default")
	if ! docker-machine inspect "${_VM}" &> /dev/null; then
		echo "Creating machine ${_VM}..."
		docker-machine -D create -d virtualbox --virtualbox-memory 2048 ${_VM}
	fi
	docker-machine start ${_VM} > /dev/null
    eval $(docker-machine env $_VM --shell=sh)
fi

_IP=$(docker-machine ip ${_VM} 2> /dev/null || echo "localhost" )
_URL="http://${_IP}:8888"

_RUNNING=$(docker ps -q --filter "name=simpleitk-notebooks")
if [ -n "$_RUNNING" ]; then
	docker stop simpleitk-notebooks
fi

echo ""
echo "Setting up the Docker Jupyter Notebook"
echo ""
echo "Point your web browser to ${_URL}"
echo ""
echo ""
echo "Enter Control-C to stop the server."

_REPO_DIR="$(cd "$(dirname "$0")" && pwd )"
_MOUNT_LOCAL=""
if [ "${_OS}" = "Linux" ] || [ "${_OS}" = "Darwin" ]; then
	_MOUNT_LOCAL=" -v ${_REPO_DIR}:/home/jovyan/notebooks/ "
fi
docker run \
  --rm \
  --name 2015-miccai \
  ${_MOUNT_LOCAL} \
  -p 8888:8888 \
  insighttoolkit/simpleitk-notebooks &> /dev/null

# vim: noexpandtab shiftwidth=4 tabstop=4 softtabstop=0
{'fraction_non_alphanumeric': 0.17840054682159945, 'fraction_numerical': 0.02460697197539303, 'mean_word_length': 3.707395498392283, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3963743', 'n_tokens_mistral': 606, 'n_tokens_neox': 559, 'n_words': 153}