Skip to main content

Nginx Serve Storybook

CHS
2 likes • Oct 17, 2023 • 10 views
Shell
Loading...

More Shell Posts

Bash Basics

0 likes • Nov 19, 2022 • 1 view
Shell
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"

Search file with word list fast

0 likes • Feb 22, 2022 • 1 view
Shell
#Leif Messinger
#For when you want to search a lot of words in a file fast
#Arg 1 is the argument the list of words you want to search
#Arg 2 is the file you want to search
#-z means that it looks at the file as a whole, just treating newlines a characters.
#-r is regex. Needed for $, even tho the documentation says you don't need it. They are liars.
#First command replaces all . with \. and all - with \-
#Second command takes all newlines and replaces them with )|(
#Third command takes the trailing |( and deletes it
#Forth command puts a /( at the start
#Fith command puts /!d at the end. This tells it to not delete any lines that match the pattern.
#The second sed takes the output of the first sed as a command that searches any of the combined words
#-f - takes a command from the input
sed -z -r -e 's/\./\\\./g ; s/\-/\\\-/g' -e 's/\n/\)\|\(/g' -e 's/\|\($//' -e 'i/\(' -e 'a/!d' $1 | sed -r -f - $2

NPM Workspaces Commands

CHS
0 likes • Aug 16, 2023 • 2 views
Shell
# Run "test" script on all packages
npm run test --workspaces
# Tip - this also works:
npm run test -ws
----------------------------------------------------
# Runs "test" only on package-a
npm run test --workspace package-a
# Tip - this also works:
npm run test -w package-a
----------------------------------------------------
# Install `lodash` on `package-a`
npm install lodash --workspace package-a
# Install `tap` on `package-b` as a dev dependency
npm install tap --workspace package-b --save-dev
# Install `package-a` on `package-b`
npm install package-a --workspace package-b
# Install `eslint` in all packages
npm install eslint --workspaces

Delete Git Branches

0 likes • Mar 10, 2023 • 0 views
Shell
#!/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

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

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"