Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kotnik
Forked from ralt/pastebin.sh
Last active August 26, 2015 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotnik/dedb6aa52068e31e170a to your computer and use it in GitHub Desktop.
Save kotnik/dedb6aa52068e31e170a to your computer and use it in GitHub Desktop.
putfile & pastebin
#!/bin/bash
file=$(mktemp ~/Documents/Pastes/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} foo@main:www/
echo "https://bin.foo/${file##*/}" | xclip -f -selection clipboard
#!/bin/bash
if [[ -z "$1" ]]; then
echo "Need filename"
exit 1
fi
file_ext=$(echo $1 |awk -F . '{if (NF>1) {print $NF}}')
if [ -z "$file_ext" ]; then
file_ext="txt"
fi
file=$(mktemp /tmp/XXXXXX.$file_ext)
cp "$1" $file
chmod 644 $file
scp -q -o "LogLevel quiet" "$file" bin_kotur_org@main:www/
echo "https://bin.kotur.org/$(basename $file)" | xclip -f -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment