Skip to content

Instantly share code, notes, and snippets.

View jasondavis's full-sized avatar

Jason Davis jasondavis

View GitHub Profile
@jasondavis
jasondavis / getCampaignList.js
Created April 28, 2026 03:16 — forked from nicolevanderhoeven/getCampaignList.js
Writes Dataview query results to a Markdown note in Obsidian
function getNumOfGames(campaign) {
let numOfGames = app.plugins.plugins.dataview.api
.pages(`"ttrpgs/${campaign}"`)
.where(page => {
if (page.type === 'session') {
if (page.campaign === campaign) {
return true;
}
}
}).length
@jasondavis
jasondavis / returnStudyOptions.js
Created April 28, 2026 02:58 — forked from nicolevanderhoeven/returnStudyOptions.js
Script for use with the Obsidian Dataview and Templater plugins to return activity options given an amount of time available
/*
This script returns a list of activity options you could do (each defined by a Markdown file),
depending on how much time you have available.
REQUIRES:
- Obsidian: https://obsidian.md
- Obsidian Dataview plugin: https://blacksmithgu.github.io/obsidian-dataview/
- Obsidian Templater plugin: https://silentvoid13.github.io/Templater/
- this folder structure:
@jasondavis
jasondavis / llm-wiki.md
Created April 21, 2026 23:13 — 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.

@jasondavis
jasondavis / fakemenu.c
Created March 30, 2026 11:25 — forked from kjk/fakemenu.c
how to implement menu-like pop-up the right way in win32
/*****************************************************************************
* Sample program to demonstrate how a program can display a
* popup window which does not deactivate its parent. This
* can be used for things like a magnifying glass window or
* a pseudo-menu.
*****************************************************************************/
#define STRICT
#include <windows.h>
#define COMPILE_MULTIMON_STUBS
@jasondavis
jasondavis / microgpt.py
Created February 12, 2026 02:09 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and inference a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@jasondavis
jasondavis / RaindropTemplaterTemplate
Created September 9, 2025 19:34 — forked from rwmyers/RaindropTemplaterTemplate
Raindrop / Obsidian Integration
<%*
let raindrop = tp.user.raindrop;
let collections = await raindrop.collections();
let collection = await tp.system.suggester((item) => item.title, collections);
let raindrops = await raindrop.raindrops(collection._id);
let drop = await tp.system.suggester((item) => item.title, raindrops);
drop = await raindrop.raindrop(drop._id);
let title = drop.title
let url = drop.link
@jasondavis
jasondavis / new note.md
Created July 7, 2025 23:53 — forked from QuaCKeReD/new note.md
Templater based workflow for creating new notes - Reason: I was fed up of having to select 5 different combinations of metadata, some combinations of which were not valid

<%* tpOptionsList = await tp.file.include('[[noteYamlOptions]]') || '' tpOptions = tpOptionsList.split('\n') || ''

tpOptionChosen = await tp.system.suggester(tpOptions, tpOptions, false, "Select option") || ''

tpOptionChosenArea = tpOptionChosen.toString().split(',')[0] || '' tpOptionChosenCompany = tpOptionChosen.toString().split(',')[1] || '' tpOptionChosenClient = tpOptionChosen.toString().split(',')[2] || '' tpOptionChosenProject = tpOptionChosen.toString().split(',')[3] || ''

@jasondavis
jasondavis / obsidian.templater.pane.send-to-next.js
Created December 20, 2024 22:59 — forked from GitMurf/obsidian.templater.pane.send-to-next.js
Send the current active line of text or if text is selected, send the selection... to the pane next to the active one
<%*
//OPTIONS: TOP / BOTTOM
const whereToWrite = "TOP";
//OPTIONS: COPY / MOVE
const copyOrMove = "COPY";
//Find leaf next door
const thisLeaf = app.workspace.activeLeaf;
const thisFile = thisLeaf.view.file;
let leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "right");
if(!leafToUse){leafToUse = app.workspace.getAdjacentLeafInDirection(thisLeaf, "left");}
javascript: (function() {
var scripts = document.getElementsByTagName("script"),
regex = /(?<=(\"|\%27|\`))\/[a-zA-Z0-9_?&=\/\-\#\.]*(?=(\"|\'|\%60))/g;
const results = new Set;
for (var i = 0; i < scripts.length; i++) {
var t = scripts[i].src;
"" != t && fetch(t).then(function(t) {
return t.text()
}).then(function(t) {
var e = t.matchAll(regex);
import requests
import sys
import json
def waybackurls(host, with_subs):
if with_subs:
url = 'http://web.archive.org/cdx/search/cdx?url=*.%s/*&output=json&fl=original&collapse=urlkey' % host
else:
url = 'http://web.archive.org/cdx/search/cdx?url=%s/*&output=json&fl=original&collapse=urlkey' % host