pastebin (475B) (RAW)
1 #!/bin/sh 2 3 # Serve data from stdin on $HOST over http. 4 # Inspired by https://codemadness.org/paste-service.html 5 6 if [ -t 0 ] && [ $# -ne 1 ] 7 then 8 printf 'usage: %s [filetype]\n' "${0##*/}" 9 exit 1 10 fi 11 12 HOST='thyssentishman.com' 13 DIR="/var/www/htdocs/${HOST}/paste" 14 URL="https://www.${HOST}/paste" 15 16 rname() { 17 tr -dc '[:alnum:]' < /dev/urandom | fold -w 5 | head -n1 18 } 19 20 push() { 21 ssh "$HOST" "cat > \"${DIR}/${1}\"" && printf '%s/%s\n' "$URL" "$1" 22 } 23 24 push "$(rname).${1:-txt}"