diff options
Diffstat (limited to 'wr')
-rwxr-xr-x | wr/evmnhol | 16 | ||||
-rwxr-xr-x | wr/holc | 6 | ||||
-rwxr-xr-x | wr/kt | 5 | ||||
-rwxr-xr-x | wr/lle | 6 | ||||
-rwxr-xr-x | wr/lssec | 4 | ||||
-rwxr-xr-x | wr/mdsec | 28 | ||||
-rwxr-xr-x | wr/mer | 6 | ||||
-rwxr-xr-x | wr/mkhol | 10 | ||||
-rwxr-xr-x | wr/mn | 5 | ||||
-rwxr-xr-x | wr/mndream | 6 | ||||
-rwxr-xr-x | wr/mnholmd | 18 | ||||
-rwxr-xr-x | wr/mnkic | 5 | ||||
-rwxr-xr-x | wr/mnman | 5 | ||||
-rwxr-xr-x | wr/mnrec | 5 | ||||
-rwxr-xr-x | wr/mnsec | 8 | ||||
-rwxr-xr-x | wr/rddream | 8 | ||||
-rwxr-xr-x | wr/rdsec | 8 | ||||
-rwxr-xr-x | wr/tasks | 3 | ||||
-rwxr-xr-x | wr/trk | 3 | ||||
-rwxr-xr-x | wr/wr | 4 | ||||
-rwxr-xr-x | wr/yer | 6 |
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" @@ -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" @@ -0,0 +1,5 @@ +#!/bin/sh +# kt + +mkdir -p "$HOME/docs/wr/orgd/kt" +orgd "kt/$1" @@ -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" @@ -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" @@ -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 @@ -0,0 +1,3 @@ +#!/bin/sh + +wr trk/$1 @@ -0,0 +1,4 @@ +#!/bin/sh + +mkdir -p "$HOME/docs/wr" +nvim "$HOME/docs/wr/$1" @@ -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" |