Created
March 13, 2021 14:25
-
-
Save lanefu/cdee807c352499ed3b0dedce185e0232 to your computer and use it in GitHub Desktop.
armbian fastly debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/bin/env bash | |
# Examples: | |
# linx hello.txt # paste file (name/ext will be set). | |
# echo Hello world. | linx # read from STDIN (won't set name/ext). | |
# linx -n 1 self_destruct.txt # paste will be deleted after one read. | |
# linx -i ID hello.txt # replace ID, if you have permission. | |
# linx -d ID | |
fastly_headers() { | |
curl -I -X GET https://mirrors.fossho.st/armbian/apt/ | |
} | |
get_myip() { | |
curl -s ifconfig.me | |
} | |
get_geoip() { | |
curl -s https://apt.armbian.com/geoip | |
} | |
linx() { | |
local opts | |
local OPTIND | |
[ -f "$HOME/.netrc" ] && opts='-n' | |
while getopts ":hd:i:n:" x; do | |
case $x in | |
h) echo "linx [-d ID] [-i ID] [-n N] [opts]"; return;; | |
d) $echo curl $opts -X DELETE linx.io/$OPTARG; return;; | |
i) opts="$opts -X PUT"; local id="$OPTARG";; | |
n) opts="$opts -F read:1=$OPTARG";; | |
esac | |
done | |
shift $(($OPTIND - 1)) | |
[ -t 0 ] && { | |
local filename="$1" | |
shift | |
[ "$filename" ] && { | |
curl $opts -T "$filename" $* https://armbian.lane-fu.com/linx/upload/ | |
return | |
} | |
echo "^C to cancel, ^D to send." | |
} | |
curl $opts -T - https://armbian.lane-fu.com/linx/upload/ | |
} | |
echo -e "$(fastly_headers) \n MyIP:$(get_myip) \n \n $(get_geoip) "| linx | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment