From ccd795ee6f9f6ff30b366bbf56fbe390662afe89 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 20 Sep 2024 17:25:20 -0700 Subject: [PATCH] Adds old zsh functions untouched. --- .zsh_functions/clone | 9 +++++++++ .zsh_functions/compress | 9 +++++++++ .zsh_functions/remind | 18 ++++++++++++++++++ .zsh_functions/whatsapp-backup | 6 ++++++ 4 files changed, 42 insertions(+) create mode 100755 .zsh_functions/clone create mode 100755 .zsh_functions/compress create mode 100755 .zsh_functions/remind create mode 100755 .zsh_functions/whatsapp-backup diff --git a/.zsh_functions/clone b/.zsh_functions/clone new file mode 100755 index 0000000..758c7dd --- /dev/null +++ b/.zsh_functions/clone @@ -0,0 +1,9 @@ +clone() { + if [ -z "$1" -o "$1" = " " -o -z "$2" -o "$2" = " " ]; then + echo "Clones the repo into \$PROJECT_ROOT/" + echo "usage: clone " + return + fi + + git clone "$1" "$2" +} diff --git a/.zsh_functions/compress b/.zsh_functions/compress new file mode 100755 index 0000000..9a8e0c0 --- /dev/null +++ b/.zsh_functions/compress @@ -0,0 +1,9 @@ +compress(){ + if [ -z "$1" -o "$1" = " " ]; then + echo "Compresses all of * to ../compresses/.tar.bz2" + echo "usage: compress " + return + fi + + tar -jcvf ../compressed/$1.tar.bz2 $1* && rm $1* +} diff --git a/.zsh_functions/remind b/.zsh_functions/remind new file mode 100755 index 0000000..35d0ea5 --- /dev/null +++ b/.zsh_functions/remind @@ -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 +} diff --git a/.zsh_functions/whatsapp-backup b/.zsh_functions/whatsapp-backup new file mode 100755 index 0000000..2b55e18 --- /dev/null +++ b/.zsh_functions/whatsapp-backup @@ -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 \; +}