summaryrefslogtreecommitdiff
path: root/wr
diff options
context:
space:
mode:
authorGeorge Abbott <george@gabbott.dev>2023-10-31 17:54:07 +0000
committerGeorge Abbott <george@gabbott.dev>2023-10-31 17:54:07 +0000
commit4d0bd914e7c1ee65f4036e60149a7b891906a5d3 (patch)
treec2a6751823e064e003cd4f6166df07bfc106d7eb /wr
Commit all to date.
Diffstat (limited to 'wr')
-rwxr-xr-xwr/evmnhol16
-rwxr-xr-xwr/holc6
-rwxr-xr-xwr/kt5
-rwxr-xr-xwr/lle6
-rwxr-xr-xwr/lssec4
-rwxr-xr-xwr/mdsec28
-rwxr-xr-xwr/mer6
-rwxr-xr-xwr/mkhol10
-rwxr-xr-xwr/mn5
-rwxr-xr-xwr/mndream6
-rwxr-xr-xwr/mnholmd18
-rwxr-xr-xwr/mnkic5
-rwxr-xr-xwr/mnman5
-rwxr-xr-xwr/mnrec5
-rwxr-xr-xwr/mnsec8
-rwxr-xr-xwr/rddream8
-rwxr-xr-xwr/rdsec8
-rwxr-xr-xwr/tasks3
-rwxr-xr-xwr/trk3
-rwxr-xr-xwr/wr4
-rwxr-xr-xwr/yer6
21 files changed, 165 insertions, 0 deletions
diff --git a/wr/evmnhol b/wr/evmnhol
new file mode 100755
index 0000000..ef56204
--- /dev/null
+++ b/wr/evmnhol
@@ -0,0 +1,16 @@
+#!/bin/sh
+# evmnhol
+# First set EVMNHOL_DIR as the directory in $HOME/docs/wr/lle/hol/ to write to,
+# then run evmnhol with the date you want to write to.
+
+
+if [ -z "$EVMNHOL_DIR" ] ; then echo "EVMNHOL_DIR is not set"; return; fi
+if [ -z "$1" ] ; then echo "You need to pass a date"; return; else DT="$1" fi
+if [ ! -d "$HOLIDAY/$EVMNHOL_DIR" ] ; then echo "$HOLIDAY/$EVMNHOL_DIR does not exist"; return; fi
+
+# TODO: add logic to verify the date using md. But check md actually
+# exists first. Use date +%s -d "$(cat md | grep begin | cut -d'=' -f2)"
+
+mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
+wr "lle/$(date +%Y-%m -d $DT)/H$(date --iso-8601 -d $DT).txt"
+ln -s "../../$(date +%Y-%m -d $DT)/H$(date --iso-8601 -d $DT).txt" "$HOLIDAY/$EVMNHOL_DIR/H$(date --iso-8601 -d $DT).txt"
diff --git a/wr/holc b/wr/holc
new file mode 100755
index 0000000..aeb33dc
--- /dev/null
+++ b/wr/holc
@@ -0,0 +1,6 @@
+#!/bin/sh
+# holc <holiday> <date>
+
+[ -z $1 ] && DT="today" || DT="$1"
+mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
+nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/H$(date --iso-8601 -d $DT).txt"
diff --git a/wr/kt b/wr/kt
new file mode 100755
index 0000000..268c17f
--- /dev/null
+++ b/wr/kt
@@ -0,0 +1,5 @@
+#!/bin/sh
+# kt
+
+mkdir -p "$HOME/docs/wr/orgd/kt"
+orgd "kt/$1"
diff --git a/wr/lle b/wr/lle
new file mode 100755
index 0000000..ea032c1
--- /dev/null
+++ b/wr/lle
@@ -0,0 +1,6 @@
+#!/bin/sh
+# lle
+
+[ -z "$1" ] && DT="today" || DT="$1"
+mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d "$DT")"
+wr "lle/$(date +%Y-%m -d "$DT")/L$(date --iso-8601 -d "$DT").txt"
diff --git a/wr/lssec b/wr/lssec
new file mode 100755
index 0000000..9a98b79
--- /dev/null
+++ b/wr/lssec
@@ -0,0 +1,4 @@
+#!/bin/sh
+# lssec
+
+ls "$HOME/docs/wr/sec" $@
diff --git a/wr/mdsec b/wr/mdsec
new file mode 100755
index 0000000..031f5a7
--- /dev/null
+++ b/wr/mdsec
@@ -0,0 +1,28 @@
+#!/bin/sh
+# mdsec: modify a secure entry, writing it back after.
+
+[ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return
+[ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return
+mkdir -p "/tmp/mksec"
+
+# File names
+temp="/tmp/mksec/$1.decrypted"
+ck="/tmp/mksec/$1-modck.decrypted"
+src="$HOME/docs/wr/sec/$1"
+dest="$src"
+
+
+gpg -d --output "$temp" "$src"
+cp "$temp" "$ck"
+nvim "$temp"
+
+# Only try to save if a modification has been made, tested with modification
+# date, where the edited file should only be -nt if its been modified/saved.
+if [ "$temp" -nt "$ck" ] ; then
+ gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG" --output "$dest" "$temp"
+else
+ printf "No modification made - no changes saved\n"
+fi
+
+shred -u "$temp"
+shred -u "$ck"
diff --git a/wr/mer b/wr/mer
new file mode 100755
index 0000000..f5bf550
--- /dev/null
+++ b/wr/mer
@@ -0,0 +1,6 @@
+#!/bin/sh
+# mer
+
+if [ -z $1 ] ; then DT="yesterday" else DT="$1" fi
+mkdir -p "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)"
+nvim "$HOME/docs/wr/lle/$(date +%Y-%m -d $DT)/M$(date +%Y-%m -d $DT).txt"
diff --git a/wr/mkhol b/wr/mkhol
new file mode 100755
index 0000000..4b8c02a
--- /dev/null
+++ b/wr/mkhol
@@ -0,0 +1,10 @@
+#!/bin/sh
+# mkhol
+if [ -z "$HOLIDAY" ] ; then HOL="$HOLIDAY" else HOL="$HOME/docs/wr/lle/hol" fi
+if [ -z "$1" ] ; then
+ # TODO: add logic to verify the date is valid
+ echo "You need to provide a date parameter"; return; fi
+if [ -z "$2" ] ; then echo "Please enter a place where you went.";
+ return; fi
+
+mkdir -p "$HOL/$1-$2"
diff --git a/wr/mn b/wr/mn
new file mode 100755
index 0000000..53221fa
--- /dev/null
+++ b/wr/mn
@@ -0,0 +1,5 @@
+#!/bin/sh
+# mn
+
+mkdir -p "$HOME/docs/wr/mn"
+wr "mn/$1"
diff --git a/wr/mndream b/wr/mndream
new file mode 100755
index 0000000..25fbcac
--- /dev/null
+++ b/wr/mndream
@@ -0,0 +1,6 @@
+#!/bin/sh
+# mndream
+
+[ -z $1 ] && DT="yesterday" || DT="$1"
+mkdir -p "$HOME/docs/wr/dream"
+wr "dream/D$(date --iso-8601 -d $DT).txt"
diff --git a/wr/mnholmd b/wr/mnholmd
new file mode 100755
index 0000000..f359ff2
--- /dev/null
+++ b/wr/mnholmd
@@ -0,0 +1,18 @@
+#!/bin/sh
+# mnholmd: Create the metadata file for a holiday file.
+# mnholmd <date> <place-name>
+
+if [ -z "$HOLIDAY" ] ; then HOL="$HOLIDAY" else HOL="$HOME/docs/wr/lle/hol" fi
+if [ -z "$1" ] ; then
+ # TODO: add logic to verify the date is valid
+ echo "You need to provide a date parameter"; return; fi
+if [ -z "$2" ] ; then echo "Please enter a place where you went.";
+ return; fi
+# logic
+if [ ! -d "$HOL/$1-$2" ] ; then echo "$1-$2 does not exist"; return; fi
+if [ -f "$HOL/$1-$2/md" ] ; then
+ nvim "$HOL/$1-$2/md"
+else
+ echo "begin=\nend=\nwith=\nat=\n" >> "$HOL/$1-$2/md"
+ nvim "$HOL/$1-$2/md"
+fi
diff --git a/wr/mnkic b/wr/mnkic
new file mode 100755
index 0000000..7f5ab0c
--- /dev/null
+++ b/wr/mnkic
@@ -0,0 +1,5 @@
+#!/bin/sh
+# mnkic
+
+mkdir "$HOME/docs/wr/kic" -p
+wr "kic/$1"
diff --git a/wr/mnman b/wr/mnman
new file mode 100755
index 0000000..df72b17
--- /dev/null
+++ b/wr/mnman
@@ -0,0 +1,5 @@
+#!/bin/sh
+# mnman
+
+mkdir -p "$HOME/docs/wr/man"
+wr "man/$1"
diff --git a/wr/mnrec b/wr/mnrec
new file mode 100755
index 0000000..26e5b81
--- /dev/null
+++ b/wr/mnrec
@@ -0,0 +1,5 @@
+#!/bin/sh
+# mnrec
+
+mkdir -p "$HOME/docs/wr/rec"
+wr "rec/$1"
diff --git a/wr/mnsec b/wr/mnsec
new file mode 100755
index 0000000..8f1d3ca
--- /dev/null
+++ b/wr/mnsec
@@ -0,0 +1,8 @@
+#!/bin/sh
+# mnsec: Make a secure encrypted entry using GPG.
+
+[ -z "$DEFAULT_GPG" ] && echo "DEFAULT_GPG not set" && return
+mkdir -p "/tmp/mksec"
+nvim "/tmp/mksec/$1"
+gpg --encrypt --armor --symmetric -r "$DEFAULT_GPG" --output "$HOME/docs/wr/sec/$1" "/tmp/mksec/$1"
+shred -u "/tmp/mksec/$1"
diff --git a/wr/rddream b/wr/rddream
new file mode 100755
index 0000000..706e088
--- /dev/null
+++ b/wr/rddream
@@ -0,0 +1,8 @@
+#!/bin/sh
+# rddream
+if [ -z "$1" ] ; then
+ wr "dream"
+ exit
+else
+ wr "dream/D$(date --iso-8601 -d $DT).txt"
+fi
diff --git a/wr/rdsec b/wr/rdsec
new file mode 100755
index 0000000..21ba438
--- /dev/null
+++ b/wr/rdsec
@@ -0,0 +1,8 @@
+#!/bin/sh
+# rdsec: Read a secure entry, will NOT write it back after.
+
+[ ! -f "$HOME/docs/wr/sec/$1" ] && echo "File $1 does not exist" && return
+mkdir -p "/tmp/mksec"
+gpg -d --output "/tmp/mksec/$1.decrypted" "$HOME/docs/wr/sec/$1"
+nvim "/tmp/mksec/$1.decrypted"
+rm "/tmp/mksec/$1.decrypted"
diff --git a/wr/tasks b/wr/tasks
new file mode 100755
index 0000000..2d9e3e0
--- /dev/null
+++ b/wr/tasks
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+wr tasks
diff --git a/wr/trk b/wr/trk
new file mode 100755
index 0000000..f8b4893
--- /dev/null
+++ b/wr/trk
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+wr trk/$1
diff --git a/wr/wr b/wr/wr
new file mode 100755
index 0000000..812fb6a
--- /dev/null
+++ b/wr/wr
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+mkdir -p "$HOME/docs/wr"
+nvim "$HOME/docs/wr/$1"
diff --git a/wr/yer b/wr/yer
new file mode 100755
index 0000000..246fc78
--- /dev/null
+++ b/wr/yer
@@ -0,0 +1,6 @@
+#!/bin/sh
+# yer
+
+[ -z "$1" ] && DT="yesterday" || DT="$1"
+mkdir -p "$HOME/docs/wr/lle/$1-12"
+nvim "$HOME/docs/wr/lle/$1-12/Y$1.txt"