Skip to content

Instantly share code, notes, and snippets.

View thexa4's full-sized avatar

Max Maton thexa4

  • Delft, Netherlands
View GitHub Profile
@thexa4
thexa4 / 001 - Base summary.md
Last active August 26, 2026 09:52
LightRAG dates, tagging, metadata

Adding queryable tags and date ranges

My goal is to allow filtering by tag and by date range. To do that we allow documents to be submitted with an optional array of tags, an optional start time and an optional end time. Tags and start end dates propagate by taking the union of the documents values to knowledge base entries and relations.

Filtering by tag while doing vector lookup can very likely be supported by: Qdrant, Milvus, PostgreSQL, MongoDB, OpenSearch. Others will need to overfetch and filter.

Querying is modified to support only returning chunks and knowledge base entries and relationships that have overlap, are contained or are a superset of the query daterange. Queries without required / forbidden tags and date ranges return the same data as they do now.

The full plan also adds a json metadata field that's not queryable and is transparantly returned when querying but it's not needed for this change.

#!/usr/bin/env python3
# Copyright (c) 2026 Max Maton
#
# 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@thexa4
thexa4 / elevator.js
Last active August 15, 2025 21:03
Idle managers
// https://play.elevatorsaga.com
class Manager {
constructor(elevators, floors) {
this.elevators = elevators
this.floors = floors
var obj = this
var id = 0
for(var e of elevators) {
#!/usr/bin/env python3
import pyvo
import requests
import sqlite3
from datetime import datetime
service_name = "Gaia@AIP"
url = "https://gaia.aip.de/tap"
token = ''
@thexa4
thexa4 / ATV Firmware.cs
Last active January 24, 2023 03:23
Space Engineers scripts
bool _autoPowerSave = true;
IMyTextSurface _cockpitSurface;
RectangleF _viewport;
List<IMyCargoContainer> _containers = new List<IMyCargoContainer>();
List<IMyEntity> _storages = new List<IMyEntity>();
IMyGasGenerator _splitter;
List<IMyBatteryBlock> _batteries = new List<IMyBatteryBlock>();
function printf {
declare parameter format.
local sentinel to lex().
local args to list().
declare parameter last to sentinel.
local test to last.
until test = sentinel {
args:add(test).
declare parameter last to sentinel.
@thexa4
thexa4 / day1a
Last active December 11, 2018 00:20
Advent calendar 2018
#!/bin/bash
(printf "puts "; cat) | tr -d "\n" | ruby
import copy
class ParallelPlayer
def __init__(self, prototype, concurrent_games):
self.prototype = prototype
self.instances = [None] * concurrent_games
self.seen_hand = [False] * concurrent_games
def start_game(self, game_id):
self.instances[game_id] = copy.deepcopy(self.prototype)
@thexa4
thexa4 / ceph-slow-rebalance
Created October 23, 2017 08:01
Rebalance ceph
while true; do
sleep 5m;
if ceph -s | grep -q 'are blocked'; then
echo 'skip, blocked'
continue
fi
if ceph -s | grep -q 'osd down'; then
#!/bin/sh
# postinst script for empires-gitlab-runner
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>