aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2022-01-15 10:56:44 +0800
committerAaron LI <aly@aaronly.me>2023-06-13 10:01:03 +0800
commit0235adb5d52110d951e9001d46ecbc52192a5e01 (patch)
tree61abcf8f2a083c0de6be22ab62261928c9120c6b
parent07a7bab4bd2d3ae4a6e96528b1f1db65d0aadbc8 (diff)
downloaddotfiles-0235adb5d52110d951e9001d46ecbc52192a5e01.tar.bz2
zsh: Add zlibd() to uncompress zlib data
-rw-r--r--_zshrc7
1 files changed, 7 insertions, 0 deletions
diff --git a/_zshrc b/_zshrc
index ca2af45..adf59e7 100644
--- a/_zshrc
+++ b/_zshrc
@@ -252,6 +252,13 @@ cdiff() {
diff -u "$@" | cpatch
}
+## Uncompress zlib data
+# Credit: https://unix.stackexchange.com/a/49066
+zlibd() {
+ # Prepend the gzip magic number and compress method.
+ { printf '\x1f\x8b\x08\x00\x00\x00\x00\x00'; cat "$@"; } | gzip -dc
+}
+
#
# Terminal settings
#