Skip to main content

Update Prefixed Dependencies

Oct 9, 2023C S
Loading...

More Shell Posts

cpcmd.sh

Sep 29, 2021LeifMessinger

0 likes • 23 views

#!/bin/bash
#cpcmd.sh [file1 [file2...]]
#Prints out the commands needed to copy the file to your local machine
#This will work on any server that also has the same hostname as in your hosts file.
#I should update this to detect if a file is a directory, and enable recursion for those commands. If you do it now, it will probably just warn you.
if [ -n "$1" ]; then
for arg; do
recursive=$(if [[ -d $arg ]]; then printf " -r"; fi)
printf "scp$recursive \"$(whoami)@$(hostname):"
printf `readlink -f $arg`
printf "\" .\n"
done
else
echo "scp \"$(whoami)@$(hostname):$PWD/*\" ."
fi
#-----------EDIT:
#On the UNT cell machines, you have to do this script instead
##!/bin/bash
#if [ -n "$1" ]; then
# for arg; do
# recursive=$(if [[ -d $arg ]]; then printf " -r"; fi)
# printf "scp$recursive $(whoami)@$(hostname).eng.unt.edu:"
# printf `readlink -f $arg`
# printf " .\n"
# done
#else
# echo "scp $(whoami)@$(hostname).eng.unt.edu:$PWD/* ."
#fi

abuseipdb config

Nov 18, 2022AustinLeath

0 likes • 9 views

#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"

mitosis.sh

Apr 3, 2025LeifMessinger

0 likes • 4 views

#!/usr/bin/env bash
#Splits a command across a number of CELL machines
user=$(whoami)
if [[ -z $user ]]; then
echo "whoami failed. Exiting..."
exit 1
fi
command="$1"
if [[ -z $command ]]; then
echo "Need to put in a command."
exit 1
fi
shift
array=("$@")
let start=8
let stop=18
for ((i = $start; i <= $stop; i++)); do
extraZero=$(if [[ "$i" -lt 10 ]]; then echo "0"; fi)
domain="CELL${extraZero}${i}-CSE.ENG.UNT.EDU"
let "index = i - start"
echo ${#array[@]}
if [[ ${#array[@]} != 0 ]] && [[ $index -ge ${#array[@]} ]]; then
echo "$index > ${#array[@]}"
break
fi
ssh -o StrictHostKeyChecking=accept-new "${user}@${domain}" -t "$command ${array[$index]}" &
done

NPM Workspaces Commands

Aug 16, 2023C S

0 likes • 6 views

# 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

Useful NVM Commands

Mar 20, 2023C S

0 likes • 0 views

// 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

credit.sh

Oct 26, 2021LeifMessinger

0 likes • 3 views

#!/bin/bash
#Leif Messinger lsm0147
#credit.sh FILES
cred="Leif Messinger lsm0147"
for bruh; do
if [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; then
comment="//$cred"
else
#Basically everything else gets a pound sign comment
#Pound signs are standard across linux. bash, sed, gawk, python etc
#Speaking of which, I need to escape it because of that.
comment="\#$cred"
fi
if [ -s $bruh ]; then
#If the file has a shebang
if egrep -q '^#!/' $bruh; then
sed -i "/^\#!\//a$comment" $bruh
else
sed -i "1i$comment" $bruh
fi
else
echo "$comment" > $bruh
fi
done