What is this…Where am I?
If you are here outside of TryHackMe, this is the supporting material for the Jupyter-101 room I have created. You can follow along and attempt the challenges yourself.
Jupyter (formerly IPython) is a fantastic web application where authors can write, share and execute code snippets - henceforth notebooks in an interactive, standardised format!
You can try Jupyter yourself outside of this room without installation (although it is strongly recommended) in-browser!
Installing can be a bit of a pain, but I’ve done the leg-work to make Jupyter as accessible (and cloud friendly) as I can
Any of the 40 code languages Jupyter supports can be interpreted within this “Notebook”. For this room, we will be using Python. Whilst I’ll try to explain most elements of the code, a crash-course in Python is a tad-bit out of scope for this. There is however, plenty of tutorials out there to get you started!
Moreover, Jupyter has the great facility of allowing additional data types to be executed and visualised in tandem; such as Markdown, images, videos, plots, etc…Making it a really attractive environment for the Data Analysis / Artificial Intelligence community.
Any of the 40 code languages, or visual data is stored into cells, just like this one! Essentially allowing an application to be built and executed in stages, as you will see throughout some of the examples I have made.
What will I (you) be doing?
- Navigating the Jupyter interface
- Basic Python arithmetic
- Small data handling tasks and visualising this!
If you’d like to know how Jupyter works or any of the libraries we’re using, there are a plethora out there - but here are a few.
Interacting with Jupyter
After successfully deploying and logging into the instance, you will be presented with the following:
This is root directory of where Jupyter was started (for this room, I have set it to launch in /home/thm/), as seen below.
Jupyter directly interacts with the Operating Systems filesystem (assuming the user it is running as has the necessary permissions!). This means you can create and upload files and traverse folders - as if you would on the host itself.
Similarly, anything you delete on the host - gets deleted on Jupyter…you get the picture…
Making a new Notebook
We are then taken to the new Notebook! Take some time to explore the options you can do here.
You can rename the Notebook in File -> Rename
Below the toolbar is your first cell, this is where you the magic happens!
A Lil’ Cheatsheet
- Create a new Cell by pressing the “+” button
- Delete the current Cell by pressing the “Scissor / Snip” icon
- You can copy and paste Cells by pressing the respective “Copy” and “Paste” buttons
- You have the “Run, Interrupt (think of this as halting) and restart kernel buttons”:
- “Restart Kernel with dialog” essentially restarts the program, forgetting any stored data such as variables *but retains the contents of cells and waits for you to execute cells as you wish.
- The next button does the same as above ^ but does runs the cells automatically