all repos — dotfiles @ 7aea05e57ad97627f5907f1e8e220b61cc467254

my *nix dotfiles

home/bin/up (view raw)

 1#!/usr/bin/env bash
 2
 3random_name="$(tr -dc 'a-zA-Z0-9' < /dev/random | fold -w 5 | head -n 1)"
 4
 5export LATEST_SCROT="$HOME/pics/scrots/latest.png"
 6
 7upload() {
 8    file="$(basename "$1")"
 9	ext="${file##*.}"
10	fullname="$random_name.$ext"
11	scp -P 22222 "$1" fern:~/www/icy/uploads/"$fullname"
12	printf '%s\n' "https://x.icyphox.sh/$fullname"
13	printf '%s' "https://x.icyphox.sh/$fullname" | xclip -selection clipboard
14}
15
16if [ "$1" == "l" ]; then
17    upload "$LATEST_SCROT" 
18elif [ "$1" != "l" ]; then
19   upload "$1" 
20fi