#!/bin/sh -e

file="$1"

[ -z $file ] \
    && file="$(find $PWD $HOME $HOME/Downloads -maxdepth 2 -type f \
                | fgrep -v "/." \
                | sort -u \
                | fzf -e -x -i)"

[ -z $file ] \
    && exit 0

scp "$file" \
    sdk@home.codevoid.de:make-web/src/paste/

ssh sdk@home.codevoid.de \
    "cd ~/make-web && make install"

echo "https://ptrace.org/$(basename "$file")" \
    | sed 's/ /%20/g' \
    | xclip -f -r

echo

