Adds old zsh functions untouched.

This commit is contained in:
Tom Hicks
2024-09-20 17:25:20 -07:00
parent 13eeb245e3
commit ccd795ee6f
4 changed files with 42 additions and 0 deletions

9
.zsh_functions/clone Executable file
View File

@@ -0,0 +1,9 @@
clone() {
if [ -z "$1" -o "$1" = " " -o -z "$2" -o "$2" = " " ]; then
echo "Clones the repo into \$PROJECT_ROOT/<projectName>"
echo "usage: clone <repositoryUrl> <projectName>"
return
fi
git clone "$1" "$2"
}

9
.zsh_functions/compress Executable file
View File

@@ -0,0 +1,9 @@
compress(){
if [ -z "$1" -o "$1" = " " ]; then
echo "Compresses all of <basename>* to ../compresses/<basename>.tar.bz2"
echo "usage: compress <basename>"
return
fi
tar -jcvf ../compressed/$1.tar.bz2 $1* && rm $1*
}

18
.zsh_functions/remind Executable file
View File

@@ -0,0 +1,18 @@
# Use like this
# some-command && sleep 1 ; alert-me -s -t -f --success-message --success-title --failure-message --failure-title --title
# osascript -e 'display notification "The command worked" with title "Success"'
# osascript -e 'display notification "The command failed" with title "Failed"'
alert-me(){
local SUCCESS_MESSAGE="The command worked"
local SUCCESS_TITLE="Success"
local FAILURE_MESSAGE="The command failed"
local FAILURE_TITLE="Failed"
if [ $? -eq 0 ]; then
osascript -e "display notification \"$SUCCESS_MESSAGE\" with title \"$SUCCESS_TITLE\""
else
osascript -e "display notification \"$FAILURE_MESSAGE\" with title \"$FAILURE_TITLE\""
fi
}

6
.zsh_functions/whatsapp-backup Executable file
View File

@@ -0,0 +1,6 @@
whatsapp-backup() {
TIMESTAMP=`python3 -c "from datetime import datetime; print(datetime.now().strftime('%Y-%m-%d.%H-%M-%S.%f'))"`
DESTDIR=~/Downloads/WhatsApp-export-$TIMESTAMP
mkdir -p $DESTDIR
find ~/Library/Group\ Containers/group.net.whatsapp.WhatsApp.shared/ -type f -iname '*.*' -exec cp "{}" $DESTDIR \;
}