Computers and Terminals

A brief overview of Terminal and Linux is a step on your way to becoming a Linux expert. When a computer boots up, a kernel (MacOS, Windows, Linux) is started. This kernel is the core of the operating system and manages hardware resources. Above the kernel, various applications run, including the shell and terminal, which allow users to interact with the system using a basic set of commands provided by the kernel.

Typically, casual users interact with the system through a Desktop User Interface (UI) that is started by the computer’s boot-up processes. However, to interact directly with the shell, users can run a “terminal” application through the Desktop UI. Additionally, VS Code provides the ability to activate a “terminal” within its editing environment, making it convenient for developers to execute commands without leaving the code editor.

In this next phase, we will use a Jupyter notebook to perform Linux commands through a terminal. The Jupyter notebook is an application that runs above the kernel, providing an interactive environment for writing and executing code, including shell commands. This setup allows us to seamlessly integrate code execution, data analysis, and documentation in one place, enhancing our productivity and learning experience.

Setup a Personal GitHub Pages Project

You will be making a personal copy of the course repository. Be sure to have a GitHub account!!!

  • Use the Green “Use this Template” button on the portfolio_2025 repository page to set up your personal GitHub Pages repository.
  • Create a new repository.
  • Fill in the dialog and select the Repository Name to be under your GitHub ID ownership.

    create repo

  • After this is complete, use the Green “Code” button on the newly created repository page to capture your “Project Repo” name.

In the next few code cells, we will run a bash (shell) script to pull a GitHub project.

Shell Script and Variables

We will ultimately run a bash (shell) script to pull a GitHub project. This next script simply sets up the necessary environment variables to tell the script the location of repository from GitHub and where to copy the output.

For now, focus on each line that begins with export. These are shell variables. Each line has a name (after the keyword export) and a value (after the equal sign).

Here is a full description:

  • Creates a temporary file /tmp/variables.sh to store environment variables.
  • Sets the project_dir variable to your home directory with a subdirectory named nighthawk. You can change nighthawk to a different name to test your git clone.
  • Sets the project variable to a subdirectory within project_dir named portfolio_2025. You can change portfolio_2025 to the name of your project.
  • Sets the project_repo variable to the URL of the GitHub repository. Change this to the project you created from the portfolio_2025 template.

By running this script, you will prepare your environment for cloning and working on your GitHub project. This is an essential step in setting up your development environment and ensuring that all dependencies are correctly configured.

%%script bash

# Dependency Variables, set to match your project directories

cat <<EOF > /tmp/variables.sh
export project_dir=$HOME/nighthawk  # change nighthawk to different name to test your git clone
export project=\$project_dir/neil_2025  # change student_2025 to name of project from git clone
export project_repo="https://github.com/neil9674/neil_2025.git"  # change to project you created from portfolio_2025 template 
EOF

Describing the Outputs of the Variables

The next script will extract the saved variables and display their values. Here is a description of the commands:

  • The source command loads the variables that we saved in the /tmp/variables.sh file in the previous code cell.
  • The echo commands display the contents of the named variables:
    • project_dir: The directory where your project is located.
    • project: The specific project directory within project_dir.
    • project_repo: The URL of the GitHub repository.

By running this script, you can verify that the environment variables are correctly set in your development environment. If they don’t match up, go back to the previous code cell and make the necessary corrections.

%%script bash

# Extract saved variables
source /tmp/variables.sh

# Output shown title and value variables
echo "Project dir: $project_dir"
echo "Project: $project"
echo "Repo: $project_repo"
Project dir: /Users/neilchandra/nighthawk
Project: /Users/neilchandra/nighthawk/neil_2025
Repo: https://github.com/neil9674/neil_2025.git

Project Setup and Analysis with Bash Scripts

The bash scripts that follow automate what was done in the Tools Installation procedures with regards to cloning a GitHub project. Doing this in a script fashion adds the following benefits:

  • After completing these steps, we will have notes on how to set up and verify a project.
  • By reviewing these commands, you will start to learn the basics of Linux.
  • By setting up these code cells, you will be learning how to develop automated scripts using Shell programming.
  • You will learn that pretty much anything we type on a computer can be automated through the use of variables and a coding language.

Pull Code

Pull code from GitHub to your machine. This is a bash script, a sequence of commands, that will create a project directory and add the “project” from GitHub to the vscode directory. There is conditional logic to make sure that the clone only happens if it does not (!) exist. Here are some key elements in this code:

  • cd command (change directory), remember this from the terminal session.
  • if statements (conditional statements, called selection statements by College Board), code inside only happens if the condition is met.

Run the script two times and you will see that the output changes. In the second run, the files exist and it impact the flow of the code.

%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Using conditional statement to create a project directory and project"

cd ~    # start in home directory

# Conditional block to make a project directory
if [ ! -d $project_dir ]
then 
    echo "Directory $project_dir does not exist... making directory $project_dir"
    mkdir -p $project_dir
fi
echo "Directory $project_dir exists." 

# Conditional block to git clone a project from project_repo
if [ ! -d $project ]
then
    echo "Directory $project does not exist... cloning $project_repo"
    cd $project_dir
    git clone $project_repo
    cd ~
fi
echo "Directory $project exists."
Using conditional statement to create a project directory and project
Directory /Users/neilchandra/nighthawk exists.
Directory /Users/neilchandra/nighthawk/neil_2025 exists.

Look at Files in GitHub Project

All computers contain files and directories. The clone brought more files from the cloud to your machine. Review the bash shell script, observe the commands that show and interact with files and directories. These were used during setup.

  • ls lists computer files in Unix and Unix-like operating systems.
  • cd offers a way to navigate and change the working directory.
  • pwd prints the working directory.
  • echo is used to display a line of text/string that is passed as an argument.
%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Navigate to project, then navigate to area wwhere files were cloned"
cd $project
pwd

echo ""
echo "list top level or root of files with project pulled from github"
ls

Navigate to project, then navigate to area wwhere files were cloned
/Users/neilchandra/nighthawk/neil_2025

list top level or root of files with project pulled from github
404.html
Gemfile
Gemfile.lock
LICENSE
Makefile
README.md
README4YML.md
_config.yml
_data
_includes
_layouts
_notebooks
_posts
_sass
_site
assets
images
index.md
navigation
requirements.txt
scripts
venv

Look at File List with Hidden and Long Attributes

Most Linux commands have options to enhance behavior. The enhanced listing below shows permission bits, owner of the file, size, and date.

Some useful ls flags:

  • -a: List all files including hidden files.
  • -l: List in long format.
  • -h: Human-readable file sizes.
  • -t: Sort by modification time.
  • -R: Reverse the order of the sort.

ls reference

%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Navigate to project, then navigate to area wwhere files were cloned"
cd $project
pwd

echo ""
echo "list all files in long format"
ls -al   # all files -a (hidden) in -l long listing
Navigate to project, then navigate to area wwhere files were cloned
/Users/neilchandra/nighthawk/neil_2025

