On a simple pastebin

On the list of projects I have been kicking around in my mind, a simple pastebin has been high on the list. It struck me that since I live in ssh, a daemonized port dwelling beast was overkill. Then it hit me that everyone's webserver is an scp away.So a simple bash script to pipe to would suffice for pulling this off. Character encoding via the (granted, not totally accurate) hueristics of the file command and some simple css to state that we are using UTF-8 (the one true character encoding) was added.

I started down the rabbithole of adding a width handler for output, then unix philosophy came slapping me in the face. If I needed width formatting I could pipe thru cut/fmt/fold. So here is my script, there are many like it, but this one is mine...

#!/usr/bin/env bash 
while read line 
do 
a=$(echo -e "$a\n$line\n") 
done 
CHARSET="$(file -bi "$i"|awk -F "=" '{print $2}')" 
nam=$(date +%s) 
echo "Leveck.us pastebin "\ 
"document $nam
"\ 
> /tmp/$nam echo "$a" | sed 's/&/\&/g; s//\>/g;\ 
s/"/\"/g; s/'"'"'/\'/g' | iconv -f "$CHARSET" -t UTF-8 \ 
>> /tmp/$nam 
echo "
" >> /tmp/$nam scp /tmp/$nam leveck@rpod:/var/www/html/pastebin rm /tmp/$nam echo -e "\n\nYour link:\nhttps://leveck.us/pastebin/$nam"
Proxy Information
Original URL
gemini://1436.ninja/Phlog/gmi/20171215.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
749.029732 milliseconds
Gemini-to-HTML Time
0.226621 milliseconds

This content has been proxied by September (3851b).