1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(scripts): add initial version of klemmbrett

This commit is contained in:
Kierán Meinhardt
2020-06-04 13:29:45 +02:00
parent 489386992e
commit 8b835c1252

29
packages/scripts/klemmbrett.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
options='Pastebin
Shorten
[Replace p.r]'
r_to_krebscode() {
sed 's/\<r\>/krebsco.de/'
}
modify_clipboard() {
case $(echo "$options" | dmenu -i -p 'clipboard') in
'Pastebin')
curl -fSs -F 'f:1=<-' ix.io
# curl -fSs http://p.r --data-binary @- | tail --lines=1 | r_to_krebscode
;;
'Shorten')
# curl -fSs "http://tinyurl.com/api-create.php?url=$(cat)"
curl -fSs "https://0x0.st" -F "shorten=$(cat)"
# curl -fSs http://go.r -F "uri=$(cat)"
;;
'Replace p.r') r_to_krebscode ;;
*) cat;;
esac
}
xclip -selection clipboard -out \
| modify_clipboard \
| tr -d '\r\n' \
| xclip -selection clipboard -in