From 2098dc9968618561224fbc30394d39ab77b2dbe6 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 10 Feb 2026 22:39:30 -0800 Subject: [PATCH 1/2] Convert `bell` to shell alias --- .dotfiles/bin/bell | 7 ------- .dotfiles/shell/aliases | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) delete mode 100755 .dotfiles/bin/bell diff --git a/.dotfiles/bin/bell b/.dotfiles/bin/bell deleted file mode 100755 index 568a987..0000000 --- a/.dotfiles/bin/bell +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# Prefix another command with this script to ring the terminal bell on command -# completion -"${@}" -ret=${?} -tput bel -exit ${ret} diff --git a/.dotfiles/shell/aliases b/.dotfiles/shell/aliases index c4d9008..12278ef 100644 --- a/.dotfiles/shell/aliases +++ b/.dotfiles/shell/aliases @@ -259,6 +259,13 @@ if [ -x /usr/bin/notify-send ]; then } fi +bell() { + "${@}" + ret=${?} + tput bel + return "${ret}" +} + png2jpg() { for i in "${@}"; do echo "${i}" From 2b550bdf9add62f39535f5aac4d53aeffff9d916 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 10 Feb 2026 22:39:31 -0800 Subject: [PATCH 2/2] Recreate `howlong`, `howold` as new combined `ago` Python tool --- .dotfiles/bin/ago | 13 +++++++++++++ .dotfiles/bin/howlong | 43 ------------------------------------------- .dotfiles/bin/howold | 14 -------------- 3 files changed, 13 insertions(+), 57 deletions(-) create mode 100755 .dotfiles/bin/ago delete mode 100755 .dotfiles/bin/howlong delete mode 100755 .dotfiles/bin/howold diff --git a/.dotfiles/bin/ago b/.dotfiles/bin/ago new file mode 100755 index 0000000..b9b2f02 --- /dev/null +++ b/.dotfiles/bin/ago @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import datetime +import sys +import time + +if len(sys.argv) <= 1: + print(f"Usage: {sys.argv[0]} [:]value", file=sys.stderr) + sys.exit(0) + +v = sys.argv[1] +seconds = int(v[1:]) if v[0] == ":" else int(time.time()) - int(v) +print(datetime.timedelta(seconds=seconds)) diff --git a/.dotfiles/bin/howlong b/.dotfiles/bin/howlong deleted file mode 100755 index b15a8f8..0000000 --- a/.dotfiles/bin/howlong +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -usage() -{ - ( - echo "Usage: $(basename "${0}") [-p] " - echo "Convert number of seconds to human-readable time difference" - ) >&2 - exit 1 -} - -opt_precision= -while getopts "p:h" opt; do - case ${opt} in - p) opt_precision="${OPTARG##*[!0-9]*}";; - h|\?) usage;; - *) echo "hmm ${1}";; - esac - shift "$((OPTIND-1))" -done - -count="${1##*[!0-9]*}" -[ -z "${count}" ] && usage - -div= -str= -mod=0 -for i in s m h d y; do - [ "${count}" -le 0 ] && break - case "${i}" in - y) div=0;; - d) div=365;; - h) div=24;; - m|s) div=60;; - esac - if [ "${div:-0}" -gt 0 ]; then - mod=$((count % div)) - count=$((count / div)) - str="${mod}${i} ${str}" - else - str="${count}${i} ${str}" - fi -done -echo "${str}" | cut -d' ' -f1-"${opt_precision:-100}" diff --git a/.dotfiles/bin/howold b/.dotfiles/bin/howold deleted file mode 100755 index 877e72d..0000000 --- a/.dotfiles/bin/howold +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e -args="${*}" -if [ "${args##*[!0-9]*}" != "" ]; then - # Value is a number of seconds, parse as a unix timestamp - args="@${args}" -fi -ts=$(date --date="${args}" +%s) -delta=$(($(date +%s) - ts)) -if [ "${delta}" -lt 0 ]; then - printf "future " - delta=$((0 - delta)) -fi -howlong "${delta}"