My Dev Log
Table of Contents
About
Source Repo -> https://github.com/utsavdarlami/dlog
log to track my dev journey
print("hello world")
hello world
2024
2024-10 October
2024-10-10 Thursday
- 08:17 AM
- writing my own pre-commit hook
I created a pre-commit hook that automatically exports my journal Org file to HTML whenever I make a new commit to this dev journal repo. Previously, I often forgot to perform this export manually, which is what you are currently reading.
Purpose of the Hook:
- The pre-commit hook ensures that the latest changes in log.org are reflected in an HTML file, eliminating the manual process.
Here is simple script that i needed to run every time a new changes was about to be committed
# Run the org to HTML conversion command emacsclient -e '(progn (find-file "log.org") (org-html-export-to-html) (bury-buffer))'
This sounds like pre-commit hook right? So i ended up setting my own pre-commit hook following the resources
- https://www.youtube.com/watch?v=ObksvAZyWdo
- https://medium.com/@shimo164/custom-python-shell-script-for-pre-commit-700f464bfd63
I am using pre-commit to set up the follow, which might have been a overkill. You can also modify the
hooks
provided inside the.git/hooks
. Above resources covers it.Setting up
.pre-commit-config.yaml
to run the hook scriptrepos: - repo: local hooks: - id: org-to-html name: Org File To HTML description: This hook converts org file to html entry: org_to_html.sh language: script files: 'log.org'
Here the
entry
points to the main script that we want to run when we make the commit. More on here https://pre-commit.com/#new-hooksLets look at the final hook script
# org_to_html.sh #!/bin/bash # Get the list of modified files in the commit modified_files=$(git diff --cached --name-only) # Check if log.org is modified and index.html is NOT modified if echo "$modified_files" | grep -q "log.org" && ! echo "$modified_files" | grep -q "index.html"; then echo "Running org to HTML export for log.org..." # Run the org to HTML conversion command emacsclient -e '(progn (find-file "log.org") (org-html-export-to-html) (bury-buffer))' else echo "Skipping org to HTML export. Either log.org is not modified or index.html is modified." fi
Complete Code
- writing my own pre-commit hook
2024-08 August
2024-08-03 Saturday
- 07:24 PM - Log:
how to set a type-hint for sub-classes in python
my use-case
from typing import Dict, Type class Operator: @abstractmethod def operate(): raise NotImplementedError class Add(Operator): def operate(): return + class Minus(Operator): def operate(): return - # Dictionary \w the Operator's child as value operator_factory: Dict[str, Type[Operator]] = { "add": Add, "minus": Minus }
2024-07 July
2024-07-06 Saturday
- 09:42 AM - Log:
Faced an
JsonDecodingError
error while trying to convert llm reponse to json object in python.Decoding JSON String When There are Single Quotes:
- 09:50 AM - Log:
why use
functools.wraps
?functools.wrap
ensures that the decorated function retains the original function’s signature, documentation, and other attributes.
2024-06 June
2024-06-28 Friday
- 09:48 PM - Log:
trying to have reverse datetree for this dev-log (feedback from ashish subedi)
- Latest log at top instead in bottom
This should be handled in the org-mode capture itself. Found one packages that does it
2024-06-26 Wednesday
- 11:03 AM - Log:
Running gunicorn to support
n
workers andy
thread, and Why?- Increasing the server's throughput
- https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
2024-06-24 Monday
- 05:11 PM - Log:
- you can only cook what's in the fridge // reasons to read
Book reco from above
- 1984 by George Orwell: https://www.thriftbooks.com/w/ninetee…
- Cycling Home From Siberia: https://www.thriftbooks.com/w/cycling…
- Wind, Sand, and Stars by Antoine de St. Exupery: https://www.thriftbooks.com/w/wind-sa…
- Flight to Arras by Antoine de St. Exupery: https://www.thriftbooks.com/w/pilote-…
- The Little Prince by Antoine de St. Exupery: https://www.thriftbooks.com/w/the-lit…
- The Complete Tales of Winnie the Pooh by A.A. Milne: https://www.thriftbooks.com/w/the-com…
These links are to new copies:
- Steal Like An Artist by Austin Kleon: https://austinkleon.com/steal/
- Keep Going by Austin Kleon: https://austinkleon.com/keepgoing/
- Show Your Work by Austin Kleon: https://austinkleon.com/show-your-work/
- you can only cook what's in the fridge // reasons to read
2024-06-22 Saturday
- 10:01 PM - Log:
Was thinking about writing my own editor. Why you ask?
- A fun and challenging project to work on
I could write it down in python with help of blogs and videos. But i also want to learn new language so maybe i can try in rust.
Found this good blogs on writing your or TUI based editor in C.
And of course everything that is in C has a version in rust.
- https://www.flenker.blog/hecto/ [this is what i am planning to follow]
Both seem to be great work.