diff options
author | Nicholas Van Doorn <vandoorn.nick@gmail.com> | 2021-08-04 18:12:54 -0700 |
---|---|---|
committer | Nicholas Van Doorn <vandoorn.nick@gmail.com> | 2021-08-17 10:47:48 -0700 |
commit | 6af4ba943f6b73e31a0b2bd0262d953a2e954ddb (patch) | |
tree | 0cf7b1d160d0671eeacb66004433b63572b96ebd /bin |
Initial commit
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cfind | 3 | ||||
-rwxr-xr-x | bin/convert-art | 5 | ||||
-rwxr-xr-x | bin/dmg | 4 | ||||
-rwxr-xr-x | bin/dns-flush | 3 | ||||
-rwxr-xr-x | bin/fixup | 3 | ||||
-rwxr-xr-x | bin/heroku-env-apply | 3 | ||||
-rwxr-xr-x | bin/heroku-env-dump | 3 | ||||
-rwxr-xr-x | bin/iso2wbfs | 161 | ||||
-rwxr-xr-x | bin/jdiff | 3 | ||||
-rwxr-xr-x | bin/kabab | 3 | ||||
-rwxr-xr-x | bin/killer | 3 | ||||
-rwxr-xr-x | bin/rgr | 3 | ||||
-rwxr-xr-x | bin/smell-test | 5 | ||||
-rwxr-xr-x | bin/strip | 3 | ||||
-rwxr-xr-x | bin/sync-ipod | 8 | ||||
-rwxr-xr-x | bin/sync-music | 3 | ||||
-rwxr-xr-x | bin/ticket | 3 | ||||
-rwxr-xr-x | bin/togif | 13 | ||||
-rwxr-xr-x | bin/wit | bin | 0 -> 5013112 bytes | |||
-rwxr-xr-x | bin/write-image | 4 |
20 files changed, 236 insertions, 0 deletions
diff --git a/bin/cfind b/bin/cfind new file mode 100755 index 0000000..c8814bf --- /dev/null +++ b/bin/cfind @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git show $(git log --pretty=oneline --abbrev-commit | fzy | gawk '{print$1}') diff --git a/bin/convert-art b/bin/convert-art new file mode 100755 index 0000000..4f72351 --- /dev/null +++ b/bin/convert-art @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +gfind "$1" -iname "cover.jpg" -o -iname "cover.gif" -o -iname "cover.png" | while read file + do convert "$file" -thumbnail 130x130 "${file%/*}"/cover.bmp +done @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +hdiutil create -fs HFS+ -srcfolder "$1" -volname "$2" "$2.dmg" + diff --git a/bin/dns-flush b/bin/dns-flush new file mode 100755 index 0000000..438d73d --- /dev/null +++ b/bin/dns-flush @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sudo killall -HUP mDNSResponder diff --git a/bin/fixup b/bin/fixup new file mode 100755 index 0000000..c0f0a53 --- /dev/null +++ b/bin/fixup @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git commit --fixup=$(git log --pretty=oneline --abbrev-commit | fzy | gawk '{print$1}') diff --git a/bin/heroku-env-apply b/bin/heroku-env-apply new file mode 100755 index 0000000..067021d --- /dev/null +++ b/bin/heroku-env-apply @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cat $2 | tr '\n' ' ' | xargs heroku config:set -a $1 diff --git a/bin/heroku-env-dump b/bin/heroku-env-dump new file mode 100755 index 0000000..dafb7ed --- /dev/null +++ b/bin/heroku-env-dump @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +heroku config -s -a $1 > $2 diff --git a/bin/iso2wbfs b/bin/iso2wbfs new file mode 100755 index 0000000..59b0eed --- /dev/null +++ b/bin/iso2wbfs @@ -0,0 +1,161 @@ +#!/bin/bash +#=============================================================================== +# +# FILE: iso2wbfs +# +# USAGE: ./iso2wbfs [option] FILE... [wbfs directory] +# +# DESCRIPTION: Uses wit to convert one or more Wii ISO into a WBFS file +# properly named for use on non-WBFS partitions. +# +# OPTIONS: --- +# REQUIREMENTS: WIT ( http://wit.wiimm.de/wit/ ) +# BUGS: --- +# NOTES: --- +# AUTHOR: Timothy Caraballo, openback@gmail.com +# COMPANY: Pixelpod International, Inc. +# VERSION: 1.04 +# CREATED: 2010-08-10 08:31:01 AM EST +#=============================================================================== + +#=============================================================================== +# Script variables +#=============================================================================== +# The regex to grab info from the iso +REG="^([[:alnum:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:alpha:]]{3,4})[[:space:]]+(.+)$" +NOCLOBBER=1 +NAMINGSTYLE=1 +NAMINGSTYLESET=0 +eval OUTPUTDIR=\$$# + +#=============================================================================== +# Prints usage info +#=============================================================================== +function USAGE () { +echo "" +echo "USAGE: " +echo " iso2wbfs [option] FILE... [wbfs_directory]" +echo "" +echo "OPTIONS:" +echo " -f Force overwrite of existing files" +echo " -v Version information" +echo " -h This usage information" +echo " NAMING STYLES:" +echo " -1 /GAMEID.wbfs (default)" +echo " -2 /GAMEID_Game title.wbfs" +echo " -3 /Game title [GAMEID].wbfs" +echo " -4 /GAMEID/GAMEID.wbfs" +echo " -5 /GAMEID_Game title/GAMEID.wbfs" +echo " -6 /Game title [GAMEID]/GAMEID.wbfs" +echo "" +exit $E_OPTERROR # Exit and explain usage, if no argument(s) given. +} + +#=============================================================================== +# Main routine +#=============================================================================== + +# Set our option variables +while getopts ":123456fhv?" opt +do + case $opt in + [1-6]) + if (( $NAMINGSTYLESET == 1 )); then + echo "Error: You may only specify one naming convention" + USAGE + exit 1 + else + NAMINGSTYLESET=1 + NAMINGSTYLE=$opt + fi + ;; + f) + NOCLOBBER=0 + ;; + h) + USAGE + exit 0 + ;; + v) + echo "`basename $0` 1.04 (2011-08-11)" + exit 0 + ;; + ?) + echo "" + echo "Invalid option: -$OPTARG" >&2 + USAGE + exit 1 + ;; + esac +done +shift $(($OPTIND - 1)) + +# Is the last argument a directory? +if [[ -d "$OUTPUTDIR" ]]; then + HASDIR=1 +else + # It isn't a directory, so let's make sure it's a file and not a mistake + if [[ -f "$OUTPUTDIR" ]]; then + OUTPUTDIR=. + HASDIR=0 + else + echo "Error: $OUTPUTDIR was not found." + exit 1 + fi +fi + +# Do we have an iso to work with? +(( $# )) || USAGE + +while (( $# > $HASDIR )) +do + ISO=$1 + shift + + # Check if the ISO is a valid Wii disc + if [[ `wit ll -H "$ISO"` =~ $REG ]]; then + # Grab the info from the output + WIITITLE=`echo ${BASH_REMATCH[4]}|tr -d '\n'|tr '[\:\*]' '_'` + GAMEID=${BASH_REMATCH[1]} + + case $NAMINGSTYLE in + 1) + WBFSFILE=$GAMEID.wbfs + ;; + 2) + WBFSFILE=${GAMEID}_$WIITITLE.wbfs + ;; + 3) + WBFSFILE=$WIITITLE\ \[$GAMEID\].wbfs + ;; + 4) + WBFSFILE=$GAMEID/$GAMEID.wbfs + ;; + 5) + WBFSFILE=${GAMEID}_$WIITITLE/$GAMEID.wbfs + ;; + 6) + WBFSFILE=${WIITITLE}\ \[$GAMEID\]/$GAMEID.wbfs + ;; + esac + + WBFSFILE=$OUTPUTDIR/$WBFSFILE + + if [[ -f "$WBFSFILE" ]]; then + if (( $NOCLOBBER )); then + echo "Error: $WBFSFILE exists." + else + rm "$WBFSFILE" || exit 1 + fi + fi + + # Make the destination folder if it doesn't exist + mkdir -p "`dirname "$WBFSFILE"`" || exit 1 + + # Now just run the copy + wit -BP COPY "$ISO" "$WBFSFILE" + else + echo "Error parsing $ISO" + exit 1 + fi +done
\ No newline at end of file diff --git a/bin/jdiff b/bin/jdiff new file mode 100755 index 0000000..c7eb308 --- /dev/null +++ b/bin/jdiff @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +vimdiff <(jq -S . $1) <(jq -S . $2) diff --git a/bin/kabab b/bin/kabab new file mode 100755 index 0000000..f3eee6b --- /dev/null +++ b/bin/kabab @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby + +puts STDIN.read.split(" ").join("-").downcase diff --git a/bin/killer b/bin/killer new file mode 100755 index 0000000..8f3cfdb --- /dev/null +++ b/bin/killer @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +kill -9 $(ps aux | fzy | gawk '{print$2}') @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +rg $1 --files-with-matches -0 | xargs -0 gsed -i "s/$1/$2/g" diff --git a/bin/smell-test b/bin/smell-test new file mode 100755 index 0000000..8916180 --- /dev/null +++ b/bin/smell-test @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +ag 'binding.pry' . +ag 'debugger' . +ag 'console.log' . diff --git a/bin/strip b/bin/strip new file mode 100755 index 0000000..380c767 --- /dev/null +++ b/bin/strip @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby + +puts ARGV.join(" ").split("#").first diff --git a/bin/sync-ipod b/bin/sync-ipod new file mode 100755 index 0000000..e485ab3 --- /dev/null +++ b/bin/sync-ipod @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Sync the files. +rsync -uva --ignore-existing "/Volumes/media1/lossless" "/Volumes/IPOD 1/" +# Convert the album art to a format Rockbox likes. +# convert-art "/Volumes/IPOD 1/lossless" +# Delete the originals so Rockbox doesn't try and load them. +# rm -rf "/Volumes/IPOD 1/lossless/**/*.jpg" diff --git a/bin/sync-music b/bin/sync-music new file mode 100755 index 0000000..8adeb69 --- /dev/null +++ b/bin/sync-music @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +rsync -uva --ignore-existing ~/personal/lossless "/Volumes/media1/" diff --git a/bin/ticket b/bin/ticket new file mode 100755 index 0000000..82b1a1a --- /dev/null +++ b/bin/ticket @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cat .tickets.csv | fzy | gawk -F, '{print $1}' diff --git a/bin/togif b/bin/togif new file mode 100755 index 0000000..02bd824 --- /dev/null +++ b/bin/togif @@ -0,0 +1,13 @@ +#!/usr/bin/env zsh +if [ "$#" -ne 3 ]; then + echo "Usage: togif <input file> <output file> <scale>\n" + echo "Example with 500px width and auto height:\n" + echo " \$ togif myinput.mov myoutput.gif 500:-1" + exit -1 +fi + +TEMP_FOLDER=/tmp/gifconvert-$(date) +mkdir $TEMP_FOLDER +ffmpeg -i $1 -vf scale=$3 -r 10 $TEMP_FOLDER/ffout%3d.png +convert -delay 8 -loop 0 $TEMP_FOLDER/ffout*.png $2 +rm -rf $TEMP_FOLDER Binary files differdiff --git a/bin/write-image b/bin/write-image new file mode 100755 index 0000000..0091580 --- /dev/null +++ b/bin/write-image @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Make sure you have GNU dd as it supports much larger block sizes +sudo gdd if=$1 of=$2 bs=4M status=progress conv=fsync |