diff options
author | ryo <ryo@nopwd.lol> | 2024-12-17 00:15:40 +0000 |
---|---|---|
committer | ryo <ryo@nopwd.lol> | 2024-12-17 00:15:40 +0000 |
commit | 8321c0e378204ed93e391b1ec3933aabe28e757d (patch) | |
tree | e19e4b130e05c4b73aec7b1df7a160c7fbb0c751 /bin | |
parent | 30beb339e8566d3b336b60292a3a2592b92d256f (diff) |
Added null.sh and zathura plus some fixes
In scripts don't specify dash but just sh.
Removed bc from aliases.
Changed pocket to dl.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/blind.sh | 2 | ||||
-rwxr-xr-x | bin/null.sh | 88 | ||||
-rwxr-xr-x | bin/record.sh | 2 | ||||
-rwxr-xr-x | bin/scshot.sh | 2 | ||||
-rwxr-xr-x | bin/xray.sh | 2 |
5 files changed, 92 insertions, 4 deletions
diff --git a/bin/blind.sh b/bin/blind.sh index 431967c..81d7d16 100755 --- a/bin/blind.sh +++ b/bin/blind.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env dash +#!/bin/sh now=$(TZ=Iran date +%H) night=21 diff --git a/bin/null.sh b/bin/null.sh new file mode 100755 index 0000000..938913c --- /dev/null +++ b/bin/null.sh @@ -0,0 +1,88 @@ +#!/bin/sh + +# ==== DELETE THIS LINES ===== +echo "NOTHING HAPPENED!" +echo "FIRST READ THE SCRIPT!" +exit +# ============================ + +set -e + +host="https://x.nopwd.lol" +links="$HOME/.local/null-links.txt" +exp="1" +sec="" +prog="${0##*/}" + +usage() { + cat <<-_EOF + Usage: + $prog [option] [file|url] + + Options: + -l long link + -s shorten url + -e [hour] expire time + + Examples: + # upload file + $prog somefile.png + + # expire time 24 hours + $prog -e 24 somefile.png + + # upload piped data + echo "something" | $prog - + + # get long link + $prog -l somefile.png + + # shorten url + $prog -s https://verylongurl + + # combine expire and long + $prog -e 5 -s somefile.txt + _EOF + exit +} + +if [ $1 = "-e" ]; then + exp=$2 + shift 2 +fi + +if [ $# -ge 3 ] || [ $# -eq 0 ]; then + usage +fi + +if [ $# -eq 2 ]; then + case $1 in + -s) + url=$(curl -s -Fshorten=$2 $host) + echo $url + echo -e "$url\t# shorten: $2" >> $links + exit + ;; + -l) + long="secret=" + shift + ;; + *) + echo "$prog: unrecognized option '$1'" + usage + ;; + esac +fi + +if [ -f $1 ] || [ $1 = "-" ]; then + out=$(curl -s -Ffile=@$1 -F$long -Fexpires=$exp -w '%header{x-token}' $host) +else + echo "$prog: file '$1' not exist" + exit +fi + +url=$(echo "$out" | sed '1q;d') +token=$(echo "$out" | sed '2q;d') + +echo $url +echo -e "$url\t\t# expire: $exp, token: $token" >> $links diff --git a/bin/record.sh b/bin/record.sh index be85a2f..9796672 100755 --- a/bin/record.sh +++ b/bin/record.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env dash +#!/bin/sh if [ $# -ne 1 ]; then echo "bad usage" diff --git a/bin/scshot.sh b/bin/scshot.sh index e789c6e..a709c63 100755 --- a/bin/scshot.sh +++ b/bin/scshot.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env dash +#!/bin/sh sspath="$HOME/media" ssname="$(date +"%F_%I%M").png" diff --git a/bin/xray.sh b/bin/xray.sh index faf4c0b..2b8fa11 100755 --- a/bin/xray.sh +++ b/bin/xray.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env dash +#!/bin/sh if [ -n "$(pgrep xray)" ]; then pkill xray |