From 026220fe2623fd4bcccbb8b5aeae003bfce1c53f Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 31 Dec 2019 16:55:45 -0600 Subject: [PATCH 1/3] SMTP tools --- bin/email-via-mailgun-smtp | 53 +++++++++++++++++++ .../arch-linux/provisioning/2-essentials.bash | 1 + 2 files changed, 54 insertions(+) create mode 100755 bin/email-via-mailgun-smtp diff --git a/bin/email-via-mailgun-smtp b/bin/email-via-mailgun-smtp new file mode 100755 index 0000000..3b885cf --- /dev/null +++ b/bin/email-via-mailgun-smtp @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +err() { + >&2 echo "ERROR: $@"; usage; exit 1 +} + +warn() { + >&2 echo "$@" +} + +usage() { >&2 cat < Date: Tue, 31 Dec 2019 17:03:22 -0600 Subject: [PATCH 2/3] Fancy colors --- bin/email-via-mailgun-smtp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/bin/email-via-mailgun-smtp b/bin/email-via-mailgun-smtp index 3b885cf..2b2dfb5 100755 --- a/bin/email-via-mailgun-smtp +++ b/bin/email-via-mailgun-smtp @@ -1,11 +1,29 @@ #!/usr/bin/env bash err() { - >&2 echo "ERROR: $@"; usage; exit 1 + errpre="" + errpost="" + if test -t 1; then + ncolors=$(tput colors) + if test -n "$ncolors" && test $ncolors -ge 8; then + errpre="$(tput setaf 1)" + errpost="$(tput setaf 7)" + fi + fi + >&2 echo "${errpre}ERROR: $@${errpost}"; usage; exit 1 } warn() { - >&2 echo "$@" + pre="" + post="" + if test -t 1; then + ncolors=$(tput colors) + if test -n "$ncolors" && test $ncolors -ge 8; then + pre="$(tput setaf 3)" + post="$(tput setaf 7)" + fi + fi + >&2 echo "${pre}WARNING: $@${post}" } usage() { >&2 cat <&2 echo "Finished reading body. Sending email..." swaks --auth \ --server smtp.mailgun.org \ From 2456dad7def9c24442ba33b94dbe2ae0b2e0d267 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 6 Jan 2020 11:15:30 -0600 Subject: [PATCH 3/3] Zstd --- apps/shell/bash/aliases | 1 + bin/archive | 4 ++-- bin/compress | 3 +++ bin/decompress | 3 +++ bin/unarchive | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 bin/compress create mode 100755 bin/decompress diff --git a/apps/shell/bash/aliases b/apps/shell/bash/aliases index 89a4311..022baa6 100644 --- a/apps/shell/bash/aliases +++ b/apps/shell/bash/aliases @@ -16,6 +16,7 @@ alias tree='tree -Csuh' alias f='fzf' alias cp="rsync -ah --progress" alias year="cal $(date +%Y)" +alias y="year" # gets the newest function for the current directory (or the specified directory # if one is provided) diff --git a/bin/archive b/bin/archive index 31d8517..dba3675 100755 --- a/bin/archive +++ b/bin/archive @@ -1,5 +1,5 @@ #!/usr/bin/env bash -archive_name="${1}.tar.gz"; shift -tar czvf "${archive_name}" ${@} +archive_name="${1}.tar.zstd"; shift +tar --zstd -cvf "${archive_name}" ${@} echo "Archive created at: ${archive_name}" diff --git a/bin/compress b/bin/compress new file mode 100755 index 0000000..b7cfcf4 --- /dev/null +++ b/bin/compress @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +zstd "$@" diff --git a/bin/decompress b/bin/decompress new file mode 100755 index 0000000..f47ea85 --- /dev/null +++ b/bin/decompress @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +unzstd "$@" diff --git a/bin/unarchive b/bin/unarchive index 6b64366..65b9901 100755 --- a/bin/unarchive +++ b/bin/unarchive @@ -4,6 +4,6 @@ archive_name="${1}"; shift to_dir="$(basename $archive_name)" mkdir -p "${to_dir}" pushd "${to_dir}" -tar xzvf "${archive_name}" +tar --zstd -xvf "${archive_name}" echo "Unarchived to: ${to_dir}" popd