From 0235adb5d52110d951e9001d46ecbc52192a5e01 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 15 Jan 2022 10:56:44 +0800 Subject: zsh: Add zlibd() to uncompress zlib data --- _zshrc | 7 +++++++ 1 file changed, 7 insertions(+) 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 # -- cgit v1.2.2