snippets

share files to server

sometimes i need a quick link to a file, be it an image, video, text file, anything. and sometimes i don’t want to wait to upload it somewhere, when all i need is a quick URL!

the next best thing? send the file to your server (with a UUID before the original filename, so it can’t be easily guessed), using SCP and SSH config shortcuts.

code copied!
	#!/usr/bin/env bash
#
# quickly share files

if [ $# -eq 0 ]; then
	echo "Usage: share [FILENAME]"
	exit 1
fi

FN_TEMP=$(uuidgen)_$(basename "$1")

scp -q "$1" mac:/var/www/stash/pics/dump/"$FN_TEMP"

echo "https://stash.4-walls.net/pics/dump/$FN_TEMP" | lolcat