← Go to Home
Blog

Solving the Context Problem - A Local RAG System for Code

Solving the Context Problem: A Local RAG System for Code Yesterday I was using Kilocode to help refactor some authentication code in a 7,620-file Java codebase. The AI agent kept giving me generic advice because it couldn't see the actual implementation patterns in the project or some constraints. I could paste in a few files, but then I'd hit the context limit. Paste in more, and earlier files would fall out of context. The fundamental problem: you can't fit an entire codebase into an LLM's con...

More ›

Mastering Keycloak Configuration with GitOps and keycloak-config-cli

!current image in my mind. current image in my mind. In the realm of Identity and Access Management (IAM), Keycloak stands out as a powerful, open-source solution. Yet, managing its configuration—especially in complex, multi-tenant environments—can quickly become a significant bottleneck. Manual changes through the UI, often referred to as “Click-Ops” lead to inconsistent environments, lack of auditability, and high operational overhead. Multi-tenant SaaS applications face a critical challenge: ...

More ›

How to Read Hacker News Threads with Most Recent Comments First

Hacker News displays comments in a tree structure, which can make it difficult to track the latest updates in a conversation. To address this, I explored three different methods to sort and read Hacker News comments by most recent first. Here's how you can do it, starting from the simplest approach. 1. The Easiest Way: Algolia Search Hacker News uses Algolia for its search functionality, which has a continuously updated index. You can use this to display comments for a specific story in reverse ...

More ›

Rust concurrency with Mandelbrot Set

Rust excels in concurrent programming by enforcing rules that prevent memory errors and data races. For example: - Mutexes: Rust ensures you only access shared data when holding the lock and releases it automatically. In C/C++, this relationship is often left to comments. - Read-Only Data: Rust prevents accidental modification of shared read-only data. In C/C++, the type system helps but is error-prone. - Ownership Transfer: Rust guarantees you relinquish all access when transferring data betwee...

More ›

intercept fetch requests in JavaScript

I'm learning service workers. I wanted to start with one that intercepts calls to a and returns "Hello World". Here's the initial recipe I came up with. contained this: This is using the service worker registration boilerplate from MDN. Then my service worker script itself in just does this: You have to run service workers with a real web server - you can't serve them directly from disk. I used the Python 3 one-liner recipe for that: python3 -m http.server 8009 Then I visited to load the...

More ›

How to use cURL to interact with GraphQL APIs.

Running GraphQL queries from the command line using can be made simple and readable. Here's an example of how to query the GitHub GraphQL API using , tested in both and . Replace with your GitHub API personal access token. This command constructs and submits a GraphQL query encoded in JSON, using for JSON handling. Building a JSON Document with jq The query needs to be encoded as a JSON document like this: This is generated using the following command: Explanation of jq Options - : Produces...

More ›

How to retrieve a GraphQL schema from an endpoint.

The GraphQL schema language is a concise way to represent the available schema provided by a GraphQL endpoint. It looks something like this: You can retrieve a JSON version of this from the GraphQL server itself using the query at the bottom of this document. But... if you want it back in readable text as shown above, you can use the get-graphql-schema tool. Run that like this: npx get-graphql-schema https://github-to-sqlite.dogsheep.net/graphql If the API requires authentication, use the o...

More ›

Deploying Python web apps as AWS Lambda functions

AWS Lambda can host functions written in Python. These are "scale to zero" - my favourite definition of serverless! - which means you only pay for the traffic that they serve. A project with no traffic costs nothing to run. You used to have to jump through a whole bunch of extra hoops to get a working URL that triggered those functions, but in April 2022 they released Lambda Function URLs and dramatically simplified that process. There are still a lot of steps involved though. Here's how to depl...

More ›

Programmatically Access Postgres

The db-to-sqlite tool can connect to a PostgreSQL database, export all of the content, and write it to a SQLite database file on disk. This guide demonstrates how to integrate this process into a GitHub Actions workflow, allowing programmatic access to a Heroku PostgreSQL database. Overview Heroku provides a environment variable that contains all the necessary information to connect to the PostgreSQL database from external sources. We can leverage this in our GitHub Actions workflow. Local Usag...

More ›

jq Array of Array Object

Input: I want an array of objects. Here's what I came up with, using jqplay.org: This outputs: If you remove the outer and and use the "Compact output" option you get back this instead:

More ›