Loading...
More Shell Posts
#!/bin/bashgit statusecho "Do you want to add all changed files?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 1;;esacdonegit add -ugit statusecho "Does this look right?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 2;;esacdonegit commitecho "Do you want to push?"select yn in "Yes" "No"; docase $yn inYes ) break;;No ) exit 2;;esacdonegit push
#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#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 ""
// check versionnode -v || node --version// list installed versions of node (via nvm)nvm ls// install specific version of nodenvm install 6.9.2// set default version of nodenvm alias default 6.9.2// switch version of nodenvm use 6.9.1
for region in `aws ec2 describe-regions --output text | cut -f4`doecho -e "\nListing Instances in region:'$region'..."aws ec2 describe-instances --query 'Reservations[*].Instances[*].{Instance:InstanceId,Subnet:SubnetId}' --region $regiondone#This script is to be used with any AWS CLI configured environment, it will list any EC2 instances and their associated subnet network ID's in JSON format
#!/bin/bashfor branch in $(git branch | cut -c 3-); doread -p "Delete local branch $branch? (y/n) " -n 1 -recho ""if [[ $REPLY =~ ^[Yy]$ ]]; thengit branch -D $branchfidone