Skip to content

Instantly share code, notes, and snippets.

View jackbdu's full-sized avatar

Jack B. Du jackbdu

View GitHub Profile
@jackbdu
jackbdu / batch-traceroute.sh
Last active September 19, 2024 04:24
Initiating traceroute to a list of hosts specified in hosts.txt and logging the outputs to separate files for each host.
#!/bin/bash
# -----------------------------------------------------------------------------
# Script: batch-traceroute.sh
# Description: A script to run multiple traceroutes in the background, track their
# completion status, and log the results with timestamps.
#
# Created by: Jack B. Du (github@jackbdu.com)
# with help from OpenAI ChatGPT
# Date: Sept 18, 2024
# -----------------------------------------------------------------------------
@jackbdu
jackbdu / launching-google-chrome-with-a-specified-url.md
Last active May 11, 2024 04:52
Shell script launching Google Chrome with a specified URL
  1. Create a plain text file named click_me_to_start (make sure not to include any extension, as it may cause issue in starting up the script in macOS) and paste below text (remember modify your url accordingly):
#!/bin/bash

# Specify the URL you want to open in kiosk mode
url="https://example.com"

# Check if Google Chrome is installed
if [ -e "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
@jackbdu
jackbdu / redirect-generator.sh
Last active March 18, 2024 23:35
Generating simple redirect index.html in docs/subfolder in GitHub repo
#!/bin/bash
#
# Redirect Generator
#
# Author: Jack B. Du (github@jackbdu.com)
#
# Usage:
# ./redirect-generator.sh # Interactive mode: prompts for folder name and URL.
# ./redirect-generator.sh --update-from-csv # Update redirects from CSV file interactively.
# ./redirect-generator.sh --update-from-csv --confirm-all # Update redirects from CSV file without confirmation prompts.
@jackbdu
jackbdu / batch-download.sh
Last active March 18, 2024 01:59
Run the JavaScript in console to get a list of URLs to all sketches by a user and download them all with a shell script
#!/bin/bash
# Path to the file containing the list of filenames and URLs
urls_file="filenames_and_p5js_sketch_urls.txt"
# Check if the file exists
if [ ! -f "$urls_file" ]; then
echo "Error: File '$urls_file' not found."
exit 1
fi