Skip to main content

getDependencies.sh

0 likes • Oct 30, 2020 • 2 views
Shell
Loading...

More Shell Posts

Update Prefixed Dependencies

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

stealNFTs

0 likes • Nov 23, 2021 • 1 view
Shell
#!/bin/bash
#Makes a directory ./monkeys and puts every single bored bored ape yacht club monkey in there
#Leif Messinger
let OFFSET=0
let BATCHSIZE=50
let LIMIT=100
mkdir monkeys
function 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; do
name=`echo "$line" | sed 's/https:\/\/lh3.googleusercontent.com\///'`
wget -q -O "./monkeys/$name.png" "$line" &
done
}
function queryMonkeys(){
let progress=($OFFSET*100)/$LIMIT
echo "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 download
sleep 10
else
#Download Monkeys
echo "$result" | parseResults | downloadMonkeys
let OFFSET+=$BATCHSIZE
fi
#If not out of bounds, recurse
if [ "$OFFSET" -lt "$LIMIT" ] || [[ "$result" =~ '"assets":[]' ]]; then
queryMonkeys
fi
}
echo "Downloading your monkeys into ./monkeys asynchronously."
queryMonkeys

Symlink Desktop

0 likes • Nov 18, 2022 • 0 views
Shell
#
# 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" != "" ]; then
TARGET_USER=$4
else
TARGET_USER=$3
fi
if [ "$5" != "" ]; then
DIRECTORY_NAME=$5
else
TARGET_USER="$3 Desktop"
fi
# Functions
CHECK_SYMLINK() {
if test -f "/Desktop"; then
echo "/Desktop exists"
else
echo "/Desktop does not exist"
fi
}
CHECK_SYNTHETIC_CONF() {
if test -f "/etc/synthetic.conf"; then
echo "/etc/synthetic.conf exists"
else
echo "/etc/synthetic.conf does not exist"
fi
}
CREATE_SYMLINK() {
if [[ $(CHECK_SYNTHETIC_CONF) != "/etc/synthetic.conf exists" ]]; then
echo "/etc/synthetic.conf does not exist. creating.."
touch /etc/synthetic.conf
chown -R root:wheel /etc/synthetic.conf
fi
if grep -q "$DIRECTORY_NAME" /etc/synthetic.conf; then
echo "$DIRECTORY_NAME already exists"
exit 1
else
echo "$DIRECTORY_NAME\t/Users/$TARGET_USER/Desktop" >> /etc/synthetic.conf
fi
echo "/Desktop symbolic link created"
}
if [[ $(CHECK_SYMLINK) != "/Desktop exists" ]]; then
CREATE_SYMLINK
fi
exit 0

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

credit.sh

0 likes • Oct 26, 2021 • 0 views
Shell
#!/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

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"