Skip to content

Instantly share code, notes, and snippets.

View kzndotsh's full-sized avatar

kzndotsh kzndotsh

View GitHub Profile
@kzndotsh
kzndotsh / sortTorrentsByTracker.ps1
Last active September 18, 2022 17:42
sortTorrentsByTracker.ps1
<#
sortTorrentsByTracker.ps1
Sort .TORRENT files into subdirectories named after the tracker indicated in the file
Place this powershell script inside your /torrents directory, run the script and wait.
When finished, you will find all torrents organized into sub directories per tracker.
#>
$allfiles = gci "*.torrent"
$ToNatural= { [regex]::Replace($_, '\d+',{$args[0].Value.Padleft(20)})} # Define natural sort method
@kzndotsh
kzndotsh / deleteEmptyFoldersRecursively.ps1
Created May 23, 2022 20:49
deleteEmptyFoldersRecursively.ps1
# Set to true to test the script
$whatIf = $false
# Remove hidden files, like thumbs.db
$removeHiddenFiles = $true
# Get hidden files or not. Depending on removeHiddenFiles setting
$getHiddelFiles = !$removeHiddenFiles
# Remove empty directories locally
@kzndotsh
kzndotsh / moveFilteredFilesToFolders.ps1
Created May 24, 2022 18:47
moveFilteredFilesToFolders.ps1
$items = gci .\ -Recurse -File -Include *480p*, *720p*, *1080p*
foreach($item in $items) {
if($item.Name -like "*480p*") {
Move-Item -LiteralPath $item 'G:\path\480p'
} elseif($item.Name -like "*720p*") {
Move-Item -LiteralPath $item 'G:\path\720p'
} elseif ($item.Name -like "*1080p*") {
Move-Item -LiteralPath $item 'G:\path\1080p'
@kzndotsh
kzndotsh / alpha-organize.sh
Created September 19, 2023 14:57
alpha-organize.sh
#!/bin/bash
# alpha-organize.sh
#####################
# The following script is to help organize a directory of directories into alphabetical groups based on their initial characters
# This is useful for organizing a large directory of movies into alphabetical groups for easier importing into Radarr
#####################
# Set the source directory - this is the directory that contains the movies to be organized, this directory should contain only directories
@kzndotsh
kzndotsh / dropdown-terminal.sh
Created September 19, 2023 14:58
dropdown-terminal.sh
#!/bin/bash
# Controls a dropdown terminal for use in i3wm
DISPLAY_WIDTH=1920
DISPLAY_HEIGHT=1080 # May be usefull...
TERMINAL_WIDTH=900
TERMINAL_HEIGHT=400
TERMINAL_X=$(( (DISPLAY_WIDTH - TERMINAL_WIDTH)/2 ))
TERMINAL_Y=500
@kzndotsh
kzndotsh / find-corrupted-videos.sh
Created September 19, 2023 14:58
find-corrupted-videos.sh
#!/bin/bash
root="."
filecount=$(find "$root" -type f | wc -l)
find "$root" -iname \*.avi -o -iname \*.mp4 -o -iname \*.mkv -o -iname \*.m4v -o -iname \*.wmv -o -iname \*.mov -o -iname \*.mpg -o -iname \*.mpeg -o -iname \*.wma -o -iname \*.asf -o -iname \*.asx -o -iname \*.rm -o -iname \*.3gp -o -iname \*.0gm | {
processed=0
corrupt=0
while read -r pathname
do
if ! ffprobe -v quiet -show_error -i "$pathname"
then
@kzndotsh
kzndotsh / find-missing-audio.sh
Created September 19, 2023 15:01
find-missing-audio.sh
#!/bin/bash
# Logging needs if I recall corectly
# Set the path to the directory where you want to move the files with missing audio
target_dir=/path/to/target
# Set the path to the log file
log_file=/path/to/log
@kzndotsh
kzndotsh / group-images-by-size.sh
Created September 19, 2023 15:01
group-images-by-size.sh
#!/bin/bash
# Define the directory containing the images to sort
DIR=/path/to/images
# Define the maximum dimensions for each category
BIG_MAX_WIDTH=1024
BIG_MAX_HEIGHT=1024
SMALL_MAX_WIDTH=512
SMALL_MAX_HEIGHT=512
@kzndotsh
kzndotsh / mv-dirs-with-plus2i.sh
Created September 19, 2023 15:02
mv-dirs-with-plus2i.sh
#!/bin/sh
## Move dirs containing more than 1 file to a specific dir
## initialize newdir from 1st argument (or default: OOOO3_MORE_THAN_ONE)
newdir="${1:-dupes}"
## set your complete path from 2nd arg (or '.' by default)
cmpltpath="${2:-.}"
@kzndotsh
kzndotsh / postman-on-arch.sh
Created September 19, 2023 15:02
postman-on-arch.sh
#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman