Loading...
More Shell Posts
#!/bin/bash#Takes all the c and h files in the current directory and prints them#Yup, it's that easyfor file in *.h *.hpp *.c *.cpp; do#If it existsif [ -f "$file" ]; thenecho "//===============$file==============="cat $filefidone
#!/bin/bash#Installs the Vulkan library and other goodies. Works on Arch and Arch based distros. Needs pacman and makepkginstallVulkan(){#Tries installing every linux package in existencepackages=( vulkan-tools libvulkan-dev vulkan-loader-devel vulkan-validation-layers spirv-tools mesa-vulkan-devel vulkan-validation-layers-devel )for package in ${packages[*]}; dosudo pacman --noconfirm -S $packagedone}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#donesudo git clone https://aur.archlinux.org/glfw-git.git /tmp/glfw-gitsudo chmod 777 /tmp/glfw-gitcd /tmp/glfw-gitmakepkg -sisudo git clone https://aur.archlinux.org/glm-git.git /tmp/glm-gitsudo chmod 777 /tmp/glm-gitcd /tmp/glm-gitmakepkg -si}installShaderCompiler(){#Basically installs glslcsudo pacman -S shaderc}while true; doselect bruh in installVulkan installLibraries installShaderCompiler "exit"; do$bruhdonedone
#pinger.sh by Leif Messinger#./pinger.sh [ADDRESS] to search#./pinger.sh [ADDRESS] & to search in the background#https://serverfault.com/a/42382ping_cancelled=false # Keep track of whether the loop was cancelled, or succeededuntil ping -c1 "$1" >/dev/null 2>&1; do :; done & # The "&" backgrounds ittrap "kill $!; ping_cancelled=true" SIGINTwait $! # Wait for the loop to exit, one way or anothertrap - SIGINT # Remove the trap, now we're done with itif [ "$ping_cancelled" == true ] #https://stackoverflow.com/a/21210966/10141528thenprintf "The pinger for $1 just closed bro.\n"elseprintf "$1 IS UP BROOO\a\n"fi
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"
#!/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
touch /tmp/login1.txt /tmp/login2.txtwhile [ true ]dowho | gawk '{ print $1 }' > /tmp/login2.txtcomm -13 /tmp/login1.txt /tmp/login2.txt#Just a bit easier to read#diff /tmp/login1.txt /tmp/login2.txtcat /tmp/login2.txt > /tmp/login1.txtsleep 1done