Created
April 8, 2013 14:49
-
-
Save kotnik/5337349 to your computer and use it in GitHub Desktop.
Self-hosted pastebin. Pipe code/text to be automatically uploaded to your server for sharing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER=YOUR_USERNAME | |
HOST=YOUR_SERVER_HOSTNAME | |
WEBPATH=PATH_TO_WEBSERVER_ROOT | |
WEBURL=YOUR_URL | |
BACKUP_DIR=DIR_FOR_BACKUP | |
file=$(mktemp $BACKUP_DIR/XXXXXX) | |
mv $file $file.html | |
file="$file.html" | |
chmod 644 ${file} | |
[[ ! -z "$1" ]] && lang="-s $1" | |
cat - > ${file}.in | |
source-highlight -i ${file}.in -o ${file} ${lang} | |
rm ${file}.in | |
scp -q -o "LogLevel quiet" ${file} $USER@$HOST:$WEBPATH | |
echo "http://$WEBURL/${file##*/}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment