commit ed8c8d64eaa384ad6e03d2877901784efb205112 Author: dozens Date: Fri Feb 2 13:39:32 2024 -0700 inits commits diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dd3b61 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +this work is licensed under the TILDE ZINE LICENSE, version 7. + +it may be freely remixed, cut up, pounded into dust, or simply used as +a handkerchief, provided the following conditions are met: + +1. You submit to the next available issue of the TILDE ZINE. +2. You get up right now and do a little dance. +3. You promise to love yourself every day. Sometimes it's hard but + that's why we promise. + +<3 dozens diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce0c1d9 --- /dev/null +++ b/README.md @@ -0,0 +1,109 @@ +# MEALS + +This is my own personal recipe database and meal planner + +STATUS: janky, proof of concept, unsafe, used in production + +## ABOUT + +recipes.rec contains two types: meals and recipes + +a meal may contain many recipe components. + +``` +%rec: meal +%doc: a meal can consist of several recipes +%key: name +%type: recipe rec recipe +%type: name line +%mandatory: name recipe +%allowed: name recipe +``` + +Example: + +``` +name: Lemon Couscous w Salmon and roast broccoli +recipe: lemon couscous +recipe: frozen salmon patties +recipe: roast brocolli +``` + + +and a recipe comprises several ingredients and steps. + +``` +%rec: recipe +%doc: a recipe for one thing +%key: name +%type: name,ingredient,step line +%mandatory: name ingredient step +%allowed: name ingredient step +``` + +Example: + +``` +name: lemon couscous +ingredient: couscous +ingredient: veggie stock +ingredient: lemon juice +ingredient: garlic +step: cook the couscous in the stock +step: drain +step: add lemon and garlic +``` + +menu.rec +contains meals for breakfast, lunch, and dinner for each day. + +``` +%rec: menu +%doc: a menu of meals +%type: breakfast rec meal +%type: lunch rec meal +%type: dinner rec meal +%type: day line +%type: date date +%allowed: day date breakfast lunch dinner +%mandatory: day date breakfast lunch dinner +``` + +Example: + +``` +day: Wednesday +date: 2024-02-07 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: Lemon Couscous w Salmon and roast broccoli +``` + +the justfile contains scrips for creating a `.rem` file for remind(1). +(from there you can use the `rem2ics` utility to create a calendar file, +or `rem2ps` to create a pdf.) +it also can create a simple pdf menu via groff and tbl. +finally it print a list of ingredients needed for next week's menu +so you can plan your shoping. + +## YOU WILL NEED + +- recutils +- groff +- zx + +## GETTING STARTED + +- add recipes and meals to db/recipes.rec +- plan your weekly menu in db/menu.rec +- `just menu` to create `.rem` and `.pdf` menus for the week +- `just shopping` to print a shopping list + +## TODO + +This might eventually become part of the backend for supervegan.neocities.org + +- [ ] remove zx dep (i thought it would make dates easier in the beginning) +- [ ] parameterize the date for which the week should be calculated. +- [ ] quantity for recipe ingredient? +- [ ] yield for recipe? diff --git a/db/menu.rec b/db/menu.rec new file mode 100644 index 0000000..cbd5498 --- /dev/null +++ b/db/menu.rec @@ -0,0 +1,103 @@ +%rec: menu +%doc: a menu of meals +%type: breakfast rec meal +%type: lunch rec meal +%type: dinner rec meal +%type: day line +%type: date date +%allowed: day date breakfast lunch dinner +%mandatory: day date breakfast lunch dinner + +# WEEK 05 / 52 + +day: Monday +date: 2024-02-05 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: stirfry w roast brocolli + +day: Tuesday +date: 2024-02-06 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: pasta with balls and roast broccoli + +day: Wednesday +date: 2024-02-07 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: Lemon Couscous w Salmon and roast broccoli + +day: Thursday +date: 2024-02-08 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: Roast squash w mashed potatoes + +day: Friday +date: 2024-02-09 +breakfast: eggs n peanutbutter +lunch: chipotle bowl +dinner: Burgers + + +# WEEK 04 / 52 + +day: Monday +date: 2024-01-29 +breakfast: eggs n cornbread +lunch: 3P Pasta +dinner: stirfry w roast brocolli + +day: Tuesday +date: 2024-01-30 +breakfast: eggs n cornbread +lunch: 3P Pasta +dinner: Corndogs n fries + +day: Wednesday +date: 2024-01-31 +breakfast: eggs n cornbread +lunch: 3P Pasta +dinner: Black bean grain bowl + +day: Thursday +date: 2024-02-01 +breakfast: eggs n cornbread +lunch: 3P Pasta +#dinner: Roast squash w mashed potatoes +dinner: canceled + +day: Friday +date: 2024-02-02 +breakfast: eggs n cornbread +lunch: 3P Pasta +dinner: FFY + + + +# WEEK 02/52 + +day: Monday +date: 2024-01-15 +breakfast: eggs n cornbread +lunch: Chili +dinner: gnocci and squash + +day: Tuesday +date: 2024-01-16 +breakfast: eggs n cornbread +lunch: Chili +dinner: mashed potatoes w mac-n-cheese + +day: Wednesday +date: 2024-01-17 +breakfast: eggs n cornbread +lunch: Chili +dinner: stirfry w roast brocolli + +day: Thursday +date: 2024-01-18 +breakfast: eggs n cornbread +lunch: Chili +dinner: spaghetti n balls diff --git a/db/recipes.rec b/db/recipes.rec new file mode 100644 index 0000000..2d2bf91 --- /dev/null +++ b/db/recipes.rec @@ -0,0 +1,103 @@ +%rec: meal +%doc: a meal can consist of several recipes +%key: name +%type: recipe rec recipe +%type: name line +%mandatory: name recipe +%allowed: name recipe + +name: chipotle bowl +recipe: chipotle bowl + +name: stirfry w roast brocolli +recipe: stirfry +recipe: roast brocolli + +name: pasta with balls and roast broccoli +recipe: pasta +recipe: gardein frozen balls +recipe: roast brocolli + +name: Lemon Couscous w Salmon and roast broccoli +recipe: lemon couscous +recipe: frozen salmon patties +recipe: roast brocolli + +name: Roast squash w mashed potatoes +recipe: frozen roast squash +recipe: mashed potatoes + +name: Burgers +recipe: beyond burger cookout classic + +%rec: recipe +%doc: a recipe for one thing +%key: name +%type: name,ingredient,step line +%mandatory: name ingredient step +%allowed: name ingredient step + +name: chipotle bowl +ingredient: black beans +ingredient: brown rice or farro +ingredient: yellow onions +ingredient: corn +ingredient: peppers +step: cook the beans +step: cook the rice +step: saute the onions and peppers +step: combine everything and spice it up + +name: mashed potatoes +ingredient: russet potato +ingredient: butter +ingredient: milk +step: boil water +step: add potatoes (do not peel) +step: boil until soft enough to pass a knife though + +name: lemon couscous +ingredient: couscous +ingredient: veggie stock +ingredient: lemon juice +ingredient: garlic +step: cook the couscous in the stock +step: drain +step: add lemon and garlic + +name: beyond burger cookout classic +ingredient: beyond burgers +ingredient: burger buns +ingredient: ketchup and mustard +ingredient: red onion +ingredient: sliced tomato +step: air fry at 365 for 30 minutes + +name: frozen roast squash +ingredient: frozen squash +step: cook it in the air frier + +name: frozen salmon patties +ingredient: frozen salmon patty +step: fry it in the pan + +name: pasta +ingredient: spaghetti or other pasta +ingredient: pasta sauce +step: boil the pasta +step: heat up the sauce in a sauce pan + +name: gardein frozen balls +ingredient: frozen balls +step: heat them up in the microwave + +name: stirfry +ingredient: frozen stirfry +step: heat it up in a pan + +name: roast brocolli +ingredient: brocolli +step: preheat the oven to 350 +step: tear the brocolli into bite sized pieces +step: add drizzle of oil and dash of seasond salt +step: bake for 30 minutes diff --git a/dist/2024-01-29-02.pdf b/dist/2024-01-29-02.pdf new file mode 100644 index 0000000..ebaeb0e Binary files /dev/null and b/dist/2024-01-29-02.pdf differ diff --git a/dist/2024-02-05-09.pdf b/dist/2024-02-05-09.pdf new file mode 100644 index 0000000..0ac633b Binary files /dev/null and b/dist/2024-02-05-09.pdf differ diff --git a/dist/menu.rem b/dist/menu.rem new file mode 100644 index 0000000..191b5e9 --- /dev/null +++ b/dist/menu.rem @@ -0,0 +1,42 @@ +rem 2024-02-05 at 08:00 tag breakfast msg eggs n peanutbutter% +rem 2024-02-05 at 12:00 tag lunch msg chipotle bowl% +rem 2024-02-05 at 18:00 tag dinner msg stirfry w roast brocolli% +rem 2024-02-06 at 08:00 tag breakfast msg eggs n peanutbutter% +rem 2024-02-06 at 12:00 tag lunch msg chipotle bowl% +rem 2024-02-06 at 18:00 tag dinner msg pasta with balls and roast broccoli% +rem 2024-02-07 at 08:00 tag breakfast msg eggs n peanutbutter% +rem 2024-02-07 at 12:00 tag lunch msg chipotle bowl% +rem 2024-02-07 at 18:00 tag dinner msg Lemon Couscous w Salmon and roast broccoli% +rem 2024-02-08 at 08:00 tag breakfast msg eggs n peanutbutter% +rem 2024-02-08 at 12:00 tag lunch msg chipotle bowl% +rem 2024-02-08 at 18:00 tag dinner msg Roast squash w mashed potatoes% +rem 2024-02-09 at 08:00 tag breakfast msg eggs n peanutbutter% +rem 2024-02-09 at 12:00 tag lunch msg chipotle bowl% +rem 2024-02-09 at 18:00 tag dinner msg Burgers% +rem 2024-01-29 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-29 at 12:00 tag lunch msg 3P Pasta% +rem 2024-01-29 at 18:00 tag dinner msg stirfry w roast brocolli% +rem 2024-01-30 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-30 at 12:00 tag lunch msg 3P Pasta% +rem 2024-01-30 at 18:00 tag dinner msg Corndogs n fries% +rem 2024-01-31 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-31 at 12:00 tag lunch msg 3P Pasta% +rem 2024-01-31 at 18:00 tag dinner msg Black bean grain bowl% +rem 2024-02-01 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-02-01 at 12:00 tag lunch msg 3P Pasta% +rem 2024-02-01 at 18:00 tag dinner msg canceled% +rem 2024-02-02 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-02-02 at 12:00 tag lunch msg 3P Pasta% +rem 2024-02-02 at 18:00 tag dinner msg FFY% +rem 2024-01-15 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-15 at 12:00 tag lunch msg Chili% +rem 2024-01-15 at 18:00 tag dinner msg gnocci and squash% +rem 2024-01-16 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-16 at 12:00 tag lunch msg Chili% +rem 2024-01-16 at 18:00 tag dinner msg mashed potatoes w mac-n-cheese% +rem 2024-01-17 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-17 at 12:00 tag lunch msg Chili% +rem 2024-01-17 at 18:00 tag dinner msg stirfry w roast brocolli% +rem 2024-01-18 at 08:00 tag breakfast msg eggs n cornbread% +rem 2024-01-18 at 12:00 tag lunch msg Chili% +rem 2024-01-18 at 18:00 tag dinner msg spaghetti n balls% diff --git a/justfile b/justfile new file mode 100644 index 0000000..b102af1 --- /dev/null +++ b/justfile @@ -0,0 +1,100 @@ +# show all recipes +default: + just --list --unsorted + +remtmpl := ''' + "rem {{date}} at 08:00 tag breakfast msg {{breakfast}}% + rem {{date}} at 12:00 tag lunch msg {{lunch}}% + rem {{date}} at 18:00 tag dinner msg {{dinner}}% + "''' + +# build menu.rem from menu.rec +rem: + #!/bin/sh + exec > dist/menu.rem + recsel db/menu.rec | recfmt {{remtmpl}} + +# build menu pdf from menu.rec +pdf: + #!/usr/bin/env zx + const curr = new Date() + const firstday = new Date(curr.setDate(curr.getDate() - curr.getDay())); + const lastday = new Date(curr.setDate(curr.getDate() - curr.getDay()+6)); + const options = { + year: "numeric", + month: "long", + day: "numeric", + }; + const rec = await $`recsel db/menu.rec -e ${'date >> "' + firstday + '"'}`.quiet() + .pipe($`recsel -e ${'date << "' + lastday + '"'}`).quiet() + const bkfst = await $`echo ${rec}`.quiet() + .pipe($`recsel -p breakfast`).quiet() + .pipe($`recfmt '.ad l + {{{{breakfast}} + T};T{ + '`).quiet() + const lunch = await $`echo ${rec}`.quiet() + .pipe($`recsel -p lunch`).quiet() + .pipe($`recfmt '.ad l + {{{{lunch}} + T};T{ + '`).quiet() + const dinner = await $`echo ${rec}`.quiet() + .pipe($`recsel -p dinner`).quiet() + .pipe($`recfmt '.ad l + {{{{dinner}} + T};T{ + '`).quiet() + const firstdaygroff = new Date(firstday.setDate(firstday.getDate()+1 - firstday.getDay())).toLocaleString('en-US', options); + const lastdaygroff = new Date(lastday.setDate(lastday.getDate() - lastday.getDay()+5)).toLocaleString('en-US', options); + const tmpl=` + .ce + .I + chez brun + .sp 2 + .LP + .ps 14 + ${firstdaygroff} - ${lastdaygroff} + .ps + .sp 3 + .LP + .TS + center expand tab(;); + l | lp+2 lp+2 lp+2 lp+2 lp+2 + - | - - - - - + l | l l l l l. + ;Monday;Tuesday;Wednesday;Thursday;Friday + Breakfast;T{ + ${bkfst} + T} + .sp + Lunch;T{ + ${lunch} + T} + .sp + Dinner;T{ + ${dinner} + T} + .TE` + await $`echo ${tmpl}`.quiet() + .pipe($`groff -t -ms -Tpdf -d paper=letterl -P-pletterl > dist/${new Date(firstdaygroff).toISOString().slice(0, 10)}-${new Date(lastdaygroff).toISOString().slice(8,10)}.pdf`) + +# build menus! +menu: rem pdf + +# shopping list +shopping: + #!/usr/bin/env sh + begin=$(gdate -d'next sun') + end=$(gdate -d'next sun +7 days') + recsel db/menu.rec -e "date >> '$begin'" \ + | recsel -e "date << '$end'" -P breakfast,lunch,dinner -C \ + | sort \ + | uniq \ + | xargs -I % recsel db/recipes.rec \ + -t meal \ + -j recipe \ + -e "name = '%'" \ + -G name \ + -P recipe_ingredient \ + | sort