Loading...
More Shell Posts
awk '\{ for (i=1; i<=NF; i++) { ++D[$i]; } }\END { for (i in D) { print i, D[i] } }\' words.txt | sort -nr -k 2
#!/bin/bash# Recursively find all .svelte files in the current directory and its subdirectoriesfind . -type f -name "*.svelte" -o -name "*.html" -o -name "*.htm" | while read file; do# Replace all h1 tags with the specified formatsed -i 's/<h1>\(.*\)<\/h1>/<h1 id="\1">\1<\/h1>/g' "$file"# Replace all h2 tags with the specified formatsed -i 's/<h2>\(.*\)<\/h2>/<h2 id="\1">\1<\/h2>/g' "$file"# Remove whitespace from the id attribute valuefor i in {0..10} ; dosed -i 's/\(id="[^"]*\)\W\([^"]*"\)/\1\2/g' "$file"donedone
#pinger.sh by Leif Messinger#./pinger.sh [ADDRESS] to search#./pinger.sh [ADDRESS] & to search in the background#https://serverfault.com/a/42382ping_cancelled=false # Keep track of whether the loop was cancelled, or succeededuntil ping -c1 "$1" >/dev/null 2>&1; do :; done & # The "&" backgrounds ittrap "kill $!; ping_cancelled=true" SIGINTwait $! # Wait for the loop to exit, one way or anothertrap - SIGINT # Remove the trap, now we're done with itif [ "$ping_cancelled" == true ] #https://stackoverflow.com/a/21210966/10141528thenprintf "The pinger for $1 just closed bro.\n"elseprintf "$1 IS UP BROOO\a\n"fi
#!/bin/bash#Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there#Leif Messingerlet OFFSET=0let BATCHSIZE=50let LIMIT=100mkdir monkeysfunction parseResults(){sed 'y/,/\n/' | sed -e '/storage.opensea/d' -e '/https:\/\/lh3.googleusercontent.com\/Ju9CkWtV-1Okvf45wo8UctR-M9He2PjILP0oOvxE89AyiPPGtrR3gysu1Zgy0hjd2xKIgjJJtWIc0ybj4Vd7wv8t3pxDGHoJBzDB=s120/d' | egrep '"image_url":"(.*)"' | tr -d '\"' | sed 's/image_url://'}function downloadMonkeys(){while read -r line; doname=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'`wget -q -O "./monkeys/$name.png" "$line" &done}function queryMonkeys(){let progress=($OFFSET*100)/$LIMITecho "Progress: $progress%"result=`curl -s --request GET --url "https://api.opensea.io/api/v1/assets?order_direction=desc&offset=$OFFSET&limit=$BATCHSIZE&collection=boredapeyachtclub"`if [[ "$result" =~ "Request was throttled" ]] || [ "$result" == "" ]; then#Retry downloadsleep 10else#Download Monkeysecho "$result" | parseResults | downloadMonkeyslet OFFSET+=$BATCHSIZEfi#If not out of bounds, recurseif [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; thenqueryMonkeysfi}echo "Downloading your monkeys into ./monkeys asynchronously."queryMonkeys
#!/bin/bash#Installs the Vulkan library and other goodies. Works on Arch and Arch based distros. Needs pacman and makepkginstallVulkan(){#Tries installing every linux package in existencepackages=( vulkan-tools libvulkan-dev vulkan-loader-devel vulkan-validation-layers spirv-tools mesa-vulkan-devel vulkan-validation-layers-devel )for package in ${packages[*]}; dosudo pacman --noconfirm -S $packagedone}installLibraries(){#All of these packages don't exist, so we have to download and install the AUR packages#packages=( libglfw3-dev glfw-devel libglm glm-devel )#for package in ${packages[*]}; do# sudo pacman --noconfirm -S $package#donesudo git clone https://aur.archlinux.org/glfw-git.git /tmp/glfw-gitsudo chmod 777 /tmp/glfw-gitcd /tmp/glfw-gitmakepkg -sisudo git clone https://aur.archlinux.org/glm-git.git /tmp/glm-gitsudo chmod 777 /tmp/glm-gitcd /tmp/glm-gitmakepkg -si}installShaderCompiler(){#Basically installs glslcsudo pacman -S shaderc}while true; doselect bruh in installVulkan installLibraries installShaderCompiler "exit"; do$bruhdonedone
## Austin Leath# checks for /Desktop symlink. Creates the symlink if it doesnt already exist##Fetch the target user if desired, otherwise use the currently logged in user.if [ "$4" != "" ]; thenTARGET_USER=$4elseTARGET_USER=$3fiif [ "$5" != "" ]; thenDIRECTORY_NAME=$5elseTARGET_USER="$3 Desktop"fi# FunctionsCHECK_SYMLINK() {if test -f "/Desktop"; thenecho "/Desktop exists"elseecho "/Desktop does not exist"fi}CHECK_SYNTHETIC_CONF() {if test -f "/etc/synthetic.conf"; thenecho "/etc/synthetic.conf exists"elseecho "/etc/synthetic.conf does not exist"fi}CREATE_SYMLINK() {if [[ $(CHECK_SYNTHETIC_CONF) != "/etc/synthetic.conf exists" ]]; thenecho "/etc/synthetic.conf does not exist. creating.."touch /etc/synthetic.confchown -R root:wheel /etc/synthetic.conffiif grep -q "$DIRECTORY_NAME" /etc/synthetic.conf; thenecho "$DIRECTORY_NAME already exists"exit 1elseecho "$DIRECTORY_NAME\t/Users/$TARGET_USER/Desktop" >> /etc/synthetic.conffiecho "/Desktop symbolic link created"}if [[ $(CHECK_SYMLINK) != "/Desktop exists" ]]; thenCREATE_SYMLINKfiexit 0