Skip to content

Instantly share code, notes, and snippets.

@RobinCPC
Last active September 3, 2021 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobinCPC/6a7e8417da865a956c28bd8e81305cd2 to your computer and use it in GitHub Desktop.
Save RobinCPC/6a7e8417da865a956c28bd8e81305cd2 to your computer and use it in GitHub Desktop.
Login local jupyter notebook through AWS EC2 instance by ssh reverse tunnel

Open Inbound port (such as 19999) for jupyter notebook

open ssh reverser tunnerl from local (8888 for jupyter port) to ec2 (19999)

sudo ssh -i "ebs-test.pem" -N -R 19999:localhost:8888 ubuntu@ec2-34-XXX-YYY-ZZZ.us-west-2.compute.amazonaws.com

Set up Jupyter notebook to remote login

(base) C:\workspace\NexMotion-Python_API>jupyter notebook --generate-config
# Writing default config to: C:\Users\RobinChen\.jupyter\jupyter_notebook_config.py

Then, open jupyter_notebook_config.py and uncomment following line and set to True c.NotebookApp.allow_remote_access = True

For now, it is find to remote login, but need token for login. It would be better to setup password.

Set up Jupyter notebook password

(base) C:\workspace\NexMotion-Python_API>jupyter notebook password
#Enter password:  ****
#Verify password: ****
[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json

ref:

https://jupyter-notebook.readthedocs.io/en/stable/public_server.html jupyterhub/jupyterhub#2230

issue

ipywidget not display correct when login from remote (** need disable cache**) jupyter-widgets/ipywidgets#1411 open chrome console (dev tool), let browser refresh (F5) get new copy from server (not use local cache) https://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#7000899

for iOS device (mobile) https://stackoverflow.com/questions/9218123/how-to-disable-cache-on-ios-safari

iOS

Open Settings Navigate to Safari > Advanced Enable Web Inspector Switch back to Safari and load a web page

Mac Desktop

Open Safari Navigate to Safari > Preferences > Advanced tab Enable the Develop menu In the Develop menu, select Your iOS Device Name > The Page You Want to Debug Press Command-Shift-R to reload while disabling cache Bonus: This is a full Web Inspector on your computer inspecting a page on your iOS device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment