Loading...
More Shell Posts
# ---------------- 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#Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there#Leif Messingerlet OFFSET=0let BATCHSIZE=50let LIMIT=100mkdir monkeysfunction parseResults(){sed 'y/,/\n/' | sed -e '/storage.opensea/d' -e '/https:\/\/lh3.googleusercontent.com\/Ju9CkWtV-1Okvf45wo8UctR-M9He2PjILP0oOvxE89AyiPPGtrR3gysu1Zgy0hjd2xKIgjJJtWIc0ybj4Vd7wv8t3pxDGHoJBzDB=s120/d' | egrep '"image_url":"(.*)"' | tr -d '\"' | sed 's/image_url://'}function downloadMonkeys(){while read -r line; doname=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'`wget -q -O "./monkeys/$name.png" "$line" &done}function queryMonkeys(){let progress=($OFFSET*100)/$LIMITecho "Progress: $progress%"result=`curl -s --request GET --url "https://api.opensea.io/api/v1/assets?order_direction=desc&offset=$OFFSET&limit=$BATCHSIZE&collection=boredapeyachtclub"`if [[ "$result" =~ "Request was throttled" ]] || [ "$result" == "" ]; then#Retry downloadsleep 10else#Download Monkeysecho "$result" | parseResults | downloadMonkeyslet OFFSET+=$BATCHSIZEfi#If not out of bounds, recurseif [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; thenqueryMonkeysfi}echo "Downloading your monkeys into ./monkeys asynchronously."queryMonkeys
## Austin Leath# checks for /Desktop symlink. Creates the symlink if it doesnt already exist##Fetch the target user if desired, otherwise use the currently logged in user.if [ "$4" != "" ]; thenTARGET_USER=$4elseTARGET_USER=$3fiif [ "$5" != "" ]; thenDIRECTORY_NAME=$5elseTARGET_USER="$3 Desktop"fi# FunctionsCHECK_SYMLINK() {if test -f "/Desktop"; thenecho "/Desktop exists"elseecho "/Desktop does not exist"fi}CHECK_SYNTHETIC_CONF() {if test -f "/etc/synthetic.conf"; thenecho "/etc/synthetic.conf exists"elseecho "/etc/synthetic.conf does not exist"fi}CREATE_SYMLINK() {if [[ $(CHECK_SYNTHETIC_CONF) != "/etc/synthetic.conf exists" ]]; thenecho "/etc/synthetic.conf does not exist. creating.."touch /etc/synthetic.confchown -R root:wheel /etc/synthetic.conffiif grep -q "$DIRECTORY_NAME" /etc/synthetic.conf; thenecho "$DIRECTORY_NAME already exists"exit 1elseecho "$DIRECTORY_NAME\t/Users/$TARGET_USER/Desktop" >> /etc/synthetic.conffiecho "/Desktop symbolic link created"}if [[ $(CHECK_SYMLINK) != "/Desktop exists" ]]; thenCREATE_SYMLINKfiexit 0
#!/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
for region in `aws ec2 describe-regions --output text | cut -f4`doecho -e "\nListing Instances in region:'$region'..."aws ec2 describe-instances --query 'Reservations[*].Instances[*].{Instance:InstanceId,Subnet:SubnetId}' --region $regiondone#This script is to be used with any AWS CLI configured environment, it will list any EC2 instances and their associated subnet network ID's in JSON format
name="John"echo ${name}echo ${name/J/j} #=> "john" (substitution)echo ${name:0:2} #=> "Jo" (slicing)echo ${name::2} #=> "Jo" (slicing)echo ${name::-1} #=> "Joh" (slicing)echo ${name:(-1)} #=> "n" (slicing from right)echo ${name:(-2):1} #=> "h" (slicing from right)echo ${food:-Cake} #=> $food or "Cake"