Skip to content

Instantly share code, notes, and snippets.

View jimdiroffii's full-sized avatar
🏠
Working from home

Jim Diroff II jimdiroffii

🏠
Working from home
View GitHub Profile
@jimdiroffii
jimdiroffii / lowercase-rename.sh
Created April 16, 2025 17:21
Rename all files in a directory to its lowercase equivalent, skip if a duplicate filename already exists
#!/usr/bin/env bash
# Just comment this out to run the script within the target directory.
cd /mnt/example || exit 1
for f in *; do
lower="$(echo "$f" | tr '[:upper:]' '[:lower:]')"
if [[ "$f" != "$lower" ]]; then
if [[ -e "$lower" ]]; then
@jimdiroffii
jimdiroffii / update-links.sh
Created April 17, 2025 17:29
Find all symlinks and change their link path
@jimdiroffii
jimdiroffii / wheelhouse.sh
Last active April 18, 2025 04:53
Maintain a Python wheelhouse across different machines. I'm using this for VM data disks, where the VM is only used on one host at a time, and the data disk is transferred between hosts.
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Path to the data disk
DATA_DISK="/mnt/data"
WHEELHOUSE_PATH="$DATA_DISK/wheelhouse"
PIP_CONF_PATH="$DATA_DISK/pip/pip.conf"
mountpoint -q "$DATA_DISK" || { echo "Error: $DATA_DISK not mounted"; exit 1; }
@jimdiroffii
jimdiroffii / MercuryViewingScript-Miami.ssc
Created April 18, 2025 01:57
A Stellarium script for finding the best date and time for viewing Mercury. The script tries to find when Mercury will be at least 5 degrees above the horizon, at least 0.0 magnitude, and within an hour of sunset or sunrise. The script is centered on Miami, Florida, and set to check for specific dates. Most variables need adjustment to work.
//////////////////////////////////////////////////////////////////////////////
// Stellarium Script: Mercury Twilight Search
// Date Range: Feb 10, 2025 – Apr 30, 2025
// Time Step: 5 minutes
// Location: Miami (lat: 25.7617, lon: -80.1918), ignoring DST complexities.
//////////////////////////////////////////////////////////////////////////////
// ------------------------ USER CONFIGURATION ------------------------
// Observing location