Skip to content

Commit

Permalink
Update colab_ssh_setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
treezy254 authored Jul 24, 2024
1 parent 1ae586f commit a2424ec
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions scripts/colab_ssh_setup.sh
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."

0 comments on commit a2424ec

Please sign in to comment.