blob: a10c918ba6dd52c438b4b164dc88fa28d6aeae7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
: ${PB_INSTANCE:=ptpb.pw}
: ${PB_CURL_ARGS:=""}
PASTE_LOG_DIR="$HOME/.local/pb/$PB_INSTANCE"
# pb upload
function pbu() {
local res
if [ "$#" -eq 0 ]; then
# paste from stdin
res=$(curl $PB_CURL_ARGS -sF c=@- "https://$PB_INSTANCE")
else
res=$(curl $PB_CURL_ARGS -sF "c=@$1" "https://$PB_INSTANCE")
fi
local url=$(awk '/url/ { print $2 }' <<<"$res" | tr -d '\n')
local short=$(awk '/short/ { print $2 }' <<<"$res" | tr -d '\n')
mkdir -p "$PASTE_LOG_DIR"
echo "$res" | tee "$PASTE_LOG_DIR/$short"
if [[ -v DISPLAY ]]; then
xclip -i <<<"$url"
notify-send "pbu" "Copied to clipboard: $url"
fi
}
# pb delete, takes short id
# someone please fix this
function pbd() {
local short=$(grep -C2 $1 $PASTE_LOG_FILE \
| awk '/uuid/ { print $2 }')
curl $PB_CURL_ARGS -X DELETE https://$PB_INSTANCE/$short
}
function pbi() {
scrot --select --quality 0 /tmp/$$.png
pngcrush -ow /tmp/$$.png
pbu /tmp/$$.png
}
function pbr() {
asciinema rec /tmp/$$.json
pbu /tmp/$$.json
}
function termbin() {
nc termbin.com 9999
}
|