Skip to content

Instantly share code, notes, and snippets.

@chungy
Created April 7, 2014 01:43
Show Gist options
  • Save chungy/10013693 to your computer and use it in GitHub Desktop.
Save chungy/10013693 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Extracts thing from here: http://www.unforgettable.dk/
cat <<EOF
If you are not on a file system with features such as compression or
de-duplication, you will most likely run out of space! ... Unless you
happen to have 4.5PB to spare.
Will begin in 5 seconds. ^C now to abort.
EOF
sleep 5
trap "exit 1" 2
mkcd() {
mkdir -p "$1" || return 1
cd "$1"
}
mkcd 42
# UnZip doesn't handle the archive encryption, but 7z does
7z e -p42 ../42.zip
for lib in {0..9} {a..f}; do
mkcd "lib $lib"
unzip -q "../lib $lib.zip"
for book in {0..9} {a..f}; do
mkcd "book $book"
unzip -q "../book $book.zip"
for chapter in {0..9} {a..f}; do
mkcd "chapter $chapter"
unzip -q "../chapter $chapter.zip"
for doc in {0..9} {a..f}; do
mkcd "doc $doc"
unzip -q "../doc $doc.zip"
for page in {0..9} {a..f}; do
mkcd "page $page"
echo "Extracting \"lib $lib/book $book/chapter $chapter/doc $doc/page $page/0.dll\""
unzip -q "../page $page.zip"
cd ..
done # page
cd ..
done # doc
cd ..
done # chapter
cd ..
done # book
cd ..
done # lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment