Skip to content

Instantly share code, notes, and snippets.

@nyo
nyo / add_date_overlay.sh
Created January 4, 2025 19:12
wrote this script to help me do my yearly 1 second everyday video (shot on iPhone; tested on macOS)
#!/bin/bash
input_dir="."
output_dir="$input_dir/processed"
font_file="/System/Library/Fonts/Menlo.ttc"
# Create the output directory if it doesn't exist
mkdir -p "$output_dir"
# Enable case-insensitive globbing for file matching
@nyo
nyo / get_youtube_video_subtitles.gs
Last active January 30, 2025 20:57
a Google Apps Script to fetch YouTube video subtitles from URL
const API_KEY = "YOUR_API_KEY";
/**
* Retrieves the video ID from a YouTube video link.
* @param {string} videoUrl
* @returns {string} videoId
*/
function getYouTubeVideoId(videoUrl) {
const regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
const match = videoUrl.match(regExp);
@nyo
nyo / mp3s2wav.sh
Last active October 11, 2020 14:18
since Ableton isn't able to play mp3s because of last macOS update, I made this script to convert all .mp3 files from a specified directory to .wav
#!/bin/bash
[ $# -eq 0 ] && { echo "Usage: $0 <path>"; exit 1; }
# /!\ adjust path here!
LOG_FILE="/path/to/mp3s2wav-$(date +%s).log"
echo "[$(date)] Start converting..." | tee -a "$LOG_FILE"
# loop recursively through all .mp3 files under given path