Sometimes you just want to base 64 encode an image or a font file:
function 64enc() {
openssl base64 -in $1 | awk -v ext="${1#*.}" '{ str1=str1 $0 }END{ print "background:url(data:image/"ext";base64,"str1");" }'|pbcopy
echo "$1 encoded to clipboard"
}
function 64font() {
openssl base64 -in $1 | awk -v ext="${1#*.}" '{ str1=str1 $0 }END{ print "src:url(\"data:font/"ext";base64,"str1"\") format(\"woff\");" }'|pbcopy
echo "$1 encoded as font and copied to clipboard"
}