Skip to content

Instantly share code, notes, and snippets.

View gandharva's full-sized avatar
🧑‍💻
building measure.sh

gandharva kumar gandharva

🧑‍💻
building measure.sh
View GitHub Profile
@gandharva
gandharva / llm-wiki.md
Created May 7, 2026 07:07 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@gandharva
gandharva / Authentication.java
Last active June 22, 2016 15:59
This demo shows a scenario where a secured resource is being accessed and the token has expired. The authenticator of the rest client detects the scenario, gets the new access token using refresh token and continues with the call
package io.leftshift.app.model;
import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Delete;
import com.activeandroid.query.Select;
@Table(name = "Authentication")
public class Authentication extends Model {
retrofitService.getAccessToken()
/* AuthenticationResponse is the return type of retrofitService.getAccessToken()
* Observable<ResponseBody> is the return type of retrofitService.getRecords(), I'm using retrofit response body here
*/
.flatMap(new Func1<AuthenticationResponse, Observable<ResponseBody>>() {
@Override
public Observable<ResponseBody> call(AuthenticationResponse authenticationResponse) {
String accessToken = authenticationResponse.getData().getAccessToken();
String refreshToken = authenticationResponse.getData().getRefreshToken();
Authentication.saveDetails(accessToken, refreshToken);
@gandharva
gandharva / TrackNPullAllBranches.sh
Created December 17, 2015 06:15
Script to track, fetch and pull all remote branches
#!/bin/bash
//Get all branches from remote and track them locally
for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done
//Fetch all branches
git fetch --all
//Pull all branches
git pull --all
@gandharva
gandharva / pushout.sh
Last active August 29, 2015 14:21 — forked from detj/pushout.sh
#!/bin/sh
# The MIT License (MIT)
# Copyright (c) 2014 Debjeet Biswas
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CircularProgressView">
<attr name="cpv__backgroundColor" format="color" />
<attr name="cpv__backgroundColorPressed" format="color" />
<attr name="cpv__animationTime" format="float" />
<attr name="cpv__insideRadius" format="dimension" />
<attr name="cpv__progressWidth" format="dimension" />
</declare-styleable>
</resources>
package com.doomonafireball.samples.android.widget;
import com.doomonafireball.samples.android.R;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@gandharva
gandharva / .gitignore
Created April 23, 2014 08:38
.gitignore file to be included while developing in android studio
.DS_Store
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
package io.leftshift.app;
import com.crashlytics.android.Crashlytics;
import timber.log.Timber;
/**
* A logging implementation which reports 'info', 'warning', and 'error' logs to Crashlytics.
*/
public class CrashlyticsTree extends Timber.HollowTree {
@Override public void v(String message, Object... args) {
package io.leftshift.utilities;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpResponse;