• Jul 16, 2023 •LeifMessinger
0 likes • 6 views
#!/bin/bash sudo apt install build-essential vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools libglfw3-dev libglm-dev libtinyobjloader-dev #The rest of this downloads the Vulkan Tutorial project and its dependencies. #Comment this out to keep going exit sudo apt install git cmake cmake-gui sudo mkdir /usr/lib/stb pushd /usr/lib/stb sudo wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h popd cd ~/Documents git clone https://github.com/Overv/VulkanTutorial.git cd VulkanTutorial/code cmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DSTB_INCLUDEDIR:PATH="/usr/lib/stb" cd build make
• Oct 26, 2021 •LeifMessinger
0 likes • 3 views
#!/bin/bash #Leif Messinger lsm0147 #credit.sh FILES cred="Leif Messinger lsm0147" for bruh; do if [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; then comment="//$cred" else #Basically everything else gets a pound sign comment #Pound signs are standard across linux. bash, sed, gawk, python etc #Speaking of which, I need to escape it because of that. comment="\#$cred" fi if [ -s $bruh ]; then #If the file has a shebang if egrep -q '^#!/' $bruh; then sed -i "/^\#!\//a$comment" $bruh else sed -i "1i$comment" $bruh fi else echo "$comment" > $bruh fi done
• Feb 22, 2022 •LeifMessinger
0 likes • 1 view
#Leif Messinger #For when you want to search a lot of words in a file fast #Arg 1 is the argument the list of words you want to search #Arg 2 is the file you want to search #-z means that it looks at the file as a whole, just treating newlines a characters. #-r is regex. Needed for $, even tho the documentation says you don't need it. They are liars. #First command replaces all . with \. and all - with \- #Second command takes all newlines and replaces them with )|( #Third command takes the trailing |( and deletes it #Forth command puts a /( at the start #Fith command puts /!d at the end. This tells it to not delete any lines that match the pattern. #The second sed takes the output of the first sed as a command that searches any of the combined words #-f - takes a command from the input sed -z -r -e 's/\./\\\./g ; s/\-/\\\-/g' -e 's/\n/\)\|\(/g' -e 's/\|\($//' -e 'i/\(' -e 'a/!d' $1 | sed -r -f - $2
• Sep 29, 2021 •LeifMessinger
0 likes • 29 views
#!/bin/bash #cpcmd.sh [file1 [file2...]] #Prints out the commands needed to copy the file to your local machine #This will work on any server that also has the same hostname as in your hosts file. #I should update this to detect if a file is a directory, and enable recursion for those commands. If you do it now, it will probably just warn you. if [ -n "$1" ]; then for arg; do recursive=$(if [[ -d $arg ]]; then printf " -r"; fi) printf "scp$recursive \"$(whoami)@$(hostname):" printf `readlink -f $arg` printf "\" .\n" done else echo "scp \"$(whoami)@$(hostname):$PWD/*\" ." fi #-----------EDIT: #On the UNT cell machines, you have to do this script instead ##!/bin/bash #if [ -n "$1" ]; then # for arg; do # recursive=$(if [[ -d $arg ]]; then printf " -r"; fi) # printf "scp$recursive $(whoami)@$(hostname).eng.unt.edu:" # printf `readlink -f $arg` # printf " .\n" # done #else # echo "scp $(whoami)@$(hostname).eng.unt.edu:$PWD/* ." #fi
• Jul 8, 2024 •C S
0 likes • 17 views
#!/bin/bash # Set the directory to search DIRECTORY="src" # Set the output file OUTPUT_FILE="testids.txt" # Clear the output file > "$OUTPUT_FILE" # Find all .tsx files in the specified directory and its subdirectories find "$DIRECTORY" -type f -name "*.tsx" | while read -r FILE do # Search for instances of 'data-testid="testid"' and append them to the output file grep -o 'data-testid="[^"]*"' "$FILE" >> "$OUTPUT_FILE" # Search for instances of "'data-testid': 'testid'" and append them to the output file grep -o "'data-testid': '[^']*'" "$FILE" >> "$OUTPUT_FILE" done echo "Search complete. Test IDs written to $OUTPUT_FILE."
• Nov 23, 2021 •LeifMessinger
#!/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