Initial commit.

This commit is contained in:
Jonathan Bernard
2016-01-19 15:10:51 -06:00
commit 09aeb9f1ca
46 changed files with 1610 additions and 0 deletions

20
bin/clean_imports.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# Author: Paul Bourke <pauldbourke@gmail.com>
# Version: 0.1
# Find line numbers of unused imports, concatenate into a single line, and
# delete those lines from the file
OUT=$(eval "sed '`checkstyle -c /usr/share/checkstyle/sun_checks.xml $1 2>&1 \
| grep -i 'unused import' | awk -F: '{ print $2 }' \
| sed ':a;{N;s/\n/d;/;ba}'`d' $1")
# If we get no output from the above, there are no unused imports, just return
# the original file
if [ -z "$OUT" ]
then
/bin/cat $1
else
echo "$OUT"
fi

1
bin/java-file-formatter Executable file
View File

@ -0,0 +1 @@
/home/jdbernard/programs/eclipse/eclipse -nosplash -vm $JAVA_HOME/bin -application org.eclipse.jdt.core.JavaCodeFormatter -config /home/jdbernard/projects/3m-tolling-host/host-formatter-prefs.properties "$@"

32
bin/link-ssh-agent Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Check to see if we at least have an agent running, and have previously
# saved exports.
if [ ! `pgrep -n ssh-agent` ] || [ ! -f ~/temp/ssh-agent-exports.sh ]
then
# If not, create a new agent and save the details.
echo $(ssh-agent) > ~/temp/ssh-agent-exports.sh
chmod +x ~/temp/ssh-agent-exports.sh
# If we do have previous details and a running agent, make sure that
# the details match an available agent (and not one that was killed).
elif [[ `(source ~/temp/ssh-agent-exports.sh; ssh-add -l 2>&1)` =~ "Could not open" ]]
then
# If the current details are for a dead agent, create a new agent and
# save the details.
echo $(ssh-agent) > ~/temp/ssh-agent-exports.sh
chmod +x ~/temp/ssh-agent-exports.sh
fi
# Finally, if we were called without an argument, echo the current settings.
if [ "$1" = "" ]
then
cat ~/temp/ssh-agent-exports.sh
# If we do have an argument then evaluate that argument in a new shell which
# has the SSH agent defined.
else
(
source ~/temp/ssh-agent-exports.sh
eval $1
)
fi

61
bin/video2ogg Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
#
# EDWARDS RESEARCH
# www.edwards-research.com
#
# This converts the audio from .mp4 files that include video (e.g. youtube.com streams) to
# .mp3 files.
#
# If file exists, set $FILE
# I know this is a sloppy way to handle command line arguments -- I'm ok with that. (I
# was going to provide for options, blah blah...)
if [[ -e ${1} ]] ; then
FILE=${1}
fi
# Ensure input file exits
if [[ -z $FILE ]] ; then
echo "File not found -- exiting."
exit
fi
# Extract Filename
base=$(basename "${FILE}" .mp4)
# Dump audio from .mp4 to .wav with mplayer
# So, it looks as if it doesn't make a difference in terms of the output (at least from
# my small test group) whether you pick pcm:waveheader or pcm:fast. pcm:waveheader takes
# more than twice as long to convert but pcm:fast complains. I'm going to leave it at
# waveheader because I'm not in a rush and I'd rather not have the warnings. Feel free
# to change this to pcm:fast and experiment.
# -ao pcm:waveheader -> 59 seconds, 4625553 byte .mp3
# -ao pcm:fast -> 22 seconds, 4625553 byte .mp3
#
mplayer -vc null -vo null -nocorrect-pts -ao pcm:fast "${FILE}"
#
# mplayer -vc null -vo null -nocorrect-pts -ao pcm:waveheader "${FILE}"
RV=$?
if [[ $RV != 0 ]] ; then
echo "mplayer completed unsuccessfully -- exiting."
exit
fi
# Convert .wav to .ogg
oggenc -q 5 -o "${base}.ogg" audiodump.wav
#lame -h -b 192 audiodump.wav "${base}.mp3" ${VERB}
RV=$?
if [[ $RV != 0 ]] ; then
echo "oggenc completed unsuccessfully -- exiting."
exit
fi
# Cleanup Temporary File
rm audiodump.wav
echo "Conversion complete."