Skip to content

Instantly share code, notes, and snippets.

@pfn
pfn / loaded-models-extension-app.js
Created April 1, 2026 04:57
OpenWebUI loaded models extension for VLLM & llama.cpp server
/**
* Loaded Models Extension for Open WebUI
*
* This extension adds a "Loaded Models" section to the sidebar that displays
* OpenAI-type models with status.value === 'loaded'. Users can click on these
* models to immediately start a new chat with that model selected.
*
* Features:
* - Fetches models from /api/models endpoint
* - Filters for owned_by === 'openai' AND status?.value === 'loaded'
@pfn
pfn / filter-function.py
Last active April 1, 2026 15:37
PP/TG counter for openwebui
"""
title: Real-time PP and TG metrics
author: pfn0
author_url: https://github.com/pfn
funding_url: https://github.com/pfn
version: 0.9
"""
from pydantic import BaseModel, Field
import traceback
@pfn
pfn / fit_target_jit.c
Created March 24, 2026 21:58
My llama-server preload
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <spawn.h>
#include <dlfcn.h>
#include <stdbool.h>
#include <errno.h>
#include <nvml.h>
@pfn
pfn / flash_uf2.sh
Last active January 31, 2024 20:27
Copy UF2 file to a mounted drive in Windows WSL2
#!/bin/bash
# This requires a line in /etc/fstab like so:
#E: /mnt/e drvfs noexec,user,noauto,mode=644,uid=1000,gid=1000 0 0
MOUNTPATH=/mnt/e
if [ $# -ne 1 ]; then
echo "Usage: flash_uf2 <image.uf2>"
exit 1
fi
@pfn
pfn / butterflight_dump_3inch.txt
Last active May 18, 2022 04:28
Dump from hglrc f3 flytower
CLI
# dump
# ButterFlight / OMNIBUS (OMNI) 3.5.2 Jun 28 2018 / 14:30:13 (1012e5f) MSP API: 1.40
name -
resource BEEPER 1 C15
resource MOTOR 1 B09
resource MOTOR 2 B08
resource MOTOR 3 A02
resource MOTOR 4 A03
@pfn
pfn / butterflight_config.txt
Created May 16, 2022 04:54
butterflight + omnibus + x4r
2022-05-15 @21:52:41 -- OS: Windows
2022-05-15 @21:52:41 -- Configurator: 10.8.0 (be4a9e1)
2022-05-15 @21:52:42 -- Loaded release information for configurator from GitHub.
2022-05-15 @21:52:48 -- Serial port successfully opened with ID: 1
2022-05-15 @21:52:48 -- MultiWii API version: 1.40.0
@pfn
pfn / output.c
Created December 7, 2021 06:04
updating qmk json2c to maintain key layout formatting if possible
// $ qmk json2c no_mod_tap_a.json
#include QMK_KEYBOARD_H
/* THIS FILE WAS GENERATED!
*
* This file was generated by qmk json2c. You may or may not want to
* edit it directly.
*/
@pfn
pfn / grr.py
Last active May 14, 2024 13:55
Simple tool to mirror (download) RRF configuration to local host
#!/usr/bin/env python
# tested on python3
import argparse
import ctypes
import hashlib
import http
import json
import os
@pfn
pfn / lis3dh_esp8266.cpp
Last active October 13, 2021 22:49
LIS3DH data collection for RRF using a Wemos D1 Mini
#include <Arduino.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <WifiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#define STASSID "YOURSSIDHERE"
#define STAPSK "YOURWIFIPSKHERE"
void setup() {
Serial.begin(9600);
pinMode(11, OUTPUT);
analogReference(DEFAULT);
}
void loop() {
static int lastValue = 0;
int value = analogRead(A0) >> 3;
if (lastValue != value) {