Loading...
More Shell Posts
#!/bin/bash#cpcmd.sh [file1 [file2...]]#Prints out the commands needed to copy the file to your local machine#This will work on any server that also has the same hostname as in your hosts file.#I should update this to detect if a file is a directory, and enable recursion for those commands. If you do it now, it will probably just warn you.if [ -n "$1" ]; thenwhile [ -n "$1" ]; doprintf "scp \"$(whoami)@$(hostname):"printf `readlink -f $1`printf "\" .\n"shiftdoneelseecho "scp \"$(whoami)@$(hostname):$PWD/*\" ."fi#-----------EDIT:#On the UNT cell machines, you have to do this script instead#if [ -n "$1" ]; then# while [ -n "$1" ]; do# printf "scp $(whoami)@$(hostname).eng.unt.edu:"# printf `readlink -f $1`# printf " .\n"# shift# done#else# echo "scp $(whoami)@$(hostname).eng.unt.edu:$PWD/* ."#fi
#!/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
#!/bin/bash#getDependencies.sh by Leif Messingergrep -Po '#include\s*"\K.+(?=")' | while read -r line ; doecho -n " $line"./getDependencies.sh < $linedone
#diskRipper.sh by Leif Messinger#For use on debian, where your cds aren't immediately mountedwall "CD inserted boss"set -x #echo oncdDrivePath=$(ls -l /dev/cdrom | awk '{print $NF}')#CD could have no label, so that's why I need awkcdLabel=$(lsblk -n "/dev/$cdDrivePath" -o label)if [[ ! -z "$cdLabel" ]]; then #CD has labelfolderName=$cdLabelecho "The cd label is ${folderName}"if mkdir ./cds/"${folderName}"; then #Folder didn't exist beforesudo mount /dev/cdrom ./.cdmountpointsudo cp -r ./.cdmountpoint/* "./cds/${folderName}"sudo chmod -R 777 "./cds/${folderName}"sudo umount ./.cdmountpointejectwall "CD done and ejecting"elsewall "Already read that cd, skipped"fielsewall "CD had no label, skipped"fi
# Update all npm packages under the scope defined by the PREFIX variable ("foo").PREFIX="foo"; npm ls | grep "$PREFIX" | awk -F/ '{print $NF}' | sed 's/@.*//' | xargs -I package npm update @"$PREFIX"/package
#!/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."