Skip to content

Instantly share code, notes, and snippets.

View mehalter's full-sized avatar

Micah Halter mehalter

View GitHub Profile
@mehalter
mehalter / preview
Created March 3, 2023 14:14
mimetype based preview script
#! /usr/bin/env sh
case $(file -bL --mime-type "$1") in
cannot\ open*) exit ;;
inode/directory) ls --color=always "$1" ;;
text/html) w3m -O UTF-8 -dump "$1" ;;
text/troff) man ./"$1" ;;
application/gzip | application/x-tar | application/zip | application/x-7z-compressed | application/vnd.rar | application/x-bzip*) bsdtar --list --file "$1" ;;
application/json) jq --color-output . "$1" ;;
audio/* | image/* | application/octet-stream) mediainfo "$1" || exit 1 ;;
@mehalter
mehalter / .zshrc
Last active March 19, 2024 22:18
Sharable ZSH Configuration
# assumed commands:
# git (plugin management)
# wget (downloading preview script)
# bat (tab preview)
# delta (tab preview)
# w3m (tab preview)
# bsdtar (tab preview)
# jq (tab preview)
# mediainfo (tab preview)
# odt2txt (tab preview)