list all files in long format
total 176
drwxr-xr-x  29 neilchandra  staff    928 Sep 16 09:57 .
drwxr-xr-x   6 neilchandra  staff    192 Aug 30 10:10 ..
-rw-r--r--@  1 neilchandra  staff  10244 Sep 10 10:39 .DS_Store
drwxr-xr-x  15 neilchandra  staff    480 Sep 19 22:38 .git
drwxr-xr-x   3 neilchandra  staff     96 Aug 27 10:13 .github
-rw-r--r--   1 neilchandra  staff    251 Aug 27 10:13 .gitignore
drwxr-xr-x   3 neilchandra  staff     96 Aug 27 10:13 .vscode
-rw-r--r--   1 neilchandra  staff    436 Aug 27 10:13 404.html
-rw-r--r--   1 neilchandra  staff    122 Aug 27 10:13 Gemfile
-rw-r--r--   1 neilchandra  staff   8446 Aug 28 10:53 Gemfile.lock
-rw-r--r--@  1 neilchandra  staff  11357 Aug 27 10:13 LICENSE
-rw-r--r--   1 neilchandra  staff   3549 Aug 27 10:13 Makefile
-rw-r--r--   1 neilchandra  staff  14171 Aug 27 10:13 README.md
-rw-r--r--   1 neilchandra  staff     79 Aug 27 10:13 README4YML.md
-rw-r--r--   1 neilchandra  staff    835 Sep 19 22:44 _config.yml
drwxr-xr-x   7 neilchandra  staff    224 Aug 27 10:03 _data
drwxr-xr-x  19 neilchandra  staff    608 Aug 27 10:13 _includes
drwxr-xr-x   8 neilchandra  staff    256 Aug 27 10:13 _layouts
drwxr-xr-x   4 neilchandra  staff    128 Sep 10 10:08 _notebooks
drwxr-xr-x   4 neilchandra  staff    128 Sep 10 10:09 _posts
drwxr-xr-x   7 neilchandra  staff    224 Aug 27 10:03 _sass
drwxr-xr-x  30 neilchandra  staff    960 Sep 19 22:44 _site
drwxr-xr-x   7 neilchandra  staff    224 Aug 30 10:54 assets
drwxr-xr-x  27 neilchandra  staff    864 Sep 10 10:39 images
-rw-r--r--   1 neilchandra  staff   5866 Sep 17 10:48 index.md
drwxr-xr-x  13 neilchandra  staff    416 Sep 12 10:00 navigation
-rw-r--r--@  1 neilchandra  staff     57 Aug 27 10:13 requirements.txt
drwxr-xr-x   9 neilchandra  staff    288 Aug 27 10:16 scripts
drwxr-xr-x   8 neilchandra  staff    256 Aug 27 10:15 venv
%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Look for posts"
export posts=$project/_posts  # _posts inside project
cd $posts  # this should exist per fastpages
pwd  # present working directory
ls -lR  # list posts recursively
Look for posts
/Users/neilchandra/nighthawk/neil_2025/_posts
total 0
drwxr-xr-x  9 neilchandra  staff  288 Sep 19 22:42 Foundation

./Foundation:
total 56
-rw-r--r--  1 neilchandra  staff   2683 Aug 27 10:16 2024-08-21-sprint1_plan_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff   1482 Sep  8 20:30 2024-09-08-Jupyter-Notebook-Hack_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  17688 Sep 19 22:42 2024-09-08-Tools_Equipment_Play-Hack_IPYNB_2_.md
drwxr-xr-x  9 neilchandra  staff    288 Sep 19 22:48 A-pair_programming
drwxr-xr-x  8 neilchandra  staff    256 Aug 27 10:16 B-tools_and_equipment
drwxr-xr-x  4 neilchandra  staff    128 Sep 19 22:42 Sprint1

./Foundation/A-pair_programming:
total 72
-rw-r--r--  1 neilchandra  staff   5433 Sep 10 10:55 2023-08-16-pair_programming.md
-rw-r--r--  1 neilchandra  staff   3242 Aug 27 10:16 2023-08-16-pair_showcase_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  10043 Aug 27 10:16 2023-08-17-pair_habits_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff   2031 Sep 19 09:49 2024-09-08-Cookie_Clicker-(PairProject).md
-rw-r--r--  1 neilchandra  staff    645 Sep  9 07:45 2024-09-08-Frontend_Hacks.md
-rw-r--r--  1 neilchandra  staff   2578 Sep 19 22:59 2024-09-19-github_pages_hacks_javascript.ipynb

./Foundation/B-tools_and_equipment:
total 264
-rw-r--r--  1 neilchandra  staff   8196 Aug 27 10:16 2023-08-19-devops_accounts_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff   4949 Aug 27 10:16 2023-08-21-devops_tools-home_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  17367 Aug 27 10:16 2023-08-21-devops_tools-setup_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  56633 Sep  3 10:29 2023-08-22-devops_tools-verify_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  25972 Sep  8 19:42 2023-08-23-devops-githhub_pages-play_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff   7506 Aug 27 10:16 2023-08-23-devops-hacks_IPYNB_2_.md

./Foundation/Sprint1:
total 72
-rw-r--r--  1 neilchandra  staff  20056 Sep 19 22:42 2024-09-15-javascript_output_objects_IPYNB_2_.md
-rw-r--r--  1 neilchandra  staff  13631 Sep 19 22:42 2024-09-15-jupyter-notebook-python_IPYNB_2_.md
%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Look for notebooks"
export notebooks=$project/_notebooks  # _notebooks is inside project
cd $notebooks   # this should exist per fastpages
pwd  # present working directory
ls -lR  # list notebooks recursively
Look for notebooks
/Users/neilchandra/nighthawk/neil_2025/_notebooks


total 0
drwxr-xr-x  9 neilchandra  staff  288 Sep 16 09:57 Foundation

./Foundation:
total 64
-rw-r--r--  1 neilchandra  staff   3509 Aug 27 10:13 2024-08-21-sprint1_plan.ipynb
-rw-r--r--  1 neilchandra  staff   1091 Sep  8 20:24 2024-09-08-Jupyter-Notebook-Hack.ipynb
-rw-r--r--  1 neilchandra  staff  22986 Sep 19 22:38 2024-09-08-Tools_Equipment_Play-Hack.ipynb
drwxr-xr-x  4 neilchandra  staff    128 Aug 27 10:13 A-pair_programming
drwxr-xr-x  8 neilchandra  staff    256 Sep  8 20:07 B-tools_and_equipment
drwxr-xr-x  4 neilchandra  staff    128 Sep 17 09:57 Sprint1

./Foundation/A-pair_programming:
total 32
-rw-r--r--  1 neilchandra  staff   3918 Aug 27 10:13 2023-08-16-pair_showcase.ipynb
-rw-r--r--  1 neilchandra  staff  11624 Aug 27 10:13 2023-08-17-pair_habits.ipynb

./Foundation/B-tools_and_equipment:
total 320
-rw-r--r--  1 neilchandra  staff   9767 Aug 27 10:13 2023-08-19-devops_accounts.ipynb
-rw-r--r--  1 neilchandra  staff   5931 Aug 27 10:13 2023-08-21-devops_tools-home.ipynb
-rw-r--r--  1 neilchandra  staff  22859 Aug 27 10:13 2023-08-21-devops_tools-setup.ipynb
-rw-r--r--  1 neilchandra  staff  70755 Sep  3 10:26 2023-08-22-devops_tools-verify.ipynb
-rw-r--r--  1 neilchandra  staff  32304 Sep  8 19:40 2023-08-23-devops-githhub_pages-play.ipynb
-rw-r--r--  1 neilchandra  staff   9478 Aug 27 10:13 2023-08-23-devops-hacks.ipynb

