Skip to main content

codecatch.sh

0 likes • Nov 14, 2021 • 0 views
Shell
Loading...

More Shell Posts

watchLogins.sh

0 likes • Sep 30, 2021 • 0 views
Shell
touch /tmp/login1.txt /tmp/login2.txt
while [ true ]
do
who | gawk '{ print $1 }' > /tmp/login2.txt
comm -13 /tmp/login1.txt /tmp/login2.txt
#Just a bit easier to read
#diff /tmp/login1.txt /tmp/login2.txt
cat /tmp/login2.txt > /tmp/login1.txt
sleep 1
done

Nginx Serve Storybook

CHS
0 likes • Oct 17, 2023 • 10 views
Shell
# ---------------- 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

unexpandDirectory.sh

0 likes • May 13, 2023 • 1 view
Shell
#!/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!"

abuseipdb config

0 likes • Nov 18, 2022 • 0 views
Shell
#for ssh abuse attempts
action = %(action_)s
%(action_abuseipdb)s[abuseipdb_apikey="", abuseipdb_category="18,22"]
actionban = curl --fail --ciphers ecdhe_ecdsa_aes_256_sha --data 'key=<abuseipdb_apikey>' --data-urlencode 'comment=<matches>' --data 'ip=<ip>' --data 'category=<abuseipdb_category>' "https://www.abuseipdb.com/report/json"

installVulkanUbuntu.sh

0 likes • Jul 16, 2023 • 2 views
Shell
#!/bin/bash
sudo 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 going
exit
sudo apt install git cmake cmake-gui
sudo mkdir /usr/lib/stb
pushd /usr/lib/stb
sudo wget https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
popd
cd ~/Documents
git clone https://github.com/Overv/VulkanTutorial.git
cd VulkanTutorial/code
cmake -S . -B build -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" -DSTB_INCLUDEDIR:PATH="/usr/lib/stb"
cd build
make

Update Prefixed Dependencies

CHS
0 likes • Oct 9, 2023 • 41 views
Shell
# 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