commit 2a6936f04058203606cb839e6080adb985dd39bf parent 6facd92be8d7b36c06abd2ed9f6cf352cc3c6a16 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 9 Apr 2020 07:32:47 +0200 Add functions for random files or man pages Diffstat:
M | .profile | | | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/.profile b/.profile @@ -127,9 +127,7 @@ ddg() { alias wanip='curl https://ipinfo.io/ip' news() { - if [ $# -eq 0 ]; then - url="https://text.npr.org" - elif [ "$1" = "npr" ]; then + if [ $# -eq 0 ] || [ "$1" = "npr" ]; then url="https://text.npr.org" elif [ "$1" = "cnn" ]; then url="https://lite.cnn.io/en" @@ -151,6 +149,14 @@ t_stop_done() { done } +randomfile() { + printf '%s/%s\n' "${1:-.}" "$(ls -p "${1:-.}" | grep -v / | sort -R | head -1)" +} + +randomman() { + man -l "$(ls /usr/share/man/man[23567]/*.[23567] | sort -R | head -1)" +} + alias julia-fast='julia --procs 1 --optimize=3 --math-mode=fast' if [ -d "/usr/local/cuda/bin" ]; then