./Foundation/Sprint1:
total 120
-rw-r--r--  1 neilchandra  staff  30245 Sep 17 10:26 2024-09-15-javascript_output_objects.ipynb
-rw-r--r--  1 neilchandra  staff  27562 Sep 19 22:28 2024-09-15-jupyter-notebook-python.ipynb
%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Look for images, print working directory, list files"
cd $project/images  # this should exist per fastpages
pwd
ls -lR
Look for images, print working directory, list files
/Users/neilchandra/nighthawk/neil_2025/images
total 16288
-rw-r--r--   1 neilchandra  staff   129584 Aug 27 10:03 agile.webp
drwxr-xr-x  26 neilchandra  staff      832 Aug 27 10:03 binary
-rw-r--r--@  1 neilchandra  staff  2340507 Sep 10 10:38 cookie.png
drwxr-xr-x   9 neilchandra  staff      288 Aug 27 10:03 course-brag
-rw-r--r--   1 neilchandra  staff   134051 Aug 27 10:03 createusersample.png
-rw-r--r--   1 neilchandra  staff    15406 Aug 27 10:03 favicon.ico
-rw-r--r--   1 neilchandra  staff   177895 Aug 27 10:03 food.png
drwxr-xr-x   5 neilchandra  staff      160 Aug 27 10:03 fullstack
-rw-r--r--   1 neilchandra  staff   244133 Aug 27 10:03 homesample.png
-rw-r--r--   1 neilchandra  staff   220573 Aug 27 10:03 information.png
drwxr-xr-x   5 neilchandra  staff      160 Aug 27 10:03 jokes
drwxr-xr-x  13 neilchandra  staff      416 Sep  3 10:34 jpa-lesson-images
drwxr-xr-x   3 neilchandra  staff       96 Aug 27 10:03 kasm
-rw-r--r--   1 neilchandra  staff   155071 Aug 27 10:03 loginesample.png
-rw-r--r--   1 neilchandra  staff    34239 Aug 27 10:03 logo.png
-rw-r--r--@  1 neilchandra  staff  3851947 Sep  3 10:51 mario_animation.png
-rw-r--r--   1 neilchandra  staff      713 Sep  3 10:04 mario_metadata.yml
drwxr-xr-x   3 neilchandra  staff       96 Aug 27 10:03 notebooks
drwxr-xr-x  11 neilchandra  staff      352 Aug 27 10:03 platformer
-rw-r--r--   1 neilchandra  staff   165794 Aug 27 10:03 postmanexample.png
-rw-r--r--   1 neilchandra  staff   207818 Aug 27 10:03 sleep.png
-rw-r--r--   1 neilchandra  staff   203861 Aug 27 10:03 stress.png
-rw-r--r--   1 neilchandra  staff   168467 Aug 27 10:03 tracker1.png
-rw-r--r--   1 neilchandra  staff   244703 Aug 27 10:03 waterfood.png
-rw-r--r--   1 neilchandra  staff    12911 Aug 27 10:03 wireframe.png

./binary:
total 10080
-rw-r--r--  1 neilchandra  staff   37088 Aug 27 10:03 1.png
-rw-r--r--  1 neilchandra  staff   39155 Aug 27 10:03 2.png
-rw-r--r--  1 neilchandra  staff  145986 Aug 27 10:03 andgate.png
-rw-r--r--  1 neilchandra  staff  221394 Aug 27 10:03 ascii_label.png
-rw-r--r--  1 neilchandra  staff   82759 Aug 27 10:03 b.png
-rw-r--r--  1 neilchandra  staff  322245 Aug 27 10:03 binary_math_conversion.png
-rw-r--r--  1 neilchandra  staff  298587 Aug 27 10:03 binary_shift.png
-rw-r--r--  1 neilchandra  staff   19526 Aug 27 10:03 codetable.png
-rw-r--r--  1 neilchandra  staff   82392 Aug 27 10:03 color_block.png
-rw-r--r--  1 neilchandra  staff  457749 Aug 27 10:03 color_code.png
-rw-r--r--  1 neilchandra  staff  301661 Aug 27 10:03 elaboration_of_shift.png
-rw-r--r--  1 neilchandra  staff   30647 Aug 27 10:03 halt.png
-rw-r--r--  1 neilchandra  staff  121894 Aug 27 10:03 integer_math_neg.png
-rw-r--r--  1 neilchandra  staff  125395 Aug 27 10:03 integer_math_pos.png
-rw-r--r--  1 neilchandra  staff  419775 Aug 27 10:03 logic_gate_application.png
-rw-r--r--  1 neilchandra  staff  536361 Aug 27 10:03 logic_gate_lab.png
-rw-r--r--  1 neilchandra  staff  107742 Aug 27 10:03 logic_gates.png
-rw-r--r--  1 neilchandra  staff  888227 Aug 27 10:03 logic_of_shift.png
-rw-r--r--  1 neilchandra  staff   17921 Aug 27 10:03 problems.png
-rw-r--r--  1 neilchandra  staff   38846 Aug 27 10:03 reverse.png
-rw-r--r--  1 neilchandra  staff  373203 Aug 27 10:03 sample_unicode.png
-rw-r--r--  1 neilchandra  staff  145986 Aug 27 10:03 truth.png
-rw-r--r--  1 neilchandra  staff  245559 Aug 27 10:03 twos_complement.png
-rw-r--r--  1 neilchandra  staff   55105 Aug 27 10:03 unsigned_addition.png

./course-brag:
total 5504
-rw-r--r--  1 neilchandra  staff  536162 Aug 27 10:03 ccr.png
-rw-r--r--  1 neilchandra  staff  654211 Aug 27 10:03 csa.png
-rw-r--r--  1 neilchandra  staff  311888 Aug 27 10:03 csa24.png
-rw-r--r--  1 neilchandra  staff  680581 Aug 27 10:03 csp.png
-rw-r--r--  1 neilchandra  staff  323986 Aug 27 10:03 csp24.png
-rw-r--r--  1 neilchandra  staff  270084 Aug 27 10:03 csse.png
-rw-r--r--  1 neilchandra  staff   27531 Aug 27 10:03 qr.png

./fullstack:
total 80
-rw-r--r--  1 neilchandra  staff  15371 Aug 27 10:03 newvars.png
-rw-r--r--  1 neilchandra  staff   8035 Aug 27 10:03 quickSketch.png
-rw-r--r--  1 neilchandra  staff  14073 Aug 27 10:03 variables.png

./jokes:
total 3576
-rw-r--r--  1 neilchandra  staff  1040469 Aug 27 10:03 debug.png
-rw-r--r--  1 neilchandra  staff   245915 Aug 27 10:03 postman.png
-rw-r--r--  1 neilchandra  staff   533869 Aug 27 10:03 run.png

