Created
November 14, 2018 20:51
-
-
Save randomcamel/7f27694e65680ac7d7388bb5303fddbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install prereqs with Homebrew: | |
# | |
# uninstall moreutils if installed: | |
# `brew uninstall moreutils` | |
# | |
# brew install wget | |
# brew install poppler | |
# brew install parallel | |
# brew install moreutils --without-parallel | |
set -e | |
BASE="https://www.vaultproject.io/" | |
wget --spider -nd -r "${BASE}docs/index.html" --no-parent -nv -o - | while read line; | |
do | |
echo $line | grep -o "https://[^ ]\+" | grep ".html$" | sed -E "s=${BASE}(.+)=\1 ${BASE}\1="; | |
done | parallel -t -C' ' 'mkdir -p {1//}; /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --print-to-pdf={1.}.pdf {2}' | |
find docs -name index.pdf | while read line; do | |
mv $line $(echo $line | sed 's/index.pdf/_.pdf/'); | |
done | |
mkdir -p out | |
find -s docs -iname "*.pdf" | parallel -X 'pdfunite {} out/{#}.pdf' | |
pdfunite $(ls -1 out/*.pdf | sort -n) out/vault.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment