Loading...
More Shell Posts
#!/bin/bash#makefileMaker.sh by Leif Messinger#Needs getDependencies.shCC="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 $LIBRARIESecho -n "output:"if compgen -G "*.cpp" &> /dev/null; thenfor f in *.cpp; doecho -n " ${f%.cpp}.o"donefiif compgen -G "*.c" &> /dev/null; thenfor f in *.c; doecho -n " ${f%.c}.o"donefiecho ""if compgen -G "*.cpp" &> /dev/null; thenecho -e -n "\t$CXX $CXXFLAGS "elseecho -e -n "\t$CC $CFLAGS "fiif compgen -G "*.cpp" &> /dev/null; thenfor f in *.cpp; doecho -n " ${f%.cpp}.o"donefiif compgen -G "*.c" &> /dev/null; thenfor f in *.c; doecho -n " ${f%.c}.o"donefiecho " -o output $LIBRARIES"echo ""}function compileAllObjectFiles(){#bruh.o: bruh.cpp yeet.h# CXX $CXXFLAGS -c bruh.cpp $LIBRARIESif compgen -G "*.cpp" &> /dev/null; thenfor f in *.cpp; doecho -n "${f%.cpp}.o: $f"getDependencies.sh < $fecho ""echo -e "\t$CXX $CXXFLAGS -c $f"echo ""donefi#yeet.o: yeet.c# CC $CFLAGS -c yeet.c $LIBRARIESif compgen -G "*.c" &> /dev/null; thenfor f in *.c; doecho -n "${f%.c}.o: $f"getDependencies.sh < $fecho ""echo -e "\t$CC $CFLAGS -c $f"echo ""donefi}compileAllFilescompileAllObjectFiles#does not work on windowsecho "clean:"echo -e "\trm -f -v *.o output"echo ""echo "run:"echo -e "\t./output"echo ""echo "debug:"if compgen -G "*.cpp" &> /dev/null; thenecho -e -n "\t$CXX $CXXFLAGS -g "elseecho -e -n "\t$CC $CFLAGS -g "fiif compgen -G "*.cpp" &> /dev/null; thenfor f in *.cpp; doecho -n " ${f}"donefiif compgen -G "*.c" &> /dev/null; thenfor f in *.c; doecho -n " ${f}"donefiecho " $LIBRARIES -o output"echo ""
#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 inputsed -z -r -e 's/\./\\\./g ; s/\-/\\\-/g' -e 's/\n/\)\|\(/g' -e 's/\|\($//' -e 'i/\(' -e 'a/!d' $1 | sed -r -f - $2
#!/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
#!/bin/bashsudo 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 goingexitsudo apt install git cmake cmake-guisudo mkdir /usr/lib/stbpushd /usr/lib/stbsudo wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.hpopdcd ~/Documentsgit clone https://github.com/Overv/VulkanTutorial.gitcd VulkanTutorial/codecmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DSTB_INCLUDEDIR:PATH="/usr/lib/stb"cd buildmake
## 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
#!/bin/bash# Set the directory to searchDIRECTORY="src"# Set the output fileOUTPUT_FILE="testids.txt"# Clear the output file> "$OUTPUT_FILE"# Find all .tsx files in the specified directory and its subdirectoriesfind "$DIRECTORY" -type f -name "*.tsx" | while read -r FILEdo# Search for instances of 'data-testid="testid"' and append them to the output filegrep -o 'data-testid="[^"]*"' "$FILE" >> "$OUTPUT_FILE"# Search for instances of "'data-testid': 'testid'" and append them to the output filegrep -o "'data-testid': '[^']*'" "$FILE" >> "$OUTPUT_FILE"doneecho "Search complete. Test IDs written to $OUTPUT_FILE."