./jpa-lesson-images:
total 1480
-rw-r--r--  1 neilchandra  staff   15657 Aug 27 10:03 columnName.jpg
-rw-r--r--  1 neilchandra  staff   48430 Aug 27 10:03 email.jpg
-rw-r--r--  1 neilchandra  staff   83139 Aug 27 10:03 haslastname.jpg
-rw-r--r--  1 neilchandra  staff   85779 Aug 27 10:03 jpa.jpg
-rw-r--r--  1 neilchandra  staff  201269 Aug 27 10:03 largeterminal.jpg
-rw-r--r--  1 neilchandra  staff   62635 Aug 27 10:03 partial.jpg
-rw-r--r--  1 neilchandra  staff   75480 Aug 27 10:03 postman.jpg
-rw-r--r--  1 neilchandra  staff   42227 Aug 27 10:03 search2.jpg
-rw-r--r--  1 neilchandra  staff   27237 Aug 27 10:03 userJpaRepositoryFile.jpg
-rw-r--r--  1 neilchandra  staff   37602 Aug 27 10:03 userTable.jpg
-rw-r--r--  1 neilchandra  staff   56784 Aug 27 10:03 walloftext.jpg

./kasm:
total 272
-rw-r--r--  1 neilchandra  staff  138312 Aug 27 10:03 kasmv2.png

./notebooks:
total 0
drwxr-xr-x  6 neilchandra  staff  192 Aug 27 10:03 foundation

./notebooks/foundation:
total 728
-rw-r--r--  1 neilchandra  staff  310743 Aug 27 10:03 create_repo.png
-rw-r--r--  1 neilchandra  staff   29416 Aug 27 10:03 push.jpg
-rw-r--r--  1 neilchandra  staff   17105 Aug 27 10:03 stage.jpg
-rw-r--r--  1 neilchandra  staff    6659 Aug 27 10:03 wsl.jpg

./platformer:
total 248
-rw-r--r--   1 neilchandra  staff    841 Aug 27 10:03 1_lopez.png
-rw-r--r--   1 neilchandra  staff   8525 Aug 27 10:03 Untitled drawing.png
-rw-r--r--   1 neilchandra  staff  91596 Aug 27 10:03 background.png
drwxr-xr-x  32 neilchandra  staff   1024 Aug 27 10:03 backgrounds
-rw-r--r--   1 neilchandra  staff  15406 Aug 27 10:03 favicon.ico
drwxr-xr-x  21 neilchandra  staff    672 Aug 27 10:03 obstacles
drwxr-xr-x  28 neilchandra  staff    896 Aug 27 10:03 platforms
drwxr-xr-x  34 neilchandra  staff   1088 Aug 27 10:03 sprites
drwxr-xr-x  11 neilchandra  staff    352 Aug 27 10:03 transitions

./platformer/backgrounds:
total 21528
-rw-r--r--  1 neilchandra  staff   989059 Aug 27 10:03 BossBackground.png
-rw-r--r--  1 neilchandra  staff   916487 Aug 27 10:03 Congratulations!!!.png
-rw-r--r--  1 neilchandra  staff    23764 Aug 27 10:03 avenidawide3.jpg
-rw-r--r--  1 neilchandra  staff    10759 Aug 27 10:03 bat.png
-rw-r--r--  1 neilchandra  staff    71134 Aug 27 10:03 castles.png
-rw-r--r--  1 neilchandra  staff    32795 Aug 27 10:03 clouds.png
-rw-r--r--  1 neilchandra  staff   180238 Aug 27 10:03 desertbg.png
-rw-r--r--  1 neilchandra  staff    43261 Aug 27 10:03 devil.png
-rw-r--r--  1 neilchandra  staff    61795 Aug 27 10:03 flyingplayers.png
-rw-r--r--  1 neilchandra  staff    47684 Aug 27 10:03 game_over.png
-rw-r--r--  1 neilchandra  staff    33177 Aug 27 10:03 greek.png
-rw-r--r--  1 neilchandra  staff   232046 Aug 27 10:03 hills.png
-rw-r--r--  1 neilchandra  staff   160593 Aug 27 10:03 home.png
-rw-r--r--  1 neilchandra  staff    28317 Aug 27 10:03 icewater.png
-rw-r--r--  1 neilchandra  staff   150548 Aug 27 10:03 mini.png
-rw-r--r--  1 neilchandra  staff   258834 Aug 27 10:03 miniHogwarts.png
-rw-r--r--  1 neilchandra  staff    29894 Aug 27 10:03 moon.jpg
-rw-r--r--  1 neilchandra  staff   194001 Aug 27 10:03 mountains.jpg
-rw-r--r--  1 neilchandra  staff  3804266 Aug 27 10:03 multiplayerbackground.png
-rw-r--r--  1 neilchandra  staff   101005 Aug 27 10:03 narwhal.png
-rw-r--r--  1 neilchandra  staff   663965 Aug 27 10:03 planet.jpg
-rw-r--r--  1 neilchandra  staff   230522 Aug 27 10:03 podium.jpg
-rw-r--r--  1 neilchandra  staff    48819 Aug 27 10:03 quidditch2.jpg
-rw-r--r--  1 neilchandra  staff   328600 Aug 27 10:03 reef.png
-rw-r--r--  1 neilchandra  staff   188425 Aug 27 10:03 school-fish.png
-rw-r--r--  1 neilchandra  staff   863997 Aug 27 10:03 skibidiCompletion.png
-rw-r--r--  1 neilchandra  staff      721 Aug 27 10:03 snowfall.png
-rw-r--r--  1 neilchandra  staff   543088 Aug 27 10:03 springfield.png
-rw-r--r--  1 neilchandra  staff   599642 Aug 27 10:03 water.png
-rw-r--r--  1 neilchandra  staff   118454 Aug 27 10:03 winter.png

./platformer/obstacles:
total 1720
-rw-r--r--  1 neilchandra  staff   81268 Aug 27 10:03 Chest.png
-rw-r--r--  1 neilchandra  staff   33120 Aug 27 10:03 Trident.png
-rw-r--r--  1 neilchandra  staff   25554 Aug 27 10:03 blue-tube-up.png
-rw-r--r--  1 neilchandra  staff   25477 Aug 27 10:03 blue-tube.png
-rw-r--r--  1 neilchandra  staff   32653 Aug 27 10:03 cabin.png
-rw-r--r--  1 neilchandra  staff   16925 Aug 27 10:03 coin.png
-rw-r--r--  1 neilchandra  staff   23107 Aug 27 10:03 coinanimation.png
-rw-r--r--  1 neilchandra  staff   43191 Aug 27 10:03 dimonds.png
-rw-r--r--  1 neilchandra  staff   66987 Aug 27 10:03 flag.png
-rw-r--r--  1 neilchandra  staff   24701 Aug 27 10:03 iceberg.png
-rw-r--r--  1 neilchandra  staff    7163 Aug 27 10:03 laser.png
-rw-r--r--  1 neilchandra  staff   11955 Aug 27 10:03 snitch.png
-rw-r--r--  1 neilchandra  staff   22801 Aug 27 10:03 snowflake.png
-rw-r--r--  1 neilchandra  staff   19408 Aug 27 10:03 star.png
-rw-r--r--  1 neilchandra  staff   60071 Aug 27 10:03 toilet.png
-rw-r--r--  1 neilchandra  staff  248218 Aug 27 10:03 tree.png
-rw-r--r--  1 neilchandra  staff   29442 Aug 27 10:03 tube.png
-rw-r--r--  1 neilchandra  staff   21876 Aug 27 10:03 vbucks.png
-rw-r--r--  1 neilchandra  staff   48319 Aug 27 10:03 whompingwillowtree.png

./platformer/platforms:
total 4688
-rw-r--r--  1 neilchandra  staff     8474 Aug 27 10:03 Chocolatefrog.jpg
-rw-r--r--  1 neilchandra  staff    75783 Aug 27 10:03 alien.png
-rw-r--r--  1 neilchandra  staff    41211 Aug 27 10:03 brick_block.png
-rw-r--r--  1 neilchandra  staff     2782 Aug 27 10:03 brick_wall.png
-rw-r--r--  1 neilchandra  staff    10690 Aug 27 10:03 bubbles.png
-rw-r--r--  1 neilchandra  staff     6537 Aug 27 10:03 cobblestone.png
-rw-r--r--  1 neilchandra  staff    26145 Aug 27 10:03 grass.png
-rw-r--r--  1 neilchandra  staff    56810 Aug 27 10:03 ground.png
-rw-r--r--  1 neilchandra  staff    15969 Aug 27 10:03 island.png
-rw-r--r--  1 neilchandra  staff    84023 Aug 27 10:03 lava.jpg
-rw-r--r--  1 neilchandra  staff    23906 Aug 27 10:03 lionpattern.jpg
-rw-r--r--  1 neilchandra  staff   143056 Aug 27 10:03 magic_beam.png
-rw-r--r--  1 neilchandra  staff    66332 Aug 27 10:03 mario_block_spritesheet_v2.png
-rw-r--r--  1 neilchandra  staff    27915 Aug 27 10:03 mushroom.png
-rw-r--r--  1 neilchandra  staff     4921 Aug 27 10:03 narwhalfloor.png
-rw-r--r--  1 neilchandra  staff   115313 Aug 27 10:03 rockslava.png
-rw-r--r--  1 neilchandra  staff    64074 Aug 27 10:03 sand.png
-rw-r--r--  1 neilchandra  staff      298 Aug 27 10:03 sandblock.png
-rw-r--r--  1 neilchandra  staff     8076 Aug 27 10:03 sandstone.png
-rw-r--r--  1 neilchandra  staff    55870 Aug 27 10:03 skibidiBlock.png
-rw-r--r--  1 neilchandra  staff   330989 Aug 27 10:03 snowyfloor.png
-rw-r--r--  1 neilchandra  staff     7447 Aug 27 10:03 snowywood.png
-rw-r--r--  1 neilchandra  staff    39059 Aug 27 10:03 stone.jpg
-rw-r--r--  1 neilchandra  staff  1092399 Aug 27 10:03 turf.png
-rw-r--r--  1 neilchandra  staff    27827 Aug 27 10:03 yellowredpattern.jpg
-rw-r--r--  1 neilchandra  staff    17518 Aug 27 10:03 yellowtowerpattern.jpg

./platformer/sprites:
total 17232
-rw-r--r--  1 neilchandra  staff    38055 Aug 27 10:03 alert.gif
-rw-r--r--  1 neilchandra  staff    51640 Aug 27 10:03 alien.png
-rw-r--r--  1 neilchandra  staff   120450 Aug 27 10:03 boss.png
-rw-r--r--  1 neilchandra  staff     6736 Aug 27 10:03 canelopezspritesheet.png
-rw-r--r--  1 neilchandra  staff     3167 Aug 27 10:03 cerberus.png
-rw-r--r--  1 neilchandra  staff   103701 Aug 27 10:03 dementor2.png
-rw-r--r--  1 neilchandra  staff    49625 Aug 27 10:03 dracomalfoy.png
-rw-r--r--  1 neilchandra  staff    24281 Aug 27 10:03 dragon.png
-rw-r--r--  1 neilchandra  staff   141829 Aug 27 10:03 escaper.png
-rw-r--r--  1 neilchandra  staff   121796 Aug 27 10:03 flying-goomba.png
-rw-r--r--  1 neilchandra  staff   356155 Aug 27 10:03 flying-ufo.png
-rw-r--r--  1 neilchandra  staff   121815 Aug 27 10:03 goomba.png
-rw-r--r--  1 neilchandra  staff    91068 Aug 27 10:03 goombaspritesheet.png
-rw-r--r--  1 neilchandra  staff    14232 Aug 27 10:03 harryanimation2.png
-rw-r--r--  1 neilchandra  staff    15902 Aug 27 10:03 harryanimation3.png
-rw-r--r--  1 neilchandra  staff    15969 Aug 27 10:03 island.png
-rw-r--r--  1 neilchandra  staff   164132 Aug 27 10:03 jellyfish.png
-rw-r--r--  1 neilchandra  staff   162387 Aug 27 10:03 knight.png
-rw-r--r--  1 neilchandra  staff    17116 Aug 27 10:03 lopezanimation.png
-rw-r--r--  1 neilchandra  staff     6609 Aug 27 10:03 lopezspritesheet3.png
-rwxr-xr-x  1 neilchandra  staff  3851947 Aug 27 10:03 mario.png
-rw-r--r--  1 neilchandra  staff   111425 Aug 27 10:03 monkey.png
-rw-r--r--  1 neilchandra  staff    49605 Aug 27 10:03 narwhal_boss.png
-rw-r--r--  1 neilchandra  staff   181376 Aug 27 10:03 noirio.png
-rw-r--r--  1 neilchandra  staff    59931 Aug 27 10:03 owl.png
-rw-r--r--  1 neilchandra  staff    23940 Aug 27 10:03 penguin.png
-rw-r--r--  1 neilchandra  staff   457104 Aug 27 10:03 skibidiEnemy.png
-rw-r--r--  1 neilchandra  staff   155875 Aug 27 10:03 skibidiTItan.png
-rw-r--r--  1 neilchandra  staff    26141 Aug 27 10:03 snowman.png
-rw-r--r--  1 neilchandra  staff  1683899 Aug 27 10:03 white_mario.png
-rw-r--r--  1 neilchandra  staff   376506 Aug 27 10:03 white_mario1.png
-rw-r--r--  1 neilchandra  staff   152460 Aug 27 10:03 zombie.png

./platformer/transitions:
total 9512
-rw-r--r--  1 neilchandra  staff  123315 Aug 27 10:03 IceMinigameEnd.png
-rw-r--r--  1 neilchandra  staff  750112 Aug 27 10:03 greeceEnd.png
-rw-r--r--  1 neilchandra  staff   20774 Aug 27 10:03 greenscreen.png
-rw-r--r--  1 neilchandra  staff  951532 Aug 27 10:03 hillsEnd.png
-rw-r--r--  1 neilchandra  staff  211655 Aug 27 10:03 hogwartsminiEnd.jpg
-rw-r--r--  1 neilchandra  staff  859809 Aug 27 10:03 miniEnd.png
-rw-r--r--  1 neilchandra  staff  917436 Aug 27 10:03 quidditchEnd.png
-rw-r--r--  1 neilchandra  staff  917788 Aug 27 10:03 waterEnd.png
-rw-r--r--  1 neilchandra  staff   94865 Aug 27 10:03 winterEnd.png

Look inside a Markdown File

“cat” reads data from the file and gives its content as output

%%script bash

# Extract saved variables
source /tmp/variables.sh

echo "Navigate to project, then navigate to area wwhere files were cloned"

cd $project
echo "show the contents of README.md"
echo ""

cat README.md  # show contents of file, in this case markdown
echo ""
echo "end of README.md"

Navigate to project, then navigate to area wwhere files were cloned
show the contents of README.md

# Introduction

Nighthawk Pages is a project designed to support students in their Computer Science and Software Engineering education. It offers a wide range of resources including tech talks, code examples, and educational blogs.

