Skip to main content

checkAndPush.sh

0 likes • Nov 4, 2023 • 6 views
Shell
Loading...

More Shell Posts

upload_key.sh

0 likes • Jan 12, 2023 • 0 views
Shell
#!/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 computer
if [ -e ~/.ssh/id_rsa.pub ];
then
echo "SSH Key already exists on local machine"
else
echo "Generating SSH key on local machine"
ssh-keygen -t rsa #generates id_rsa and id_rsa.pub
chmod -R 700 ~/.ssh #Sets permissions of ssh folder
ssh-add #Adds keys (and passwords?) to ssh_agent. (hopefully doesn't require password)
fi
echo "Loading client public key into memory"
pubKey=$(<~/.ssh/id_rsa.pub)
for server
do
echo "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-add
ssh-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 portnumber
echo "Displaying server public key"
ssh $server "cat ~/.ssh/id_rsa.pub"
#Though, he did give me a good idea
echo "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_keys
done
echo "SSH keys schronized successfully!"

pinger.sh

0 likes • Mar 21, 2021 • 0 views
Shell
#pinger.sh by Leif Messinger
#./pinger.sh [ADDRESS] to search
#./pinger.sh [ADDRESS] & to search in the background
#https://serverfault.com/a/42382
ping_cancelled=false # Keep track of whether the loop was cancelled, or succeeded
until ping -c1 "$1" >/dev/null 2>&1; do :; done & # The "&" backgrounds it
trap "kill $!; ping_cancelled=true" SIGINT
wait $! # Wait for the loop to exit, one way or another
trap - SIGINT # Remove the trap, now we're done with it
if [ "$ping_cancelled" == true ] #https://stackoverflow.com/a/21210966/10141528
then
printf "The pinger for $1 just closed bro.\n"
else
printf "$1 IS UP BROOO\a\n"
fi

installVulkan.sh

0 likes • Nov 8, 2021 • 0 views
Shell
#!/bin/bash
#Installs the Vulkan library and other goodies. Works on Arch and Arch based distros. Needs pacman and makepkg
installVulkan(){
#Tries installing every linux package in existence
packages=( vulkan-tools libvulkan-dev vulkan-loader-devel vulkan-validation-layers spirv-tools mesa-vulkan-devel vulkan-validation-layers-devel )
for package in ${packages[*]}; do
sudo pacman --noconfirm -S $package
done
}
installLibraries(){
#All of these packages don't exist, so we have to download and install the AUR packages
#packages=( libglfw3-dev glfw-devel libglm glm-devel )
#for package in ${packages[*]}; do
# sudo pacman --noconfirm -S $package
#done
sudo git clone https://aur.archlinux.org/glfw-git.git /tmp/glfw-git
sudo chmod 777 /tmp/glfw-git
cd /tmp/glfw-git
makepkg -si
sudo git clone https://aur.archlinux.org/glm-git.git /tmp/glm-git
sudo chmod 777 /tmp/glm-git
cd /tmp/glm-git
makepkg -si
}
installShaderCompiler(){
#Basically installs glslc
sudo pacman -S shaderc
}
while true; do
select bruh in installVulkan installLibraries installShaderCompiler "exit"; do
$bruh
done
done

installVulkanUbuntu.sh

0 likes • Jul 16, 2023 • 2 views
Shell
#!/bin/bash
sudo 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 going
exit
sudo apt install git cmake cmake-gui
sudo mkdir /usr/lib/stb
pushd /usr/lib/stb
sudo wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
popd
cd ~/Documents
git clone https://github.com/Overv/VulkanTutorial.git
cd VulkanTutorial/code
cmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DSTB_INCLUDEDIR:PATH="/usr/lib/stb"
cd build
make

makeHeaderTags.sh

0 likes • Feb 5, 2024 • 8 views
Shell
#!/bin/bash
# Recursively find all .svelte files in the current directory and its subdirectories
find . -type f -name "*.svelte" -o -name "*.html" -o -name "*.htm" | while read file; do
# Replace all h1 tags with the specified format
sed -i 's/<h1>\(.*\)<\/h1>/<h1 id="\1">\1<\/h1>/g' "$file"
# Replace all h2 tags with the specified format
sed -i 's/<h2>\(.*\)<\/h2>/<h2 id="\1">\1<\/h2>/g' "$file"
# Remove whitespace from the id attribute value
for i in {0..10} ; do
sed -i 's/\(id="[^"]*\)\W\([^"]*"\)/\1\2/g' "$file"
done
done

Bash Basics

0 likes • Nov 19, 2022 • 1 view
Shell
name="John"
echo ${name}
echo ${name/J/j} #=> "john" (substitution)
echo ${name:0:2} #=> "Jo" (slicing)
echo ${name::2} #=> "Jo" (slicing)
echo ${name::-1} #=> "Joh" (slicing)
echo ${name:(-1)} #=> "n" (slicing from right)
echo ${name:(-2):1} #=> "h" (slicing from right)
echo ${food:-Cake} #=> $food or "Cake"