Loading...
More Shell Posts
#diskRipper.sh by Leif Messinger#For use on debian, where your cds aren't immediately mountedwall "CD inserted boss"set -x #echo oncdDrivePath=$(ls -l /dev/cdrom | awk '{print $NF}')#CD could have no label, so that's why I need awkcdLabel=$(lsblk -n "/dev/$cdDrivePath" -o label)if [[ ! -z "$cdLabel" ]]; then #CD has labelfolderName=$cdLabelecho "The cd label is ${folderName}"if mkdir ./cds/"${folderName}"; then #Folder didn't exist beforesudo mount /dev/cdrom ./.cdmountpointsudo cp -r ./.cdmountpoint/* "./cds/${folderName}"sudo chmod -R 777 "./cds/${folderName}"sudo umount ./.cdmountpointejectwall "CD done and ejecting"elsewall "Already read that cd, skipped"fielsewall "CD had no label, skipped"fi
#!/bin/bash#Takes all the c and h files in the current directory and prints them#Yup, it's that easyfor file in *.h *.hpp *.c *.cpp; do#If it existsif [ -f "$file" ]; thenecho "//===============$file==============="cat $filefidone
#!/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" != "" ]; doecho "#include<$1>" | g++ -x c++ -E -shiftdone
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"
## 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#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