Skip to content

Commit

Permalink
docs(end): end 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
shane0 committed Dec 20, 2024
1 parent b077820 commit f0e7fbd
Show file tree
Hide file tree
Showing 11 changed files with 293 additions and 21 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 6 additions & 6 deletions .placeholder
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

# found issue browser is 404 on versions.json updated discussion
# started tshooting docs to clarify confusions
git push origin 2022
git push origin 2023
git push origin 2024
git push origin main
git push origin gh-pages
mike deploy --push --update-aliases 2024 latest
# git push origin 2022
# git push origin 2023
# git push origin 2024
# git push origin main
# git push origin gh-pages
# mike deploy --push --update-aliases 2024 latest
118 changes: 104 additions & 14 deletions cli.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,71 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Console script for click"""
import os
# cli.py
"""shane null command line workflows"""
import click
import os
import logging
import inspect
import sys
import shutil
import datetime
# import inspect
# import sys
# import shutil
import sys

import sys



plugin_folder = os.path.join(os.path.dirname(__file__), "plugins")
homedir = os.path.expanduser("~")

TODAY = datetime.date.today().strftime("%Y-%m-%d")
ISODATE = datetime.date.today().strftime("%Y-%m-%d")
ISOFILE = ISODATE + ".md"
BUJO_FOLDER = os.path.join(os.path.dirname(__file__), "docs/bujo/")
BUJO_FOLDER = os.path.join(os.path.dirname(__file__), "docs/bujo")
MONTH = datetime.date.today().strftime("%m_%B")
WEEK = datetime.date.today().strftime("%U")
DAYFILE = BUJO_FOLDER + "/" + TODAY + ".md"
WEEKFILE = BUJO_FOLDER + "/" + WEEK + ".md"
MONTHFILE = BUJO_FOLDER + "/" + MONTH + ".md"
MONTHFILE = BUJO_FOLDER + "/" + MONTH + ".md"
YEAR = datetime.date.today().strftime("%Y")


# Set up the logger
from plugins.mods.log_tools import setup_logger
# logger = setup_logger('cli_logger', logging.DEBUG)
logger = setup_logger(logging.DEBUG)


# logger = setup_logger('cli_logger', logging.DEBUG)

# # Example usage of logging
# def main():
# logger.debug('This is a debug message from the CLI.')
# logger.info('This is an info message from the CLI.')
# logger.warning('This is a warning message from the CLI.')
# logger.error('This is an error message from the CLI.')
# logger.critical('This is a critical message from the CLI.')

# if __name__ == "__main__":
# main()


# Define the log file path in the plugins/ directory
# log_directory = "plugins/logs"
# os.makedirs(log_directory, exist_ok=True) # Create the 'logs' directory if it doesn't exist
# log_file = os.path.join(log_directory, "cli_commands.log")

# # Set up the logger to log to a file
# logging.basicConfig(
# level=logging.INFO, # Adjust level as needed (DEBUG, INFO, WARNING, etc.)
# format="%(asctime)s - %(levelname)s - %(message)s", # Customize log format
# handlers=[
# logging.FileHandler(log_file, mode='a'), # Append to log file instead of overwriting
# logging.StreamHandler() # Also print logs to the console
# ]
# )
# logger = logging.getLogger(__name__)


class PluginCLI(click.MultiCommand):
def list_commands(self, ctx):
"""Dynamically get the list of commands."""
Expand All @@ -37,18 +80,65 @@ def get_command(self, ctx, name):
"""Dynamically get the command."""
ns = {}
fn = os.path.join(plugin_folder, name + ".py")
with open(fn) as f:
code = compile(f.read(), fn, "exec")
eval(code, ns, ns)
return ns["cli"]
try:
with open(fn) as f:
code = compile(f.read(), fn, "exec")
eval(code, ns, ns)
logger.info(f"cli.py {name} loaded successfully.") # Log successful command loading
except Exception as e:
logger.error(f"Error loading cli.py {name}: {e}")

# Return the dynamically loaded command
command = ns.get("cli")
if command:
if len(sys.argv) > 1:
logger.info(f"cli.py {sys.argv[1]}")
if len(sys.argv) > 2:
logger.info(f"cli.py {sys.argv[1]} {sys.argv[1]}")
logger.info(f"Loading command: {name}") # Log the command being loaded
# Access before_invoke directly
# logger.info(f"cli.py '{ctx.command.name}' executed with arguments: {ctx.args}")
return command
# return command

# fix me this does not log the 2nd argument
# 2024-12-09 18:13:46,469 - INFO - Starting the CLI application...
# 2024-12-09 18:13:46,470 - INFO - Loading command: bujo
# 2024-12-09 18:13:46,475 - INFO - Command bujo loaded successfully.
# 2024-12-09 18:13:46,475 - INFO - Command 'cli' executed with arguments: []
import pdb

def before_invoke(self, ctx):
if len(sys.argv) > 1:
logger.info(f"cli.py {sys.argv[1]}")
if len(sys.argv) > 2:
logger.info(f"cli.py {sys.argv[1]} {sys.argv[1]}")
logger.info(f"Loading command: {name}") # Log the command being loaded
click.echo(f"Arguments: {ctx.args}")

# def before_invoke(self, ctx):
# print(f"Arguments: {ctx.args}")
# logger.info(f"Command '{ctx.command.name}' executed with arguments: {ctx.args}")
# def before_invoke(self, ctx):
# pdb.set_trace() # Set a breakpoint here
# args = ctx.args
# logger.info(f"Command '{ctx.command.name}' executed with arguments: {args}")
# def before_invoke(self, ctx):
# args = ctx.params.values()
# logger.info(f"Command '{ctx.command.name}' executed with arguments: {args}")

# def before_invoke(self, ctx):
# args = ctx.args
# if len(args) >= 2:
# command = args[0]
# argument = args[1]
# logger.info(f"Executing command '{command}' with argument '{argument}'")

@click.command(cls=PluginCLI)
def cli():
"""2022 Shane Null Workflows"""
# click.echo(dir(PluginCLI))
pass


if __name__ == "__main__":

cli()
50 changes: 50 additions & 0 deletions docs/bujo/12_December.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 12 Dec

- reflecting on 2024 great year
- level 2 is done!
- starting level 3
- starting a new clean branch for notes

## choose samsara or the path?

<iframe width="1145" height="644" src="https://www.youtube.com/embed/KFjC1yG1N5Q?list=PLGY2UhH7nNtLUtjap8EvMUU9ohIHU3f6x" title="Buddhism vs. The World" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

## six dusts

In Buddhism, guarding the six sense doors is a practice of mindfulness and restraint to prevent unwholesome mental states from arising. This is called **sense restraint** (*indriya-saṃvara* in Pali). The "guards" for the six sense doors are mindfulness, wisdom, and discernment, which help one maintain control over the sensory experiences. Here’s how this works for each sense base:

### 1. **Mindfulness (Sati)**

- **Purpose:** To be fully aware of sensory experiences as they arise.
- **How:** Mindfulness helps you notice the moment a sense object (e.g., a sight, sound, or thought) arises and prevents automatic, unwholesome reactions like craving or aversion.

### 2. **Wisdom (Paññā)**

- **Purpose:** To discern the impermanent, unsatisfactory, and non-self nature of sensory experiences.
- **How:** Wisdom provides insight into the true nature of phenomena, helping to reduce attachment or aversion to them.

### 3. **Guarding the Eye (Cakkhu)**

- Being mindful of what is seen, avoiding unwholesome sights or reactions (e.g., lust, envy).

### 4. **Guarding the Ear (Sota)**

- Being mindful of what is heard, avoiding unwholesome sounds or reactions (e.g., gossip, anger).

### 5. **Guarding the Nose (Ghana)**

- Being mindful of smells, avoiding clinging to pleasant scents or aversion to unpleasant ones.

### 6. **Guarding the Tongue (Jivha)**

- Being mindful of tastes, avoiding overindulgence or aversion.

### 7. **Guarding the Body (Kaya)**

- Being mindful of physical sensations, recognizing the arising of pleasure, pain, or neutrality without clinging or aversion.

### 8. **Guarding the Mind (Mano)**

- Being vigilant about thoughts, avoiding unwholesome mental proliferations (e.g., greed, hatred, delusion).

By practicing sense restraint, one prevents the mind from becoming overwhelmed by desires, aversions, or distractions, which is essential for cultivating inner peace and progressing on the path to enlightenment.
2 changes: 2 additions & 0 deletions docs/evening_ritual.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ end

<iframe width="1159" height="652" src="https://www.youtube.com/embed/XVC9bRDniOk" title="Partita No. 2 in D Minor Bwv 1004: Ciaccona" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<iframe width="1145" height="644" src="https://www.youtube.com/embed/9RuZ3_55vKc" title="Death Of Your Personality" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<iframe width="1159" height="652" src="https://www.youtube.com/embed/5SBrCdRTX8o" title="Maranasati: Buddhist Reflections on Death" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<iframe width="1043" height="652" src="https://www.youtube.com/embed/aaNq1DenFh8" title="0303n4b1 The Five Recollections \ \ Thanissaro Bhikkhu \ \ Dhamma Talks" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
Expand Down
Binary file added docs/images/IMG_0010.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/maranasati.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ tags:

![ramen](images/ramen.jpeg)

<iframe width="1145" height="644" src="https://www.youtube.com/embed/KFjC1yG1N5Q?list=PLGY2UhH7nNtLUtjap8EvMUU9ohIHU3f6x" title="Buddhism vs. The World" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<iframe width="1132" height="637" src="https://www.youtube.com/embed/9RuZ3_55vKc" title="Death Of Your Personality" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

<iframe width="1145" height="644" src="https://www.youtube.com/embed/9RuZ3_55vKc" title="Death Of Your Personality" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

- the goal is to always be prepared for the possibility of unpredictable death or similar radical transformations and let go of denial or deep ptsd
- [what it means to transcend life and death](https://www.ctworld.org.tw/Buddhist%20e-Books/CTM/CTM064GM/index.html)
- [sutra on impermanence](https://www.ctworld.org.tw/Buddhist%20e-Books/Books05/index.html)
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ plugins:
extra:
version:
provider: mike
default: latest
default: 2025
social:
- icon: "fontawesome/brands/wordpress-simple"
link: "https://shanenull.com/"
Expand Down
62 changes: 62 additions & 0 deletions plugins/logs/cli_logs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
timestamp,level,module,message
2024-12-14T10:47 - INFO - cli.py buddhism loaded successfully.
2024-12-14T10:47 - INFO - cli.py buddhism loaded successfully.
2024-12-14T10:47 - INFO - cli.py bujo loaded successfully.
2024-12-14T10:47 - INFO - cli.py bujo loaded successfully.
2024-12-14T10:47 - INFO - cli.py h loaded successfully.
2024-12-14T10:47 - INFO - cli.py h loaded successfully.
2024-12-14T10:47 - INFO - cli.py i loaded successfully.
2024-12-14T10:47 - INFO - cli.py i loaded successfully.
2024-12-14T10:47 - INFO - cli.py m loaded successfully.
2024-12-14T10:47 - INFO - cli.py m loaded successfully.
2024-12-14T10:47 - INFO - cli.py s loaded successfully.
2024-12-14T10:47 - INFO - cli.py s loaded successfully.
2024-12-14T10:47 - INFO - cli.py s loaded successfully.
2024-12-14T10:47 - INFO - cli.py s
2024-12-14T10:47 - INFO - Loading command: s
2024-12-14T10:47 - INFO - cli.py s loaded successfully.
2024-12-14T10:47 - INFO - cli.py s
2024-12-14T10:47 - INFO - cli.py s s
2024-12-14T10:47 - INFO - Loading command: s
2024-12-19T17:33 - INFO - cli.py bujo loaded successfully.
2024-12-19T17:33 - INFO - cli.py bujo loaded successfully.
2024-12-19T17:33 - INFO - cli.py bujo
2024-12-19T17:33 - INFO - cli.py bujo
2024-12-19T17:33 - INFO - cli.py bujo bujo
2024-12-19T17:33 - INFO - cli.py bujo bujo
2024-12-19T17:33 - INFO - Loading command: bujo
2024-12-19T17:33 - INFO - Loading command: bujo
2024-12-19T18:04 - INFO - cli.py buddhism loaded successfully.
2024-12-19T18:04 - INFO - cli.py buddhism loaded successfully.
2024-12-19T18:04 - INFO - cli.py bujo loaded successfully.
2024-12-19T18:04 - INFO - cli.py bujo loaded successfully.
2024-12-19T18:04 - INFO - cli.py h loaded successfully.
2024-12-19T18:04 - INFO - cli.py h loaded successfully.
2024-12-19T18:04 - INFO - cli.py i loaded successfully.
2024-12-19T18:04 - INFO - cli.py i loaded successfully.
2024-12-19T18:04 - INFO - cli.py m loaded successfully.
2024-12-19T18:04 - INFO - cli.py m loaded successfully.
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py h loaded successfully.
2024-12-19T18:04 - INFO - cli.py h
2024-12-19T18:04 - INFO - Loading command: h
2024-12-19T18:04 - INFO - cli.py buddhism loaded successfully.
2024-12-19T18:04 - INFO - cli.py buddhism loaded successfully.
2024-12-19T18:04 - INFO - cli.py bujo loaded successfully.
2024-12-19T18:04 - INFO - cli.py bujo loaded successfully.
2024-12-19T18:04 - INFO - cli.py h loaded successfully.
2024-12-19T18:04 - INFO - cli.py h loaded successfully.
2024-12-19T18:04 - INFO - cli.py i loaded successfully.
2024-12-19T18:04 - INFO - cli.py i loaded successfully.
2024-12-19T18:04 - INFO - cli.py m loaded successfully.
2024-12-19T18:04 - INFO - cli.py m loaded successfully.
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py s
2024-12-19T18:04 - INFO - Loading command: s
2024-12-19T18:04 - INFO - cli.py s loaded successfully.
2024-12-19T18:04 - INFO - cli.py s
2024-12-19T18:04 - INFO - cli.py s s
2024-12-19T18:04 - INFO - Loading command: s
50 changes: 50 additions & 0 deletions plugins/mods/log_tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# plugins/mods/log_tools.py
# plugins/mods/log_tools.py
import os
import logging
import csv
from datetime import datetime

# Ensure the log directory exists
log_dir = 'plugins/logs'
if not os.path.exists(log_dir):
os.makedirs(log_dir)

# Path to the log file
log_file = os.path.join(log_dir, 'cli_logs.csv')

# Set up logging
def setup_logger(level=logging.DEBUG):
"""
Set up a logger that logs to a CSV file.
Uses the module's name dynamically for the logger name.
"""
# Get the name of the current module (i.e., the script that is calling this function)
module_name = __name__.split('.')[-1] # This gives just the module name, not the full path
logger = logging.getLogger(module_name)
logger.setLevel(level)

# Create a formatter with ISO format for date and time
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%dT%H:%M')

# File handler to write logs to a CSV file
file_handler = logging.FileHandler(log_file)
file_handler.setFormatter(formatter)

# Add the file handler to the logger
logger.addHandler(file_handler)

# Ensure the CSV header is written if the file is empty
if os.stat(log_file).st_size == 0:
with open(log_file, 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(['timestamp', 'level', 'module', 'message'])

return logger

# Log to CSV function (write directly to CSV format)
def log_to_csv(level, module, message):
with open(log_file, 'a', newline='') as csvfile:
writer = csv.writer(csvfile)
timestamp = datetime.now().strftime('%Y-%m-%dT%H:%M')
writer.writerow([timestamp, level, module, message])
12 changes: 12 additions & 0 deletions utils/experiments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// https://learn.nucamp.co/mod/page/view.php?id=5548
// https://eloquentjavascript.net/3rd_edition/03_functions.html#h_XqQR5FlX+8
let x = 10;
if (true) {
let y = 20;
var z = 30;
console.log(x + y + z);
// → 60
}
// y is not visible here
console.log(x + z);
// →

0 comments on commit f0e7fbd

Please sign in to comment.