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

View File

@ -1,36 +1,58 @@
#! /bin/sh - #! /bin/sh -
######################## PREAMBLE ##########################
err () { 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 file=$(mktemp --tmpdir pubtmpXXXXXXXXXXXXXXX) # must not contain dot .
# curl -sfSL -F"file=@$file" 0x0.st && exit 0 ; err "Mia's (0x0.st) pastebin failed!" 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 ######################## PASTEBINS ####################
# curl -sfSL -F"f=@$file" pb1n.de && exit 0 ; err "pb1n.de pastebin failed!" # mia's 0x0.st -- fast!
curl -F"file=@$file" 0x0.st
# chris titus' hastebin -- not that fast -- prints \n # pb1n.de -- fast!
# response="$(curl -sfSL --data-binary @"$file" bin.christitus.com/documents)" && curl -F"f=@$file" pb1n.de
# { 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!"
# paste.rs -- damn slow -- prints without \n # chris titus' hastebin -- not that fast
# curl -sfSL --data-binary @"$file" paste.rs && exit 0 ; err "paste.rs pastebin failed!" 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 # clbin.com -- requires https -- not that fast
curl -sfSL --upload-file "$file" https://transfer.sh && exit 0 ; err "transfer.sh pastebin failed!" curl -F"clbin=<$file" https://clbin.com
# clbin.com -- requires https -- not that fast -- prints \n # termbin.com -- slow
curl -sfSL -F"clbin=<$file" https://clbin.com && exit 0 ; err "clbin.com pastebin failed!" <"$file" nc termbin.com 9999 && exit 0 || err "termbin.com pastebin failed!"
# sprunge.us -- RIP # paste.rs -- damn slow
curl -sfSL -F"sprunge=<$file" http://sprunge.us && exit 0 ; err "sprunge.us pastebin failed!" curl --data-binary @"$file" paste.rs
# ix.io, "taking a break" -- RIP #### RIP: sprunge.us, just 404 ####
curl -sfSL -F"f:1=<$file" ix.io && exit 0 ; err "ix.io pastebin failed!" 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