githubtocolab: Open GitHub Jupyter Notebooks in Colab!

by Seungjae Ryan Lee

How To Use

  1. Find the jupyter notebook in GitHub.

    1
    
     github.com/tensorflow/agents/blob/master/tf_agents/colabs/0_intro_rl.ipynb
    
  2. In the link, add tocolab after github.

    1
    
     githubtocolab.com/tensorflow/agents/blob/master/tf_agents/colabs/0_intro_rl.ipynb
    
  3. A Google Colab page with the jupyter notebook will open!

Behind the Scenes

Last week, I read this from the official Colab GitHub Demo:

I thought that it would be lot easier if the link was more memorizable, so I decided to create githubtocolab.com, a simple wepbage that redirects to Google Colab.

I have very little front-end knowledge, so I had to read a lot of tutorials to set it up correctly. Below, I briefly describe what I had to do to and what resources I used.

Purchase Domain and Server

To create a webpage, I needed a domain name and a place to host my website. I purchased the “githubtocolab.com” domain in Namecheap, which was $12 per year. For the place to host my website, I chose DigitalOcean since it had the most tutorials. I chose the smallest “droplet,” which cost $5 a month.

Total cost: $6 per month

DNS Setup: Connect Domain and Server

To Point Namecheap domain to DigitalOcean, I had to setup Nameservers and A Records:

The 142.93.177.234 IP is the DigitalOcean droplet IP.

Here are the three tutorials I read to setup DNS:

Nginx Setup: Setup Redirects

I set up the server to do two things:

  1. Redirect “githubtocolab.com” to this blog post.
  2. Redirect all other (non-root) urls to colaboratory.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
server {
    root /var/www/githubtocolab.com/html;
    index index.html index.htm index.nginx-debian.html;

    server_name githubtocolab.com www.githubtocolab.com;

    location = / {
        return 301 https://endtoend.ai/blog/githubtocolab/;
    }
    location / {
        return 301 https://colab.research.google.com/github/$request_uri;
    }

     # managed by Certbot
    listen [::]:443 ssl ipv6only=on;
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/githubtocolab.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/githubtocolab.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
    # managed by Certbot
    if ($host = www.githubtocolab.com) {
        return 301 https://$host$request_uri;
    }
    if ($host = githubtocolab.com) {
        return 301 https://$host$request_uri;
    }

    listen 80;
    listen [::]:80;

    server_name githubtocolab.com www.githubtocolab.com;
    # managed by Certbot
    return 404;
}

Here are the four tutorials I read to setup NGINX:

comments powered by Disqus