GitHub Pages can be customized by the blogger to support computer science learnings as the student works through the pathway of using Javascript, Python/Flask, Java/Spring.  

## Student Requirements

Del Norte HS students will be required to review their personal GitHub Pages at each midterm and final.  This review will contain a compilation of personal work performed within each significant grading period.

In general, Students and Teachers are expected to use GitHub pages to build lessons, complete classroom hacks, perform work on JavaScript games, and serve as a frontend to full-stack applications.

Exchange of information could be:

1. sharing a file:  `wget "raw-link.ipynb"
2. creating a template from this repository
3. sharing a fork among team members
4. etc.

---

## History

This project is in its 3rd revision (aka 3.0).

The project was initially based on Fastpages. But this project has diverged from those roots into an independent entity.  The decision to separate from Fastpages was influenced by the deprecation of Fastpages by authors.  It is believed by our community that the authors of fastpages turned toward Quatro.  After that change of direction fastpages did not align with the Teacher's goals and student needs. The Nighthawk Pages project has more of a raw development blogging need.

### License

The Apache license has its roots in Fastpages.  Thus, it carries its license forward.  However, most of the code is likely unrecognizable from those roots.

### Key Features

- **Code Examples**: Provides practical coding examples in JavaScript, including a platformer game, and frontend code for user databases using Python and Java backends.
- **Educational Blogs**: Offers instructional content on various topics such as developer tools setup, deployment on AWS, SQL databases, machine learning, and data structures. It utilizes Jupyter Notebooks for interactive lessons and coding challenges.
- **Tools and Integrations**: Features GitHub actions for blog publishing, Utterances for blog commenting, local development support via Makefile and scripts, and styling with the Minima Theme and SASS. It also includes a new integration with GitHub Projects and Issues.

### Contributions

- **Notable Contributions**: Highlights significant contributions to the project, including theme development, search and tagging functionality, GitHub API integration, and the incorporation of GitHub Projects into GitHub pages. Contributors such as Tirth Thakker, Mirza Beg, and Toby Ledder have played crucial roles in these developments.

- **Blog Contributions**:  Often students contribute articles and blogs to this project.  Their names are typically listed in the front matter of their contributing post.

---

## GitHub Pages setup

The absolutes in setup up...

**Activate GitHub Pages Actions**: This step involves enabling GitHub Pages Actions for your project. By doing so, your project will be automatically deployed using GitHub Pages Actions, ensuring that your project is always up to date with the latest changes you push to your repository.

- On the GitHub website for the repository go to the menu: Settings -> Pages ->Build
- Under the Deployment location on the page, select "GitHub Actions".

**Update `_config.yml`**: You need to modify the `_config.yml` file to reflect your repository's name. This configuration is crucial because it ensures that your project's styling is correctly applied, making your deployed site look as intended rather than unstyled or broken.

```text
github_repo: "student_2025" 
baseurl: "/student_2025"
```

**Set Repository Name in Makefile**: Adjust the `REPO_NAME` variable in your Makefile to match your GitHub repository's name. This action facilitates the automatic updating of posts and notebooks on your local development server, improving the development process.

```make
# Configuration, override port with usage: make PORT=4200
PORT ?= 4100
REPO_NAME ?= student_2025
LOG_FILE = /tmp/jekyll$(PORT).log
```

### Tool requirements

All `GitHub Pages` websites are managed on GitHub infrastructure and use GitHub version control.  Each time we change files in GitHub it initiates a GitHub Action, a continuous integration and development toolset, that rebuilds and publishes the site with Jekyll.  

- GitHub uses `Jekyll` to transform your markdown and HTML content into static websites and blogs. [Jekyll](https://jekyllrb.com/).
- A Linux shell is required to work with this project integration with GitHub Pages, GitHub and VSCode.  Ubuntu is the preferred shell, though MacOS shell is supported as well.  There will be some key setup scripts that follow in the README.
- Visual Studio Code is the Nighthawk Pages author's preferred code editor and extensible development environment.  VSCode has a rich ecosystem of developer extensions that ease working with GitHub Pages, GitHub, and many programming languages.  Setting up VSCode and extensions will be elaborated upon in this document.
- An anatomy section in this README will describe GitHub Pages and conventions that are used to organize content and files.  This includes file names, key coding files, metadata tagging of blogs, styling tooling for blogs, etc.

### Development Environment Setup

Comprehensive start. A topic-by-topic guide to getting this project running is published [here](https://nighthawkcoders.github.io/portfolio_2025/devops/tools/home).

Quick start.  A quick start below is a reminder, but is dependent on your knowledge.  Only follow this instruction if you need a refresher.  Always default to the comprehensive start if any problem occurs.

#### Clone Repo

Run these commands to obtain the project, then locate into the project directory with the terminal, install an extensive set of tools, and make.

```bash
git clone <this-repo> # git clone https://github.com/nighthawkcoders/student_2025.git 
cd <repo-dir>/scripts # cd student_2025
```

#### Windows WSL and/or Ubuntu Users

- Execute the script: `./activate_ubuntu.sh`

#### macOS Users

- Execute the script: `./activate_macos.sh`

#### Kasm Cloud Desktop Users

- Execute the script: `./activate.sh`

## Run Server on localhost

To preview the project you will need to "make" the project.

### Bundle install

The very first time you clone run project you will need to run this Ruby command as the final part of your setup.

```bash
bundle install
```

### Start the Server  

This requires running terminal commands `make`, `make stop`, `make clean`, or `make convert` to manage the running server.  Logging of details will appear in the terminal.   A `Makefile` has been created in the project to support commands and start processes.

Start the server, this is the best choice for initial and iterative development.  Note. after the initial `make`, you should see files automatically refresh in the terminal on VSCode save.

  ```bash
  make
  ```

### Load web application into the Browser

Start the preview server in the terminal,
The terminal output from `make` shows the server address. "Cmd" or "Ctl" click the http location to open the preview server in a browser. Here is an example Server address message, click on the Server address to load:...

  ```text
  http://0.0.0.0:4100/student_2025/
  ```

### Regeneration of web application

Save on ".ipynb" or ".md" file activiates "regeneration". An example terminal message is below.  Refresh the browser to see updates after the message displays.

  ```text
  Regenerating: 1 file(s) changed at 2023-07-31 06:54:32
      _notebooks/2024-01-04-cockpit-setup.ipynb
  ```

### Other "make" commands

Terminal messages are generated from background processes.  At any time, click return or enter in a terminal window to obtain a prompt.  Once you have the prompt you can use the terminal as needed for other tasks.  Always return to the root of project `cd ~/vscode/student_2025` for all "make" actions.

#### Stop the preview server

Stopping the server ends the web server applications running process.  However, it leaves constructed files in the project in a ready state for the next time you run `make`.

  ```bash
  make stop
  ```

### Clean the local web application environment

This command will top the server and "clean" all previously constructed files (ie .ipynb -> .md). This is the best choice when renaming files has created duplicates that are visible when previewing work.

  ```bash
  make clean
  ```

### Observe build errors

Test Jupyter Notebook conversions (ie .ipynb -> .md), this is the best choice to see if an IPYNB conversion error is occurring.

  ```bash
  make convert
  ```

---

## Development Support

### File Names in "_posts", "_notebooks"

There are two primary directories for creating blogs.  The "_posts" directory is for authoring in markdown only.  The "_notebooks" allows for markdown, pythons, javascript and more.

To name a file, use the following structure (If dates are in the future, review your config.yml setting if you want them to be viewed).  Review these naming conventions.

- For markdown files in _posts:
  - year-month-day-fileName.md
    - GOOD EXAMPLE: 2021-08-02-First-Day.md
    - BAD EXAMPLE: 2021-8-2-first-day.md
    - BAD EXAMPLE: first-day.md
    - BAD EXAMPLE: 2069-12-31-First-Day.md

- For Jupyter notebooks in _notebooks:
  - year-month-day-fileName.ipynb
    - GOOD EXAMPLE: 2021-08-02-First-Day.ipynb
    - BAD EXAMPLE: 2021-8-2-first-day.ipynb
    - BAD EXAMPLE: first-day.ipynb
    - BAD EXAMPLE: 2069-12-31-First-Day.ipynb

### Tags

Tags are used to organize pages by their tag the way to add tags is to add the following to your front matter such as the example seen here `categories: [Tools]` Each item in the same category will be lumped together to be seen easily on the search page.

### Search

All pages can be searched for using the built-in search bar. This search bar will search for any word in the title of a page or in the page itself. This allows for easily finding pages and information that you are looking for. However, sometimes this may not be desirable so to hide a page from the search you need to add `search_exclude: true` to the front matter of the page. This will hide the page from appearing when the viewer uses search.

### Navigation Bar

To add pages to the top navigation bar use _config.yml to order and determine which menus you want and how to order them.  Review the_config.yml in this project for an example.

### Blog Page

There is a blog page that has options for images and a description of the page. This page can help the viewer understand what the page is about and what they can expect to find on the page. The way to add images to a page is to have the following front matter `image: /images/file.jpg` and then the name of the image that you want to use. The image must be in the `images` folder. Furthermore, if you would like the file to not show up on the blog page `hide: true` can be added to the front matter.

### SASS support

NIGHTHAWK Pages support a variety of different themes that are each overlaid on top of minima. To use each theme, go to the "_sass/minima/custom-styles.scss" file and simply comment or uncomment the theme you want to use.

To learn about the minima themes search for "GitHub Pages minima" and review the README.

To find a new theme search for "Github Pages Themes".

### Includes

- Nighthawk Pages uses liquid syntax to import many common page elements that are present throughout the repository. These common elements are imported from the _includes directory. If you want to add one of these common elements, use liquid syntax to import the desired element to your file. Here’s an example of the liquid syntax used to import: `<h3>
<a class="post-link" href="">

