From c1e2b436a00117af6c63daa7f2716f4ae0038d80 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 18 Jun 2023 11:36:20 +0800 Subject: Update --- alias | 1 + bin/log/shellrc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/alias b/alias index 7a1ff75..6532c1e 100644 --- a/alias +++ b/alias @@ -446,6 +446,7 @@ alias mm='mkvmerge -o out.webm -w 01.webm + 02.webm' alias we='weechat' alias p8='ping -c 3 8.8.8.8' alias curl.google='curl -v google.com' +alias curl.wifi='curl -I google.com | grep -E "^Location:" | cut -d" " -f2 | xsel -ib' pbf() { protoc --decode_raw } diff --git a/bin/log/shellrc b/bin/log/shellrc index 721ed1b..a39e291 100644 --- a/bin/log/shellrc +++ b/bin/log/shellrc @@ -10,3 +10,12 @@ alias dia='diary' alias dias='diary specify' alias diaa='diary print' alias diat='diary today' + +# Filter frontmatter +wf() { + grep -m1 --include='*md' -n -o "$@" -R ~/log | \ + while IFS=: read file number pattern; do + end_of_frontmatter=$(grep -m2 -n -P '\-\-\-' $file | sed -n 2p | cut -d: -f1) + [ $number -lt "${end_of_frontmatter:-0}" ] && echo $file + done +} -- cgit v1.2.3-70-g09d2