scripts: fix syntax + use 0x0.st for url shortening

This commit is contained in:
Hoang Nguyen 2021-09-29 21:35:06 +07:00
parent 9b81f9b07b
commit 5b79df9f6f
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
8 changed files with 12 additions and 14 deletions

View File

@ -3,5 +3,5 @@
if [ -n "$2" ]; then
curl "$2.rate.sx/$1"
else
curl "rate.sx/$1"
curl "rate.sx/${1:-}"
fi

View File

@ -1,3 +1,3 @@
#!/bin/sh
curl -s "$1" | pandoc --from=html --to=markdown | glow - -s dark -w 80 | less -r
curl -s "${1:--}" | pandoc --from=html --to=markdown | glow - -s dark -w 80 | less -r

View File

@ -2,4 +2,4 @@
# $1=geo for verbose look up
curl -s "https://ipinfo.io/$1" | jq .
curl -s "https://ipinfo.io/${1:-}" | jq .

View File

@ -6,11 +6,9 @@ echo "Song: " | tr -d '\n'
read -r song
# Nice look
echo "========================
"
echo "========================"
artist=$(echo "$artist" | sed s/" "/%20/g | sed s/"&"/%26/g | sed s/,/%2C/g | sed s/-/%2D/g)
song=$(echo "$song" | sed s/" "/%20/g | sed s/"&"/%26/g | sed s/,/%2C/g | sed s/-/%2D/g)
curl -s "https://api.lyrics.ovh/v1/$artist/$song" | jq -r ".lyrics"
curl -s "https://api.lyrics.ovh/v1/$artist/$song" | jq -r ".lyrics" | sed '/\r$/d'

View File

@ -1,3 +1,3 @@
#!/bin/sh
curl -s "https://wttr.in/Moon$1"
curl -s "https://wttr.in/Moon${1:-}"

View File

@ -3,4 +3,4 @@
# When you don't want to install `qrencode` yourself
input=$(printf '%s ' "$@")
input=$(echo "$input" | sed s/" "/%20/g)
curl "qrenco.de/$input"
curl "https://qrenco.de/$input"

View File

@ -1,9 +1,9 @@
#!/bin/sh
if [ "$1" = "-e" ]; then
curl https://unshorten.me/s/"$2"
curl https://unshorten.me/s/"${2:--}"
elif [ "$1" = "-s" ]; then
curl https://tinyurl.com/api-create.php?url="$2"
curl -F"shorten=${2:--}" https://0x0.st
else
echo "Wrong arguments"
return 1

View File

@ -1,9 +1,9 @@
#!/bin/sh
if [ "$2" = "-v2" ]; then
curl "https://v2.wttr.in/$1"
curl "https://v2.wttr.in/${1:-}"
elif [ "$2" = "-v3" ]; then
curl "https://v3.wttr.in/$1.sxl"
curl "https://v3.wttr.in/${1:-}.sxl"
else
curl "https://wttr.in/$1"
curl "https://wttr.in/${1:-}"
fi