-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,6 @@ | ||
#!/bin/bash | ||
# Install colab_ssh on google colab | ||
!pip install colab_ssh --upgrade | ||
|
||
# Prevent disconnection by periodically clicking the "connect" button | ||
echo "function ClickConnect(){ | ||
console.log('Working'); | ||
document.querySelector('colab-toolbar-button#connect').click() | ||
} | ||
setInterval(ClickConnect, 60000)" > keepalive.js | ||
from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared | ||
launch_ssh_cloudflared(password="root") | ||
|
||
# Install Node.js to run the keepalive script | ||
apt-get update | ||
apt-get install -y nodejs | ||
|
||
# Load the keepalive.js script in the background using Node.js | ||
nohup node keepalive.js & | ||
|
||
# Install required Python packages | ||
pip install colab_ssh --upgrade | ||
pip install fastprogress | ||
|
||
# Setup SSH using colab_ssh | ||
python - << 'END_PYTHON' | ||
from colab_ssh import launch_ssh | ||
launch_ssh('YOUR_NGROK_TOKEN', password='YOUR_CHOSEN_PASSWORD') | ||
END_PYTHON | ||
|
||
echo "SSH setup complete. Please check the output above for connection details." |