Skip to content

Instantly share code, notes, and snippets.

View ConorShore's full-sized avatar

Conor Shore ConorShore

View GitHub Profile
@ConorShore
ConorShore / gist:587cf82d0742453509df31cf7c87ac3c
Created August 21, 2023 20:01
One liner for extracting YouTube IDs from filenames when enclose in []. Useful for yt-dlp’s download archive option
ls -R | grep -o -P '.{0,11}\]' | cut -c 1-11 | sort -u | xargs -Iytid echo "youtube ytid" > .Downloaded
@ConorShore
ConorShore / cutplexuserdata.sh
Created April 4, 2023 09:21
Cut plex data from one user to another
#!/bin/bash
sudo apt install sqlite3
echo "Please enter the path to your database, should look something like this"
echo "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/"
read -p "Full path to database [/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/]: " DB_LOC
DB_LOC=${DB_LOC:-/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/}
FULL_DB_LOC=${DB_LOC}com.plexapp.plugins.library.db
sudo cp "${FULL_DB_LOC}" "${FULL_DB_LOC}.backup"
sqlite3 "${FULL_DB_LOC}" 'SELECT id, name FROM accounts;'
read -p "User id to copy info FROM: " FROM_ID
#!/bin/bash
# Make sure to run this script from where your docker-compose.yml is
docker volume ls | grep sonarqube | cut -d ' ' -f 6 | xargs docker volume inspect | grep Mountpoint | cut -d '"' -f 4 | xargs sudo zip -r sonarbk.zip
docker-compose down
docker-compose pull
docker-compose up -d --remove-orphans
docker image prune -f
Credit to ninjaroach on reddit for this one (https://www.reddit.com/r/fortinet/comments/cn84v0/cant_remove_forticlient_6/)
Run the below command in a elevated command prompt
Note that it will restart without warning during this process
It took a little while until it looked alive, so don't be put off if it looks like it is hanging, just leave it running
wmic product where "name like 'Forti%%'" call uninstall /nointeractive
find . -name "server.properties" | xargs cat | grep server-port | cut -f 2 -d "=" | xargs -n 1 -Ihere upnpc -r here here TCP
#Search current directory and subdirectories for minecraft servers and uses uPnP to automatically port forward them all
#Method
#find the server.properties files, search the with grep for the server-port field, then copy that into upnpc
@ConorShore
ConorShore / ESXI_iSCSI_Wait_Till_Mount.sh
Last active November 30, 2020 17:11
A script that boots a VM, waits till it reports that it is on, then forces iSCSI rescans until a target devices is only. Very useful for iSCSI from internal VM
#Originally inspired by this script https://jc-lan.org/2020/02/05/script-to-automatically-rescan-and-mount-software-iscsi-datastores-on-startup-for-esxi/
#This original script didn't work for me, as it didn't wait until the vm was confirmed on, so would boot loop if the vm didn't boot first time
#Designed to go in the ESXI host's local.sh file. This will mean vm autostart will not occur till after this script has executed
#Establish our timer
count=0
#Power on the guest VM with the specified Vmid
@ConorShore
ConorShore / Quanta_D51B-2U_IPMI_FanController.sh
Created November 30, 2020 17:03
A very simple fan controller to control D51B-2U fans via the IPMI interface
#!/bin/bash
#Conor Shore 2020
#Basic Fan Control Script For Quanta D51B-2U Server via IPMI
#designed to be used in init.d
### BEGIN INIT INFO
# Provides: IPMI Fan Controller
# Required-Start: $all
# Required-Stop: