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
#!/bin/bash#Leif Messinger lsm0147#credit.sh FILEScred="Leif Messinger lsm0147"for bruh; doif [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; thencomment="//$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"fiif [ -s $bruh ]; then#If the file has a shebangif egrep -q '^#!/' $bruh; thensed -i "/^\#!\//a$comment" $bruhelsesed -i "1i$comment" $bruhfielseecho "$comment" > $bruhfidone
#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 ""
# Run "test" script on all packagesnpm run test --workspaces# Tip - this also works:npm run test -ws----------------------------------------------------# Runs "test" only on package-anpm 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 dependencynpm install tap --workspace package-b --save-dev# Install `package-a` on `package-b`npm install package-a --workspace package-b# Install `eslint` in all packagesnpm install eslint --workspaces
awk '\{ for (i=1; i<=NF; i++) { ++D[$i]; } }\END { for (i in D) { print i, D[i] } }\' words.txt | sort -nr -k 2