More updates!
This commit is contained in:
parent
3967e285b6
commit
c501597c19
10 changed files with 66 additions and 86 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
# This Repo has Moved!
|
# Scripts
|
||||||
|
|
||||||
This repository has been moved to a [new location!](https://git.oitsjustjose.com/me/Scripts)
|
A set of scripts for multiple platforms that I've made. Made without AI, of course.
|
||||||
|
|
|
||||||
29
linux/convert-heic.sh
Executable file
29
linux/convert-heic.sh
Executable file
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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()
|
|
||||||
|
|
@ -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)
|
|
||||||
0
linux/shell/setup/setup_jarscan.sh
Normal file → Executable file
0
linux/shell/setup/setup_jarscan.sh
Normal file → Executable file
0
linux/shell/setup/setup_makerand.sh
Normal file → Executable file
0
linux/shell/setup/setup_makerand.sh
Normal file → Executable file
0
linux/shell/setup/setup_uuid.sh
Normal file → Executable file
0
linux/shell/setup/setup_uuid.sh
Normal file → Executable file
0
linux/shell/setup/setup_wifiqr.sh
Normal file → Executable file
0
linux/shell/setup/setup_wifiqr.sh
Normal file → Executable file
35
linux/sync.sh
Executable file
35
linux/sync.sh
Executable file
|
|
@ -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
|
||||||
|
|
@ -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}")
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue