Nexss Programmer The Programming Blog

Nexss Programmer Tutorials

List of Tutorials

How to use Nexss Programmer with Google Colab NoteBook

Go to the Colab and create new NoteBook.

Execute the commands:

!npm i -g @nexssp/cli # install Nexss Programmer
!nexss php run "print('x');"
!nexss py run "print('x')"
!nexss py run "import time; print(time.time())"
!nexss myprogram.py
!nexss myprogram.r


Upload file/your program to Google Colab

Upload custom files to the Colab.
To run your program, you need to upload files to your drive. You can do it in several ways.

1. Using Nexss Programmer Download Package

Create new Colab Notebook and run:

!npm i -g @nexssp/cli # install latest version of the Nexss Programmer

# to download program
!nexss Download https://raw.githubusercontent.com/nexssp/language_clojure/master/templates/helloWorld.clj --nxsField

# to display program just do:
!nexss https://raw.githubusercontent.com/nexssp/language_clojure/master/templates/helloWorld.clj --nxsField

#Note: --nxsField is the same as --nxsField=nxsOut
# which means display only value from field nxsOut.
# !nexss Download -> nxsOut will contain filepath for downloaded file
# !nexss [url] -> nxsOut will contain content of that file, in this case program.

2. From Colab using Python short script

Below code will show you the standard file input to select file and upload. The files will be stored in the uploadedFileNames variable. To see them use print(uploadedFileNames)

from google.colab import files
uploadedFileNames = files.upload()

3. From Colab using Google Drive

First go to the Google Drive and upload file there..

from google.colab import drive
drive.mount('/mygoogledrive') # you can use here any mounting point/name

Now you will see the message to authorize your google drive with the colab. Click on the link. After authorisation you will be able to copy the created token. Click the copy button and paste it to the earlier input box created in the Colab Notebook.

I have created folder ColabDrive in my google drive. (My drive is necessary. To see it run command: !ls /mygoogledrive)

# Run program in Google Colab from any programming language with Nexss Programmer
# You can also pass absolute path.
!nexss '/mygoogledrive/MyDrive/ColabDrive/helloWorld.cr'

We can mount google drive and use files from there for example: