• Nov 18, 2022 •AustinLeath
0 likes • 1 view
# # Austin Leath # checks for /Desktop symlink. Creates the symlink if it doesnt already exist # #Fetch the target user if desired, otherwise use the currently logged in user. if [ "$4" != "" ]; then TARGET_USER=$4 else TARGET_USER=$3 fi if [ "$5" != "" ]; then DIRECTORY_NAME=$5 else TARGET_USER="$3 Desktop" fi # Functions CHECK_SYMLINK() { if test -f "/Desktop"; then echo "/Desktop exists" else echo "/Desktop does not exist" fi } CHECK_SYNTHETIC_CONF() { if test -f "/etc/synthetic.conf"; then echo "/etc/synthetic.conf exists" else echo "/etc/synthetic.conf does not exist" fi } CREATE_SYMLINK() { if [[ $(CHECK_SYNTHETIC_CONF) != "/etc/synthetic.conf exists" ]]; then echo "/etc/synthetic.conf does not exist. creating.." touch /etc/synthetic.conf chown -R root:wheel /etc/synthetic.conf fi if grep -q "$DIRECTORY_NAME" /etc/synthetic.conf; then echo "$DIRECTORY_NAME already exists" exit 1 else echo "$DIRECTORY_NAME\t/Users/$TARGET_USER/Desktop" >> /etc/synthetic.conf fi echo "/Desktop symbolic link created" } if [[ $(CHECK_SYMLINK) != "/Desktop exists" ]]; then CREATE_SYMLINK fi exit 0
• Dec 23, 2024 •AustinLeath
0 likes • 27 views
#!/bin/bash # RCLONE BACKUP SCRIPT (using ionice) # Type crontab -e and copy the line below without the # # 0 0 * * * ionice -c 3 /home/owner/backup.sh >/dev/null 2>&1 nowdate=$(date -u) # OPTIONS WEBHOOK="YOUR_DISCORD_WEBHOOK_LINK_HERE" LOGFILE="/root/backup.log" FROM="/path/where/you/backup/from" TO="backblaze:BucketName/FolderName" SERVERNAME="Server Name" echo "$SERVERNAME started a backup - $nowdate" | tee -a $LOGFILE curl --data "content=$SERVERNAME started a backup - $nowdate" $WEBHOOK | tee -a $LOGFILE && echo "" >> $LOGFILE if pidof -o %PPID -x "backup.sh" then echo "Failed backup attempt on $SERVERNAME - $nowdate (rclone already running)" | tee -a $LOGFILE curl --data "content=Failed backup attempt on $SERVERNAME - $nowdate (rclone already running)" $WEBHOOK | tee -a $LOGFILE exit 1 fi rclone sync $FROM $TO -P --b2-hard-delete --stats 5s --progress | sed 's/Transferred:/\n\nTransferred:/' | tee -a $LOGFILE enddate=$(date -u) endtime=$(date +'%T') echo "Completed backup on $SERVERNAME - $enddate" | tee -a $LOGFILE curl -F "content=Completed backup on $SERVERNAME - $enddate" -F upload=@"$LOGFILE" $WEBHOOK | tee -a $LOGFILE if [ -f $LOGFILE ] then rm $LOGFILE fi
• Nov 8, 2021 •LeifMessinger
#!/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
• Nov 19, 2022 •CodeCatch
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"
echo -e ${PATH//:/\\n} | awk '{print length, $0}' | sort -n | cut -f2- -d' '
• Apr 3, 2025 •LeifMessinger
0 likes • 4 views
#!/usr/bin/env bash #Splits a command across a number of CELL machines user=$(whoami) if [[ -z $user ]]; then echo "whoami failed. Exiting..." exit 1 fi command="$1" if [[ -z $command ]]; then echo "Need to put in a command." exit 1 fi shift array=("$@") let start=8 let stop=18 for ((i = $start; i <= $stop; i++)); do extraZero=$(if [[ "$i" -lt 10 ]]; then echo "0"; fi) domain="CELL${extraZero}${i}-CSE.ENG.UNT.EDU" let "index = i - start" echo ${#array[@]} if [[ ${#array[@]} != 0 ]] && [[ $index -ge ${#array[@]} ]]; then echo "$index > ${#array[@]}" break fi ssh -o StrictHostKeyChecking=accept-new "${user}@${domain}" -t "$command ${array[$index]}" & done