commit 75848f740318d301a36626404ce64914e8bf278d
parent f565fa907f4338271d097fe0504fa5937772d8d9
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 22 Jul 2020 16:03:28 -0700
Add and remove functions
add zfeed related functions zt, zv, nth, and htt.
remove daily function
add cmd alias to command
Diffstat:
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/aliases/.config/aliases b/aliases/.config/aliases
@@ -97,12 +97,23 @@ mfind() {
find "$dir" -type d | grep ${@-""} | sed "s:$dir/?::"
}
+# get title from zfeed output
+zt() {
+ cut -f2
+}
+
+# format and view zfeed output
+zv() {
+ cut -f4 | htt | less
+}
+
# random
alias mstat="command ps -eo pmem,rss,args --sort pmem | grep -v '^[[:space:]]0.0'"
alias mpv="mpv --no-input-default-bindings"
alias pkill="pkill -x"
alias col="column -t"
alias la="ls -A"
+alias com="command"
# Search all history for `regex`
@@ -143,24 +154,6 @@ prc()
}
-# Open note for today
-daily()
-{
- time="$(date +%H%M)"
- if [ "$time" -gt 0 -a "$time" -lt 600 ]; then
- date=$(perl -e "use DateTime; print DateTime->today(time_zone => 'local')->add(days => -1)->strftime('%Y/%m/%d');")
- else
- date="$(date +%Y/%m/%d)"
- fi
- time=$(date "+%R")
- if [ ! -e "$NOTES/daily/$date" ]; then
- echo "$date\n\n$time" >> "$NOTES/daily/$date"
- else
- echo "\n\n$time" >> "$NOTES/daily/$date"
- fi
- ff "$NOTES/daily/$date"
-}
-
# Print the current date, time, or date and time to stdout.
now()
{
@@ -183,3 +176,15 @@ self()
{
exec $0
}
+
+# convert html to text
+htt()
+{
+ w3m -T text/html -dump -cols ${1:-${COLUMNS:-80}}
+}
+
+# get nth line from stdout
+nth()
+{
+ head -n ${1:?"nth: no index"} | tail -1
+}