Live coding discussion

Sorry had the wrong zoom link. Here is the right one

One thing neat to cover could be how to search for files in bash

(just needed that to get myself out of a pickle, somehow after restart on paperspace jupyter lab started to point at the /root directory and not /notebooks :man_shrugging:)

I also found these two graphics:


source

image
(source)

Sticking them into my notes to “remember” this once and for all :smile: (I have now quite a collection of notes on stuff I use every blue moon, but I always have to google for it, such as for instance how to create a new fstab entry, so much faster to just pull up my own notes)

Also, just wanted to add, this line
#!/usr/bin/env bash

goes by the name of shebang. Makes googling for that easier if you know the name :slight_smile:

9 Likes

If you’re comfortable with binary/octal, just imagining them as a bit pattern also helps but a set of 3 bit patterns of 3 bits each. 3 bits in octal go up to 7 (111 in binary)

2 Likes

Sorry for messing up the Zoom today! I’ve just added a new link for future lessons. It’s in the top post, and also I’ll paste it here:

Note that lessons are 11am Tues-Fri Brisbane time (Mon-Thurs US time).

2 Likes

For all the people in the US Eastern Time Zone, it is 9pm Eastern Standard Time.

1 Like

yup, that is the part I feel comfortable with :slight_smile: where I struggle is earlier, remembering the ordering of the groups and which number maps to which capability :slight_smile:

But maybe as I spent a bit more time on this now, I will remember this going forward :slight_smile:

(though realistically, still happy to have this in my notes, as the situations where I would amend file permissions are so few and far between…)

1 Like

ha! true, I do a bit of sys admin type of work for my day job, so I have to deal with it frequently. I agree, after dealing with it for a while, you start to internalize the order (left to right, user, group, world , 3 bits each lol ) and it becomes automatic. :smiley:

1 Like

The command for file search is unsurprisingly find to see how to use if type info find

examples

find . -name *.py -print
. = current directory can be some other directory / top entire systems or /some_dir or ../parent
-name = find keyword followed by name expression
*.py = filename expression must be placed in quotes mostly allowing for different flavours of bash
-print = prints to standard output the file path from . and filename

aside
/ is the root location of the file system

(fastai-cpu) Users-Mac-Pro:ThinkPython mac$ ls /
Applications			Volumes				home				sbin
Library				bin				installer.failurerequests	tmp
Network				cores				net				usr
System				dev				opt				var
Users				etc				private

to add to this you can do this

find some_directory -name file_expression -print | xargs grep "search_expression"

Users-Mac-Pro:course22 mac$ find clean -name "*.ipynb" -print | xargs grep -i "CELL"
clean/00-is-it-a-bird-creating-a-model-from-your-own-data.ipynb: "cells": [
clean/00-is-it-a-bird-creating-a-model-from-your-own-data.ipynb:   "cell_type": "markdown",
clean/00-is-it-a-bird-creating-a-model-from-your-own-data.ipynb:   "cell_type": "code",
clean/00-is-it-a-bird-creating-a-model-from-your-own-data.ipynb:    "#NB: Kaggle requires phone verification to use the internet or a GPU. If you haven't done that yet, the cell below will fail\n",

You could then redirect standard_output to a file by adding the following to the end of the line

> somefilename.txt
or
>> add_to_some_existing_file_at_end.txt

| is the pipe character it allows you to take the standard_output of one command and pipe it to the standard_input of another command.

some times it is easier to do this

man xargs | less that’s pipe the manual page for xargs to less

the difference between man pages and info is man is serial and info is hierarchical with keyboard short cuts to drill down and back within the structure. This is the google of the bash/terminal

man tips inside man
shift + g takes you to the end/bottom of the page
g takes you to the start/top
/ search_string search forward

2 Likes

Anyone knows where is the Youtube link for walk-thru 4? :thinking:

2 Likes

There was no YouTube live stream, so we have to wait Jeremy to upload the recording to YT.

2 Likes

Is there a way to post view the days zoom session Thanks

To change File permissions i need to look up online chmod calculator like this one for example https://chmodcommand.com/

1 Like

Isn’t there a course walk-thrus today as well?

1 Like

I created a new notebook in paperspace today. However, when I opened jupyterlab, the working folder was /root (used !pwd after opening notebook) instead of /notebooks. Has something changed? I can still see pre-run.sh in /storage and local/ in storage/cfg.

This was discussed in the walk-thru today :slight_smile: You need to open the pre-run.sh file and cd back to /notebooks at the end. It is all described at the beginning of today’s walk-thru if that can be of help :slight_smile:

2 Likes

Hi,

I’m sharing this Colab Notebook that does a simple text search over YouTube video transcriptions in a playlist.

Simple Text Search in Youtube’s Playlist Video Transcriptions [Selenium].ipynb

Example for the walk-thrus:

Playlist Link:
https://youtube.com/playlist?list=PLfYUBJiXbdtSLBPJ1GMx-sQWf6iNhb8mM

WordToSearch:
jupyter

Returns the video link and time location where the word is found.

You can also try it with the regular lessons:

Playlist Link:
https://www.youtube.com/playlist?list=PLalXj0-wtdCaQEm5F13yiiO9OIf_4lOEc

WordToSearch:
trees

Hope this is useful.

I would like to clean the interface by using a Gradio or Streamlit app. Let’s see if it works since the Selenium and chromium-chromedriver part could make it a little harder to setup, I think.

If someone makes this Notebook run in a local environment on WSL2, please share, I’m failing to do it!

Thanks

5 Likes

Thanks a lot! I watched and enjoyed the session!

1 Like

I’m not sure which walk-thru it was, but Jeremy was having trouble in WSL getting explorer.exe . working - and also code. It was because he was in as his additional user jph00 and not his default user for WSL. I’ve seen the same. I’m sure there is a way to get this working with any additional user too - but I did notice that no .vscode.server directory is present for my additional user. I suspect it may be something that gets set in default user’s $PATH - so I’ll take a look and report back.

Looking at where the default users get code, with “which code” showed me what needed adding to my PATH. I can see this is there for my default user with echo $PATH (along with a lot of other /mnt/c directories). Adding these to your path should get things working, although I did also notice that from explorer the default users files could be seen, but there were no permissions on the additional users files. I’ll try and solve this part too.

(base) brismith@EEYORE:/mnt/c$ which code
/mnt/c/Users/bsmi0/AppData/Local/Programs/Microsoft VS Code/bin/code

Yeah I got to a similar point in my explorations. The bit I found really weird though is that even when I exited from the sudo session in the other user, my default user’s explorer.exe didn’t work either any more!

1 Like