From bd069cc2758b74548ae66b8953a62ccaf43f370d Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Thu, 9 Jul 2026 03:10:40 -0500 Subject: [PATCH] docs(knowledge): reorganize knowledge base and add new guides Restructure the knowledge/ directory by sorting guides into domain-specific subdirectories to improve vault organization and scannability: - devenv/: environments and shell configurations - dsa/: data structures and algorithms (hashmaps) - python/: language features (enumerate, zip) - tools/: containerization and utilities (docker, tmux) - skills/: backend competencies (auth, sql, testing, and new pydantic guide) Update relative links in SKILLS.md and knowledge guides to track unpacking and, track Obsidian vault configurations. --- .gitignore | 3 +- .obsidian/app.json | 3 + .obsidian/appearance.json | 1 + .obsidian/core-plugins.json | 33 +++++ SKILLS.md | 12 +- knowledge/{ => devenv}/devShell.md | 0 knowledge/{ => devenv}/environments.md | 0 knowledge/{ => dsa}/hashmap.md | 2 +- knowledge/parking-lot.md | 3 +- knowledge/{ => python}/enumerate.md | 9 -- knowledge/python/zip.md | 181 ++++++++++++++++++++++++ knowledge/{ => skills}/auth.md | 0 knowledge/{ => skills}/notes-to-docs.md | 0 knowledge/skills/pydantic.md | 39 +++++ knowledge/{ => skills}/sql.md | 0 knowledge/{ => skills}/testing.md | 0 knowledge/{ => tools}/docker.md | 0 knowledge/{ => tools}/tmux.md | 0 18 files changed, 268 insertions(+), 18 deletions(-) create mode 100644 .obsidian/app.json create mode 100644 .obsidian/appearance.json create mode 100644 .obsidian/core-plugins.json rename knowledge/{ => devenv}/devShell.md (100%) rename knowledge/{ => devenv}/environments.md (100%) rename knowledge/{ => dsa}/hashmap.md (99%) rename knowledge/{ => python}/enumerate.md (99%) create mode 100644 knowledge/python/zip.md rename knowledge/{ => skills}/auth.md (100%) rename knowledge/{ => skills}/notes-to-docs.md (100%) create mode 100644 knowledge/skills/pydantic.md rename knowledge/{ => skills}/sql.md (100%) rename knowledge/{ => skills}/testing.md (100%) rename knowledge/{ => tools}/docker.md (100%) rename knowledge/{ => tools}/tmux.md (100%) diff --git a/.gitignore b/.gitignore index 88c17a4..3ab23ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.envrc .agents/ .obsidian/workspace.json -.obsidian/ +.venv/ diff --git a/.obsidian/app.json b/.obsidian/app.json new file mode 100644 index 0000000..6abe4c1 --- /dev/null +++ b/.obsidian/app.json @@ -0,0 +1,3 @@ +{ + "alwaysUpdateLinks": true +} \ No newline at end of file diff --git a/.obsidian/appearance.json b/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.obsidian/core-plugins.json b/.obsidian/core-plugins.json new file mode 100644 index 0000000..639b90d --- /dev/null +++ b/.obsidian/core-plugins.json @@ -0,0 +1,33 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "footnotes": false, + "properties": true, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "bases": true, + "webviewer": false +} \ No newline at end of file diff --git a/SKILLS.md b/SKILLS.md index d65340f..a334467 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -4,13 +4,13 @@ Use this matrix to track your confidence and interview readiness for key backend | Skill | Confidence | Interview Ready | Linked Notes | | :--- | :---: | :---: | :--- | -| **Python** | 3/5 | 🟨 | [[knowledge/testing]] | +| **Python** | 3/5 | 🟨 | [[testing]] | | **Git & GitHub** | 4/5 | 🟩 | - | -| **FastAPI** | 2/5 | πŸŸ₯ | [[knowledge/auth]] | -| **SQL & PostgreSQL** | 2/5 | πŸŸ₯ | [[knowledge/sql]] | -| **Docker & Compose** | 2/5 | πŸŸ₯ | [[knowledge/docker]] | -| **Testing (pytest)** | 1/5 | πŸŸ₯ | [[knowledge/testing]] | -| **JWT & RBAC** | 1/5 | πŸŸ₯ | [[knowledge/auth]] | +| **FastAPI** | 2/5 | πŸŸ₯ | [[auth]] | +| **SQL & PostgreSQL** | 2/5 | πŸŸ₯ | [[sql]] | +| **Docker & Compose** | 2/5 | πŸŸ₯ | [[docker]] | +| **Testing (pytest)** | 1/5 | πŸŸ₯ | [[testing]] | +| **JWT & RBAC** | 1/5 | πŸŸ₯ | [[auth]] | *Status Legend:* - πŸŸ₯ Not Ready (Cannot explain under interview pressure) diff --git a/knowledge/devShell.md b/knowledge/devenv/devShell.md similarity index 100% rename from knowledge/devShell.md rename to knowledge/devenv/devShell.md diff --git a/knowledge/environments.md b/knowledge/devenv/environments.md similarity index 100% rename from knowledge/environments.md rename to knowledge/devenv/environments.md diff --git a/knowledge/hashmap.md b/knowledge/dsa/hashmap.md similarity index 99% rename from knowledge/hashmap.md rename to knowledge/dsa/hashmap.md index 32a48f7..51a4308 100644 --- a/knowledge/hashmap.md +++ b/knowledge/dsa/hashmap.md @@ -185,7 +185,7 @@ for fruit, quantity in inventory.items(): # Today we have 8 oranges ``` -When looping through a sequence, the position index and corresponding value can be retrieved at the same time using the [`enumerate()`](./enumerate) function. +When looping through a sequence, the position index and corresponding value can be retrieved at the same time using the [`enumerate()`](../python/enumerate.md) function. ```python for i, (fruit, quantity) in enumerate(inventory.items(), start=1): diff --git a/knowledge/parking-lot.md b/knowledge/parking-lot.md index 960963f..fad822e 100644 --- a/knowledge/parking-lot.md +++ b/knowledge/parking-lot.md @@ -9,4 +9,5 @@ Topics worth studying after they become relevant. - [ ] Robin Hood hashing - [ ] Skip Lists - +## Python Features +- [ ] Sequence and Dictionary unpacking (`*`, `**`) \ No newline at end of file diff --git a/knowledge/enumerate.md b/knowledge/python/enumerate.md similarity index 99% rename from knowledge/enumerate.md rename to knowledge/python/enumerate.md index 12c21aa..38121dd 100644 --- a/knowledge/enumerate.md +++ b/knowledge/python/enumerate.md @@ -4,8 +4,6 @@ If you spend enough time writing Python, you will eventually find yourself needi Imagine you are building a simple command-line application and you want to print a numbered menu of options: -Python - ```python fruits = ["apple", "banana", "orange"] ``` @@ -118,8 +116,6 @@ If the answer is yes, `enumerate` is usually the right choice. Here are a few co Displaying human-readable lists to users. - - ```Python for number, option in enumerate(menu, start=1): print(f"Press {number} for {option}") @@ -129,7 +125,6 @@ for number, option in enumerate(menu, start=1): Searching for a specific element and returning its index. - ```Python for index, user in enumerate(users): if user.id == target_id: @@ -140,8 +135,6 @@ for index, user in enumerate(users): When you need to modify the original list based on the items currently inside it. - - ```Python for i, value in enumerate(numbers): numbers[i] = value * 2 @@ -162,8 +155,6 @@ Imagine someone walking beside your list carrying a mechanical tally clicker. Ev 3. You receive both together. - - ```Plaintext apple ← the item 0 ← the click diff --git a/knowledge/python/zip.md b/knowledge/python/zip.md new file mode 100644 index 0000000..4e2a907 --- /dev/null +++ b/knowledge/python/zip.md @@ -0,0 +1,181 @@ +# Quick Guide to Python's `zip()` +If you spend enough time writing Python, you will eventually find yourself needing to loop over two or more related lists at the same time. + +Imagine you are processing user data and have two separate listsβ€”one for names and one for test scores: + +```python +names = ["Luisa", "Nathalia", "Daniela", "Elizabeth", "Camila", "Jennifer"] +scores = [90, 72, 92, 82, 84, 40] +``` + +You want the output to match them up logically: + +```text +Luisa scored 90 +Nathalia scored 72 +Daniela scored 92 +... +``` + +Naturally, the first question is: *"How do I pull items from both lists simultaneously?"* + +## The First Solution Most People Write +If you are coming from a language like C, C++ or Java, your instinct is to use an index to keep track of your position, then ask both lists for the item at that position: + +```python +for i in range(len(names)): + print(f"{names[i]} scored {scores[i]}") +``` + +This works, and it's logically correct. However, it introduces unnecessary complexity. You are forcing yourself to manage the mechanics of an index `i` that you do not actually care about. The index is merely a middleman to get the data you want. Furthermore, if `names` and `scores` happen to be of unequal lengths, this approach risks throwing an `IndexError`. + +What if Python could weave these lists together for you? + +## Introducing `zip()` + +Python provides the built-in function `zip()` exactly for this scenario. Instead of managing an index, you hand the lists directly to `zip()`, which pairs them up. + +If we convert the iterator to a list to peek inside, we obtain: + +```python +list(zip(names, scores)) +# [('Luisa', 90), ('Nathalia', 72), ('Daniela', 92), ('Elizabeth', 82), ('Camila', 84), ('Jennifer', 40)] +``` + +This reinforces the idea that `zip()` is lazyβ€”it returns an iterator, which we must cast to a list to view all at once. + +If we loop over the `zip()` iterator directly, we see that every iteration yields a paired tuple: + +```python +for pair in zip(names, scores): + print(pair) +``` + +Output: +```text +('Luisa', 90) +('Nathalia', 72) +('Daniela', 92) +... +``` + +## The Role of Tuple Unpacking + +Only after seeing that `zip()` yields tuples does it become clear how we can use **tuple unpacking** to clean up the loop. Python can split the tuple directly in the loop header: + +```python +for name, score in zip(names, scores): + print(f"{name} scored {score}") +``` + +Every time the loop spins, Python instantly splits the yielded tuple into the individual variables you defined: + +```txt +('Luisa', 90) + ↓ +name = "Luisa" +score = 90 +``` + +This completely removes the need for an index variable or bracket notation like `names[i]`. You are interacting directly with the data elements themselves. + +## The Magic of Unzipping with `*` (Iterable unpacking) +One question beginners often have is how to reverse the operation. + +Suppose you have a list of paired records from a database query, and you need to split them back into two separate lists: + +```python +records = [("Luisa", 85), ("Nathalia", 92), ("Angie", 78)] +``` + +You can use `zip()` in conjunction with the unpacking operator `*` to pull them apart: + +```python +names, scores = zip(*records) + +print(names) +# ('Luisa', 'Nathalia', 'Angie') +print(scores) +# (85, 92, 78) +``` + +**How does this work?** The `*` operator (unpacking operator) unpacks the `records` iterable into separate positional arguments before `zip()` executes. If you're coming from JavaScript, you'll notice the resemblance to the spread operator (`...`): they take a collection of items and "blast them out" into their individual elements. + +```python +numbers = [2, 5, 1] +print(numbers) +# [2, 5, 1] +print(*numbers) +# 2 5 1 +``` + +Writing `zip(*records)` is exactly equivalent to writing: + +```python +zip(records[0], records[1], records[2]) + +# which means: +zip(("Luisa", 85), ("Nathalia", 92), ("Angie", 78)) +``` + +`zip()` takes the first item from every tuple (`"Luisa"`, `"Nathalia"`, `"Angie"`), and groups them. Then it takes the second item from every tuple (`85`, `92`, `78`) and groups them. The result is two separate tuples. + +## When should I use it? +To decide whether `zip()` is the right tool, ask yourself: + +> ***Do I need to process multiple sequences in parallel?*** + +If the answer is yes, `zip()` is the correct choice. Here a few common scenarios: + +**1. Creating Dictionaries:** +Fusing two lists into a key-value mapping. This avoids manual iteration entirely. +```python +keys = ["username", "email", "role"] +values = ["kiskaadee", "admin@system.local", "superadmin"] + +user_profile = dict(zip(keys, values)) +``` + +**2. Multi-Variable Calculation**: +Calculating results from corresponding elements in multiple data sets. +```python +prices = [10.00, 15.00, 20.00] +quantities = [2, 1, 4] + +total_cost = sum(price * qty for price, qty in zip(prices, quantities)) +``` + +**3. Transposing Matrices**: +Pivoting rows into columns (or vice versa) in a 2D grid. +```python +matrix = [ + [1, 2, 3], + [4, 5, 6] +] + +transposed = list(zip(*matrix)) +``` + +## The Mental Picture +To fully grasp `zip()`, visualize a literal zipper on a jacket. +1. One sequence represents the teeth on the left +2. The other sequence represents the teeth on the right +3. As you pull the slider down, it locks the corresponding left and right teeth together into a single unit. + +Like `enumerate()`, `zip()` is lazy. It does not construct a massive list of tuples in memory all at once. It yields one pair at a time, making it highly efficient for processing massive files or data streams. + +## The Shortest-Length Trade-Off +A real jacket zipper stops working if one side is missing teeth. Python's `zip()` behaves similarly: it stops as soon as the *shortest* iterable is exhausted. Any remaining items in the longer list are silently ignored. + +If losing data silently is a risk for your application, you have two options to manage this trade-off: +- Use `zip(a, b, strict=True)` (Python 3.10+), which intentionally throws an error if the lists are different lengths. +- Use `itertools.zip_longest()`, which pads the missing spaces with `None` (or a filler value) instead of truncating. + +## One Principle to Remember +You do not need to memorize edge cases to start using this tool. Rely on this heuristic: + +Whenever you find yourself writing `[i]` multiple times inside a loop to access elements from different lists, pause and ask yourself: + +> ***"Am I trying to move through these lists at the same time?"*** + +If the answer is yes, consider using `zip()`. diff --git a/knowledge/auth.md b/knowledge/skills/auth.md similarity index 100% rename from knowledge/auth.md rename to knowledge/skills/auth.md diff --git a/knowledge/notes-to-docs.md b/knowledge/skills/notes-to-docs.md similarity index 100% rename from knowledge/notes-to-docs.md rename to knowledge/skills/notes-to-docs.md diff --git a/knowledge/skills/pydantic.md b/knowledge/skills/pydantic.md new file mode 100644 index 0000000..4dd5c15 --- /dev/null +++ b/knowledge/skills/pydantic.md @@ -0,0 +1,39 @@ +# Introduction to Pydantic +Notes during my Pydantic documentation review; +## Why does Pydantic exist? + +↓ + +## What problem does it solve? + +↓ + +## What is a BaseModel? + +↓ + +## How does validation work? + +↓ + +## How does FastAPI use Pydantic? + +↓ + +## Input models vs output models + +↓ + +## Field validation + +↓ + +## Custom validators + +↓ + +## Serialization + +↓ + +## Configuration diff --git a/knowledge/sql.md b/knowledge/skills/sql.md similarity index 100% rename from knowledge/sql.md rename to knowledge/skills/sql.md diff --git a/knowledge/testing.md b/knowledge/skills/testing.md similarity index 100% rename from knowledge/testing.md rename to knowledge/skills/testing.md diff --git a/knowledge/docker.md b/knowledge/tools/docker.md similarity index 100% rename from knowledge/docker.md rename to knowledge/tools/docker.md diff --git a/knowledge/tmux.md b/knowledge/tools/tmux.md similarity index 100% rename from knowledge/tmux.md rename to knowledge/tools/tmux.md