</a>

</h3><p class="post-meta"></p> ` Note that the liquid syntax is surrounded by curly braces and percent signs. This can be used anywhere in the repository.

### Layouts

- To use or create a custom page layout, make an HTML page inside the _layouts directory, and when you want to use that layout in a file, use the following front matter `layout: [your layout here]`.  All layouts will be written in liquid to define the structure of the page.

### Metadata

Metadata, also known as "front matter", is a set of key-value pairs that can provide additional information to GitHub Pages about .md and .ipynb files. This can and probably will be used in other file types (ie doc, pdf) if we add them to the system.

In the front matter, you can also define things like a title and description for the page.  Additional front matter is defined to place content on the "Computer Science Lab Notebook" page.  The `courses:` key will place data on a specific page with the nested `week:` placing data on a specific row on the page.  The `type:` key in "front matter" will place the blog under the plans, hacks(ToDo), and tangibles columns.

- In our files, the front matter is defined at the top of the page or the first markdown cell.

  - First, open one of the .md or .ipynb files already included in either your _posts|_notebooks folder.

  - In the .md file, you should notice something similar to this at the top of the page. To see this in your .ipynb files you will need to double-click the markdown cell at the top of the file.

  ```yaml
  ---
  toc: true
  comments: true
  layout: post
  title: Jupyter Python Sample
  description: Example Blog!!!  This shows code and notes from hacks.
  type: ccc
  courses: { csa: {week: 5} }
  ---
  ```

- The front matter will always have '---' at the top and bottom to distinguish it and each key-value pair will be separated by a ':'.

- Here we can modify things like the title and description.

- The type value will tell us which column this is going to appear under the time box supported pages.  The "ccc" stands for Code, Code, Code.

- The courses will tell us which menu item it will be under, in this case, the `csa` menu, and the `week` tells it what row (week) it will appear under that menu.

end of README.md

Env, Git, and GitHub

Env(ironment) is used to capture things like the path to the Code or Home directory. Git and GitHub are not only used to exchange code between individuals but are also often used to exchange code through servers, in our case for website deployment. All tools we use have behind-the-scenes relationships with the system they run on (MacOS, Windows, Linux) or a relationship with servers to which they are connected (e.g., GitHub). There is an “env” command in bash. There are environment files and setting files (e.g., .git/config) for Git. They both use a key/value concept.

  • env shows settings for your shell.
  • git clone sets up a directory of files.
  • cd $project allows the user to move inside that directory of files.
  • .git is a hidden directory that is used by Git to establish a relationship between the machine and the Git server on GitHub.
%%script bash

# This command has no dependencies

echo "Show the shell environment variables, key on left of equal value on right"
echo ""

env
Show the shell environment variables, key on left of equal value on right

VSCODE_CLI=1
VSCODE_CRASH_REPORTER_PROCESS_TYPE=extensionHost
TERM_PROGRAM=Apple_Terminal
GEM_HOME=/Users/neilchandra/gems
TERM=xterm-color
SHELL=/bin/zsh
CLICOLOR=1
TMPDIR=/var/folders/vp/gy17mkw5653_ptpdhdppzg740000gn/T/
HOMEBREW_REPOSITORY=/opt/homebrew
PYTHONUNBUFFERED=1
TERM_PROGRAM_VERSION=453
ORIGINAL_XDG_CURRENT_DESKTOP=undefined
MallocNanoZone=0
PYDEVD_USE_FRAME_EVAL=NO
TERM_SESSION_ID=AF955371-DAE2-4DA3-BA0B-355A96C08BCA
PYTHONIOENCODING=utf-8
USER=neilchandra
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.NSfS1KisCO/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
PAGER=cat
VIRTUAL_ENV=/Users/neilchandra/nighthawk/neil_2025/venv
ELECTRON_RUN_AS_NODE=1
VSCODE_AMD_ENTRYPOINT=vs/workbench/api/node/extensionHostProcess
PATH=/Users/neilchandra/nighthawk/neil_2025/venv/bin:/Users/neilchandra/nighthawk/neil_2025/venv/bin:/Users/neilchandra/gems/bin:/Users/neilchandra/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin
__CFBundleIdentifier=com.microsoft.VSCode
PWD=/Users/neilchandra/nighthawk/neil_2025/_notebooks/Foundation/B-tools_and_equipment
VSCODE_HANDLES_UNCAUGHT_ERRORS=true
ELECTRON_NO_ATTACH_CONSOLE=1
MPLBACKEND=module://matplotlib_inline.backend_inline
LANG=en_US.UTF-8
PYTHON_FROZEN_MODULES=on
XPC_FLAGS=0x0
FORCE_COLOR=1
RBENV_SHELL=zsh
XPC_SERVICE_NAME=0
SHLVL=4
HOME=/Users/neilchandra
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=1
VSCODE_NLS_CONFIG={"userLocale":"en-us","osLocale":"en-us","resolvedLanguage":"en","defaultMessagesFile":"/Applications/Visual Studio Code.app/Contents/Resources/app/out/nls.messages.json","locale":"en-us","availableLanguages":{}}
PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING=1
HOMEBREW_PREFIX=/opt/homebrew
LOGNAME=neilchandra
VSCODE_IPC_HOOK=/Users/neilchandra/Library/Application Support/Code/1.93-main.sock
VSCODE_CODE_CACHE_PATH=/Users/neilchandra/Library/Application Support/Code/CachedData/4849ca9bdf9666755eb463db297b69e5385090e3
CLICOLOR_FORCE=1
VSCODE_PID=569
INFOPATH=/opt/homebrew/share/info:
HOMEBREW_CELLAR=/opt/homebrew/Cellar
GIT_PAGER=cat
VSCODE_L10N_BUNDLE_LOCATION=
VSCODE_CWD=/Users/neilchandra/nighthawk/neil_2025
VIRTUAL_ENV_PROMPT=(venv) 
_=/usr/bin/env
%%script bash

# Extract saved variables
source /tmp/variables.sh

cd $project

echo ""
echo "show the secrets of .git config file"
cd .git
ls -l config

echo ""
echo "look at config file"
cat config
show the secrets of .git config file
-rw-r--r--  1 neilchandra  staff  340 Aug 27 10:15 config

look at config file
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[remote "origin"]
	url = https://github.com/neil9674/neil_2025.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main
	vscode-merge-base = origin/main

Advanced Shell project

This example was requested by a student (Jun Lim, CSA). The request was to make a Jupyter file using bash; I adapted the request to markdown. This type of thought will have great extrapolation to coding and possibilities of using Lists, Arrays, or APIs to build user interfaces. JavaScript is a language where building HTML is very common.

To get more interesting output from the terminal, this will require using something like mdless (https://github.com/ttscoff/mdless). This enables seeing markdown in rendered format.

Output of the example is much nicer in “Jupyter”

This is starting the process of documentation.

%%script bash

# This example has an error in VSCode; it runs best on Jupyter
cd /tmp

file="sample.md"
if [ -f "$file" ]; then
    rm $file
fi

# Create a markdown file using tee and here document (<<EOF)
tee -a $file >/dev/null <<EOF
# Show Generated Markdown
This introductory paragraph and this line and the title above are generated using tee with the standard input (<<) redirection operator.
- This bulleted element is still part of the tee body.
EOF

# Append additional lines to the markdown file using echo and redirection (>>)
echo "- This bulleted element and lines below are generated using echo with standard output (>>) redirection operator." >> $file
echo "- The list definition, as is, is using space to separate lines. Thus the use of commas and hyphens in output." >> $file

# Define an array of actions and their descriptions
actions=("ls,list-directory" "cd,change-directory" "pwd,present-working-directory" "if-then-fi,test-condition" "env,bash-environment-variables" "cat,view-file-contents" "tee,write-to-output" "echo,display-content-of-string" "echo_text_>\$file,write-content-to-file" "echo_text_>>\$file,append-content-to-file")

# Loop through the actions array and append each action to the markdown file
for action in ${actions[@]}; do
  action=${action//-/ }  # Convert dash to space
  action=${action//,/: } # Convert comma to colon
  action=${action//_text_/ \"sample text\" } # Convert _text_ to "sample text", note escape character \ to avoid "" having meaning
  echo "    - ${action//-/ }" >> $file  # Append action to file
done

echo ""
echo "File listing and status"
ls -l $file # List file details
wc $file   # Show word count
mdless $file  # Render markdown from terminal (requires mdless installation)

rm $file  # Clean up temporary file
File listing and status
-rw-r--r--  1 neilchandra  wheel  808 Sep 19 23:06 sample.md
      15     132     808 sample.md


Config file saved to /Users/neilchandra/.config/mdless/config.yml




Show Generated Markdown ======================================================

This introductory paragraph and this line and the title above are generated using tee with the standard input (<<) redirection operator.

 * This bulleted element is still part of the tee body.
 * This bulleted element and lines below are generated using echo with standard output (>>) redirection operator.
 * The list definition, as is, is using space to separate lines. Thus the use of commas and hyphens in output.
   * ls: list directory
   * cd: change directory
   * pwd: present working directory
   * if then fi: test condition
   * env: bash environment variables
   * cat: view file contents
   * tee: write to output
   * echo: display content of string
   * echo "sample text" >$file: write content to file
   * echo "sample text" >>$file: append content to file



Display Shell commands help using man

The previous example used a markdown file to store a list of actions and their descriptions. This example uses the man command to generate a markdown file with descriptions of the commands. The markdown file is then displayed using mdless.

In coding, we should try to get data from the content creators instead of creating it on our own. This approach has several benefits:

  • Accuracy: Descriptions from man pages are authoritative and accurate, as they come directly from the documentation provided by the command’s developers.
  • Consistency: Automatically generating descriptions ensures consistency in formatting and terminology.
  • Efficiency: It saves time and effort, especially when dealing with a large number of commands.
  • Up-to-date Information: man pages are regularly updated with the latest information, ensuring that the descriptions are current.
%%script bash

# This example has an error in VSCode; it runs best on Jupyter
cd /tmp

file="sample.md"
if [ -f "$file" ]; then
    rm $file
fi

# Set locale to C to avoid locale-related errors
export LC_ALL=C

# Create a markdown file using tee and here document (<<EOF)
tee -a $file >/dev/null <<EOF
# Show Generated Markdown
This introductory paragraph and this line and the title above are generated using tee with the standard input (<<) redirection operator.
- This bulleted element is still part of the tee body.
EOF

# Append additional lines to the markdown file using echo and redirection (>>)
echo "- This bulleted element and lines below are generated using echo with standard output (>>) redirection operator." >> $file
echo "- The list definition, as is, is using space to separate lines. Thus the use of commas and hyphens in output." >> $file

# Define an array of commands
commands=("ls" "cat" "tail" "pwd" "env" "grep" "awk" "sed" "curl" "wget")

# Loop through the commands array and append each command description to the markdown file
for cmd in ${commands[@]}; do
  description=$(man $cmd | col -b | awk '/^NAME/{getline; print}')
  echo "    - $description" >> $file
done

echo ""
echo "File listing and status"
ls -l $file # List file details
wc $file   # Show word count
mdless $file  # Render markdown from terminal (requires mdless installation)

rm $file  # Clean up temporary file
File listing and status
-rw-r--r--  1 neilchandra  wheel  972 Sep 19 23:06 sample.md
      15     151     972 sample.md


Show Generated Markdown ======================================================

This introductory paragraph and this line and the title above are generated using tee with the standard input (<<) redirection operator.

 * This bulleted element is still part of the tee body.
 * This bulleted element and lines below are generated using echo with standard output (>>) redirection operator.
 * The list definition, as is, is using space to separate lines. Thus the use of commas and hyphens in output.
   * ls - list directory contents
   * cat - concatenate and print files
   * tail - display the last part of a file
   * pwd - return working directory name
   * env - set environment and execute command, or print environment
   * grep, egrep, fgrep, rgrep, bzgrep, bzegrep, bzfgrep, zgrep, zegrep,
   * awk - pattern-directed scanning and processing language
   * sed - stream editor
   * curl - transfer a URL
   * Wget - The non-interactive network downloader.