Loading...
More Shell Posts
# 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
#!/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# 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>&1nowdate=$(date -u)# OPTIONSWEBHOOK="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 $LOGFILEcurl --data "content=$SERVERNAME started a backup - $nowdate" $WEBHOOK | tee -a $LOGFILE && echo "" >> $LOGFILEif pidof -o %PPID -x "backup.sh"thenecho "Failed backup attempt on $SERVERNAME - $nowdate (rclone already running)" | tee -a $LOGFILEcurl --data "content=Failed backup attempt on $SERVERNAME - $nowdate (rclone already running)" $WEBHOOK | tee -a $LOGFILEexit 1firclone sync $FROM $TO -P --b2-hard-delete --stats 5s --progress | sed 's/Transferred:/\n\nTransferred:/' | tee -a $LOGFILEenddate=$(date -u)endtime=$(date +'%T')echo "Completed backup on $SERVERNAME - $enddate" | tee -a $LOGFILEcurl -F "content=Completed backup on $SERVERNAME - $enddate" -F upload=@"$LOGFILE" $WEBHOOK | tee -a $LOGFILEif [ -f $LOGFILE ]thenrm $LOGFILEfi
#!/bin/bash# Recursively find all .svelte files in the current directory and its subdirectoriesfind . -type f -name "*.svelte" -o -name "*.html" -o -name "*.htm" | while read file; do# Replace all h1 tags with the specified formatsed -i 's/<h1>\(.*\)<\/h1>/<h1 id="\1">\1<\/h1>/g' "$file"# Replace all h2 tags with the specified formatsed -i 's/<h2>\(.*\)<\/h2>/<h2 id="\1">\1<\/h2>/g' "$file"# Remove whitespace from the id attribute valuefor i in {0..10} ; dosed -i 's/\(id="[^"]*\)\W\([^"]*"\)/\1\2/g' "$file"donedone
#!/bin/bash#Takes command line arguments and pulls the header files.#Good for checking if the function you want is in the header or not.#cppToStdout.sh "time.h"while [ "$1" != "" ]; doecho "#include<$1>" | g++ -x c++ -E -shiftdone
# ---------------- FIREWALL STEPS ----------------# Check if firewalld is installed and runningsudo systemctl status firewalld# If it's not running, you can start and enable itsudo systemctl start firewalldsudo systemctl enable firewalld# Add a rule to allow traffic on port 6006. Port 6006 is the default port that storybook runs on.sudo firewall-cmd --permanent --add-port=6006/tcp# Reload the firewall for the changes to take effectsudo firewall-cmd --reload# Check the list of allowed portssudo firewall-cmd --list-ports# ---------------- NGINX STEPS ----------------# Install Nginx (if not already installed)sudo yum install nginx# Start and enable Nginxsudo systemctl start nginxsudo systemctl enable nginx# Copy your storybook-static directory to a location that Nginx can serve from.# The default web root directory for Nginx is /usr/share/nginx/html.sudo cp -r /path/to/storybook-static /usr/share/nginx/html/# Adjust file permissions if needed to ensure that Nginx can read the filessudo chown -R nginx:nginx /usr/share/nginx/html/storybook-static# Put the following server block in /etc/nginx/conf.d/storybook.confserver {listen 6006;server_name your_domain.com;location / {root /usr/share/nginx/html/storybook-static;index index.html;}}# Test the Nginx configuration for syntax errorssudo nginx -t# If there are no errors, reload Nginx to apply the changessudo systemctl reload nginx