Skip to main content

Check For File

CHS
0 likes • Aug 7, 2023 • 2 views
Shell
Loading...

More Shell Posts

Update Prefixed Dependencies

CHS
0 likes • Oct 9, 2023 • 42 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

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"

checkAndPush.sh

0 likes • Nov 4, 2023 • 6 views
Shell
#!/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

githubSetSSH.sh

0 likes • Sep 9, 2023 • 2 views
Shell
#!/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 console
REPO_URL=$(git config --get remote.origin.url)
# Check that REPO_URL contains https://github.com
if [[ $REPO_URL == *"https://github.com"* ]]; then
# Replace https with ssh in the URL
REPO_URL=${REPO_URL/https:\/\/github.com\//[email protected]:}
# Change the remote URL to the SSH version
git remote set-url origin "$REPO_URL"
else
echo "Error: REPO_URL does not contain https://github.com" >&2
exit 1
fi

Useful NVM Commands

CHS
0 likes • Mar 20, 2023 • 0 views
Shell
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
// install specific version of node
nvm install 6.9.2
// set default version of node
nvm alias default 6.9.2
// switch version of node
nvm use 6.9.1

cppToStdout.sh

0 likes • Nov 17, 2021 • 1 view
Shell
#!/bin/bash
#Takes command line arguments and pulls the header files.
#Good for checking if the function you want is in the header or not.
#cppToStdout.sh "time.h"
while [ "$1" != "" ]; do
echo "#include<$1>" | g++ -x c++ -E -
shift
done