Last active
January 3, 2016 01:59
-
-
Save przmv/8392747 to your computer and use it in GitHub Desktop.
data-uri generator in rc
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
#!/usr/bin/env rc | |
path=($PLAN9/bin) | |
fn datauri { | |
echo data:`{/usr/bin/file -bi $1 | sed 's/ //'}^';'base64,`{/usr/bin/base64 $1 | tr -d '\x0A'} | |
} | |
if(~ $#* 0) | |
echo usage: `{basename $0} file... >[1=2] | |
if not | |
for(f) test -f $f && datauri $f || echo file $f does not exist >[1=2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment