pub brush up, +bashrc

This commit is contained in:
tosu 2024-06-17 21:23:14 +02:00
parent 34c606d965
commit d202f36cf3
2 changed files with 46 additions and 27 deletions

View File

@ -192,7 +192,7 @@ function paruuu () {
}
function skill () {
if [ -n "${1-}" ] ; then
while [ -n "${1:-}" ] ; do
# shellcheck disable=SC2046,SC2009
2>/dev/null kill -9 \
-- $(ps auxww | grep -v grep | grep "${1-}" | awk '{print $2}') \
@ -201,10 +201,7 @@ function skill () {
2>/dev/null sudo kill -9 \
-- $(ps auxww | grep "${1-}" | grep -v grep | awk '{print $2}') ||
{ echo "Couldn't kill process"; return 3; }
else
echo 'Please provide one argument'
return 1;
fi
done
}
function wpa_restart () {

View File

@ -1,36 +1,58 @@
#! /bin/sh -
######################## PREAMBLE ##########################
err () {
printf '\033[31m%s\033[m\n' "$*"
printf '\033[31m%s\033[m\n' "$*" >&2
}
trap 'rm -f "$file"' EXIT
curl () {
output=$(timeout 5 curl -sfSL "$@") # strip trailing newline
err=$? # save exit status
printf '%s\n' "${output}" # add trailing newline
[ $err = 0 ] && exit 0 # exit early, we got what we wanted
while [ -n "$1" ] && [ "${1}" = "$(printf %s "$1" | tr -d .)" ] ; do shift; done # find domain
[ -z "$1" ] && domain="<unknown>" || domain="$1" # didn't find domain?
[ $err = 124 ] && err "Timed out" # from timeout 5
err "$domain pastebin failed!" # generic error
return $err # specifically for chris titus hastebin
}
[ ! -t 0 ] && [ -z "$1" ] && file=$(mktemp) && cat >"$file" || [ -n "$1" ] && file="$1"
trap 'rm -f "$file"' EXIT # clean up tmpfile
# mia's 0x0.st -- fast! -- prints \n
# curl -sfSL -F"file=@$file" 0x0.st && exit 0 ; err "Mia's (0x0.st) pastebin failed!"
file=$(mktemp --tmpdir pubtmpXXXXXXXXXXXXXXX) # must not contain dot .
if [ -z "$1" ]; then
cat >"$file" # `pub` or `<file pub` or `echo bla | pub`
else
cp "$1" "$file" # `pub FILE`
fi
# pb1n.de -- fast! -- prints \n
# curl -sfSL -F"f=@$file" pb1n.de && exit 0 ; err "pb1n.de pastebin failed!"
######################## PASTEBINS ####################
# mia's 0x0.st -- fast!
curl -F"file=@$file" 0x0.st
# chris titus' hastebin -- not that fast -- prints \n
# response="$(curl -sfSL --data-binary @"$file" bin.christitus.com/documents)" &&
# { hasteKey="$(printf %s "$response" | jq -r '.key')" && [ -n "${hasteKey}" ] &&
# echo "http://bin.christitus.com/raw/$hasteKey" && exit 0 || err "Couldn't extract hasteKey. Sorry!"; }
# err "Chris' pastebin failed!"
# pb1n.de -- fast!
curl -F"f=@$file" pb1n.de
# paste.rs -- damn slow -- prints without \n
# curl -sfSL --data-binary @"$file" paste.rs && exit 0 ; err "paste.rs pastebin failed!"
# chris titus' hastebin -- not that fast
response="$(curl --data-binary @"$file" bin.christitus.com/documents)" &&
{ hasteKey="$(printf %s "$response" | jq -r '.key')" && [ -n "${hasteKey}" ] &&
echo "http://bin.christitus.com/raw/$hasteKey" && exit 0 || err "Couldn't extract hasteKey. Sorry!"; }
err "bin.christitus.com pastebin failed!"
# transfer.sh -- requires https -- not that fast -- prints \n
curl -sfSL --upload-file "$file" https://transfer.sh && exit 0 ; err "transfer.sh pastebin failed!"
# clbin.com -- requires https -- not that fast
curl -F"clbin=<$file" https://clbin.com
# clbin.com -- requires https -- not that fast -- prints \n
curl -sfSL -F"clbin=<$file" https://clbin.com && exit 0 ; err "clbin.com pastebin failed!"
# termbin.com -- slow
<"$file" nc termbin.com 9999 && exit 0 || err "termbin.com pastebin failed!"
# sprunge.us -- RIP
curl -sfSL -F"sprunge=<$file" http://sprunge.us && exit 0 ; err "sprunge.us pastebin failed!"
# paste.rs -- damn slow
curl --data-binary @"$file" paste.rs
# ix.io, "taking a break" -- RIP
curl -sfSL -F"f:1=<$file" ix.io && exit 0 ; err "ix.io pastebin failed!"
#### RIP: sprunge.us, just 404 ####
curl -F"sprunge=<$file" http://sprunge.us
#### RIP: ix.io, "taking a break" ####
curl -F"f:1=<$file" ix.io
#### RIP: transfer.sh, loads forever -- requires https ####
curl --upload-file "$file" https://transfer.sh