Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / morphagene_reel_from_folder.fish
Last active January 3, 2023 23:20
Morphagene Reel Bulk Conversion
# Generate reels
for dir in (ls); mgreel --out "$dir reel.wav" $dir/*.wav; end
# check durations (should be 2.9 minutes or less, (e.g. 174 seconds or 2 minutes and 53 seconds)
for file in (ls *.wav); echo $file; afinfo $file | grep duration; end
# rename files mg0.wav, mg1.wav, mg2.wav, etc.
num=0; for i in *; do mv "$i" "mg$(printf '%01d' $num).${i#*.}"; ((num++)); done
@pwenzel
pwenzel / When Song Finishes, Pause.applescript
Created September 23, 2021 17:11 — forked from capnslipp/When Song Finishes, Pause.applescript
Pause Spotify after the current song finishes playing
(*
@author: Slipp Douglas Thompson
@purpose: Pauses Spotify after the current song finishes playing.
@todo: Optimize so it's more efficient.
@usage: Drop a compiled script (a .scpt file, converted with AppleScript Editor if this is a .applescript file) into ~/Library/Scripts/Applications/Spotify.
Ensure than “Show Script menu in menu bar” is enabled (which can be found in the AppleScript Editor preferences).
When playing a song in Spotify and wishing to stop the music when the track finished, choose “When Song Finishes, Pause” from the script menu, and then walk, walk away.
*)
tell application "Spotify"
log "“When Song Finishes, Pause”: player state is " & (player state)
@pwenzel
pwenzel / ffmpeg-avi-to-mp4.fish
Last active November 6, 2020 00:59
FFMPEG AVI to MP4
for file in *.avi; ffmpeg -n -i $file -strict -2 $file.mp4; end;
@pwenzel
pwenzel / oscilloscope-letters-module.c
Created October 30, 2019 14:45
oscilloscope-letters-module.c
// For use within OsciStudio by Jerobeam Fenderson
#include <OsciText.h>
SLIDER(which,0..37);
// Letters
OsciText text1("A");
OsciText text2("B");
OsciText text3("C");
@pwenzel
pwenzel / bulk_wave_to_raw.fish
Last active January 2, 2023 15:27
FFMPEG Convert Wave to Mono Raw Audio for Radio Music Eurorack Module. Test playback with ffplay.
# Bulk convert wave to mono raw audio for Radio Music Eurorack module
# Uses FFMPEG and Fish Shell
for file in *.wav;
set basename (string match -r "(.*)\.[^\.]*\$" $file)[2]
ffmpeg -i $file -f s16le -acodec pcm_s16le -ac 1 $basename.raw;
end;
@pwenzel
pwenzel / unserialize_clipboard.fish
Last active February 12, 2019 16:11
Fish shell function to unserialize php from the OSX clipboard.
# ~/.config/fish/functions/unserialize_clipboard.fish
# unserialize PHP from the clipboard
# based on https://gist.github.com/gregferrell/747642
function unserialize_clipboard
set STRING (pbpaste)
php -r "echo var_dump(unserialize('$STRING'));"
end
@pwenzel
pwenzel / handle_host_ping.fish
Last active November 8, 2018 21:22
Ping host and do something if it's down. Example showing how to use and/or operator in Fish shell
ping -q -c 1 bogus.local; and echo "pinging the host worked"; or echo "pinging the host didn't work"
ping -q -c 1 google.com; and echo "pinging the host worked"; or echo "pinging the host didn't work"
@pwenzel
pwenzel / concatenate_csv.sh
Created January 25, 2018 17:49
Concatenate CSV files with sed
# Concatenate CSV files to all.csv in parent directory
# Assumes they all have the same CSV header
# https://stackoverflow.com/questions/9633114/unix-script-to-remove-the-first-line-of-a-csv-file/9633203#9633203
sed 1q *.csv > ../all.csv
sed 1d *.csv >> ../all.csv
@pwenzel
pwenzel / TransmissionPushover.sh
Created May 22, 2016 01:30
Send iOS push notification when torrent is complete, via Pushover
#!/bin/sh
#
# Send push notification to pushover device when a torrent is complete.
#
# Requires: Pushover account, Transmission torrent client and curl.
#
# Get the API token from the pushover website.
# Change text output below if you wish.
# Set Transmission to start script when torrent is complete.
@pwenzel
pwenzel / ffmpeg-mkv-to-mp4.sh
Last active September 10, 2023 16:22
MKV and AVI to MP4 Conversion for Apple TV
# See also https://trac.ffmpeg.org/wiki/Encode/AAC
# direct copy
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
# direct copy video, but convert audio to AAC with default variable bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental output.mp4
# direct copy video, but convert audio to AAC with constant bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 320k output.mp4