From c501597c197194b6b29ff98d8b70b1115f153034 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Fri, 19 Jun 2026 11:40:49 -0500 Subject: [PATCH] More updates! --- README.md | 4 +-- linux/convert-heic.sh | 29 ++++++++++++++++++++ linux/shell/python/convert_heic.py | 19 ------------- linux/shell/python/wifi_qr.py | 24 ----------------- linux/shell/setup/setup_jarscan.sh | 0 linux/shell/setup/setup_makerand.sh | 0 linux/shell/setup/setup_uuid.sh | 0 linux/shell/setup/setup_wifiqr.sh | 0 linux/sync.sh | 35 ++++++++++++++++++++++++ linux/update-readmes.py | 41 ----------------------------- 10 files changed, 66 insertions(+), 86 deletions(-) create mode 100755 linux/convert-heic.sh delete mode 100644 linux/shell/python/convert_heic.py delete mode 100644 linux/shell/python/wifi_qr.py mode change 100644 => 100755 linux/shell/setup/setup_jarscan.sh mode change 100644 => 100755 linux/shell/setup/setup_makerand.sh mode change 100644 => 100755 linux/shell/setup/setup_uuid.sh mode change 100644 => 100755 linux/shell/setup/setup_wifiqr.sh create mode 100755 linux/sync.sh delete mode 100644 linux/update-readmes.py diff --git a/README.md b/README.md index 5f4b3fb..31f01e4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# This Repo has Moved! +# Scripts -This repository has been moved to a [new location!](https://git.oitsjustjose.com/me/Scripts) \ No newline at end of file +A set of scripts for multiple platforms that I've made. Made without AI, of course. diff --git a/linux/convert-heic.sh b/linux/convert-heic.sh new file mode 100755 index 0000000..5c93f1d --- /dev/null +++ b/linux/convert-heic.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +if [[ -z "$1" ]]; then + echo "Missing required argument [heif_file]!" + exit 1 +fi + +# Set up the python environment +mkdir -p /tmp/shell-scripts +python3 -m venv /tmp/shell-scripts/env > /dev/null 2>&1 +# Install reqs +/tmp/shell-scripts/venv/bin/pip install pillow pillow-heif > /dev/null 2>&1 +# Finally run the script +/tmp/shell-scripts/venv/bin/python << EOF +from PIL import Image +from pillow_heif import register_heif_opener +from pathlib import Path +from sys import exit + +path = Path("$1").resolve() +if path.suffix.lower() != ".heic": + exit(0) + +register_heif_opener() +im = Image.open(path) +im.save(path.with_suffix(".jpeg"), quality=100) +EOF + + diff --git a/linux/shell/python/convert_heic.py b/linux/shell/python/convert_heic.py deleted file mode 100644 index 15eb3db..0000000 --- a/linux/shell/python/convert_heic.py +++ /dev/null @@ -1,19 +0,0 @@ -from PIL import Image -from pillow_heif import register_heif_opener -from pathlib import Path -from sys import argv - -def main() -> None: - if len(argv) < 2: - return - - path = Path(argv[1]).resolve() - if path.suffix.lower() != ".heic": - return - - register_heif_opener() - im = Image.open(path) - im.save(path.with_suffix(".jpeg"), quality=100) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/linux/shell/python/wifi_qr.py b/linux/shell/python/wifi_qr.py deleted file mode 100644 index 5255a3e..0000000 --- a/linux/shell/python/wifi_qr.py +++ /dev/null @@ -1,24 +0,0 @@ -from argparse import ArgumentParser - -from utils import install_package - -try: - import qrcode -except ImportError: - install_package("qrcode[pil]") -finally: - import qrcode - - -def main(args): - img = qrcode.make(f"WIFI:S:{args.ssid};T:WPA;P:{args.passwd};;") - img.save(args.output) - - -if __name__ == "__main__": - parser = ArgumentParser(prog="WiFi QR Generator", description="Creates QR Codes to join a Password Protected WiFi Network") - parser.add_argument("ssid", help="The SSID of the WiFi Network to connect to") - parser.add_argument("passwd", help="The passphrase of the WiFi Network to connect to") - parser.add_argument("-o", "--output", required=True, help="Where to save the resulting image to") - args = parser.parse_args() - main(args) diff --git a/linux/shell/setup/setup_jarscan.sh b/linux/shell/setup/setup_jarscan.sh old mode 100644 new mode 100755 diff --git a/linux/shell/setup/setup_makerand.sh b/linux/shell/setup/setup_makerand.sh old mode 100644 new mode 100755 diff --git a/linux/shell/setup/setup_uuid.sh b/linux/shell/setup/setup_uuid.sh old mode 100644 new mode 100755 diff --git a/linux/shell/setup/setup_wifiqr.sh b/linux/shell/setup/setup_wifiqr.sh old mode 100644 new mode 100755 diff --git a/linux/sync.sh b/linux/sync.sh new file mode 100755 index 0000000..cfdd166 --- /dev/null +++ b/linux/sync.sh @@ -0,0 +1,35 @@ +#!/bin/bash +job_name="$1" +src="$2" +dest="$3" + +# Validate required params. +if [[ -z "$job_name" || -z "$src" || -z "$dest" ]]; then + echo "Missing required parameter!" + echo " Usage: sync.sh [name] [source] [destination]" + exit 1 +fi + +# Bail if the lockfile already exists +if [ -f "/tmp/$job_name" ]; then + exit 0 +fi + +# Bail if the source path doesn't exist +if [ ! -d "$src" ]; then + echo "Source path '$src' does not exist!" + exit 1 +fi + +# Bail if the destination path doesn't exist +if [ ! -d "$dest" ]; then + echo "Destination path '$dest' does not exist!" + exit 1 +fi + +# Create the lockfile +touch /tmp/$job_name +# Archive, Partial w/ Progress & Preserve Permissions +rsync -apP "$src" "$dest" +# Remove the lockfile when done +rm /tmp/$job_name diff --git a/linux/update-readmes.py b/linux/update-readmes.py deleted file mode 100644 index d917700..0000000 --- a/linux/update-readmes.py +++ /dev/null @@ -1,41 +0,0 @@ -from subprocess import run, Popen, PIPE - -import json -import os -import shutil - -NEW_REPO_BASE_NAME="https://git.oitsjustjose.com/me" - -# Grab each github repo's URL and Name -proc = Popen(["gh", "repo", "list", "--no-archived", "-L", "500", "--json", "url,name"], stdout=PIPE, stderr=PIPE) -# Parse into JSON -stdout, stderr = proc.communicate() -repo_data = json.loads(stdout) - -# Iterate over all repos, cloning, updating the README, committing, pushing, then deleting the clone -for repo in repo_data: - url = repo["url"] - dirname = repo["name"] - - # clone the repo - run(f"git clone {url}", shell=True, check=True) - - readme_filenm = "README.md" - for file in os.listdir(dirname): - if file.lower() == "readme.md": - readme_filenm = file - break - - print(f"Found readme file at ./{dirname}/{readme_filenm}") - - new_loc = f"{NEW_REPO_BASE_NAME}/{dirname}" - with open(f"./{dirname}/{readme_filenm}", "w", encoding="utf-8") as fh: - fh.write(f"# This Repo has Moved!\n\nThis repository has been moved to a [new location!]({new_loc})") - - run(f"git -C {dirname} add {readme_filenm}", shell=True) - run(f"git -C {dirname} commit -m '[AUTOMATED] Updated README to redirect to {new_loc}'", shell=True) - run(f"git -C {dirname} push", shell=True) - - shutil.rmtree(dirname) - print(f"Successfully pushed the new redirected repo for {dirname}") -