Loading...
More Shell Posts
#!/bin/bash#Originally made by Isaac Cook https://gist.github.com/icook/5400173#Modified by Leif Messinger#upload_key.sh [server_ip [server2_ip [...]]]#To be run locally on a linux computerif [ -e ~/.ssh/id_rsa.pub ];thenecho "SSH Key already exists on local machine"elseecho "Generating SSH key on local machine"ssh-keygen -t rsa #generates id_rsa and id_rsa.pubchmod -R 700 ~/.ssh #Sets permissions of ssh folderssh-add #Adds keys (and passwords?) to ssh_agent. (hopefully doesn't require password)fiecho "Loading client public key into memory"pubKey=$(<~/.ssh/id_rsa.pub)for serverdoecho "Adding client public key to $server remote server authorized keys"#Idiot Isaac Cook didn't know about ssh-copy-id#ssh-copy-id even checks if your key already exists#In fairness, I didn't either until researching ssh-addssh-copy-id -i ~/.ssh/id_rsa.pub $server #In theory, this should prompt for a username#ssh $server "mkdir -p ~/.ssh; #Make the folder if not already made# echo \"$pubKey\" >> ~/.ssh/authorized_keys; #Append your public key to the server's authorized_keys# chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys" #Set the correct permissions of those files#echo "Adding server public key to local authorized keys"#ssh $server "ssh-copy-id -i ~/.ssh/id_rsa.pub \$SSH_CLIENT" #this might need some awk, as $SSH_CLIENT spits out clientip portnumberecho "Displaying server public key"ssh $server "cat ~/.ssh/id_rsa.pub"#Though, he did give me a good ideaecho "Displaying keys authorized on $server (you can paste them in your authorized_keys file)"ssh $server "cat ~/.ssh/authorized_keys"#echo "Appending keys authorized on $server to your local authorized_keys"#ssh $server "cat ~/.ssh/authorized_keys" >> ~/.ssh/authorized_keysdoneecho "SSH keys schronized successfully!"
CLIENT_VPN_ID="cvpn-endpoint-xxxxxxxxxxxx"for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); doecho "Searching in region: $region"aws ec2 describe-client-vpn-endpoints --region $region --query "ClientVpnEndpoints[?ClientVpnEndpointId=='$CLIENT_VPN_ID']" --output tabledone
#!/bin/bashsudo apt install build-essential vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools libglfw3-dev libglm-dev libtinyobjloader-dev#The rest of this downloads the Vulkan Tutorial project and its dependencies.#Comment this out to keep goingexitsudo apt install git cmake cmake-guisudo mkdir /usr/lib/stbpushd /usr/lib/stbsudo wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.hpopdcd ~/Documentsgit clone https://github.com/Overv/VulkanTutorial.gitcd VulkanTutorial/codecmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DSTB_INCLUDEDIR:PATH="/usr/lib/stb"cd buildmake
#!/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#Changes the remote url from https to ssh.#Only works for github, because I'd have to store a dictionary of every https to ssh url otherwise.#Made using Bing Chat# Get the remote URL from the consoleREPO_URL=$(git config --get remote.origin.url)# Check that REPO_URL contains https://github.comif [[ $REPO_URL == *"https://github.com"* ]]; then# Replace https with ssh in the URL# Change the remote URL to the SSH versiongit remote set-url origin "$REPO_URL"elseecho "Error: REPO_URL does not contain https://github.com" >&2exit 1fi
# 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