Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / internet_radio_stream_aliases.sh
Created October 23, 2012 15:16
Internet Radio Streams Via Command Line
# 1. Install mplayer command line (via Brew, Macports, or APT)
# 2. Add the following aliases to ~/.profile
# 3. Type `source ~/.profile`
# 3. Type `news` or `current` to listen in your terminal
alias news="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/news.pls" # MPR News
alias current="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/the_current.pls" # The Current
alias classical="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/classical.pls" # Classical MPR
alias localcurrent="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/local.pls" # Local Current
alias heartland="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls" # MPR Radio Heartland
@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
@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 / 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 / git-log-to-tsv.sh
Created June 6, 2012 20:53
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@pwenzel
pwenzel / rbenv-fish-setup.md
Last active September 13, 2022 01:50
Installing rbenv in a fish environment

Here we use Homebrew to install rbenv:

  1. brew update; and brew install rbenv ruby-build
  2. Add ~/.rbenv/shims to your PATH
  3. Include the contents of completions/rbenv.fish in your Fish config.
  4. Run rbenv install 2.2.2 and rbenv rehash
  5. Run rbenv global 2.2.2

Now you can run gem install bundler and bundle install within your Ruby project.

@pwenzel
pwenzel / lamp-stack-osx-virtualhostx.md
Last active April 8, 2022 04:00
LAMP stack on OSX with Homebrew, built-in Apache, multiple PHP versions, VirtualhostX optional

This guide shows how to set up a PHP and MySQL development environment using OSX's built-in Apache, using Homebrew to install necessary components. With this strategy, you can use different versions of PHP for certain virtual hosts.

VirtualHostX is a convenient way to manage development sites, but not required.

Install PHP and MySQL with Homebrew

brew update
brew install php56
brew install php56-mcrypt
brew install mysql
@pwenzel
pwenzel / Makefile
Last active October 12, 2021 13:29
Wordpress Makefile Workflow
.PHONY: install
install: clean wordpress phpunit wp-cli
git submodule init;
@echo "\n\nNOTICE: You may need to configure a MySQL database for your Wordpress installation. Just run:"
@echo " mysql -u root -p;"
@echo " CREATE DATABASE example_site; \n"
wordpress: latest.tar.gz
tar -zxvf latest.tar.gz;
@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 / 0. mamp_install_composer.bash
Last active March 30, 2021 16:47
Global composer install for MAMP Users on OSX
# Global composer install for MAMP Users on OSX
# http://getcomposer.org/doc/00-intro.md#globally
# For PHP 5.4 Use:
# alias php=/Applications/MAMP/bin/php/php5.4.4/bin/php;
alias php=/Applications/MAMP/bin/php/php5.3.6/bin/php;
curl -sS https://getcomposer.org/installer | php;
mv composer.phar /usr/local/bin/composer;
composer help;