Small Emacs function I used to base64 encode the icons in the CSS for demonastery.org. Requires the GNU coreutils base64 tool.

(defun insert-file-as-base64 (file)
  "Base64 encode a file before inserting it into the buffer."
  (interactive "FInsert file as base64: ")
  (insert (shell-command-to-string (concat "base64 -w0 " (shell-quote-argument file)))))