• 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
• Oct 9, 2023 •C S
0 likes • 156 views
# 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
• Oct 26, 2021 •LeifMessinger
0 likes • 3 views
#!/bin/bash #Leif Messinger lsm0147 #credit.sh FILES cred="Leif Messinger lsm0147" for bruh; do if [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; then comment="//$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" fi if [ -s $bruh ]; then #If the file has a shebang if egrep -q '^#!/' $bruh; then sed -i "/^\#!\//a$comment" $bruh else sed -i "1i$comment" $bruh fi else echo "$comment" > $bruh fi done
• Nov 23, 2021 •LeifMessinger
#!/bin/bash #Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there #Leif Messinger let OFFSET=0 let BATCHSIZE=50 let LIMIT=100 mkdir monkeys function parseResults(){ sed 'y/,/\n/' | sed -e '/storage.opensea/d' -e '/https:\/\/lh3.googleusercontent.com\/Ju9CkWtV-1Okvf45wo8UctR-M9He2PjILP0oOvxE89AyiPPGtrR3gysu1Zgy0hjd2xKIgjJJtWIc0ybj4Vd7wv8t3pxDGHoJBzDB=s120/d' | egrep '"image_url":"(.*)"' | tr -d '\"' | sed 's/image_url://' } function downloadMonkeys(){ while read -r line; do name=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'` wget -q -O "./monkeys/$name.png" "$line" & done } function queryMonkeys(){ let progress=($OFFSET*100)/$LIMIT echo "Progress: $progress%" result=`curl -s --request GET --url "https://api.opensea.io/api/v1/assets?order_direction=desc&offset=$OFFSET&limit=$BATCHSIZE&collection=boredapeyachtclub"` if [[ "$result" =~ "Request was throttled" ]] || [ "$result" == "" ]; then #Retry download sleep 10 else #Download Monkeys echo "$result" | parseResults | downloadMonkeys let OFFSET+=$BATCHSIZE fi #If not out of bounds, recurse if [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; then queryMonkeys fi } echo "Downloading your monkeys into ./monkeys asynchronously." queryMonkeys
• Nov 8, 2021 •LeifMessinger
0 likes • 1 view
#!/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
• May 13, 2023 •LeifMessinger
0 likes • 8 views
#!/bin/bash # Turns 4 spaces into tabs. # Mostly stolen from AI # Define the directory to process DIRECTORY=$1 TabCount=${2:-'4'} #Defaults to 4 # Check if directory is specified if [ -z "$DIRECTORY" ]; then echo "Error: Directory not specified." exit 1 fi # Check if directory exists if [ ! -d "$DIRECTORY" ]; then echo "Error: Directory does not exist." exit 1 fi # Find all files in directory and subdirectories FILES=$(find "$DIRECTORY" -type f) # Loop through each file and unexpand it for FILE in $FILES; do unexpand -t "$TabCount" "$FILE" > "$FILE.tmp" mv "$FILE.tmp" "$FILE" done echo "Done!"