Tool Installation Hacks
Shell Commmands
- brew:
- Purpose: brew is a package manager for macOS (and Linux) that simplifies the process of installing, updating, and managing software packages. It allows users to install a wide variety of applications and utilities from the command line.
- git:
- Purpose: git is a version control system that helps track changes to files and collaborate on projects, especially in software development. It allows you to manage code repositories, commit changes, branch out for different features or fixes, and merge them back together.
- cd:
- Purpose: Purpose: cd stands for “change directory.” It is used to navigate between directories in the shell. When you type cd followed by a directory name, you move into that directory, making it your current working directory.
- ls:
- Purpose: Purpose: ls is a command that lists the contents of a directory. When you run ls, it displays the files and folders in the current directory. It can also show additional details like file permissions, sizes, and modification dates when used with options like -l (long format).
Version Control
Version control is a crucial part of the development process, allowing you to track changes, collaborate with others, and manage multiple versions of your project. Here are some key points:
Cloning a Repository: The files from GitHub are placed on your local machine using the git clone command. This creates a copy of the repository in your chosen directory.
- git clone [repository name]
Navigating Files: After cloning, you can navigate to the files using the cd command.
- cd/ls [directory name]
Updating Files: Files on GitHub are updated using commands like git add, git commit, and git push. These commands stage changes, commit them with a message, and push the updates to the GitHub repository.
- git add . [to commit from the repository name]
- git commit -m [‘commit message’]
Updating Your Template: To update the template of the portfolio_2025 repository and make it applicable to your specific course, you would customize the content, structure, and styles according to the course requirements. After making changes, you would push them to GitHub using git push.
Localhost vs. Deployed Server
Localhost: Viewing your project on localhost means you’re running the project on your local machine. The URL for localhost is typically something like http://localhost:8000 (in my case, it is http://127.0.0.1:4100/vibha_2025/). Only you can see this version unless you share your screen or expose the port to others. Deployed Server: Viewing your project on a deployed server, like GitHub Pages, means it’s accessible on the internet. The URL is usually in the format https://username.github.io/portfolio_2025 (in my case, it is https://vibha-yganji.github.io/vibha_2025) , and anyone with the link can view it.
DNS and GitHub Pages
Domain: GitHub Pages automatically provides a domain, typically username.github.io/repository-name. You can also set up a custom domain if you own one.
URL Differences: The URL for your GitHub Pages project is unique to your repository. It will be different from your neighbors’ URLs unless you’re working on a shared repository. If you change the repository name or set up a custom domain, the URL will change accordingly.
GitHub Usage
GitLens Commit History
GitLens Contributor View
GitHub Analytics View
Tool Verification Hacks
Anusha and I created 2 different scrips to verify the versions of our tools and our environment variables. The first script is a lot simpler; it only prints the ruby, python/python3 versions (we did both to make sure they matched or were aliased to match), and to print the available Jupyter kernels. The second script is more involved with a greater focus on environmental variables along with verifying the Git configuration.
Issues:
- One issue we have yet to resolve with the 2nd script is that the code that checks if the user-provided directory is a Git repository outputs false negatives.
%%script bash
#!/bin/bash
# Function to check the command existence
check_command() {
if ! command -v "$1" &> /dev/null; then
echo "$1 is not installed or not in the system's PATH."
else
$2
fi
}
# Check Ruby version
check_command ruby "ruby --version"
# Check Python version
check_command python "python --version"
# Check Jupyter Notebook version
check_command jupyter "jupyter notebook --version"
# List Jupyter kernelspecs
check_command jupyter "jupyter kernelspec list"
# Check Python 3 version (if you have multiple versions of Python installed)
check_command python3 "python3 --version"
%%script bash
#!/bin/bash
# Function to check if Ruby is installed
check_ruby() {
# Use 'command -v' to check if 'ruby' is available in the system's PATH
if command -v ruby >/dev/null 2>&1; then
# Ruby is installed; print its version
echo "Ruby is installed: $(ruby -v)"
else
# Ruby is not installed
echo "Ruby is not installed."
fi
}
# Function to check if Python is installed
check_python() {
# Check for 'python3' first (preferred for modern Python versions)
if command -v python3 >/dev/null 2>&1; then
# Python3 is installed; print its version
echo "Python3 is installed: $(python3 --version)"
# Fallback to checking for 'python' (older versions)
elif command -v python >/dev/null 2>&1; then
# Python2 or Python2.x is installed; print its version
echo "Python is installed: $(python --version)"
else
# Python is not installed
echo "Python is not installed."
fi
}
# Function to check if Git is installed
check_git() {
# Use 'command -v' to check if 'git' is available in the system's PATH
if command -v git >/dev/null 2>&1; then
# Git is installed
echo "Git is installed."
else
# Git is not installed; exit the script with an error code
echo "Git is not installed."
exit 1
fi
}
# Function to list global git configuration
check_git_config() {
# Ensure Git is installed before proceeding
check_git
# Print the global Git configuration
echo "Global Git configuration:"
git config --global --list
}
# Function to list all project directories in the current working directory
list_project_directories() {
# Print the current working directory and list directories
echo "Listing project directories in $(pwd):"
ls -d */
}
# Function to list the contents of a specific project directory
list_project_contents() {
local dir="$1" # Get the directory path from the argument
# Check if the directory exists
if [ -d "$dir" ]; then
# Directory exists; list its contents with detailed information
echo "Listing contents of project directory '$dir':"
ls -la "$dir"
else
# Directory does not exist
echo "Directory '$dir' does not exist."
fi
}
# Function to show Git repository details in the current directory
show_git_repo_details() {
# Check if the current directory is a Git repository
if [ -d ".git" ]; then
# Print details about the Git repository
echo "Git repository details:"
git remote -v # List remote repositories
git branch # List local branches
else
# Directory is not a Git repository
echo "This directory is not a Git repository."
fi
}
# Function to show current environment variables
show_env_vars() {
# Print all environment variables
echo "Current environment variables:"
printenv
}
# Function to check for specific directories within a project
check_project_directories() {
local project="$1" # Project directory path
local dir="$2" # Directory to check within the project
echo "Looking for '$dir' directory inside the project"
# Check if the specific directory exists within the project directory
if [ -d "$project/$dir" ]; then
# Directory exists; list its contents recursively
(cd "$project/$dir" && pwd && ls -lR) # Use a subshell to avoid changing the current directory
else
# Directory does not exist
echo "'$dir' directory does not exist in the project."
exit 1
fi
}
# Main script execution
echo "Starting system check..."
# Call the function to check Ruby installation
check_ruby
echo "-----------------------------"
# Call the function to check Python installation
check_python
echo "-----------------------------"
# Call the function to check Git configuration
check_git_config
echo "-----------------------------"
# Call the function to list project directories in the current working directory
list_project_directories
echo "-----------------------------"
# Prompt the user to enter a project directory to inspect
echo "Please enter the project directory you want to inspect:"
read -r project
# Check if the user provided a project directory
if [ -z "$project" ]; then
# User did not enter a project directory; exit with an error message
echo "No project directory entered. Exiting."
exit 1
fi
# Call the function to list contents of the specified project directory
list_project_contents "$project"
echo "-----------------------------"
# Call the function to show Git repository details in the specified project directory
show_git_repo_details
echo "-----------------------------"
# Call the function to show current environment variables
show_env_vars
echo "-----------------------------"
# Check for specific directories within the specified project directory
check_project_directories "$project" "_posts"
echo "-----------------------------"
check_project_directories "$project" "_notebooks"
echo "-----------------------------"
check_project_directories "$project" "images"
# Indicate that the system check is complete
echo "System check complete."
We have provided the output from the second script.
Remember Forever Quiz
Terminal Before and After rm-rf command
Before rm -rf
After rm -rf
Successful Portfolio Running on Browser
Successful Student Repository in Browser
CSP Help
- Avanthika, Anusha, and I helped Katherine and Soni with their portfolio/student repositories.