<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ahmed K. on Medium]]></title>
        <description><![CDATA[Stories by Ahmed K. on Medium]]></description>
        <link>https://medium.com/@0xahmedkhan?source=rss-18b667a70e35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rRvtAAqU2F2YVQFp5ar3nA.jpeg</url>
            <title>Stories by Ahmed K. on Medium</title>
            <link>https://medium.com/@0xahmedkhan?source=rss-18b667a70e35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 22:15:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xahmedkhan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The RAG Architecture Blueprint: How to Build an Expert LLM and Give it a Perfect Memory]]></title>
            <link>https://0xahmedkhan.medium.com/the-rag-architecture-blueprint-how-to-build-an-expert-llm-and-give-it-a-perfect-memory-e74f003fdfb9?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/e74f003fdfb9</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[llama-3]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Thu, 23 Oct 2025 06:29:11 GMT</pubDate>
            <atom:updated>2025-10-23T06:59:03.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sr0CUnwIfoCxnoql" /><figcaption>Photo by <a href="https://unsplash.com/@steve_j?utm_source=medium&amp;utm_medium=referral">Steve Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You ask ChatGPT about that obscure research paper you read last month. It gives you a confident answer that sounds right but is completely made up.</p><p>The problem isn’t that these models are dumb. They’re incredibly smart. The problem is they have amnesia about YOUR world.</p><p>This is where RAG comes in. Retrieval Augmented Generation. yeah fancy name for a simple idea: give your AI a perfect memory of everything that matters to you, and teach it to remember exactly the right thing at exactly the right time.</p><p>Let me show you how this actually works by building something real: a personal research assistant that actually knows what you know.</p><h3>The Problem With Smart People Who Remember Nothing</h3><p>Imagine hiring a brilliant research assistant. PhD level intelligence. Can synthesize complex ideas, write beautifully, connect dots across disciplines. There’s just one catch: every morning, they forget everything from the day before.</p><p>You’d spend your entire life re-explaining things. “Remember that paper about sleep and memory consolidation?” Blank stare. “The one I showed you yesterday?” Still nothing. “With the graphs about REM cycles?” Nope.</p><p>This is what using a base LLM feels like. TinyLlama, GPT, Claude, whatever. They’re trained on the entire internet but know nothing about YOUR specific research, YOUR notes, YOUR carefully curated collection of papers and articles.</p><p>Fine-tuning them on your data? Expensive, slow, and every time you learn something new, you need to retrain. It’s like performing brain surgery every time you want to share a new article. :)</p><p>RAG is different. RAG is like giving your AI assistant a perfect filing system and teaching them exactly how to use it.</p><h3>How RAG Actually Works</h3><p>Let me walk you through the architecture of a RAG system by showing you what happens behind the scenes. We’re building this with open-source tools, so you could actually build this yourself if you wanted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*h-f0kjFS4fGQU58qIqnNew.gif" /><figcaption>arch diagram</figcaption></figure><h3>Flow 1: When You Ask a Question</h3><p>Picture this. You’re three months into your research on neuroplasticity. You’ve read 50 papers, highlighted sections, saved articles, and scribbled notes. Now you want to ask: “What’s the relationship between exercise and neurogenesis in adults?”</p><p>Here’s what happens in the next few seconds:</p><p><strong>Step 1: Your question hits the Query Router</strong></p><p>This is just an API endpoint, nothing fancy. It receives your question and immediately sends it to a message queue service (RabbitMQ, SQS etc). Think of the queue like a really organized to-do list. It holds your question safely while the system gets ready to process it.</p><p>Why a queue? Because sometimes you’re impatient and ask three questions rapid-fire. The queue makes sure each one gets proper attention without anything getting lost or overloaded.</p><p><strong>Step 2: The Context Retriever wakes up</strong></p><p>A worker service picks up your question from the queue. First thing it does? Transforms your question into a vector using a transformer called <em>all-MiniLM-L6-v2</em> (we are using this).</p><p>A vector is just a list of numbers that represents the meaning of your question. Think of it like a fingerprint, but instead of identifying a person, it identifies an idea.</p><p>“What’s the relationship between exercise and neurogenesis?” becomes something like [0.23, -0.15, 0.89, … 384 numbers total]. Every semantically similar question would have a similar fingerprint. “How does physical activity affect brain cell growth?” would have nearby numbers.</p><p><strong>Step 3: Searching through your memory</strong></p><p>Now here’s where it gets interesting. Remember all those papers and notes you’ve been feeding the system? They’re all sitting in Qdrant, this is not your grandfather’s SQL, this is a vector database, a speedy one, which saves these numerical fingerprints.</p><p>The Context Retriever takes your question’s vector and asks Qdrant: “Find me everything in this person’s knowledge base that has a similar fingerprint to this.”</p><p>Qdrant is insanely fast at this. It doesn’t read every document word by word like a human would. It’s doing mathematical distance calculations. “Which vectors are closest to this query vector?” In milliseconds, it returns the most relevant chunks from your saved research.</p><p>Maybe it finds that section from the Nature paper about hippocampal neurogenesis. That paragraph from your notes on the correlation between cardio and BDNF levels. That article you saved about mice running on wheels and growing new neurons.</p><p><strong>Step 4: Building the perfect prompt</strong></p><p>Now the Context Retriever does something clever. It doesn’t just send your question to the AI. It builds a rich, contextual prompt that looks something like:</p><p>“You are a research assistant. The user has saved the following relevant information: [Chunk from Nature paper about exercise increasing neurogenesis by 200%] [User’s notes on BDNF as the key mechanism] [Article excerpt about optimal exercise duration]</p><p>Based on this information from the user’s research, answer the following question: What’s the relationship between exercise and neurogenesis in adults?”</p><p>See what happened there? We just transformed a general question into a specific one grounded in YOUR knowledge.</p><p><strong>Step 5: TinyLlama does its thing</strong></p><p>The prompt goes to TinyLlama, our open-source LLM. TinyLlama is small (only 1.1 billion parameters) but fast and good enough for most tasks. More importantly, it’s free and you can run it on decent hardware.</p><p>TinyLlama reads the context, understands your question, and generates an answer based on the specific research you’ve saved. Not based on its general training. Not making stuff up. Based on YOUR sources.</p><p><strong>Step 6: The answer flows back</strong></p><p>The response travels back through the system. Maybe through the queue again, maybe through a database where it’s stored for your chat history, and finally back to your frontend where you see it.</p><p>The entire journey takes a couple of seconds. To you, it feels like magic. To the system, it’s a carefully orchestrated dance of components doing exactly one thing well.</p><h3>Flow 2: When You Feed It Knowledge (Building the Brain)</h3><p>The query flow is sexy. This flow is where the real work happens.</p><p>You’ve just finished reading a fascinating paper on memory consolidation during sleep. You want your research assistant to remember this. Here’s what happens:</p><p><strong>Step 1: Knowledge hits the Ingestion API</strong></p><p>You upload the PDF or paste the text into your app. It hits a different API endpoint than queries. This one is specifically designed for ingesting knowledge, not answering questions. Separation of concerns is good architecture.</p><p>The Ingestion API immediately puts your document into a message queue. Same idea as before. Multiple uploads don’t crash the system. Everything gets processed in order.</p><p><strong>Step 2: The Knowledge Processor takes over</strong></p><p>Another worker service, this one specialized for processing documents. It picks up your paper from the queue and starts doing the heavy lifting.</p><p>First, it chunks the document. A 30-page paper can’t be stored as one giant blob. It gets broken into meaningful sections. Maybe by paragraph, maybe by section, maybe using smarter semantic chunking that keeps related ideas together. Each chunk is maybe 200–500 words.</p><p>Why chunk? Because when you ask a question later, you don’t want the entire 30-page paper shoved into the context. You want the specific three paragraphs that matter.</p><p><strong>Step 3: Vectorization happens</strong></p><p>Each chunk gets run through that same <em>all-MiniLM-L6-v2</em> transformer. Each chunk becomes a vector. Each vector gets stored in Qdrant along with the original text.</p><p>Now Qdrant has both the fingerprint (for fast searching) and the actual text (for building prompts). The paper about sleep and memory consolidation is now searchable by semantic meaning, not just keywords.</p><p><strong>Step 4: The Memory Sync Scheduler (The Secret Weapon)</strong></p><p>Here’s where it gets really powerful. You don’t just manually upload documents. You connect integrations.</p><p>You link your Notion workspace. Your Google Drive. Your Pocket saved articles. Maybe your Kindle highlights. Your Slack channels where interesting links get shared.</p><p>A cron job runs periodically. Once a day, maybe. It polls all these services through their APIs, looks for new content, and automatically feeds it through the Knowledge Processor.</p><p>You highlight a passage in a book on your Kindle? Tomorrow morning, your research assistant knows about it. You save an article to Pocket at 2am? It’s in the system by breakfast. You write notes in Notion? Automatically ingested and vectorized.</p><p>Your AI assistant’s memory grows with you, automatically, without you doing anything.</p><p>This is what I mean by perfect memory. Not because it remembers everything word-for-word like a robot. But because it has instant semantic access to everything you’ve ever thought was important enough to save.</p><h4>The Part Where I Tell You This Isn’t Perfect :(</h4><p>So RAG isn’t magic. It’s a power tool that requires you to understand what you’re building.</p><p><strong>Chunking is hard.</strong> Break your documents wrong and you lose context. That brilliant insight that spans two pages? If your chunks are too small, they’ll be stored separately and might not both get retrieved together.</p><p><strong>Retrieval isn’t always perfect.</strong> Sometimes the semantically similar chunks aren’t the actually relevant chunks. You ask about exercise and neurogenesis, and it retrieves the section about exercise and cardiovascular health because those vectors happened to be close. The LLM does its best but garbage in, garbage out.</p><p><strong>Vector search has limits.</strong> It finds semantic similarity, not logical reasoning. If you need to connect three different ideas from three different papers that don’t share similar language, RAG might miss those connections. A human researcher would see it. The vector search won’t.</p><p><strong>Quality of sources matters enormously.</strong> If you’re feeding it garbage research, contradictory articles, or random internet posts, your assistant becomes confident and wrong. It’ll cite bad sources with the same authority as good ones.</p><p>But look these aren’t dealbreakers. They’re just realities. RAG is powerful but it’s not artificial general intelligence. It’s a really good filing system attached to a really good language model.</p><h3>Building Your Own?</h3><p>If you want to build this yourself, here’s your shopping list:</p><p><strong>Frontend:</strong> Whatever you’re comfortable with. React, Vue, vanilla JavaScript, doesn’t matter. You just need to call APIs and display responses.</p><p><strong>Query Router &amp; Ingestion API:</strong> FastAPI in Python is perfect. Express in Node works too. Keep them simple. They’re just HTTP endpoints that push to queues.</p><p><strong>Message Queue:</strong> RabbitMQ or Redis Pub/Sub. Both work great. RabbitMQ is more features, Redis is simpler if you’re already using Redis.<br><a href="https://hub.docker.com/_/rabbitmq">https://hub.docker.com/_/rabbitmq</a></p><p><strong>Context Retriever &amp; Knowledge Processor:</strong> Python services. Use the sentence-transformers library for the all-MiniLM-L6-v2 model. Use the qdrant-client to talk to your vector database. <a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2">https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2</a></p><p><strong>Qdrant:</strong> Runs in Docker beautifully. Their cloud offering is also very reasonable if you don’t want to self-host. <br><a href="https://qdrant.tech/">https://qdrant.tech/</a></p><p><strong>TinyLlama:</strong> Run it locally using Ollama or text-generation-inference. Or swap in any other open-source model. Mistral, Llama 3, whatever fits your needs and hardware.<br><a href="https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0">https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0</a></p><p><strong>Memory Sync Scheduler:</strong> A Python script with schedule library or a proper cron job. Calls the APIs of services you integrate, fetches new content, pushes to your ingestion queue.</p><p>The entire stack can run on a decent server or even a beefy laptop for personal use. Scale up as needed.</p><p>signing off, see ya all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e74f003fdfb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built Git From Scratch in Go and Finally Understood How It Actually Works]]></title>
            <link>https://0xahmedkhan.medium.com/i-built-git-from-scratch-in-go-and-finally-understood-how-it-actually-works-9bc504532311?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bc504532311</guid>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[version-control-system]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Wed, 08 Oct 2025 06:53:57 GMT</pubDate>
            <atom:updated>2025-10-08T08:09:14.413Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bQP99k0jpGkC2EXI" /><figcaption>Photo by <a href="https://unsplash.com/@synkevych?utm_source=medium&amp;utm_medium=referral">Roman Synkevych</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You know that feeling when you use something every day but have no clue how it works under the hood? That was me with Git. Sure, I could git add, git commit, and git push like everyone else. But what was actually happening? No idea.</p><p>So I did what? I built my own version. I call it Jit. <br>And honestly? Building it taught me more about Git in a weekend than years of Googling error messages ever did.</p><p>Here’s what I learned.</p><h3>Git Is Not Just For Code</h3><p>Well…</p><p>Git is a content tracking system. It tracks content. Any content. Text files, images, whatever. When I realized this, I felt a bit stupid for assuming it was some magic code-specific thing. It’s just a really smart filing system that happens to work great with code.</p><p>The basic idea is simple: Git is like a giant key-value store. You give it some content (any content), and it gives you back a unique key. That key is a SHA-1 hash, which is just a 40-character fingerprint of your content.</p><p>Same content? Same hash. Always. On any machine. Anywhere in the world.</p><p>This blew my mind because it means Git doesn’t need to be smart about comparing files. It just looks at the hash and knows instantly if something changed.</p><h3>The Three Building Blocks of Git</h3><p>Before we dive into the code, you need to know about Git’s three fundamental object types. Everything in Git is built from these:</p><p><strong>Blob (Binary Large Object)</strong>: This is your actual file content. When you add a file, Git stores it as a blob. Just the content, nothing else. No filename, no folder info. Just raw content with a header.</p><p><strong>Tree</strong>: We can think of it as a directory listing. A tree object lists out files (blobs) and subdirectories (other trees) with their names and hashes. It’s how Git knows that blob abc123 is actually called test.txt and lives in your project root.</p><p><strong>Commit</strong>: This is your snapshot. A commit points to a tree (your project at that moment), references its parent commit (to build history), and includes metadata like timestamp and your commit message. Commits are how Git chains everything together into a timeline.</p><p>That’s it. Three object types. Everything you do in Git just creates or references these objects in different ways.</p><h3>The .jit Folder</h3><p>When you run git init, Git creates a .git folder. I did the same with .jit. Inside, there&#39;s an objects/ folder where everything gets stored.</p><p>Let me show you what happens when we initialize:</p><pre>func initRepo() {<br>    dirs := []string{<br>        &quot;.jit&quot;,<br>        filepath.Join(&quot;.jit&quot;, &quot;objects&quot;),<br>        filepath.Join(&quot;.jit&quot;, &quot;refs&quot;, &quot;heads&quot;),<br>    }<br><br>    for _, d := range dirs {<br>        os.MkdirAll(d, 0755)<br>    }<br><br>    headPath := filepath.Join(&quot;.jit&quot;, &quot;HEAD&quot;)<br>    os.WriteFile(headPath, []byte(&quot;ref: refs/heads/master\n&quot;), 0644)<br><br>    fmt.Println(&quot;Initialized empty jit repository in .jit/&quot;)<br>}</pre><p>That’s it. We create some folders and a HEAD file that points to refs/heads/master. The HEAD file is like a bookmark telling Jit which branch you&#39;re on.</p><p>Inside .jit/ you now have:</p><ul><li>objects/ - where all your content lives (blobs, trees, commits)</li><li>refs/heads/ - where branch pointers live</li><li>HEAD - points to your current branch</li></ul><p>Simple, nah?</p><h3>Adding a File: Creating Your First Blob</h3><p>When you git add a file, Git doesn&#39;t just copy it somewhere. It does something cooler.</p><pre>func addFile(filename string) {<br>    data, _ := ioutil.ReadFile(filename)<br>    sha := writeObject(&quot;blob&quot;, data)<br>    fmt.Printf(&quot;Added %s as blob %s\n&quot;, filename, sha)<br>}<br><br>func writeObject(typ string, data []byte) string {<br>    header := fmt.Sprintf(&quot;%s %d\u0000&quot;, typ, len(data))<br>    store := append([]byte(header), data...)<br>    hash := sha1.Sum(store)<br>    sha := fmt.Sprintf(&quot;%x&quot;, hash[:])<br>    dir := filepath.Join(&quot;.jit&quot;, &quot;objects&quot;, sha[:2])<br>    file := filepath.Join(dir, sha[2:])<br>    os.MkdirAll(dir, 0755)<br>    ioutil.WriteFile(file, store, 0644)<br>    return sha<br>}</pre><p>Here’s what happens when you add test.txt:</p><ol><li>Read the file content</li><li>Create a header: blob 10\0 (type, size, null byte)</li><li>Combine header + content</li><li>Hash it with SHA-1: something like 95d09f2b10159347eece71399a7e2e907ea3df4f</li><li>Store it in .jit/objects/95/d09f2b10159347eece71399a7e2e907ea3df4f</li></ol><p>Notice how the hash becomes a folder path? First 2 characters = folder name, rest = filename. This keeps things organized when you have thousands of objects.</p><p>And this, my friends, is a <strong>blob</strong>. It’s just your file content with a tiny header put on top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ImO-yVE-SvqNrRMK9NXww.png" /><figcaption>jit add file</figcaption></figure><h3>Committing</h3><p>This is where it gets interesting. A commit isn’t just “save my changes.” It’s a snapshot of your entire project at that moment.</p><pre>func commit(message string) {<br>    treeEntries := []string{}<br>    filepath.WalkDir(&quot;.&quot;, func(path string, d fs.DirEntry, err error) error {<br>        if d.IsDir() || strings.HasPrefix(path, &quot;.jit&quot;) {<br>            return nil<br>        }<br>    data, _ := ioutil.ReadFile(path)<br>        sha := writeObject(&quot;blob&quot;, data)<br>        treeEntries = append(treeEntries, fmt.Sprintf(&quot;%s %s&quot;, sha, path))<br>        return nil<br>    })<br>    treeContent := strings.Join(treeEntries, &quot;\n&quot;)<br>    treeSha := writeObject(&quot;tree&quot;, []byte(treeContent))<br>    parent := readRef(&quot;refs/heads/master&quot;)<br>    commitContent := fmt.Sprintf(&quot;tree %s\n&quot;, treeSha)<br>    if parent != &quot;&quot; {<br>        commitContent += fmt.Sprintf(&quot;parent %s\n&quot;, parent)<br>    }<br>    commitContent += fmt.Sprintf(&quot;date %s\n&quot;, time.Now().Format(time.RFC3339))<br>    commitContent += fmt.Sprintf(&quot;\n%s\n&quot;, message)<br>    commitSha := writeObject(&quot;commit&quot;, []byte(commitContent))<br>    refPath := filepath.Join(&quot;.jit&quot;, &quot;refs&quot;, &quot;heads&quot;, &quot;master&quot;)<br>    ioutil.WriteFile(refPath, []byte(commitSha), 0644)<br>    fmt.Printf(&quot;Committed as %s\n&quot;, commitSha)<br>}</pre><p>Let’s break this down:</p><p><strong>Create a tree</strong> that lists all files in your project with their blob hashes. It’s like a directory listing. For our test.txt:</p><pre>95d09f2b10159347eece71399a7e2e907ea3df4f test.txt</pre><p>This tree gets hashed and stored as an object too.</p><p><strong>Create the commit</strong> that is just a text file with:</p><ul><li>The tree it points to</li><li>Its parent commit (if it has one)</li><li>A timestamp</li><li>Your commit message</li></ul><pre>tree abc123...<br>parent def456...<br>date 2025-10-08T10:30:00Z<br>Initial commit</pre><p>This also gets hashed and stored.</p><p><strong>Update the branch pointer,</strong> so, we write the commit hash into .jit/refs/heads/master. This makes master point to our new commit.</p><p>Inside your .jit/objects/ folder now you have:</p><ul><li>A blob for test.txt</li><li>A tree listing that blob</li><li>A commit pointing to that tree</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MpvETNQeEAXipLJn55RtmA.png" /><figcaption>git commit</figcaption></figure><h3>Branching:</h3><p>This one surprised me the most. Branches aren’t some complex data structure. They’re literally just files containing a commit hash.</p><pre>func createBranch(name string) {<br>    commitSha := readRef(&quot;refs/heads/master&quot;)<br>    path := filepath.Join(&quot;.jit&quot;, &quot;refs&quot;, &quot;heads&quot;, name)<br>    ioutil.WriteFile(path, []byte(commitSha), 0644)<br>    fmt.Println(&quot;Created branch&quot;, name)<br>}<br><br>func checkoutBranch(name string) {<br>    headPath := filepath.Join(&quot;.jit&quot;, &quot;HEAD&quot;)<br>    ref := fmt.Sprintf(&quot;ref: refs/heads/%s\n&quot;, name)<br>    ioutil.WriteFile(headPath, []byte(ref), 0644)<br>    fmt.Println(&quot;Switched to branch&quot;, name)<br>}</pre><p>Creating a branch? Copy the current commit hash into a new file in refs/heads/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLzxBSXQHgXiM4SLbNDD6A.png" /><figcaption>git branch</figcaption></figure><p>Switching branches? Update HEAD to point to a different ref.</p><p>That’s it. No magic. No copying files. Just moving pointers.</p><p>Your .jit/refs/heads/ folder might look like:</p><pre>master    -&gt; abc123...<br>feature   -&gt; abc123...</pre><p>Both pointing to the same commit initially. As you commit on each branch, these hashes update independently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*lpf70JG4uB31K24WLEDT_w.png" /><figcaption>.jit directory</figcaption></figure><h3>So what we just learned</h3><p>It’s not magic (or maybe it is). It’s just:</p><ul><li>A key-value store (content-addressable storage, if you want to sound fancy)</li><li>Three object types: blobs (files), trees (directories), commits (snapshots)</li><li>Branches as pointers to commits</li><li>Everything identified by SHA-1 hashes</li></ul><p>The genius isn’t in complexity. It’s in simplicity. Once you see that Git is just a graph of objects linked by hashes, everything clicks.</p><p>Next time you git add, you&#39;ll know you&#39;re creating a blob. When you git commit, you&#39;re creating a tree and a commit object. When you git branch, you&#39;re just creating a new pointer.</p><p>And honestly? That makes Git way less scary.</p><p>If you want to try building your own version, I highly recommend it. The code is pretty straightforward: <a href="https://github.com/0xahmedk/Jit">https://github.com/0xahmedk/Jit</a></p><p>Now if you’ll excuse me, I have about 47 other tools I use daily that I probably don’t understand. Time to build my own Docker, I guess.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bc504532311" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure to AWS Cross-Cloud Authentication: The Complete Guide]]></title>
            <link>https://0xahmedkhan.medium.com/azure-to-aws-cross-cloud-authentication-the-complete-guide-875037f6a0ae?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/875037f6a0ae</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[crosscloud]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Wed, 27 Aug 2025 16:49:21 GMT</pubDate>
            <atom:updated>2025-08-27T16:49:21.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Jdh_3Ddl4y529rp" /><figcaption>Photo by <a href="https://unsplash.com/@fabioha?utm_source=medium&amp;utm_medium=referral">fabio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ever found yourself in a situation where your Azure Function App desperately needs to send a message to an AWS SQS queue? Or maybe your Azure VM wants to read from an S3 bucket? Well, welcome to the wonderful world of cross-cloud authentication!</p><p>Today we’re diving into the art of making Azure and AWS play nice together. Think of it as setting up a diplomatic relationship between two powerful kingdoms so, there’s paperwork, handshakes, and a lot of “trust but verify” going on.</p><h3>What We’re Building</h3><p>By the end of this guide, your Azure resources will be able to assume AWS IAM roles and perform actions like:</p><ul><li>Sending messages to SQS queues</li><li>Reading/writing to S3 buckets</li><li>Invoking Lambda functions</li><li>Pretty much anything AWS IAM allows</li></ul><h3>The Game Plan</h3><p>Here’s our step-by-step plan:</p><h3>Azure Side</h3><ol><li><strong>Register an App in Entra ID</strong> — Create our identity anchor</li><li><strong>Create an App Role</strong> — Define what this identity can claim to be</li><li><strong>Set up Managed Identity</strong> — Attach this to our Azure resource</li><li><strong>Create Service Principal</strong> — The magic glue that ties it all together</li></ol><h3>AWS Side</h3><ol><li><strong>Create IAM Role</strong> — Define what actions are allowed</li><li><strong>Configure Web Identity Provider</strong> — Set up the trust relationship</li><li><strong>Craft Trust Policy</strong> — The security handshake rules</li><li><strong>Assign Permissions</strong> — What your Azure resource can actually do</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*ljG26ebTvIIbxaE5_mG_qw.png" /><figcaption>Azure to AWS authentication flow</figcaption></figure><h3>Prerequisites</h3><p>Before we start this cross-cloud adventure, make sure you have:</p><h3>Azure Requirements</h3><ul><li><strong>Azure AD Premium P1 License</strong> (minimum) — This is crucial for advanced identity features</li><li>Azure subscription with appropriate permissions</li><li>Access to create App Registrations in Entra ID</li><li>Permissions to create/manage Managed Identities</li><li>An Azure Function App or VM to test with</li></ul><h3>AWS Requirements</h3><ul><li>AWS account with IAM admin permissions</li><li>Access to create IAM roles and identity providers</li><li>Basic understanding of AWS IAM (or a willingness to learn!)</li></ul><h3>Tools You’ll Need</h3><ul><li>Azure CLI (we’ll show both portal and CLI methods)</li><li>AWS CLI</li><li>A cup of coffee ☕ (optional but recommended)</li></ul><h3>Why This Matters</h3><p>Cross-cloud authentication isn’t just a neat party trick. In today’s hybrid world, organizations often:</p><ul><li>Use best-of-breed services from different providers</li><li>Need to migrate workloads gradually</li><li>Want to avoid vendor lock-in</li><li>Require disaster recovery across clouds</li></ul><p>Instead of managing separate credentials or using hacky workarounds, we’re setting up proper federated identity that’s secure, scalable, and maintainable.</p><p>Ready to become a cross-cloud diplomat? Let’s dive in! 🚀</p><h3>The Azure Setup (Building Our Identity Foundation)</h3><p>Here’s the quick roadmap of what we’ll do on the Azure side. Don’t worry, we’ll keep it practical and skip the enterprise-grade complexity!</p><h3>Step 1: Register New App in Entra ID and Create App Role</h3><p>Think of this as creating a passport for your Azure resource:</p><ul><li><strong>Register the App</strong>: Head to Entra ID → App Registrations → New Registration</li><li><strong>Configure App ID URI</strong>: Set something like api://my-awesome-cross-cloud-app</li><li><strong>Create App Role</strong>: This defines what your identity can claim to be</li><li><strong>Enable the Role</strong>: Make sure it’s active and ready for business</li></ul><h3>Step 2: Create Managed Identity</h3><p>This is your Azure resource’s actual identity card:</p><ul><li>Create a <strong>User-Assigned Managed Identity</strong> (more flexible than system-assigned)</li><li>Give it a meaningful name like azure-to-aws-identity</li><li>Note down the <strong>Object (Principal) ID</strong> — you’ll need this later</li></ul><h3>Step 3: Create Service Principal Connection</h3><p>Now we connect the dots between your app registration and managed identity:</p><ul><li>Use Azure PowerShell or CLI to assign your managed identity to the app role</li><li>This creates the trust relationship within Azure</li><li>Think of it as introducing your identity to your app registration</li></ul><h3>Step 4: Attach Managed Identity to Your Resource</h3><p>The final Azure step — give your Function App or VM its new identity:</p><p><strong>For Function Apps or App Service:</strong></p><ul><li>Navigate to your Function App → Identity → User Assigned</li><li>Add your managed identity</li></ul><p><strong>For VMs:</strong></p><ul><li>Go to your VM → Identity → User Assigned</li><li>Add your managed identity</li></ul><h3>We’re keeping our guide focused on the “what” and “why” rather than clicking through every menu!</h3><h3>The AWS Setup (Rolling Out the Red Carpet)</h3><p>Time to teach AWS to trust your Azure identity! This is where the magic happens — we’re basically setting up a diplomatic embassy for Azure identities in AWS territory.</p><h3>Step 1: Create OpenID Connect Identity Provider</h3><p>First, we need to create an identity provider that AWS will use to verify tokens from Azure:</p><p><strong>In AWS IAM Console:</strong></p><ul><li>Navigate to IAM → Identity Providers → Add Provider</li><li>Choose <strong>OpenID Connect</strong> as provider type</li><li><strong>Provider URL</strong>: https://sts.windows.net/&lt;azure-tenant-id&gt;/ ⚠️ <strong>Critical Note</strong>: That trailing slash (/) at the end is <strong>mandatory</strong>! AWS is picky about this - without it, your authentication will fail mysteriously.</li><li><strong>Audience</strong>: Your App ID URI from Step 1 (e.g., api://my-awesome-cross-cloud-app)</li></ul><p>This tells AWS: “Hey, if someone shows up with a token from this Azure tenant and claims to be this specific app, we know how to verify them.”</p><h3>Step 2: Create IAM Role with Trust Policy</h3><p>Now we create a role that your Azure identity can assume, complete with the secret handshake rules:</p><p><strong>Trust Policy Template:</strong></p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [{<br>        &quot;Effect&quot;: &quot;Allow&quot;,<br>        &quot;Principal&quot;: {<br>            &quot;Federated&quot;: &quot;arn:aws:iam::&lt;AWS Account ID&gt;:oidc-provider/sts.windows.net/&lt;Microsoft Entra Tenant ID&gt;/&quot;<br>        },<br>        &quot;Action&quot;: &quot;sts:AssumeRoleWithWebIdentity&quot;,<br>        &quot;Condition&quot;: {<br>            &quot;StringEquals&quot;: {<br>                &quot;sts.windows.net/&lt;Microsoft Entra Tenant ID&gt;/:aud&quot;: &quot;&lt;Application ID URI&gt;&quot;<br>            }<br>        }<br>    }]<br>}</pre><p><strong>What’s happening here?</strong></p><ul><li><strong>Principal</strong>: Points to your OIDC provider (note that trailing slash again!)</li><li><strong>Action</strong>: Allows web identity assumption (the cross-cloud handshake)</li><li><strong>Condition</strong>: Double-checks the audience matches your app — no imposters allowed!</li></ul><h3>Step 3: Attach Permissions to the Role</h3><p>Finally, give your role the permissions it needs to actually do stuff. For SQS access, you might attach:</p><ul><li>AmazonSQSFullAccess (for testing)</li><li>Or create a custom policy with specific queue permissions (for production)</li></ul><p><strong>Pro Tip</strong>: Start with broader permissions for testing, then tighten them down for production. Nobody likes debugging permissions at 2 AM!</p><h3>Putting It All Together (The Magic Moment)</h3><p>Time to see our cross-cloud diplomacy in action! Here’s how your Azure resource can now assume that AWS role and start sending SQS messages like a boss.</p><h3>The Token Exchange Dance</h3><p>Here’s what happens behind the scenes:</p><ol><li><strong>Azure Function/VM</strong> requests a token from Azure MSI endpoint</li><li><strong>Azure</strong> returns an OIDC token with your app’s audience</li><li><strong>Your code</strong> calls AWS STS with this token</li><li><strong>AWS</strong> validates the token and returns temporary credentials</li><li><strong>Boom!</strong> You’re now authenticated in AWS</li></ol><h3>Python Example</h3><pre>import boto3<br>import requests<br>import os<br><br>def get_aws_session_from_azure():<br>    # Step 1: Get OIDC token from Azure MSI<br>    identity_endpoint = os.environ[&quot;IDENTITY_ENDPOINT&quot;]<br>    identity_header = os.environ[&quot;IDENTITY_HEADER&quot;]<br>    <br>    params = {<br>        &quot;api-version&quot;: &quot;2019-08-01&quot;,<br>        &quot;resource&quot;: os.getenv(&quot;AWS_OIDC_AUDIENCE&quot;),  # Your App ID URI<br>        &quot;client_id&quot;: os.getenv(&quot;MSI_CLIENT_ID&quot;)      # Optional for user-assigned<br>    }<br>    <br>    headers = {&quot;X-IDENTITY-HEADER&quot;: identity_header}<br>    <br>    # Get the token<br>    response = requests.get(identity_endpoint, params=params, headers=headers)<br>    token = response.json()[&quot;access_token&quot;]<br>    <br>    # Step 2: Use token to assume AWS role<br>    sts_client = boto3.client(&quot;sts&quot;)<br>    assumed_role = sts_client.assume_role_with_web_identity(<br>        RoleArn=os.getenv(&quot;AWS_ROLE_ARN&quot;),<br>        RoleSessionName=&quot;azure-to-aws-session&quot;,<br>        WebIdentityToken=token<br>    )<br>    <br>    # Step 3: Create AWS session with temporary credentials<br>    creds = assumed_role[&quot;Credentials&quot;]<br>    return boto3.Session(<br>        aws_access_key_id=creds[&quot;AccessKeyId&quot;],<br>        aws_secret_access_key=creds[&quot;SecretAccessKey&quot;],<br>        aws_session_token=creds[&quot;SessionToken&quot;]<br>    )<br><br># Now use it!<br>aws_session = get_aws_session_from_azure()<br>sqs = aws_session.client(&quot;sqs&quot;)<br>sqs.send_message(<br>    QueueUrl=&quot;https://sqs.us-east-1.amazonaws.com/123456789012/my-queue&quot;,<br>    MessageBody=&quot;Hello from Azure! 🌩️&quot;<br>)</pre><h3>CLI Version (For VMs)</h3><p>If you’re on an Azure VM and prefer CLI magic:</p><pre>#!/bin/bash<br><br># Get token from Azure MSI<br>TOKEN=$(curl -H &quot;Metadata:true&quot; \<br>  &quot;http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&amp;resource=${AWS_OIDC_AUDIENCE}&quot;)ACCESS_TOKEN=$(echo $TOKEN | jq -r &#39;.access_token&#39;)<br><br># Assume AWS role<br>aws sts assume-role-with-web-identity \<br>  --role-arn $AWS_ROLE_ARN \<br>  --role-session-name azure-vm-session \<br>  --web-identity-token $ACCESS_TOKEN<br><br># Now use AWS CLI with the returned credentials!</pre><h3>Wrapping Up</h3><p>Congratulations! 🎉 You’ve just built a secure bridge between Azure and AWS that would make any cloud architect proud. Your Azure resources can now assume AWS roles and access services like they’re part of the family.</p><h3>Want More Automation?</h3><p>If there’s interest, I can also write a follow-up on <strong>automating this entire setup using Terraform</strong>. Imagine deploying this cross-cloud trust relationship with just a few terraform apply commands - Azure app registrations, managed identities, AWS OIDC providers, IAM roles, and all the trust policies configured automatically!</p><p>Drop a comment if you’d like to see that infrastructure-as-code magic.</p><h3>Coming Next</h3><p><strong>Part 2: AWS to Azure</strong> — We’ll reverse the flow and show how your EC2 instances can access Azure Key Vault, Cosmos DB, and other Azure services. The plot thickens!</p><p><em>Found this helpful? Give it a clap and follow for more cross-cloud adventures. Questions? Drop them in the comments below!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=875037f6a0ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securely Connect to Private AWS RDS Using Bastion Proxy and SSM — No Public Access Needed]]></title>
            <link>https://0xahmedkhan.medium.com/securely-connect-to-private-aws-rds-using-bastion-proxy-and-ssm-no-public-access-needed-a79aa6512025?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/a79aa6512025</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[bastion]]></category>
            <category><![CDATA[aws-rds]]></category>
            <category><![CDATA[sms]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Mon, 23 Sep 2024 11:15:21 GMT</pubDate>
            <atom:updated>2024-09-23T11:15:21.676Z</atom:updated>
            <content:encoded><![CDATA[<h3>Securely Connect to Private AWS RDS Using Bastion Proxy and SSM — No Public Access Needed</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8VyiScq9OpyKIetp" /><figcaption>Photo by <a href="https://unsplash.com/@pawel_czerwinski?utm_source=medium&amp;utm_medium=referral">Pawel Czerwinski</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Keeping AWS resources like RDS private is crucial for security, but connecting to those private database instances can be a bit of a hassle. Typically, you’d need to set up a bastion server to act as a proxy to your private resources. However, each time you want to connect, you often have to go through the extra step of adding a rule to the bastion’s security group to allow SSH access from your IP. This is what enables your database client to connect through the bastion.</p><p>Today, I’m here to offer a simpler solution: using AWS Systems Manager (SSM) to connect through a bastion server without needing public access. With this method, you can skip the repetitive task of updating security group rules to allow your IP. Let’s dive in and explore how this can save you time and effort.</p><p>But first, let’s take a quick look at what AWS Systems Manager (SSM) is. SSM is a service that provides browser-based interactive shell access, a command-line interface (CLI), and remote desktop access for managing instances in your cloud environment, as well as on-premises or edge devices.</p><h4>Prerequisites:</h4><ul><li>A <strong>nano EC2 </strong>instance.</li><li>AWS <strong>CLI</strong> and <strong>Session Manager </strong>plugin <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html">installed</a> locally.</li><li>Proper <strong>IAM permissions</strong> for SSM and session access.</li></ul><p>First, create a bastion ec2 instance and install the <strong>SSM agent</strong> on your bastion server by following the instructions in this <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/manually-install-ssm-agent-linux.html">documentation</a>. This instance is configured with no inbound rules in its security group and has no key pairs attached, making it essentially a “dumb” EC2 instance that runs only the SSM agent. Its sole purpose is to proxy connections, requiring minimal compute resources. As such, <strong>t4g.nano</strong>the smallest available instance type can be used for this purpose.</p><p>Now coming back to your local machine, run the following command after updating the placeholders with your specific configurations:</p><pre>aws ssm start-session \<br>    --target &lt;bastion_instance_id&gt; \<br>    --document-name AWS-StartPortForwardingSession \<br>    --parameters &#39;{&quot;host&quot;:[&quot;&lt;rds_endpoint&gt;&quot;],&quot;portNumber&quot;:[&quot;5432&quot;], &quot;localPortNumber&quot;:[&quot;5434&quot;]}&#39; \<br>    --profile &lt;aws_profile_name&gt;</pre><p>Let’s break down the command step by step:</p><ol><li><strong>&lt;bastion_instance_id&gt;</strong>: Replace with the actual instance ID of your bastion EC2.</li><li><strong>AWS-StartPortForwardingSession</strong>: Use the correct SSM document for port forwarding (change it if you’re using a different SSM document).</li><li><strong>&lt;rds_endpoint&gt;</strong>: Replace this with the actual <strong>endpoint</strong> of your RDS instance.</li><li><strong>&lt;aws_profile_name&gt;</strong>: Replace with the actual <strong>profile name</strong> you’re using in your AWS CLI config (if necessary).</li><li><strong>&quot;localPortNumber&quot;: [&quot;5434&quot;]</strong>: The <strong>local port</strong> on your machine where the connection will be forwarded (you&#39;ll connect to localhost:5434 instead of the direct RDS endpoint).</li></ol><p>This command will allow you to set up a <strong>port forwarding session</strong> between your local machine and an RDS instance in a private VPC, using the bastion instance as a proxy. Once the session is established, you can connect to your RDS via localhost:5434, which is forwarded to the actual RDS endpoint on the port 5432.</p><p>Now using your database client of choice, set up your connection information as shown below with username, password, and database should all match the target RDS database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*-mdeFyd6YEa8AXIpnomiGw.png" /></figure><p>By using AWS Systems Manager and a jump server, you can securely access your private RDS instance without exposing it to the public internet. This method eliminates the need for repetitive tasks like adjusting security group rules and allows for a more streamlined connection process. Not only does this enhance security, but it also simplifies the management of your AWS resources, saving you valuable time. With SSM, you can maintain strong security practices while keeping things efficient and easy to manage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a79aa6512025" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effortless SVN to Git Migration: Retain Your Complete Commit History]]></title>
            <link>https://0xahmedkhan.medium.com/effortless-svn-to-git-migration-retain-your-complete-commit-history-fcebb0ddcb11?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcebb0ddcb11</guid>
            <category><![CDATA[subversion]]></category>
            <category><![CDATA[svn-to-git]]></category>
            <category><![CDATA[svn]]></category>
            <category><![CDATA[version-control-system]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Sun, 26 May 2024 10:00:56 GMT</pubDate>
            <atom:updated>2024-05-26T10:00:56.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i-5n_MifH0SWnSc4" /><figcaption>Photo by <a href="https://unsplash.com/@yancymin?utm_source=medium&amp;utm_medium=referral">Yancy Min</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Apache Subversion, while once popular, has become outdated and falls short in several areas, such as not supporting local branches and having limited merge capabilities. If you have a legacy project currently managed in SVN, you can seamlessly migrate to Git while preserving all of your branches, tags, and commit history.</p><p>There are several tools available to convert your SVN repository to Git. In this tutorial, we will focus on using the git svn tool, which, despite requiring some additional steps and commands, provides a robust and reliable migration process.</p><p>Let’s dive right in, as you’ve likely been eager to find a comprehensive guide for this migration.</p><p>First, ensure that you have Git installed, as the git svn tool is included with Git. You can download Git from <a href="https://git-scm.com/downloads">here</a>. MacOS users may also need to install git-svn separately, which can be obtained from <a href="https://formulae.brew.sh/formula/git-svn">Homebrew</a>.</p><h3>Step1: Import SVN Authors</h3><p>First of all we have to import all the authors from the SVN repo in a text file. Suppose we need to migrate the SVN repository located at <a href="https://mysvnhost/mypath/mysvnreponame">https://mysvnhost/mypath/mysvnreponame</a></p><pre>svn log https://mysvnhost/mypath/mysvnreponame - quiet | <br>grep -E &quot;r[0–9]+ \| .+ \|&quot; | <br>cut -d&#39;|&#39; -f2 | <br>sed &#39;s/ //g&#39; | <br>sort | <br>uniq &gt; ~/path/to/authors.txt</pre><p>Open the file authors.txt you just created with a text editor of your choice and modify the lines as follows:</p><blockquote>svn-user = git-user &lt;git-email&gt;</blockquote><p>one line per user (including angle brackets ‘&lt;’ and ‘ &gt;’), e.g.:</p><blockquote>a.khan = Ahmed K&lt;<a href="/service/mailto:john.smith@email.com">ahmed.k@email.com</a>&gt;</blockquote><p>And for the last line add</p><blockquote>(no author) = gitsvn &lt;<a href="/service/mailto:gitsvn@gitsvn.com">gitsvn@gitsvn.com</a>&gt;</blockquote><h3>Step2: Initializing new git repository</h3><p>Create a new directory and initialize a new git repository as:</p><pre>git svn init https://myhost/mypath/myreponame --stdlayout --no-metadata</pre><p>and import users from the authors.txt file as:</p><pre>git config svn.authorsfile ~/svn-authors.txt</pre><h3>Step3: Start importing the svn repository</h3><p>Run the command</p><pre>git svn fetch</pre><p>and take a moment to relax, as this process may take a while depending on the size of your repository, if the process stops for any reason you can re-run the command and the process will pick up where you left off.</p><h3>Step4: Conversion of tags and branches</h3><p>As SVN does not support real tags like git, so they were imported as branches. To convert them to git tags, run:</p><pre>for t in `git branch -a | grep &#39;tags/&#39; | sed s_remotes/origin/tags/__` ; do<br> git tag $t origin/tags/$t<br> git branch -d -r origin/tags/$t<br>done</pre><p>As with the tags, you now need to convert the remote branches to local branches and delete the remote branches:</p><pre>for t in `git branch -r | sed s_origin/__` ; do<br> git branch $t origin/$t<br> git branch -D -r origin/$t<br>done</pre><h3>Final Step: Remove Unused SVN Data</h3><pre>git config --remove-section svn-remote.svn<br>git config --remove-section svn<br>rm -fr .git/svn .git/{logs,}/refs/remotes/svn</pre><p>Congratulations on successfully migrating from SVN to Git! To make this process even smoother, I’ve compiled a series of shell scripts. You can find them at: <a href="https://github.com/ahmedk743/svn-to-git"><strong>https://github.com/ahmedk743/svn-to-git</strong></a><strong>.</strong></p><h3>Important Notes</h3><ul><li>Always create a backup of your SVN repository before migrating to Git.</li><li>Carefully review and update authors and commit messages as needed.</li><li>Be patient during the migration process, as it may take some time depending on the size of your repository. Enjoy your newly migrated Git repository!</li></ul><h4>References:</h4><ul><li><a href="https://git-scm.com/docs/git-svn">https://git-scm.com/docs/git-svn</a></li><li><a href="https://www.linkedin.com/pulse/migrating-from-svn-git-8-steps-preserving-history-giovanni-zito/">https://www.linkedin.com/pulse/migrating-from-svn-git-8-steps-preserving-history-giovanni-zito/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcebb0ddcb11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing Data Insights: An Introduction to Metabase]]></title>
            <link>https://0xahmedkhan.medium.com/unleashing-data-insights-an-introduction-to-metabase-d07ffc34776c?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/d07ffc34776c</guid>
            <category><![CDATA[database-insights]]></category>
            <category><![CDATA[metabase]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Thu, 23 May 2024 07:59:45 GMT</pubDate>
            <atom:updated>2024-05-23T08:05:49.191Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uu9GwNG9nBrwd_zd" /><figcaption>Photo by <a href="https://unsplash.com/@mikofilm?utm_source=medium&amp;utm_medium=referral">Mike Kononov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Metabase, now?</h3><p>According to <a href="https://metabase.com/">metabase.com</a>, Metabase is “Fast analytics with the <strong>friendly</strong> <strong>UX</strong> and integrated tooling to let your company explore data on their own”.</p><p>Simply put Metabase is an open-source business intelligence tool that allows users to query, visualize, and analyze their data without the need for SQL knowledge.</p><h3>Features</h3><p>It provides a user-friendly interface for exploring data stored in various databases, such as MySQL, PostgreSQL, SQL Server, and others.</p><p>Metabase enables users to create interactive dashboards, share insights with team members, and schedule email reports.</p><p>It’s often used by organizations to democratize access to data and empower non-technical users to make data-driven decisions.</p><h3>Getting Started with Metabase</h3><p>Metabase provides different <a href="https://www.metabase.com/pricing/">pricing models</a> both for cloud and self-hosted solutions. We are going to use the Open Souce version of Metabase to show an example of how to set up Metabase on your machine.</p><p>Metabase provides an official Docker image via Dockerhub that can be used for deployments on any system that is running Docker.</p><pre>docker pull metabase/metabase:latest<br>docker run -d -p 1234:3000 --name metabase metabase/metabase</pre><p>Optional: to view the logs as your Open Source Metabase initializes, run:</p><pre>docker logs -f metabase</pre><ol><li><strong>Exploring Data with Metabase</strong></li></ol><p>Open <a href="http://localhost:1234/">http://localhost:1234</a> in your favorite browser to access Metabase. Metabase provides various database options to connect to like, Postgres, MySQL, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-cKm5T0pMKBA5ZjqT0VVA.png" /><figcaption>Database connection options</figcaption></figure><p>To build a query for a real-life example of a table, we are going to use the “Orders” table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*t-2_9_Jgomv6AngVBTL1Sg.png" /><figcaption>Metabase Home Page</figcaption></figure><p><strong>2. Building a Query:</strong></p><ul><li>Navigate to the “Ask a Question” section by clicking “New” &gt; “Question”.</li><li>Select the “Orders” table.</li></ul><p><strong>a. Focus on a specific question:</strong> What are our top-selling albums by genre in the last quarter?</p><p><strong>b. Add Filters: </strong>In the “Filters” section, choose “Created At” and select a date range for the last quarter.</p><p><strong>c. Group and Summarize: </strong>Click “Summarize” and select “Count” of “Quantity”. Drag “Genre” to the “by” box to group results by genre.</p><p><strong>3. Choosing the Right Visualization:</strong></p><ul><li>Click the “Visualize” button. Metabase suggests a few options; let’s choose a “Bar Chart”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhAl_pL9qpV8EQAmqW2owg.png" /><figcaption>Orders Table in Metabase</figcaption></figure><p><strong>4. Building a Dashboard:</strong></p><ul><li>Now, let’s create a dashboard to house multiple insights.</li><li>Go to “New” &gt; “Dashboard” and give it a name like “Sales Performance”.</li><li>Click the pencil icon to edit the layout.</li><li>Select the one you just created from the question list about top-selling albums.</li></ul><p><strong>5. Enhancing the Dashboard:</strong></p><ul><li>You can add more questions to the dashboard. For instance, create a separate question using a “Pie Chart” to visualize the total revenue generated by each genre over the same period.</li></ul><p><strong>6. Adding Context:</strong></p><ul><li>Include a “Markdown Card” as a title for your dashboard, explaining the time frame and purpose of the data.</li></ul><p><strong>7. Interactivity:</strong></p><ul><li>Metabase allows for interactivity. Try enabling “Drill Down” on the bar chart. Clicking a genre bar will display details about specific albums within that genre.</li></ul><p><strong>8. Sharing Insights:</strong></p><ul><li>Once your dashboard is refined, share it with colleagues for informed decision-making.</li></ul><p><strong>9. Community and Support</strong></p><p>The Metabase community offers a variety of resources for users of all levels. Whether you’re new to Metabase and looking for help getting started, or a seasoned user with a technical question, there’s something for you. Here are some useful links.</p><ul><li>Metabase learn: <a href="https://www.metabase.com/learn/">https://www.metabase.com/learn/</a></li><li>Setup Metabase: <a href="https://www.metabase.com/docs/latest/installation-and-operation/running-metabase-on-debian">https://www.metabase.com/docs/latest/installation-and-operation/running-metabase-on-debian</a></li><li>Example dashboards: <a href="https://www.metabase.com/dashboards/">https://www.metabase.com/dashboards/</a></li></ul><p><strong>10. Conclusion</strong></p><p>In conclusion, Metabase empowers users by making data analysis accessible to everyone. It offers a user-friendly platform that enables individuals of all technical backgrounds to explore, visualize, and derive insights from data. This accessibility fosters a data-driven culture within organizations, unlocking the true potential of their information.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d07ffc34776c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nginx Reverse Proxy Server Setup: A Comprehensive Walkthrough for Beginners]]></title>
            <link>https://0xahmedkhan.medium.com/nginx-reverse-proxy-server-setup-a-comprehensive-walkthrough-for-beginners-c6060979e751?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6060979e751</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[nginx-proxy]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[web-server]]></category>
            <category><![CDATA[reverse-proxy]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Sun, 28 May 2023 11:26:06 GMT</pubDate>
            <atom:updated>2023-05-28T11:26:48.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OGx4idT4oPZvJIGe" /><figcaption>Photo by <a href="https://unsplash.com/@floriankrumm?utm_source=medium&amp;utm_medium=referral">Florian Krumm</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction:</h3><p>In this tutorial, we will learn how to set up a reverse proxy server using Nginx. A reverse proxy acts as an intermediary between client requests and backend servers, helping to improve performance, security, and flexibility. I will explain the code snippet provided and guide you through the process of configuring Nginx to act as a reverse proxy server.</p><h3>Prerequisites:</h3><p>Before getting started, make sure you have the following:</p><ul><li>A Linux-based server with Nginx installed.</li><li>Basic familiarity with Nginx configuration or Perl.</li></ul><h3>Nginx Configuration File:</h3><p>Log in to your server via SSH or open a terminal session.</p><ol><li>Locate the Nginx configuration file. Typically, it is located at /etc/nginx/nginx.conf .</li><li>Create a new file /etc/nginx/sites-available/default to set up the logic for configuration.</li><li>Include /etc/nginx/sites-available/default in nginx.conf as:</li></ol><pre># some other code<br>http {<br>  # some other code<br>  include /etc/nginx/sites-enabled/*;<br>}</pre><h3>Code breakdown and its functionality:</h3><p>First open /etc/nginx/sites-available/default in a text editor of your choice.</p><ol><li><strong>Setting up the basic structure</strong></li></ol><pre>server {<br>     # listen 80;<br>     listen 443 ssl;<br>     listen [::]:443 ssl;<br>}</pre><ol><li>server: This keyword starts the server block, which defines the configuration for a specific server.</li><li># listen 80;: This line is commented out, but it would normally specify that the server should listen on port 80 for HTTP traffic. When uncommented, it would allow the server to handle both HTTP and HTTPS traffic.</li><li>listen 443 ssl;: This line tells Nginx to listen on port 443 for HTTPS traffic. The ssl parameter enables SSL/TLS encryption for secure communication.</li><li>listen [::]:443 ssl;: This line specifies that the server should also listen on IPv6 addresses for HTTPS traffic on port 443.</li></ol><p>By setting up the server block in this way, you are configuring Nginx to handle HTTPS traffic on port 443 with SSL/TLS encryption. This is typically used for secure communication and requires a valid SSL/TLS certificate to be installed on the server.</p><p><strong>2. Configuring the Reverse Proxy Server:</strong></p><pre>server {<br>  # listen 80;<br>  listen 443 ssl;<br>  listen [::]:443 ssl;<br>      <br>  server_name www.example.com;<br><br>  location / {<br>      root /var/www/your-html-source/;<br>      index  index.html index.htm;<br>      proxy_http_version 1.1;<br>      proxy_set_header Upgrade $http_upgrade;<br>      proxy_set_header Connection &#39;upgrade&#39;;<br>      proxy_set_header Host $host;<br>      proxy_cache_bypass $http_upgrade;<br>      try_files $uri $uri/ /index.html;<br>    }<br>}</pre><p>a. server_name www.example.com; This line specifies the server name that this configuration block applies to. In this case, it is set to “<a href="http://www.example.com/">www.example.com</a>&quot;, meaning that this configuration will be used when handling requests for the “<a href="http://www.example.com/">www.example.com</a>&quot; domain.</p><p>b. location / This directive defines a location block that matches requests for the root URL (“/”). It is used to specify how requests to the root URL should be handled.</p><p>c. root /var/www/your-html-source/; This line sets the root directory for serving files for this location. It specifies that the files should be served from the “/var/www/your-html-source/” directory.</p><p>d. index index.html index.htm; This line specifies the list of files that Nginx should try to serve if a directory is requested. In this case, it will first look for “index.html” and then “index.htm” in the requested directory.</p><p>e. proxy_http_version 1.1;<br>proxy_set_header Upgrade $http_upgrade;<br>proxy_set_header Connection &#39;upgrade&#39;;<br>proxy_set_header Host $host;<br>proxy_cache_bypass $http_upgrade;</p><p>These lines set various proxy-related headers and configuration options. They ensure that the proxying is performed correctly, including handling HTTP/1.1, upgrading the connection if needed, setting the host header, and bypassing any caching mechanisms.</p><p>f. try_files $uri $uri/ /index.html; This line specifies a fallback mechanism if the requested file or directory does not exist. It tells Nginx to first attempt to serve the requested file, then if it doesn’t exist, try to serve the corresponding directory. If that also doesn’t exist, it will serve the “index.html” file.</p><p>You can add as many as blocks you want to.</p><p>Add these lines to use certificates:</p><pre>ssl_certificate_key /path/to/ssl_certificate_key.pem;<br>ssl_certificate /path/to/ssl_certificate.pem;</pre><ul><li>Another server block can be added to perform a redirect from HTTP to HTTPS for your domain:</li></ul><pre>server {<br>    if ($host = www.example.com) {<br>        return 301 https://$host$request_uri;<br>    }<br>    listen 80;<br>    listen [::]:80;<br>    server_name www.example.com;<br>    return 301 https://$server_name$request_uri;<br>}</pre><p>Test if all is okay with the syntax:</p><pre>sudo nginx -t </pre><p>Now we need to restart the Nginx service, you can use the following command:</p><pre>sudo service nginx restart</pre><p>This command will restart the Nginx service, applying any changes made to the configuration files.</p><h3>Conclusion:</h3><p>Remember to adjust the configuration according to your specific requirements, such as domain names, file paths, and ports. Regularly update and maintain your SSL/TLS certificates to ensure the highest level of security for your website or application.</p><p>With this newfound knowledge, you are now equipped to utilize Nginx as a powerful reverse proxy server to optimize your web infrastructure. Happy proxying!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6060979e751" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying RabbitMQ Integration with Node.js Application]]></title>
            <link>https://0xahmedkhan.medium.com/simplifying-rabbitmq-integration-with-node-js-application-ef94ad5c97f?source=rss-18b667a70e35------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef94ad5c97f</guid>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[asynchronouscommunication]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[message-queue]]></category>
            <category><![CDATA[application-integration]]></category>
            <dc:creator><![CDATA[Ahmed K.]]></dc:creator>
            <pubDate>Sun, 14 May 2023 10:31:49 GMT</pubDate>
            <atom:updated>2023-05-14T10:31:49.270Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RYyXu4_ipDdXWsu_" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>RabbitMQ is an open-source message broker service which helps scaling applications by message queuing mechanism by implementing Advanced Message Queuing Protocol (AMQP).</p><p>RabbitMQ works by offering an interface, connecting message senders (Publishers) with receivers (Consumers) through an exchange (Broker) which distributes the data to relevant lists (Message Queues).</p><pre>     APP          EXCHANGE         TASK LIST          WORKER<br>   [DATA] -------&gt; [DATA] ---&gt;   [D]+[D][D][D] ---&gt;   [DATA]<br>  Publisher      EXCHANGE           Queue            Consumer</pre><p>You can use RabbitMQ for decoupling, load balancing, task queuing, implementing publish/subscriber model, etc.</p><p>If you’re looking to kick off your NodeJS application with RabbitMQ, you’ll be pleased to know that it’s a simple process. By following a few easy steps, you can have your application up and running with RabbitMQ in no time.</p><p>Kindly take note that the installation guidelines outlined in this manual are tailored for operating systems based on Debian 7 or later.</p><p>The Installation:</p><pre>apt-get    update <br>apt-get -y upgrade</pre><ol><li>Enable RabbitMQ repo &amp; update</li></ol><pre>echo &quot;deb http://www.rabbitmq.com/debian/ testing main&quot; &gt;&gt; /etc/apt/sources.list<br>curl http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -<br>apt-get update</pre><p>2. Download &amp; install RabbitMQ</p><pre>sudo apt-get install rabbitmq-server</pre><p>3. Enable RabbitMQ Management Console</p><pre>sudo rabbitmq-plugins enable rabbitmq_management</pre><p>Voila! With the console now activated, simply fire up your preferred web browser and cruise on over to <a href="http://[your">http://</a>localhost:15672/ to gain access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVcBe0aWn4BU0lXe8RqFBA.png" /><figcaption>RabbitMQ interface launched in a web browser</figcaption></figure><p>The Node side:</p><p>Install client library <a href="https://www.npmjs.com/package/amqplib">amqplib</a> using</p><pre>npm i amqplib</pre><p>After successful installation connect to RabbitMQ server &amp; create channel:</p><pre>import { Channel } from &quot;amqplib&quot;;<br>import amqp from &quot;amqplib/callback_api&quot;;<br><br>let channel: Channel;<br><br>const AMQP_SERVER = &quot;amqp://localhost&quot;;<br><br>const MY_QUEUE = &quot;MY_QUEUE&quot;;<br><br>amqp.connect(AMQP_SERVER, function (err, conn) {<br>  if (err) {<br>    console.log(&quot;AMQP connection error&quot;, err);<br>    return;<br>  }<br><br>  conn.createChannel(function (err, ch: Channel) {<br>    if (err) {<br>      console.log(&quot;AMQP channel error&quot;, err);<br>      return;<br>    }<br>    ch.assertQueue(MY_QUEUE, { durable: false }); // &lt;--- assert queue means declare queue idempotently<br> <br>    channel = ch;<br>  });<br>});<br></pre><p>With channel &amp; queue created send message to queue</p><pre>channel.sendToQueue(<br>   MY_QUEUE,<br>   Buffer.from(<br>     JSON.stringify({ message: &quot;First time with MQ, feeling nervous!&quot; })<br>  )<br>);</pre><p>Now consume message in any of application connected to mq server</p><pre> channel.consume(<br>    MY_QUEUE,<br>    async function (msg) {<br>     if (msg) {<br>        const { message } = JSON.parse(<br>          msg.content.toString()<br>        );<br>        <br>        console.log(message)<br>        <br>        channel.ack(msg); // &lt;-- don&#39;t forget to acknowledge message<br>      }<br>    },<br>    { noAck: false }<br>  );</pre><p>You can check queued message the console as:</p><pre>rabbitmqadmin list queues</pre><p>Congrats, you made it here &amp; processed your first message through RabbitMQ.</p><p>That concludes my update for now. For more of my coding and tech endeavors, feel free to connect with me on <a href="https://www.linkedin.com/in/ahmedk743/">LinkedIn</a> or visit my <a href="https://github.com/ahmedk743">Github</a> profile and stay tuned for future updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef94ad5c97f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>