Colab’s tricks
Save code
- Save cell’s code
 Note that%%writefile name.py import torch a=torch.tensor([1,2,3,4]) print(a)%%writefile code.pyshould be put at the beginning of the cell
Open a Github notebook using Colab
Change the domain from 'github.com' to 'githubtocolab.com'. The notebook will open in Colab. See other tricks.Convert ipynb notebook
- 
to pdf - Go to Colab
- Upload your IPython notebook to Colab
- run these following commands#intall nbconvert for Linux system !sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-generic-recommended #convert command !jupyter nbconvert --to pdf ttl.ipynb
- A pdf file will appear next to the your notebook, just download it.
 
- 
to interactive html 
 (the original technique is here, as an example visit this post)- Go to Colab
- Upload your notebook to Colab
- run these following commands#intall nbinteract !pip install nbinteract #convert command !nbinteract {notebook_filename}.ipynb -s {GitHub_UserName}/{Gist_ID}
- An html file will appear next to the your notebook, just download it and make necessary modification if needed.