This file contains 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
#!/usr/bin/env python3 | |
import re, sys | |
from pathlib import Path | |
def fix_srt_time_format(sub_file_name: str): | |
"""Fix time format in SubRip srt subtitle files. | |
This script will: | |
* replace `.` delimiter between seconds and miliseconds with expected `,` | |
* replace leading `0:` in timestamps with expected `00:` |
This file contains 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
#!/usr/bin/env python3 | |
import glob | |
import subprocess | |
from datetime import date, datetime, time, timedelta | |
from typing import List | |
# pip install -U pyexifinfo | |
# https://github.com/guinslym/pyexifinfo | |
import pyexifinfo as exif |
This file contains 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
var raw_links = document.querySelectorAll(".results .item-ttl a") | |
var torrent_links = []; | |
for (var i = 0; i < raw_links.length; i++) { | |
var release_name = raw_links[i].attributes.href.value.split('/')[2]; | |
torrent_links.push("https://archive.org/download/" + release_name + "/" + release_name + "_archive.torrent"); | |
}; | |
console.log(torrent_links.join('\r\n')); |
This file contains 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
function renamevideofiles(){ | |
input_ext="mkv" | |
dry_mode= | |
local OPTIND o d | |
while getopts :d: name; do | |
case "${name}" in | |
d) | |
dry_mode=1 | |
input_ext="${OPTARG}" | |
;; |
This file contains 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
# get latest version | |
wget https://github.com/skeeto/endlessh/archive/master.zip | |
unzip master.zip | |
cd endlessh-master/ | |
# compile | |
make | |
# install | |
sudo cp endlessh /usr/local/bin/ |
This file contains 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
function dlistmp3() { | |
youtube-dl -j --flat-playlist "${1}" |\ | |
jq -r '.id' |\ | |
sed 's_^_https://www.youtube.com/watch?v=_' |\ | |
parallel -j4 'youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 192K --embed-thumbnail --add-metadata --no-post-overwrites --ignore-errors {}' | |
} |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import shutil | |
def what_is_inside(types) -> str: | |
result = "" | |
if "mp3" in types and "flac" in types: | |
result = "both" | |
if "mp3" in types and not "flac" in types: |
This file contains 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
#! /usr/bin/python | |
"""Extract links to music websites from Mastodon's outbox.json | |
outbox.json contains all of your toots | |
""" | |
import json | |
from bs4 import BeautifulSoup as Soup | |
def extract_music_urls(): | |
with open("outbox.json") as f: |
This file contains 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
alias stabilize=stabilize | |
function stabilize() { | |
type ffmpeg >/dev/null 2>&1 || { echo >&2 "ffmpeg is required but it's not installed."; return 1; } | |
video="${1}" | |
filename="${1%.*}" | |
extension="${1##*.}" | |
output="${filename}-stabilized.${extension}" | |
# calculate transformation vectors | |
ffmpeg -nostdin -hide_banner -i "${video}" -vf vidstabdetect=stepsize=6:shakiness=8:accuracy=15:result=transform_vectors.trf -f null - |
This file contains 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
alias trim=trim | |
function trim() { | |
if [ "$#" != "3" ]; then | |
echo "Please provide all 3 arguments: 'filename start duration'" | |
return 1 | |
fi | |
video="${1}" | |
filename="${1%.*}" | |
extension="${1##*.}" |
NewerOlder