Compare commits

...

10 Commits

Author SHA1 Message Date
e7f42f4602 Save current changes before moving to new remote 2025-08-12 12:02:23 -04:00
1bd57833d4 another pass on cleanup 2022-12-22 10:29:39 -08:00
f8a936cffe cleaned up readme 2022-12-19 20:19:41 -08:00
2edc99873a cleaned up the readme and made the program just a little easier to configure 2022-02-03 18:26:50 -05:00
346db2ee55 fixed image 2021-06-18 16:25:20 +00:00
d7fadcf098 test 2021-01-14 02:18:21 -05:00
f7f0aabeec Update 'README.md'
spelling
2020-11-20 01:37:40 +00:00
67e89ad38a Update 'README.md'
plantext->plain text
2020-11-19 03:25:21 +00:00
793b342418 thing 2020-11-18 22:16:07 -05:00
29ce7a7013 thing 2020-11-18 22:15:53 -05:00
2 changed files with 88 additions and 61 deletions

122
README.md
View File

@ -1,70 +1,84 @@
# calendarender
<img src="calendar.jpg" width=556>
<img src="https://git.laboratoryb.org/trav/calendarender/raw/branch/master/calendar.jpg" width=556>
These are 2 scripts for calendaring in plantext files.
These are 2 scripts I use for calendaring in plain text files. The calendar consists of 2 files:
`calendar.txt` shows the current day at the top and continues down as far as the number of months you have rendered.
`calendar_archive.txt` contains all the days before current day.
calendar.txt looks like this:
- `calendar_archive.txt` contains all the days before current day.
- `calendar.txt` shows the current day at the top and continues down as far as the number of months that have been rendered. My calendar contains events and tasks for the current day. A typical day might look like:
```
☼ sun nov 29
water plants
coop fed meeting
⇃☾ tue dec 20
8 weekly meeting
9 website meeting
lunch with james
◯ mon nov 30
recycling
———— December ————
☼ tue dec 01
reading group
☼ wed dec 02
1pm appointment
⇃◌ thu dec 03
open hours at lab
reply to susan
laundry
groceries
locate receipts
```
Events are at the top with a space inbetween them and the tasks for the day are below without spaces. As tasks and events are completed I move them to just below the day title, sometimes with little notes. At the end of the day any uncompleted tasks will either get copied to the next day or migrated into my kanban task list in Obsidian. Then after midnight or next morning I run `calendarchive.sh` and start again for the next day.
## installation
1. clone or download the repo.
I've been calendaring this way since fall of 2019.
2. configure calendarender by opening calendarender.sh in your texteditor of choice and modify the line:
I sync the notes between computers with SyncThing and edit them via Notational Velocity, TextEdit or Gedit, depending on what computer I'm on. In the future I think I might merge this plain text notes folder with my markdown project notes in Obsidian.
## the scripts
### calendarender.sh
calendarender takes one argument and that's the number of months in the future you'd like to render. So say it's currently some day in November and I want to add the days in January to my calendar.txt, I would run `calendarender 2`. It then prints to the terminal as well as to the file.
Each day is rendered with a title containing the moon phase, day of the week, month, and day of the month. Moon phases that are printed are: new, full, crescents and halfs. On any day that isn't one of those phases a sun is printed. If it's waxing an up-arrow will be printed, waning, down-arrow. It's not the _most_ accurate moon-phase algorithm but close enough for me :)
### calendarchive.sh
if you run calendarchive without any arguments it will remove all days from calendar.txt that are before the current day and append them to the bottom of calendar_archive.txt. If it's late at night but before midnight you can run `calendarchive 1` and it'll also archive today as well (this doesn't work on linux though because of differences in how the `date` program works. Oh well.).
## installation + configuration
### calendarender.sh
Open calendarender.sh in your texteditor of choice and find the line:
`calendarFile="/Users/YOU/WHEREYOURNOTESARE/calendar.txt"`
to say where your calendar file is. This must be the absolute path to your calendar file. If you don't have one just make an empty txt file there to start.
This must be the absolute path to your calendar file. If you don't have one just make an empty txt file to start.
You might also like to configure recurring events. I have some SERIOUS ROOM FOR IMPROVEMENT here, it's true. Recurring events really ought to be in a separate config file. BUT ALAS, it works for me as recurring events rarely change, it is what it is, recurring events are hardcoded. So, if you have things that happen weekly or monthly and you want them to be auto-rendered, you'll need to modify this code block:
To configure recurring events find where it says `############# render weekly things`. This section is broken down by day. There are a number of examples for Sundays that you can look at and modify for different days of the week/month. Anything in quotes after `echo` will be added to the calendar.
```
#every sunday
if [ "$dayOfWeek" = "Sun" ]; then echo "water plants">> $calendarFile; sunday=$(($sunday+1)); fi
```
_Make sure not to get rid of the section `sunday=$(($sunday+1))` because that is how the program keeps track of which sunday/monday/tuesday/(etc) we're on._
```
#second sunday
if [ "$dayOfWeek" = "Sun" ] && [ "$sunday" -eq 2 ]; then echo "example potluck">> $calendarFile; fi
#3rd sunday
if [ "$dayOfWeek" = "Sun" ] && [ "$sunday" -eq 3 ]; then echo "example potluck on third sunday">> $calendarFile; fi
#last sunday
if [ "$(date -v1d -v+"$tooFarNum"m -v-1d -v-sun +%a-%b-%d)" = "$(date -v1d -v+"$1"m -v+"$PLACEINMONTH"d +%a-%b-%d)" ] && [ "$dayOfWeek" = "Sun" ]; then echo "last sunday of th>
#every monday
...
```
_copy this to another day and change `Sun`, `sunday`, and `sunday` to another day. The 2 indicates this will be on the second sunday_
```
Anytime something is `echo`ed it gets added to your calendar. Make sure not to get rid of the section `sunday=$(($sunday+1))` because that is how the program keeps track of which sunday (etc) we're on.
#last sunday
if [ "$(date -v1d -v+"$tooFarNum"m -v-1d -v-sun +%a-%b-%d)" = "$(date -v1d -v+"$1"m -v+"$PLACEINMONTH"d +%a-%b-%d)" ] && [ "$dayOfWeek" = "Sun" ]; then echo "last sunday of the month potluck">> $calendarFile; fi
```
_this one is a liiiitle more complicated but you can copy and paste this one to create events on the last monday/tuesday/etc of the month. Just change "Sun" to a different day of the week_
3. configure calendarchive
### calendarchive.sh
Within calendarchive.sh, find the lines:
@ -72,29 +86,19 @@ Within calendarchive.sh, find the lines:
`calendarchive="/Users/YOU/YOURNOTESFOLDER/calendar_archive.txt"`
and modify them to point to your calendar files. Make sure both those exist at least as blank files.
and modify them to point to the absolute path of your calendar files. Make sure both those exist at least as blank files.
4. you might need to `chmod +x` each of the scripts to make sure they're executable.
### that's basically it
5. You can now just run them with `sh calendarchive.sh` or `sh calendarender.sh` but they're easier to use if they're in your path:
You might need to `chmod +x` each of the scripts to make sure they're executable. You can now just run them with `sh calendarchive.sh` or `sh calendarender.sh`. I've added the following lines to `.bashrc` so that I can just run `arch` when I'm ready for the next day:
Copy the scripts somewhere like `~/bin` and add `export PATH=$PATH:~/bin` to `~/.bashrc`
```
function arch() {
cd ~/notes
sh calendarchive.sh
}
```
## usage
My personal notes folder is plaintext synced between machines with SyncThing and accessed via NotationalVelocity (or sometimes TextEdit, nano, whatever). I keep calendar.txt, calendar_archive.txt and all sorts of other notes in there. I've been calendaring this way since fall of 2019.
### calendarender
calendarender takes one argument and that's the number of months in the future you'd like to render. So say it's currently a day in November and I want to add the days in January to my calendar.txt, I would run `calendarender 2`. It'll print to the terminal as well as to the file.
calendarender also prints relevant moon phases: new, full, crescents and halfs. On any day that isn't one of those phases a sun is printed. If it's waxing an up-arrow will be printed, waning, down-arrow. It's not the _most_ accurate moon-phase algorithm but close enough for me :)
### calendarchive
if you run calendarchive without any arguments it will remove all days from calendar.txt that are before the current day and append them to the bottom of calendar_archive.txt. If it's late at night but before midnight you can run `calendarchive 1` and it'll also archive today as well.
you could cron calendarchive to have it automatically run but personally I keep all kinds of notes and things in my calendar and don't want to lose track of anything. So I manually run calendarchive.

View File

@ -23,7 +23,6 @@ get_moon_icon () {
else phase_icon="☼" # a SUN day :)
fi
echo $phase_icon
}
OUTPUT="$(date -v+$1m +%B", "%Y)"
@ -61,7 +60,10 @@ do
dayOfWeek="$(date -v+"$1"m -v1d -v+"$PLACEINMONTH"d +%a)"
#############render weekly things
############# render weekly things
# SUNDAYS
#every sunday
if [ "$dayOfWeek" = "Sun" ]; then echo "water plants">> $calendarFile; sunday=$(($sunday+1)); fi
#second sunday
@ -71,18 +73,39 @@ do
#last sunday
if [ "$(date -v1d -v+"$tooFarNum"m -v-1d -v-sun +%a-%b-%d)" = "$(date -v1d -v+"$1"m -v+"$PLACEINMONTH"d +%a-%b-%d)" ] && [ "$dayOfWeek" = "Sun" ]; then echo "last sunday of the month potluck">> $calendarFile; fi
# MONDAYS
#every monday
if [ "$dayOfWeek" = "Mon" ]; then echo "contact Bob">> $calendarFile; echo "put recycling out">> $calendarFile; monday=$(($monday+1)); fi
# TUESDAYS
#every tuesday
if [ "$dayOfWeek" = "Tue" ]; then tuesday=$(($tuesday+1)); fi
# WEDNESDAYS
#every wednesday
if [ "$dayOfWeek" = "Wed" ]; then wednesday=$(($wednesday+1)); fi
# THURSDAYS
#every thursday
if [ "$dayOfWeek" = "Thu" ]; then echo "open hours at Lab B">> $calendarFile; thursday=$(($thursday+1)); fi
# FRIDAYS
#every friday
if [ "$dayOfWeek" = "Fri" ]; then friday=$(($friday+1)); fi
# SATURDAYS
#every saturday
if [ "$dayOfWeek" = "Sat" ]; then saturday=$(($saturday+1)); fi