Loading...
More Shell Posts
// check versionnode -v || node --version// list installed versions of node (via nvm)nvm ls// install specific version of nodenvm install 6.9.2// set default version of nodenvm alias default 6.9.2// switch version of nodenvm use 6.9.1
# ---------------- 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
#!/bin/bash#Leif Messinger lsm0147#credit.sh FILEScred="Leif Messinger lsm0147"for bruh; doif [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; thencomment="//$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"fiif [ -s $bruh ]; then#If the file has a shebangif egrep -q '^#!/' $bruh; thensed -i "/^\#!\//a$comment" $bruhelsesed -i "1i$comment" $bruhfielseecho "$comment" > $bruhfidone
#!/bin/bash#cpcmd.sh [file1 [file2...]]#Prints out the commands needed to copy the file to your local machine#This will work on any server that also has the same hostname as in your hosts file.#I should update this to detect if a file is a directory, and enable recursion for those commands. If you do it now, it will probably just warn you.if [ -n "$1" ]; thenwhile [ -n "$1" ]; doprintf "scp \"$(whoami)@$(hostname):"printf `readlink -f $1`printf "\" .\n"shiftdoneelseecho "scp \"$(whoami)@$(hostname):$PWD/*\" ."fi#-----------EDIT:#On the UNT cell machines, you have to do this script instead#if [ -n "$1" ]; then# while [ -n "$1" ]; do# printf "scp $(whoami)@$(hostname).eng.unt.edu:"# printf `readlink -f $1`# printf " .\n"# shift# done#else# echo "scp $(whoami)@$(hostname).eng.unt.edu:$PWD/* ."#fi
#!/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
#!/bin/shBAT_LOW=15BAT_CRITICAL=5if [ "$1" = "--help" ]thenprintf "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%."exitfiif [[ -n "$1" && -n "$2" && $1 -gt $2 ]]thenBAT_LOW=$1BAT_CRITICAL=$2fiacpi -b | awk -F'[,:%]' '{print $2, $3}' | {read -r status capacityecho Low threshold: $BAT_LOW, Hibernate threshold: $BAT_CRITICALecho Status: $status, Capacity: $capacityif [ "$status" = Discharging -a "$capacity" -le $BAT_CRITICAL ]; thenecho Battery critical threshold.dunstify -u critical "Critical battery threshold, hibernating..."logger "Critical battery threshold, hibernating..."sleep .5systemctl hibernateexitfiif [ "$status" = Discharging -a "$capacity" -le $BAT_LOW ]; thenecho Battery low threshold.dunstify -u critical 'Battery low! System will hibernate at 5%.'logger 'Battery low! System will hibernate at 5%.'sleep .5light -S 15exitfi}