aboutsummaryrefslogtreecommitdiffstats
path: root/.functions
diff options
context:
space:
mode:
Diffstat (limited to '.functions')
-rw-r--r--.functions5
1 files changed, 5 insertions, 0 deletions
diff --git a/.functions b/.functions
index 97b0fca..4c7f6e7 100644
--- a/.functions
+++ b/.functions
@@ -3,6 +3,11 @@ function md() {
mkdir -p "$@" && cd "$@"
}
+# Create a data URL from an image (works for other file types too, if you tweak the Content-Type afterwards)
+dataurl() {
+ echo "data:image/${1##*.};base64,$(openssl base64 -in "$1")" | tr -d '\n'
+}
+
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"