• 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
• Mar 7, 2021 •LeifMessinger
0 likes • 10 views
#!/bin/bash #makefileMaker.sh by Leif Messinger #Needs getDependencies.sh CC="gcc" #I have no idea why it's called CXX when it's a c++ compiler #I know that cpp is c pre processor, but still, why X? CXX="g++" CXXFLAGS="-std=c++17 -O2" #CFLAGS="-std=c17" LIBRARIES="$@" #Vulkan Flags for me #LIBRARIES="-lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi" function compileAllFiles(){ #output: bruh.o yeet.o # CXX $CXXFLAGS bruh.o yeet.o -o output $LIBRARIES echo -n "output:" if compgen -G "*.cpp" &> /dev/null; then for f in *.cpp; do echo -n " ${f%.cpp}.o" done fi if compgen -G "*.c" &> /dev/null; then for f in *.c; do echo -n " ${f%.c}.o" done fi echo "" if compgen -G "*.cpp" &> /dev/null; then echo -e -n "\t$CXX $CXXFLAGS " else echo -e -n "\t$CC $CFLAGS " fi if compgen -G "*.cpp" &> /dev/null; then for f in *.cpp; do echo -n " ${f%.cpp}.o" done fi if compgen -G "*.c" &> /dev/null; then for f in *.c; do echo -n " ${f%.c}.o" done fi echo " -o output $LIBRARIES" echo "" } function compileAllObjectFiles(){ #bruh.o: bruh.cpp yeet.h # CXX $CXXFLAGS -c bruh.cpp $LIBRARIES if compgen -G "*.cpp" &> /dev/null; then for f in *.cpp; do echo -n "${f%.cpp}.o: $f" getDependencies.sh < $f echo "" echo -e "\t$CXX $CXXFLAGS -c $f" echo "" done fi #yeet.o: yeet.c # CC $CFLAGS -c yeet.c $LIBRARIES if compgen -G "*.c" &> /dev/null; then for f in *.c; do echo -n "${f%.c}.o: $f" getDependencies.sh < $f echo "" echo -e "\t$CC $CFLAGS -c $f" echo "" done fi } compileAllFiles compileAllObjectFiles #does not work on windows echo "clean:" echo -e "\trm -f -v *.o output" echo "" echo "run:" echo -e "\t./output" echo "" echo "debug:" if compgen -G "*.cpp" &> /dev/null; then echo -e -n "\t$CXX $CXXFLAGS -g " else echo -e -n "\t$CC $CFLAGS -g " fi if compgen -G "*.cpp" &> /dev/null; then for f in *.cpp; do echo -n " ${f}" done fi if compgen -G "*.c" &> /dev/null; then for f in *.c; do echo -n " ${f}" done fi echo " $LIBRARIES -o output" echo ""
• Apr 3, 2025 •LeifMessinger
0 likes • 4 views
#!/usr/bin/env bash #Splits a command across a number of CELL machines user=$(whoami) if [[ -z $user ]]; then echo "whoami failed. Exiting..." exit 1 fi command="$1" if [[ -z $command ]]; then echo "Need to put in a command." exit 1 fi shift array=("$@") let start=8 let stop=18 for ((i = $start; i <= $stop; i++)); do extraZero=$(if [[ "$i" -lt 10 ]]; then echo "0"; fi) domain="CELL${extraZero}${i}-CSE.ENG.UNT.EDU" let "index = i - start" echo ${#array[@]} if [[ ${#array[@]} != 0 ]] && [[ $index -ge ${#array[@]} ]]; then echo "$index > ${#array[@]}" break fi ssh -o StrictHostKeyChecking=accept-new "${user}@${domain}" -t "$command ${array[$index]}" & done
• Nov 19, 2022 •CodeCatch
0 likes • 1 view
name="John" echo ${name} echo ${name/J/j} #=> "john" (substitution) echo ${name:0:2} #=> "Jo" (slicing) echo ${name::2} #=> "Jo" (slicing) echo ${name::-1} #=> "Joh" (slicing) echo ${name:(-1)} #=> "n" (slicing from right) echo ${name:(-2):1} #=> "h" (slicing from right) echo ${food:-Cake} #=> $food or "Cake"
• Aug 16, 2023 •C S
0 likes • 6 views
# Run "test" script on all packages npm run test --workspaces # Tip - this also works: npm run test -ws ---------------------------------------------------- # Runs "test" only on package-a npm run test --workspace package-a # Tip - this also works: npm run test -w package-a ---------------------------------------------------- # Install `lodash` on `package-a` npm install lodash --workspace package-a # Install `tap` on `package-b` as a dev dependency npm install tap --workspace package-b --save-dev # Install `package-a` on `package-b` npm install package-a --workspace package-b # Install `eslint` in all packages npm install eslint --workspaces
• 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