Skip to content
This repository was archived by the owner on Sep 15, 2022. It is now read-only.

Commit 6391752

Browse files
committed
Specify ngrok authtoken as param
1 parent 9dff4b4 commit 6391752

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ remocolab.setupVNC()
3030
```
3131

3232
3. (Optional) If you want to run OpenGL applications or any programs that use GPU,
33-
Click "Runtime" -> "Change runtime type" in top menu and change Hardware accelerator to GPU.
33+
Click "Runtime" -> "Change runtime type" in top menu and change Hardware accelerator to GPU.
3434
4. Run that cell
3535
5. Then the message that ask you to copy & paste tunnel authtoken of ngrok will appear.
3636
Login to ngrok, click Auth on left side menu, click Copy, return to Google Colaboratory, paste it to the text box under the message and push enter key.
37+
- You can also specify ngrok token to ``remocolab.setupSSHD()`` or ``remocolab.setupVNC()`` in the code like ``remocolab.setupSSHD(ngrok_token = NGROK_TOKEN_VALUE)``.
3738
6. Select your ngrok region. Select the one closest to your location. For example, if you were in Japan, type jp and push enter key.
3839
- You can also specify ngrok region to ``remocolab.setupSSHD()`` or ``remocolab.setupVNC()`` in the code like ``remocolab.setupSSHD(ngrok_region = "jp")``.
3940
7. remocolab setup ngrok and SSH server. Please wait for it done (about 2 minutes)

remocolab.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ def _setupSSHDImpl(ngrok_token, ngrok_region):
119119
print(f"ssh {ssh_common_options} -L 5901:localhost:5901 -p {port} {user_name}@{hostname}")
120120
print("✂️"*24)
121121

122-
def setupSSHD(ngrok_region = None, check_gpu_available = False):
122+
def setupSSHD(ngrok_token = None, ngrok_region = None, check_gpu_available = False):
123123
if check_gpu_available and not _check_gpu_available():
124124
return False
125125

126126
print("---")
127127
print("Copy&paste your tunnel authtoken from https://dashboard.ngrok.com/auth")
128128
print("(You need to sign up for ngrok and login,)")
129129
#Set your ngrok Authtoken.
130-
ngrok_token = getpass.getpass()
130+
ngrok_token = ngrok_token or getpass.getpass()
131131

132132
if not ngrok_region:
133133
print("Select your ngrok region:")
@@ -266,6 +266,6 @@ def _setupVNC():
266266
universal_newlines = True)
267267
print(r.stdout)
268268

269-
def setupVNC(ngrok_region = None):
270-
if setupSSHD(ngrok_region, True):
269+
def setupVNC(ngrok_token = None, ngrok_region = None):
270+
if setupSSHD(ngrok_token, ngrok_region, True):
271271
_setupVNC()

0 commit comments

Comments
 (0)