This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisites | |
# - the `hln` command, which on mac can be installed via `brew install hardlink-osx` | |
# - various time machine cleaning scripts: tmdejunk, tmdeempty, tmdeduphl, tmdeduphldir | |
# In the time machine volume, under Backups.backupdb/<Machine Name> | |
# Note: this only prunes the hardlinks in the /Users/ folder of each backup snapshot. | |
# The following code will find the /Users folder within each snapshot, and then run the tmdejunk command, followed by tmclean command. It will prune empty folders, prune hardlink folders, then delete hardlink files, then prune empty folders again. This process can take several hours depending on how many snapshots you have backed up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will compress the entire pwd, dot files included. Archive placed in pwd | |
sudo 7z a -t7z [FILENAME.7z] -m0=lzma2 -mx=9 -aoa . | |
# No compression, just copy. Also, splits into 900MB parts for easier transfer over internet | |
7z a -t7z -mx=0 -v900m [FILENAME.7z] [files...] | |
# Same as previous, but encrypt headers (file names, and password protected | |
7z a -t7z -mx=0 -mhe=on -p -v900m [FILENAME.7z] [files...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem Check if it is installed to begin with. | |
DISM /Online /Get-Features /Format:Table | findstr -i netfx3 | |
rem Install .NET 3(.5) | |
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the -s argument protects what's inside the quotation marks. This is crucial when there are spaces in the path | |
rsync -avP -s --rsync-path=/bin/rsync ~e/Videos/Videos/2013/h265/* "superman@homenas:/volume1/PlexMedia/Home Videos/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For mp4, the recorded date can exist as Recorded date or Tagged date. If you want to do this for all the files in a folder, use the following command: | |
for file in *.mp4; do touch -t "$(mediainfo "$file" | grep --color=never -iEm 1 '(Recorded date|Tagged date)' | sed -r 's/.*([0-9]{4})-([0-9]{2})-([0-9]{2})[T ]([0-9]{2}):([0-9]{2}):([0-9]{2}).*/\1\2\3\4\5.\6/')" "$file"; done | |
# Some videos will not have that date in the metadata, so you'll have to correct it yourself | |
touch -t CCYYMMDDHHMM[.ss] file.ext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note this only works on newer versions of ffmpeg (3.4.2+) | |
ffmpeg -i file.mp4 -codec copy -vtag hvc1 -map 0:0 -map 0:1 file.mp4 | |
# see what codec id (fourcc code) your video has | |
mediainfo "file.ext" | grep -im 2 'codec id' | tail -n1 | |
# or a list of files | |
for file in *.mp4; do echo "$file" "$(mediainfo "$file" | grep -im 2 'codec id' | tail -n1)"; done | |
# Fix the fourcc code hev1 -> hvc1. Note: this will overwrite the timestamp, so make sure to save it or restore it | |
# Added _fixed suffix as to not overwrite original in case it doesn't work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Will find files based on if the magic file type 'file $file.ext' matches pattern, then print the filename | |
# e.g. look for sqlite dbs | |
find . -type f -exec sh -c 'case "$(file -b "$0")" in *"SQLite"*) true;; *) false;; esac' {} \; -print |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compare mediainfo output for two files. This requires dwdiff (or cwdiff) | |
dwdiff -c <(mediainfo file1.mp4) <(mediainfo file2.mp4) | |
# Last command has a custom script I wrote, diffmedia, as follows: | |
diffmedia file1.mp4 file2.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PhotoSweeper X database (sqlite3) is located in: | |
-- ~/Library/Containers/com.overmacs.photosweeperpaddle/Data/Library/Application Support/PhotoSweeper X/Library.pslib | |
-- First query gives all folderids that are subfolders of folderid 351 | |
CREATE TABLE folders WITH RECURSIVE folds(x) AS (VALUES(351) UNION SELECT folderID FROM PSFolder, folds WHERE PSFolder.parentFolderID=folds.x) SELECT * FROM folds ORDER BY x; | |
-- If you're curious how many files are in this folder structure, run this | |
SELECT count(*) FROM PSFile WHERE parentFolderID IN folders; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This helps if you have several sources for a package, and are not sure which one is installed or available | |
# For instance, if a pacakge is available on ubuntu main and a ppa both. | |
apt-cache policy [pkg-name] |