From 15958114cd94dd986046121d224994f5dfa80347 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 19 Oct 2016 21:40:09 +0200 Subject: [PATCH] Add bin/mac scripts --- bin/mac/html2pdf.sh | 15 +++++++++++++++ bin/mac/run-boris.sh | 5 +++++ bin/mac/timelapse.sh | 18 ++++++++++++++++++ bin/mac/timelapse2mov.sh | 3 +++ 4 files changed, 41 insertions(+) create mode 100755 bin/mac/html2pdf.sh create mode 100755 bin/mac/run-boris.sh create mode 100755 bin/mac/timelapse.sh create mode 100755 bin/mac/timelapse2mov.sh diff --git a/bin/mac/html2pdf.sh b/bin/mac/html2pdf.sh new file mode 100755 index 00000000..1c752d82 --- /dev/null +++ b/bin/mac/html2pdf.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Converts an html file (or website) to a pdf. It installs +# the dependencies if they aren't available. +# +# Note: MAC ONLY! + +if ! command -v "wkhtmltopdf" &> /dev/null +then + # wkhtmltopdf > 0.9.9 has a habit of hanging after it completes, so we + # install 0.9.9 explicitly instead. + brew install https://raw.github.com/mxcl/homebrew/6e2d550cf4961129a790bfb0973f8e88704f439d/Library/Formula/wkhtmltopdf.rb +fi + +wkhtmltopdf "$1" "$2" diff --git a/bin/mac/run-boris.sh b/bin/mac/run-boris.sh new file mode 100755 index 00000000..e47faace --- /dev/null +++ b/bin/mac/run-boris.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Mac-only: run boris REPL with homebrewed PHP + +/usr/local/bin/php /usr/local/bin/boris diff --git a/bin/mac/timelapse.sh b/bin/mac/timelapse.sh new file mode 100755 index 00000000..2b32a1c9 --- /dev/null +++ b/bin/mac/timelapse.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# Start taking screenshots every N seconds, until this script is +# called again. + +if [ ! -f ~/.ss ]; then + dir="$1" + if [ $# -eq 0 ]; then + [ ! -d ~/Desktop/ss ] && mkdir -p ~/Desktop/ss + dir=~/Desktop/ss + fi + echo "$dir" > ~/.ss + echo "Timelapse, go!" + i=1;while [ -f ~/.ss ];do screencapture -t jpg -x "$dir/$i.jpg"; let i++;sleep 5; done & +else + echo "Deactivating timelapse! Images in: $(cat ~/.ss)/" + rm ~/.ss +fi diff --git a/bin/mac/timelapse2mov.sh b/bin/mac/timelapse2mov.sh new file mode 100755 index 00000000..c114a674 --- /dev/null +++ b/bin/mac/timelapse2mov.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ffmpeg -r 24 -i %d.jpg -b 16000k $1