• Sep 23, 2024 •AustinLeath
0 likes • 6 views
CLIENT_VPN_ID="cvpn-endpoint-xxxxxxxxxxxx" for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do echo "Searching in region: $region" aws ec2 describe-client-vpn-endpoints --region $region --query "ClientVpnEndpoints[?ClientVpnEndpointId=='$CLIENT_VPN_ID']" --output table done
• Jul 29, 2024 •AustinLeath
0 likes • 7 views
for region in `aws ec2 describe-regions --output text | cut -f4` do echo -e "\nListing Instances in region:'$region'..." aws ec2 describe-instances --query 'Reservations[*].Instances[*].{Instance:InstanceId,Subnet:SubnetId}' --region $region done #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
• Mar 10, 2023 •Helper
1 like • 6 views
#!/bin/bash for branch in $(git branch | cut -c 3-); do read -p "Delete local branch $branch? (y/n) " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then git branch -D $branch fi done
• Oct 15, 2022 •CodeCatch
0 likes • 136 views
awk '\ { for (i=1; i<=NF; i++) { ++D[$i]; } }\ END { for (i in D) { print i, D[i] } }\ ' words.txt | sort -nr -k 2
• 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 ""
• Aug 7, 2023 •C S
0 likes • 2 views
# Three ways of checking if a file exists in a shell script FILE=/etc/resolv.conf if test -f "$FILE"; then echo "$FILE exists." fi if [ -f "$FILE" ]; then echo "$FILE exists." fi if [[ -f "$FILE" ]]; then echo "$FILE exists." fi