Skip to content

Instantly share code, notes, and snippets.

@mcfadden
mcfadden / not.sh
Created January 5, 2021 14:19
Adds a red translucent X over the input file (emoji), and saves the result as a PNG
#!/bin/sh
if [ "$1" = "" ]
then
echo "Usage: $0 [input_file]" 1>&2
echo "Adds a red translucent X over the input file, and saves the result as a PNG"
exit 1
fi
NOT_DATA="iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDAgNzkuMTYwNDUxLCAyMDE3LzA1LzA2LTAxOjA4OjIxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+LUNEtwAAIABJREFUeJztvWmUVNeVJvrtc6eIzIgcIkcSlSWrjBAIIQRlAfITmdgmaUklVK9/vCrV6rWqyr16qC63n9s2AiS/tfpfuSRZILns7rXeq2f7lQdhycNaz41eo7LLksuywAKh0UgMGUMmmUlmzMOdz3k/zr0RkQyCBCJI2dprBVyCGxH33vPtvb89nHPo0H/9ryieOomuj3wEg7eugKiUwIQAUxQQEZgQUBQCEYNCgKIwMACMAFVRwCId4Gem4c/M9CjDy5Zr6z/+tl+rgjwPAEEwgECAEBAACM1/CACAEMFbAAQBJIJjEIhEeBpABHAu/276fHhY/2zTfy344vr5BCLALRbh
@mcfadden
mcfadden / convert_xlive.sh
Last active January 8, 2022 01:40
Convert multitrack WAV files generated by X-Live card into one file per track
#!/bin/bash
# Accepts a single argument, which is a path to the directory containing all the
# WAV files generated by a recordings from the X-Live card.
# Looks for files like 000000.WAV 000001.WAV 000002.WAV etc.
#
# Outputs files like Ch01.WAV Ch02.WAV Ch03.WAV etc.
#
# Requires sox
@mcfadden
mcfadden / remove_stray_s3_files.rb
Created November 3, 2015 19:32
Remove Stray S3 Files
# Ever had an app/script that created a bunch of files in S3 without a matching database entry?
# This will find and remove any stray s3 files
# Requirements:
# Designed to be run in a rails console, with the `fog` gem installed
# Usage:
# Update `is_stray_file?` method to return the correct value for your use case
# Set ENV['AWS_ACCESS_KEY'] and ENV['AWS_SECRET_KEY']
# Optionally set ENV['AWS_BUCKET']