Created
March 12, 2011 01:06
-
-
Save mnot/866891 to your computer and use it in GitHub Desktop.
Quick and dirty way to get Internet-Drafts onto your kindle
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
#!/bin/sh | |
# Kindle My RFC (or Internet-Draft) | |
# | |
# Sends an Internet Draft to your kindle | |
# Invocation: | |
# > kindle_my_rfc [path/to/rfc2629-xml-file] | |
# > kindle_my_rfc [draft-name-with-number-00] | |
# | |
# Requires: | |
# - xsltproc | |
# - rfc2629xslt | |
# - kindlegen | |
# - sed | |
# - mutt | |
# - $KINDLE_ADDR set to kindle e-mail address | |
rfc2629xslt=~/Downloads/rfc2629xslt | |
tmpfile=/tmp/kindle_my_rfc | |
xmlfile=$1 | |
if [ ! -f $xmlfile ]; then | |
curl -f "http://www.ietf.org/id/${xmlfile}.xml" -o ${tmpfile}.xml || exit 1; | |
xmlfile=${tmpfile}.xml | |
fi | |
rm -f ${tmpfile}.html | |
xsltproc $rfc2629xslt/rfc2629.xslt $xmlfile > ${tmpfile}.html | |
sed -Ei '' '/^[ \t]*margin-left:/d' ${tmpfile}.html | |
kindlegen ${tmpfile}.html | |
rm -f ${tmpfile}.html | |
#uuencode ${tmpfile}.mobi ${tmpfile}.mobi | mail -s "RFC upload" $KINDLE_ADDR | |
mutt -s "RFC Upload" -a ${tmpfile}.mobi $KINDLE_ADDR < "." | |
rm ${tmpfile}.mobi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment