Skip to main content

stealNFTs

Nov 23, 2021LeifMessinger
Loading...

More Shell Posts

Nginx Serve Storybook

Oct 17, 2023CHS

2 likes • 10 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

checkAndPush.sh

Nov 4, 2023LeifMessinger

0 likes • 6 views

#!/bin/bash
git status
echo "Do you want to add all changed files?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit 1;;
esac
done
git add -u
git status
echo "Does this look right?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit 2;;
esac
done
git commit
echo "Do you want to push?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit 2;;
esac
done
git push

cpcmd.sh

Sep 29, 2021LeifMessinger

0 likes • 20 views

#!/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" ]; then
while [ -n "$1" ]; do
printf "scp \"$(whoami)@$(hostname):"
printf `readlink -f $1`
printf "\" .\n"
shift
done
else
echo "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

Check For File

Aug 7, 2023CHS

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

pinger.sh

Mar 21, 2021LeifMessinger

0 likes • 0 views

#pinger.sh by Leif Messinger
#./pinger.sh [ADDRESS] to search
#./pinger.sh [ADDRESS] & to search in the background
#https://serverfault.com/a/42382
ping_cancelled=false # Keep track of whether the loop was cancelled, or succeeded
until ping -c1 "$1" >/dev/null 2>&1; do :; done & # The "&" backgrounds it
trap "kill $!; ping_cancelled=true" SIGINT
wait $! # Wait for the loop to exit, one way or another
trap - SIGINT # Remove the trap, now we're done with it
if [ "$ping_cancelled" == true ] #https://stackoverflow.com/a/21210966/10141528
then
printf "The pinger for $1 just closed bro.\n"
else
printf "$1 IS UP BROOO\a\n"
fi

codecatch.sh

Nov 14, 2021LeifMessinger

0 likes • 0 views

#!/bin/bash
#Takes all the c and h files in the current directory and prints them
#Yup, it's that easy
for file in *.h *.hpp *.c *.cpp; do
#If it exists
if [ -f "$file" ]; then
echo "//===============$file==============="
cat $file
fi
done