• Sep 30, 2021 •LeifMessinger
0 likes • 8 views
touch /tmp/login1.txt /tmp/login2.txt while [ true ] do who | gawk '{ print $1 }' > /tmp/login2.txt comm -13 /tmp/login1.txt /tmp/login2.txt #Just a bit easier to read #diff /tmp/login1.txt /tmp/login2.txt cat /tmp/login2.txt > /tmp/login1.txt sleep 1 done
• Nov 17, 2021 •LeifMessinger
0 likes • 6 views
#!/bin/bash #Takes command line arguments and pulls the header files. #Good for checking if the function you want is in the header or not. #cppToStdout.sh "time.h" while [ "$1" != "" ]; do echo "#include<$1>" | g++ -x c++ -E - shift done
• Mar 21, 2021 •LeifMessinger
0 likes • 0 views
#pinger.sh by Leif Messinger #./pinger.sh [ADDRESS] to search #./pinger.sh [ADDRESS] & to search in the background #https://serverfault.com/a/42382 ping_cancelled=false # Keep track of whether the loop was cancelled, or succeeded until ping -c1 "$1" >/dev/null 2>&1; do :; done & # The "&" backgrounds it trap "kill $!; ping_cancelled=true" SIGINT wait $! # Wait for the loop to exit, one way or another trap - SIGINT # Remove the trap, now we're done with it if [ "$ping_cancelled" == true ] #https://stackoverflow.com/a/21210966/10141528 then printf "The pinger for $1 just closed bro.\n" else printf "$1 IS UP BROOO\a\n" fi
• Nov 18, 2022 •AustinLeath
0 likes • 1 view
echo -e ${PATH//:/\\n} | awk '{print length, $0}' | sort -n | cut -f2- -d' '
• Nov 23, 2021 •LeifMessinger
0 likes • 3 views
#!/bin/bash #Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there #Leif Messinger let OFFSET=0 let BATCHSIZE=50 let LIMIT=100 mkdir monkeys function 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; do name=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'` wget -q -O "./monkeys/$name.png" "$line" & done } function queryMonkeys(){ let progress=($OFFSET*100)/$LIMIT echo "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 download sleep 10 else #Download Monkeys echo "$result" | parseResults | downloadMonkeys let OFFSET+=$BATCHSIZE fi #If not out of bounds, recurse if [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; then queryMonkeys fi } echo "Downloading your monkeys into ./monkeys asynchronously." queryMonkeys
• Oct 15, 2022 •CodeCatch
0 likes • 136 views
awk '\ { for (i=1; i<=NF; i++) { ++D[$i]; } }\ END { for (i in D) { print i, D[i] } }\ ' words.txt | sort -nr -k 2