Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active July 2, 2020 18:25
Show Gist options
  • Select an option

  • Save kozo2/fd667b897184c5591d9732f9d029265c to your computer and use it in GitHub Desktop.

Select an option

Save kozo2/fd667b897184c5591d9732f9d029265c to your computer and use it in GitHub Desktop.

Install software in Google Colab

!apt install xfce4 xfce4-goodies vnc4server htop
!pip install pyngrok
!pip install git+https://github.com/bdemchak/py4cytoscape
!wget https://github.com/cytoscape/cytoscape/releases/download/3.8.0/cytoscape-unix-3.8.0.tar.gz
!tar xf cytoscape-unix-3.8.0.tar.gz

# configure VNC and xfce4
!mkdir ~/.vnc
!printf "#!/bin/bash\nstartxfce4 &" > ~/.vnc/xstartup
!chmod +x ~/.vnc/xstartup

Set vnc password

!vncpasswd

Set ngrok auth token

import getpass
NGROK_AUTHTOKEN = getpass.getpass(prompt='Paste ngrok authtoken')

Start VNC service and forwart it from Colab to your PC

GEOMETRY = "1920x1080"
VNC_PORT = "5901"
get_ipython().system_raw('vnc4server -geometry ' + GEOMETRY + ' -httpport ' + VNC_PORT + ' &')

from pyngrok import ngrok
ngrok.set_auth_token(NGROK_AUTHTOKEN)
ngrok.kill()
vnc_url = ngrok.connect(VNC_PORT, "tcp")
print("Open " + vnc_url.replace("tcp://", "") + " with the VNC viewer in your local PC")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment