Last active
November 16, 2023 06:30
-
-
Save sachith-gunasekara/06ca96a0ff907415c3d94a09420c1e6c to your computer and use it in GitHub Desktop.
VS Code(code-server) setup script on Colab via an ngrok tunnel
This file contains hidden or 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
import fire | |
from pyngrok import ngrok | |
def set_ngrok_auth_token(ngrok_auth_token): | |
ngrok.set_auth_token(ngrok_auth_token) | |
if __name__ == "__main__": | |
fire.Fire(set_ngrok_auth_token) |
This file contains hidden or 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
#!/bin/bash | |
# Download and install code-server if not already downloaded | |
if [ ! -f install.sh ]; then | |
wget https://raw.githubusercontent.com/coder/code-server/main/install.sh | |
chmod +x install.sh | |
fi | |
./install.sh | |
# Install pyngrok | |
pip install pyngrok fire | |
# Download ngrok.py from this gist if not already downloaded | |
if [ ! -f ngrok.py ]; then | |
wget https://gist.githubusercontent.com/sachith-gunasekara/06ca96a0ff907415c3d94a09420c1e6c/raw/be236c014068a5cedcc3facda7b0f018c2682c16/ngrok.py | |
fi | |
# Set up ngrok with auth token | |
python ngrok.py --ngrok_auth_token $2 | |
# Tunnel given port to ngrok server | |
ngrok http $1 & /usr/bin/code-server --port $1 & sleep 5s && cat /root/.config/code-server/config.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment