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
// In Chrome Dev-Tools, run the following commands, substituting the date for the earliest cutoff you want | |
earliest = new Date("2021-10-22T08:00:00Z"); // T08:00:00Z Means Midnight Pacific Time when CA is on UTC-800 | |
bc = $("bc-grouped-dates"); bc.children().filter( (i, el) => new Date($(el).data("datetime")) < earliest).remove(); bccr = $("bc-chat-room"); bccr.css("overflow", "visible"); bcip = $("bc-infinite-page"); bcip.css("overflow", "visible") |
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
#!/bin/bash | |
# If the functionality of a GNU command (vs BSD) is needed, instead of checking for $OSTYPE, check if command is installed. | |
# This method isn't perfect, because you could have the case where the preferred command isn't installed when you expect it to be | |
# (e.g. Mac has no gdate installed). Perhaps in combination with $OSTYPE for better coverage. | |
# This checks if gdate is installed (likely beacuse running in a Mac environment). If not, use the normal date command. | |
DATE=$(type -p gdate date | head -n 1) | |
# Execute the command |
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
SELECT * from files | |
WHERE hash IN ( | |
SELECT hash --, COUNT(source) | |
FROM | |
(SELECT *, COUNT(source) FROM files | |
GROUP BY hash, source) AS A | |
GROUP BY hash | |
HAVING COUNT(source) > 1) |
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
f[x_]:=x | |
f[5] ==> 5 | |
f[x: Quantity[_, unit_]?(CompatibleUnitQ[#, "feet"] &)]:=x (* Important that parameters in list do not have underscore *) | |
f[5] ==> f[5] | |
f[Quantity[5, "feet"]] ==> 5 ft | |
f[Quantity[5, "meters"]] ==> 5 m | |
f[Quantity[5, "pound"]] ==> f[5 lb] |
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] |
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
# 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
# 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
# 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
# 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 |
NewerOlder