Skip to content

Instantly share code, notes, and snippets.

@u8sand
Created August 25, 2016 14:51
Show Gist options
  • Save u8sand/cc5b77944fb6394dc19a14918062552b to your computer and use it in GitHub Desktop.
Save u8sand/cc5b77944fb6394dc19a14918062552b to your computer and use it in GitHub Desktop.
Remote iPython Notebook Configuration + Script
#!/bin/bash
conf=config.py
cert=mycert.pem
port=9999
if [ ! -f $conf ]; then
if [ ! -f $cert ]; then
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout "$cert" -out "$cert"
fi
cat << EOF > $conf
c = get_config()
c.NotebookApp.open_browser = False
c.NotebookApp.ip = '*'
c.NotebookApp.port = $port
c.NotebookApp.certfile = u'$cert'
c.NotebookApp.password = u'$(python -c 'from IPython.lib import passwd; print(passwd())')'
EOF
fi
jupyter-notebook --config="$conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment