Skip to content

Instantly share code, notes, and snippets.

View joshuacurtiss's full-sized avatar

Josh Curtiss joshuacurtiss

View GitHub Profile
@joshuacurtiss
joshuacurtiss / site-keyword-search.sh
Last active July 28, 2026 14:27
Reads a sitemap XML file and scans all pages for specified keywords. Caches pages so that rescans can be done quickly and without overloading sites.
#!/bin/bash
#
# This script checks a sitemap for pages that contain any of the specified keywords in
# their main content, excluding menus, headers, and footers.
#
# It accomplishes this by fetching and parsing the sitemap with curl, extracting URLs with
# xmllint, and then for each URL:
# 1. Fetching the page content with curl.
# 2. Using perl to remove <nav>, <header>, and <footer> sections
@joshuacurtiss
joshuacurtiss / install-wine-nws.sh
Last active July 24, 2026 18:27
Install NW Scheduler on macOS using Wine.
#!/usr/bin/env zsh
#
# Installs NW Scheduler Desktop (https://nwscheduler.com) on macOS reliably, using Wine.
# Be patient! This process can take several minutes before the NWS installer is launched.
#
# Requirements:
# - Install Homebrew (https://brew.sh)
# - It will make sure to install Wine, Winetricks, and XQuartz if they are not already installed
# - It will require a downloaded copy of NWS installer in the directory
@joshuacurtiss
joshuacurtiss / tunnel_container.sh
Created February 17, 2025 16:31
Set up a temporary tunnel for a port to a container
function tunnel_container () {
local container=$1
local port=${2:-3306}
local network=
if [[ -z $container || $container == -h || $container == --help ]]; then
echo 'USE: tunnel_container <container> [port]' >&2
return
elif ! network=$(docker container inspect -f '{{range $k, $v := .NetworkSettings.Networks}}{{$k}}{{break}}{{end}}' "$container") > /dev/null 2>&1; then
echo "Container $container does not exist." >&2
return
@joshuacurtiss
joshuacurtiss / restore-mssql-database-docker.sh
Last active June 3, 2026 16:56
Restores a MSSQL backup to a Docker instance of MSSQL for convenient viewing.
#!/bin/bash
#
# Starts up an ephemeral Docker container of MSSQL and restores your provided backup file into it,
# using the filename as the database name. When it's done, you can connect to the container to
# browse and query the database.
#
function rand_char() {
start=${1:-65} # Default to capital letters
const article = `
The Industrial Revolution had several roots, one of which was a commercial revolution that, beginning as far back as the sixteenth century, accompanied Europe’s expansion overseas.
Both exports and imports showed spectacular growth, particularly in England and France.
An increasingly larger portion of the stepped-up commercial activity was the result of trade with overseas colonies.
Imports included a variety of new beverages, spices, and ship’s goods around the world and brought money flowing back.
Europe’s economic institutions, particularly those in England, were strong, had wealth available for new investment, and seemed almost to be waiting for some technological breakthrough that would expand their profit-making potential even more.
The breakthrough came in Great Britain, where several economic advantages created a climate especially favorable to the encouragement of new technology.
One was its geographic location at the crossroads of international trade.
@joshuacurtiss
joshuacurtiss / convertMeetingRecording.ps1
Created February 22, 2017 04:33
Takes f4v video files of meeting recordings and converts them to mp4 files with ffmpeg. Copies the mp4 to one directory and moves the original f4v file to another.
#
# MEETING RECORDING SCRIPT, Joshua Curtiss 8/24/2016
#
# This script takes the meeting recordings (in the "Video" directory) and copies them
# into subdirectories (named after the date of the recording) in the "OneDrive\SLC MEETING VIDEOS"
# directory, converting them to MP4 with ffmpeg. Set this up as a scheduled task to require no
# further user involvement.
#
# Set up paths, make sure directories exist.
@joshuacurtiss
joshuacurtiss / publicip.csh
Created January 19, 2017 19:35
Script to get the public IP from DynDNS's checkip service.
#!/bin/csh
curl -s http://checkip.dyndns.org | awk '{print $6}' | awk ' BEGIN { FS = "<" } { print $1 } '