Skip to content

Instantly share code, notes, and snippets.

@bmatherly
bmatherly / normalize.py
Created November 5, 2015 05:15
Normalize media files using Python and FFMpeg
#! /usr/bin/python
import getopt, sys, os, time, subprocess, shutil, argparse
WIDTH = 1280
HEIGHT = 720
RATE = "60000/1001"
EXT = ".mov"
FFMPEG = "ffmpeg.exe"
@bmatherly
bmatherly / normalize.sh
Last active August 29, 2015 13:56
Normalize media files.
#!/bin/bash
declare SRC=""
declare DST=""
declare -i USE_TIME=0
declare -r WIDTH=1280
declare -r HEIGHT=720
declare -r RATE="60000/1001"
declare -r EXT=".mov"
@bmatherly
bmatherly / deinterlace.sh
Created February 14, 2014 04:36
deinterlace
#!/bin/sh
SRCFILE=$1
DSTFILE=$2
# Sanity checking, to make sure everything is in order.
if [ -z "$SRCFILE" -o -z "$DSTFILE" ]; then
echo "Usage: $0 <Source File> <Destination File>"
exit 5
fi
if [ ! -f "$SRCFILE" ]; then
@bmatherly
bmatherly / piano_disk_copy.txt
Last active December 20, 2015 22:49
Instructions for copying player piano floppy disks.
# The player piano takes 720k floppies. "Convert" 1.44MB floppies by putting a piece of tape over the lower right hole.
# Insert the original disk
# Make an image of the original disk:
ddrescue -b 512 -c 9 -d -r 20 /dev/fd0 classical1.img
# Insert the blank disk
# Format as 720k (Double Density)
superformat /dev/fd0 dd
@bmatherly
bmatherly / convert_to_sd.sh
Created May 10, 2013 02:17
Scripts to convert a directory of mp4 files to SD mpg files.
#!/bin/sh
SRCFILE=$1
DSTFILE=$2
# Sanity checking, to make sure everything is in order.
if [ -z "$SRCFILE" -o -z "$DSTFILE" ]; then
echo "Usage: $0 <Source File> <Destination File>"
exit 5
fi
if [ ! -f "$SRCFILE" ]; then
@bmatherly
bmatherly / APC PDU Monitor Instructions
Last active June 18, 2024 21:16
Script to control an APC MasterSwitch PDU to reset an outlet when the network stops working
sudo cp netmonitor.sh /usr/bin/netmonitor.sh
sudo chmod 755 /usr/bin/netmonitor.sh
sudo crontab -e
Add to crontab:
*/2 * * * * /usr/bin/netmonitor.sh 2>&1 | /usr/bin/logger -t netmonitor