• Nov 17, 2021 •LeifMessinger
0 likes • 6 views
#!/bin/bash #Takes command line arguments and pulls the header files. #Good for checking if the function you want is in the header or not. #cppToStdout.sh "time.h" while [ "$1" != "" ]; do echo "#include<$1>" | g++ -x c++ -E - shift done
• Aug 16, 2023 •C S
# Run "test" script on all packages npm run test --workspaces # Tip - this also works: npm run test -ws ---------------------------------------------------- # Runs "test" only on package-a npm 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 dependency npm install tap --workspace package-b --save-dev # Install `package-a` on `package-b` npm install package-a --workspace package-b # Install `eslint` in all packages npm install eslint --workspaces
• May 20, 2024 •AustinLeath
0 likes • 13 views
#!/bin/sh BAT_LOW=15 BAT_CRITICAL=5 if [ "$1" = "--help" ] then printf " Usage: \tbattery_check.sh warning%% hibernate%% Description: \tA script for notifying the user via dunst and logging when \tthe battery is low and the system is going to hibernate. \tCan be supplied arguments for the battery low warning and \thibernation percentage thresholds as the first and second arguments. \t Default behavior is to warn at 15% and hibernate at 5%." exit fi if [[ -n "$1" && -n "$2" && $1 -gt $2 ]] then BAT_LOW=$1 BAT_CRITICAL=$2 fi acpi -b | awk -F'[,:%]' '{print $2, $3}' | { read -r status capacity echo Low threshold: $BAT_LOW, Hibernate threshold: $BAT_CRITICAL echo Status: $status, Capacity: $capacity if [ "$status" = Discharging -a "$capacity" -le $BAT_CRITICAL ]; then echo Battery critical threshold. dunstify -u critical "Critical battery threshold, hibernating..." logger "Critical battery threshold, hibernating..." sleep .5 systemctl hibernate exit fi if [ "$status" = Discharging -a "$capacity" -le $BAT_LOW ]; then echo Battery low threshold. dunstify -u critical 'Battery low! System will hibernate at 5%.' logger 'Battery low! System will hibernate at 5%.' sleep .5 light -S 15 exit fi }
• 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
• Apr 21, 2021 •LeifMessinger
#diskRipper.sh by Leif Messinger #For use on debian, where your cds aren't immediately mounted wall "CD inserted boss" set -x #echo on cdDrivePath=$(ls -l /dev/cdrom | awk '{print $NF}') #CD could have no label, so that's why I need awk cdLabel=$(lsblk -n "/dev/$cdDrivePath" -o label) if [[ ! -z "$cdLabel" ]]; then #CD has label folderName=$cdLabel echo "The cd label is ${folderName}" if mkdir ./cds/"${folderName}"; then #Folder didn't exist before sudo mount /dev/cdrom ./.cdmountpoint sudo cp -r ./.cdmountpoint/* "./cds/${folderName}" sudo chmod -R 777 "./cds/${folderName}" sudo umount ./.cdmountpoint eject wall "CD done and ejecting" else wall "Already read that cd, skipped" fi else wall "CD had no label, skipped" 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."