Skip to content

Instantly share code, notes, and snippets.

View trapexit's full-sized avatar

trapexit

View GitHub Profile
@trapexit
trapexit / file-pruner
Created February 16, 2023 03:46
remove files from a path till storage is below a threshold
#!/usr/bin/env python
import os
import argparse
import stat
import psutil
def build_file_list(basepath):
file_list = []
@trapexit
trapexit / yt-dl
Created August 24, 2019 15:53
youtube-dl setup for archiving
#!/bin/bash
if [ "${1}" == "-d" ]; then
ARCHIVE="--download-archive ${2}"
shift
shift
fi
youtube-dl \
${ARCHIVE} \
@trapexit
trapexit / convert-for-streaming-cfr
Created June 21, 2019 20:45
Script to preprocess videos for HLS or RTMP streaming
#!/bin/bash
# This is useful when storage is cheaper than compute and you wish to stream
# to later stream to a RTMP target as cheaply as possible.
# To stream
# ffmpeg -re -i <source> -c copy -bsf:a -bsf:a aac_adtstoasc -f flv rtmp://...
RES_X=1920
RES_Y=1080
@trapexit
trapexit / rclone-to
Created June 21, 2019 20:40
script for simplifying backup with rclone
#!/bin/bash
USERAGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
TARGET="${1}"
path="${2}"
backup_dir="${TARGET}:archive/$(date +%Y)/$(date +%F_%T)/${path}"
rclone \
--checkers=3 \
@trapexit
trapexit / split-ovpn
Created August 22, 2016 17:58
Extract certs and keys from OpenVPN ovpn file
#!/bin/bash
OVPN_FILE="${1}"
OUTPUT_PREFIX="${2}"
if [ ! -e "${OVPN_FILE}" ]; then
echo "File not found: ${OVPN_FILE}"
exit 1
fi