Added shardz function to bash_functions (banger)

This commit is contained in:
Dionysus 2024-12-06 22:59:17 -05:00
parent f41d67cb26
commit 81a4d4cefd
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
3 changed files with 53 additions and 36 deletions

View File

@ -22,35 +22,35 @@ alias wh='curl wttr.in'
scene() {
for x in $(curl -L -k -s http://www.textfiles.com/artscene/ansi/bbs/ | tr ' ' '\n' | grep HREF | tr '"' ' ' | awk '{print $2}' | grep -P "(ans|vt)" | grep -v ".png" | grep "." | shuf); do
curl -L -k -s http://www.textfiles.com/artscene/ansi/bbs/$x | iconv -f 437 -t utf-8 | pv -q -L 600
curl -L -k -s http://www.textfiles.com/artscene/ansi/bbs/$x | iconv -f 437 -t utf-8 | pv -q -L 600
done
}
# Some of the commands below are from package installs or custom builds
fun() {
echo "COMMAND | DESCRIPTION"
echo "------------- | -----------"
echo "asciiquarium | Terminal-based aquarium"
echo "ansi | Play ANSI art in your terminal"
echo "ascii | Play ASCII art in your terminal"
echo "bomber | Bomberman in your terminal"
echo "busy | Make your terminal busy"
echo "chess | Play chess in your terminal"
echo "confetty | Confetti in your terminal"
echo "cmatrix | Matrix-style animation"
echo "crypto | Show cryptocurrency rates"
echo "donut | Spinning donut"
echo "dvd | Bouncing DVD logo"
echo "fire | Fire animation"
echo "fireworks | Fireworks in your terminal"
echo "lavat | Lava lamp style animation"
echo "mapscii | Maps in your terminal"
echo "minesweeper | Play minesweeper in your terminal"
echo "pipes | Pipes in your terminal"
echo "pokemon | Random Pokémon"
echo "scene | Play ANSI scene art in your terminal"
echo "starwars | Watch Star Wars in your terminal"
echo "tty-solitaire | Play solitaire in your terminal"
echo "wh | Weather in your terminal"
echo "wipe | Clear your terminal in style"
echo "COMMAND | DESCRIPTION"
echo "------------- | -----------"
echo "asciiquarium | Terminal-based aquarium"
echo "ansi | Play ANSI art in your terminal"
echo "ascii | Play ASCII art in your terminal"
echo "bomber | Bomberman in your terminal"
echo "busy | Make your terminal busy"
echo "chess | Play chess in your terminal"
echo "confetty | Confetti in your terminal"
echo "cmatrix | Matrix-style animation"
echo "crypto | Show cryptocurrency rates"
echo "donut | Spinning donut"
echo "dvd | Bouncing DVD logo"
echo "fire | Fire animation"
echo "fireworks | Fireworks in your terminal"
echo "lavat | Lava lamp style animation"
echo "mapscii | Maps in your terminal"
echo "minesweeper | Play minesweeper in your terminal"
echo "pipes | Pipes in your terminal"
echo "pokemon | Random Pokémon"
echo "scene | Play ANSI scene art in your terminal"
echo "starwars | Watch Star Wars in your terminal"
echo "tty-solitaire | Play solitaire in your terminal"
echo "wh | Weather in your terminal"
echo "wipe | Clear your terminal in style"
}

View File

@ -30,22 +30,22 @@ cctain() {
}
fkill() {
local pid
if [ "$UID" != "0" ]; then
pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
fi
if [ "x$pid" != "x" ]; then
echo $pid | xargs kill -${1:-9}
fi
local pid
if [ "$UID" != "0" ]; then
pid=$(ps -f -u $UID | sed 1d | fzf -m | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
fi
if [ "x$pid" != "x" ]; then
echo $pid | xargs kill -${1:-9}
fi
}
extract() {
if [ ! -z "$1" ]; then
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvJf $1 ;;
*.lzma) unlzma $1 ;;

View File

@ -54,6 +54,23 @@ crtsh() {
curl -s "https://crt.sh/?q=$1&output=json" | jq -r '.[].name_value' | sort | uniq
}
shardz() {
[ "$#" -ne 1 ] || ! echo "$1" | grep -q '^[1-9][0-9]*/[1-9][0-9]*$' && {
echo "Usage: process_with_output | shardz INDEX/TOTAL" >&2
return 1
}
shard=${1%/*}
total=${1#*/}
[ "$shard" -gt "$total" ] && {
echo "Error: INDEX cannot be greater than TOTAL" >&2
return 1
}
sed -n "$shard~$total p"
}
shodan() {
curl https://internetdb.shodan.io/$1
}