Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Created November 2, 2014 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugnburn/5ba15fda8a5d7d9c6839 to your computer and use it in GitHub Desktop.
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
#!/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