diff --git a/sub/bash/functions b/sub/bash/functions index 8b591cc..13fd0cd 100644 --- a/sub/bash/functions +++ b/sub/bash/functions @@ -217,4 +217,14 @@ split-file() { (mkdir "$1.splitted" && cd "$1.splitted" && split -d -b "$_size" "../$1") } +# returns url to code previewer +rayso() { + test -z "$1" && return 1 + local CODE FILENAME + + CODE="$(cat "$1" | base64)" + FILENAME="$(basename "$1")" + + echo "https://ray.so/?colors=candy&background=true&darkMode=true&padding=64&title=${FILENAME}&code=${CODE}&language=auto" +}