Created
November 2, 2014 15:40
-
-
Save plugnburn/5ba15fda8a5d7d9c6839 to your computer and use it in GitHub Desktop.
AnonStrap - experimental anonymous posting engine using DualWarp-type loader, StrapdownJS renderer and TinyURL API
This file contains hidden or 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
#!/bin/bash | |
#Usage: anonstrap.sh [your markdown file] ["optional title"] | |
LOADER="http://bl.ocks.org/anonymous/raw/f15ba2c3e3ea8742ced3/" | |
INMD="$1" | |
TITLE="$2" | |
[ -z "$TITLE" ] && TITLE="Anonymous post" | |
INPUT="$(<$INMD)" | |
HTML="<!DOCTYPE html><html><head><meta charset=utf-8><title>${TITLE}</title></head><xmp style='display:none'>${INPUT}"'</xmp><script src="http://strapdownjs.com/v/0.2/strapdown.js"></script></html>' | |
B64=$(echo -n "$HTML"|base64 -w 0) | |
DATAURL="data:text/html;charset=utf-8;base64,$B64" | |
DIRECTURL="${LOADER}#${DATAURL}" | |
READYURL=$(curl -0 -s --data-urlencode 'url='"${DIRECTURL}" http://tinyurl.com/api-create.php) | |
echo "$READYURL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment