aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2022-07-06 08:32:20 +0100
committerMatthew Lemon <matt@matthewlemon.com>2022-07-06 08:32:20 +0100
commite578633a77934fb70bbf0e41e5f21bcc89520e7b (patch)
tree21b845bb42adaa466cca6f55efa7068b00961d52
parenta58c43b474dbd764eb2e3530cf21cc77fa446ba9 (diff)
added ksh script
-rwxr-xr-xbookmark_by_email.ksh42
-rwxr-xr-xdayplan.ksh30
2 files changed, 72 insertions, 0 deletions
diff --git a/bookmark_by_email.ksh b/bookmark_by_email.ksh
new file mode 100755
index 0000000..6acb597
--- /dev/null
+++ b/bookmark_by_email.ksh
@@ -0,0 +1,42 @@
+#!/bin/ksh
+
+# Bookmark a web page by send the contents in text format by email to 'bookmark@matthewlemon.com'
+# for future indexing and searching by notmuch, etc.
+
+OUT_FILE=/tmp/out1.txt
+OUT_FILE_P=/tmp/outpanddoc
+EMAIL=bookmark@matthewlemon.com
+
+USAGE="f:[format]t:[title]u:[url]"
+while getopts "$USAGE" optchar
+do
+ case $optchar in
+ f) OUTFORMAT=$OPTARG ;;
+ u) URL=$OPTARG ;;
+ t) TITLE=$OPTARG ;;
+ ?) echo $USAGE; exit 2 ;;
+ esac
+done
+shift $(($OPTIND - 1)) # not sure we need this
+
+if ! [[ $OUTFORMAT == "md" || $OUTFORMAT == "markdown" || $OUTFORMAT == "plain" ]]
+then
+ echo "Format must be 'md', 'markdown' or 'plain'."; exit 1;
+fi
+
+# if [ ${#@} -gt 0 ]
+# then
+# echo "Non-option arguments: " "$@"
+# exit 1
+# fi
+
+echo "$OUTFORMAT" "$URL" "$TITLE";
+
+echo "$URL" > $OUT_FILE
+
+pandoc -f html "$URL" -t "$OUTFORMAT" -o $OUT_FILE_P
+
+# neomutt -s "$TITLE" -i "$(cat $OUT_FILE $OUT_FILE_P)" $EMAIL
+
+cat $OUT_FILE $OUT_FILE_P | mail -v -s "$TITLE" $EMAIL
+rm $OUT_FILE $OUT_FILE_P
diff --git a/dayplan.ksh b/dayplan.ksh
new file mode 100755
index 0000000..b546a5e
--- /dev/null
+++ b/dayplan.ksh
@@ -0,0 +1,30 @@
+#!/bin/ksh
+
+# our target file
+DATE=$(date +\%Y-\%m-\%d)
+TODAY_PLANNER=~/Notes/journal/day_plans/$DATE.txt
+
+if [[ -a $TODAY_PLANNER ]]
+then
+ vim "$TODAY_PLANNER"
+else
+ touch "$TODAY_PLANNER"
+ {
+ echo -e "Date: $DATE
+
+Goal for Today: [replace this with your goal]
+---
+
+08:45 - 09:10 - Sophie to school
+09:15 - 09:30 - Email
+09:30 - 10:00 -
+10:00 - 11:00 -
+11:00 - 12:00 -
+12:15 - 13:00 - Lunch
+13:00 - 14:00 -
+14:00 - 15:00 -
+15:00 - 16:00 -
+16:00 - 17:00 - "
+ } > "$TODAY_PLANNER"
+ vim "$TODAY_PLANNER"
+fi