• 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
• Oct 17, 2023 •C S
2 likes • 17 views
# ---------------- FIREWALL STEPS ---------------- # Check if firewalld is installed and running sudo systemctl status firewalld # If it's not running, you can start and enable it sudo systemctl start firewalld sudo 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 effect sudo firewall-cmd --reload # Check the list of allowed ports sudo firewall-cmd --list-ports # ---------------- NGINX STEPS ---------------- # Install Nginx (if not already installed) sudo yum install nginx # Start and enable Nginx sudo systemctl start nginx sudo 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 files sudo chown -R nginx:nginx /usr/share/nginx/html/storybook-static # Put the following server block in /etc/nginx/conf.d/storybook.conf server { listen 6006; server_name your_domain.com; location / { root /usr/share/nginx/html/storybook-static; index index.html; } } # Test the Nginx configuration for syntax errors sudo nginx -t # If there are no errors, reload Nginx to apply the changes sudo systemctl reload nginx
• Mar 10, 2023 •Helper
1 like • 6 views
#!/bin/bash for branch in $(git branch | cut -c 3-); do read -p "Delete local branch $branch? (y/n) " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then git branch -D $branch fi done
• May 20, 2024 •AustinLeath
0 likes • 13 views
#!/bin/sh BAT_LOW=15 BAT_CRITICAL=5 if [ "$1" = "--help" ] then printf " Usage: \tbattery_check.sh warning%% hibernate%% Description: \tA script for notifying the user via dunst and logging when \tthe battery is low and the system is going to hibernate. \tCan be supplied arguments for the battery low warning and \thibernation percentage thresholds as the first and second arguments. \t Default behavior is to warn at 15% and hibernate at 5%." exit fi if [[ -n "$1" && -n "$2" && $1 -gt $2 ]] then BAT_LOW=$1 BAT_CRITICAL=$2 fi acpi -b | awk -F'[,:%]' '{print $2, $3}' | { read -r status capacity echo Low threshold: $BAT_LOW, Hibernate threshold: $BAT_CRITICAL echo Status: $status, Capacity: $capacity if [ "$status" = Discharging -a "$capacity" -le $BAT_CRITICAL ]; then echo Battery critical threshold. dunstify -u critical "Critical battery threshold, hibernating..." logger "Critical battery threshold, hibernating..." sleep .5 systemctl hibernate exit fi if [ "$status" = Discharging -a "$capacity" -le $BAT_LOW ]; then echo Battery low threshold. dunstify -u critical 'Battery low! System will hibernate at 5%.' logger 'Battery low! System will hibernate at 5%.' sleep .5 light -S 15 exit fi }
• Aug 7, 2023 •C S
0 likes • 2 views
# Three ways of checking if a file exists in a shell script FILE=/etc/resolv.conf if test -f "$FILE"; then echo "$FILE exists." fi if [ -f "$FILE" ]; then echo "$FILE exists." fi if [[ -f "$FILE" ]]; then echo "$FILE exists." fi
• Nov 18, 2022 •AustinLeath
echo -e ${PATH//:/\\n} | awk '{print length, $0}' | sort -n | cut -f2- -d' '