Skip to main content

installVulkan.sh

Nov 8, 2021LeifMessinger
Loading...

More Shell Posts

Update Prefixed Dependencies

Oct 9, 2023C S

0 likes • 93 views

# 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

Find data-testids

Jul 8, 2024C S

0 likes • 16 views

#!/bin/bash
# Set the directory to search
DIRECTORY="src"
# Set the output file
OUTPUT_FILE="testids.txt"
# Clear the output file
> "$OUTPUT_FILE"
# Find all .tsx files in the specified directory and its subdirectories
find "$DIRECTORY" -type f -name "*.tsx" | while read -r FILE
do
# Search for instances of 'data-testid="testid"' and append them to the output file
grep -o 'data-testid="[^"]*"' "$FILE" >> "$OUTPUT_FILE"
# Search for instances of "'data-testid': 'testid'" and append them to the output file
grep -o "'data-testid': '[^']*'" "$FILE" >> "$OUTPUT_FILE"
done
echo "Search complete. Test IDs written to $OUTPUT_FILE."

Nginx Serve Storybook

Oct 17, 2023C 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

watchLogins.sh

Sep 30, 2021LeifMessinger

0 likes • 8 views

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

Delete Git Branches

Mar 10, 2023Helper

1 like • 5 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

AWS CLI Locate ClientVPN

Sep 23, 2024AustinLeath

0 likes • 3 views

CLIENT_VPN_ID="cvpn-endpoint-xxxxxxxxxxxx"
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do
echo "Searching in region: $region"
aws ec2 describe-client-vpn-endpoints --region $region --query "ClientVpnEndpoints[?ClientVpnEndpointId=='$CLIENT_VPN_ID']" --output table
done