Skip to content

Instantly share code, notes, and snippets.

Avatar

James Jones jamjon3

View GitHub Profile
@jamjon3
jamjon3 / convert-webm.sh
Created Apr 29, 2014
This script converts several video files to royalty free WEBM
View convert-webm.sh
#!/bin/bash
VIDEOS=~/Videos/WCW/1/
find "$VIDEOS" -name '*.MP4' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.MP4}.webm"' {} \;
find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mp4}.webm"' {} \;
find "$VIDEOS" -name '*.MPG' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.MPG}.webm"' {} \;
find "$VIDEOS" -name '*.mpg' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mpg}.webm"' {} \;
find "$VIDEOS" -name '*.MOV' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.MOV}.webm"' {} \;
find "$VIDEOS" -name '*.mov' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mov}.webm"' {} \;
find "$VIDEOS" -name '*.DV' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.DV}.webm"' {} \;
find "$VIDEOS" -name '*.dv' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.dv}.webm"'
@jamjon3
jamjon3 / convert-av-webm.sh
Last active Aug 29, 2015
This script converts several video files to royalty free WEBM (using avconv)
View convert-av-webm.sh
#!/bin/bash
VIDEOS=~/Desktop/Wedding/
find "$VIDEOS" -name '*.mp4' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mp4}.webm"' {} \;
find "$VIDEOS" -name '*.mkv' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mkv}.webm"' {} \;
find "$VIDEOS" -name '*.avi' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.avi}.webm"' {} \;
find "$VIDEOS" -name '*.AVI' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.AVI}.webm"' {} \;
find "$VIDEOS" -name '*.MPG' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.MPG}.webm"' {} \;
find "$VIDEOS" -name '*.wmv' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.wmv}.webm"' {} \;
find "$VIDEOS" -name '*.MOV' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.MOV}.webm"' {} \;
find "$VIDEOS" -name '*.mov' -exec sh -c 'avconv -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mov}
@jamjon3
jamjon3 / capture-asf.sh
Created Nov 23, 2014
Captures asf mms stream to file
View capture-asf.sh
mplayer -noframedrop -dumpfile wtan.asf -dumpstream mms://63.246.156.74/wtan
@jamjon3
jamjon3 / audio2mkv_still.sh
Created Nov 26, 2014
Turn an MP3 file into a video using a still image
View audio2mkv_still.sh
#!/bin/bash
IMAGE=~/Videos/Revolutionary\ Road\ Radio\ Show/RevolutionStar.jpg
AUDIO=~/Videos/Revolutionary\ Road\ Radio\ Show/2014-11-21_rev_rd-_141110.mp3
avconv -loop 1 -i "$IMAGE" -i "$AUDIO" -shortest -c:v libx264 -c:a copy "${AUDIO}.mkv"
@jamjon3
jamjon3 / recordrevroad.sh
Last active Aug 29, 2015
Records a radio show. This show sometimes has video and sometimes doesn't. The Webm version is for ones that have video. The MKV version just adds a still with the audio. The audio is preserved as a MP3 incase it has to be manually clipped and merged with a still (otherwise, edit the webm version)
View recordrevroad.sh
#!/bin/sh
NOW=$(date +"%b-%d-%y")
STREAM="mms://63.246.156.74/wtan"
WORKINGDIR="/home/user/Videos/"
FILENAME="${WORKINGDIR}revolutionary_road_radio_show_$NOW"
IMAGE="${WORKINGDIR}The Revolutionary Road/RevolutionStar.jpg"
DURATION="3600"
#cd $WORKINGDIR
rm -rf "${FILENAME}.wma"
@jamjon3
jamjon3 / ImportGoogleContactsCSVtoDatabase
Last active Aug 29, 2015
This script takes a Google Contacts CSV and imports it into a simple schema. This script is a Groovy Rule Script Rule for use in RuleChains.
View ImportGoogleContactsCSVtoDatabase
sql.execute("""
CREATE TABLE IF NOT EXISTS `GoogleContacts` (
`id` bigint(18) NOT NULL AUTO_INCREMENT,
`Name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Given Name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Additional Name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Family Name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Yomi Name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Given Name Yomi` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
`Additional Name Yomi` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
@jamjon3
jamjon3 / gc2mongo.sh
Last active Aug 29, 2015
Mongo Import Google Contacts and Florida Voters
View gc2mongo.sh
# mongoimport -d voters -c flvoterimport --type tsv --file ALA_20120402.txt --fieldFile flvoterfields.txt
unzip -p fla_20120402.zip | mongoimport -d voters -c flvoterimportall --type tsv --fieldFile flvoterfields.txt
iconv -f UTF-16LE -t UTF-8 stpetegreens.csv | mongoimport -d voters -c stpetegreens --type csv --headerline
iconv -f UTF-16LE -t UTF-8 pinellasgreens.csv | mongoimport -d voters -c pinellasgreens --type csv --headerline
View Generate Random Password (32 Char)
dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | cut -b -32
You can’t perform that action at this time.