Skip to content

Instantly share code, notes, and snippets.

View Thorium's full-sized avatar

Tuomas Hietanen Thorium

View GitHub Profile
@Thorium
Thorium / 00-QUBO-splitting-paper.md
Created November 2, 2026 13:07
Trading Qubits for Circuit Runs: Exact QUBO Splitting by Cutset Conditioning and Exact-Share Knapsack Blocks (preprint, T. Hietanen, 2026)

Trading Qubits for Circuit Runs: Exact QUBO Splitting by Cutset Conditioning and Exact-Share Knapsack Blocks

Tuomas Hietanen · thorium@iki.fi · November 2026

Status: preprint, November 2026. Not peer reviewed. License: CC BY 4.0. This gist holds the full text, the Python reference implementation used for the experiments, and the raw results; the file list is at the end.

Cite as: T. Hietanen, Trading Qubits for Circuit Runs: Exact QUBO Splitting by Cutset Conditioning and Exact-Share Knapsack Blocks, preprint (GitHub gist), 2026.

Abstract

@Thorium
Thorium / gist:cd5f7f9a31da132798c5854496ec4405
Last active October 16, 2026 11:00
Windows StickyKeys off
/// The annoying Windows accessibility shortcuts ("Sticky keys"), switched off while the game has focus.
///
/// Usage: call `ShortcutKeys.sync ()` once per frame and
/// `ShortcutKeys.restore ()` when the game exits (in a `finally`).
module ShortcutKeys
open System
open System.Runtime.InteropServices
[<DllImport("user32.dll", EntryPoint = "SystemParametersInfoW")>]
@Thorium
Thorium / Program.fs
Created June 2, 2026 09:34
SQLProvider.Postgresql example
module Program
// ---------------------------------------------------------------------------
// Database setup (run once before building — SQLProvider reads this schema at
// COMPILE TIME). Run with psql, e.g.:
// psql -h localhost -U postgres -d postgres -f setup.sql
//
// CREATE TABLE IF NOT EXISTS demo_people (
// id SERIAL PRIMARY KEY,
// name TEXT NOT NULL,
@Thorium
Thorium / lord.js
Last active March 17, 2026 06:44
Legend Of The Red Dragon (L.O.R.D) ported to Zachtronics Last Call BBS.
// ============================================================================
// LEGEND OF THE RED DRAGON - QuickServe Edition
// A faithful recreation for Zachtronics Last Call BBS
// ============================================================================
// How to install: Copy the raw file to your servers folder.
// --- CONSTANTS ---
var SCREEN_W = 56;
var SCREEN_H = 20;

The Nature of "Now" (as Quantum Measurement)

There are structural parallels between quantum measurement and the experience of "now":

Property Quantum measurement The present moment
Selects one outcome from many Yes Yes
Irreversible Yes (wavefunction collapse) Yes (past becomes fixed)
Creates definite classical reality Yes Yes
The "before" is indeterminate Superposition Open future
@Thorium
Thorium / remarkable_and_md2pdf.fs
Created February 10, 2026 18:17
1) Script for downloading reMarkable PDFs from their cloud service, 2) Script to convert PDFs to Markdown (pdf2md) to be consumed e.g. by agents.
#!/usr/bin/env dotnet fsi
// =============================================================================
// reMarkable Cloud File Downloader and PDF to Markdown (pdf2md) - F# Script
// Based on the PHP ReMarkableAPI by splitbrain/remarkable-api
// This is to download reMarkable cloud files and convert them e.g. for agents to read.
// You'll need to add/use reMarkable device web-script (to get auth token).
// =============================================================================
//
// Usage:
// dotnet fsi remarkable-download.fsx register <one-time-code>
@Thorium
Thorium / a-common.sql
Created October 10, 2025 12:59
A few useful Microsoft SQL Server T-SQL function samples
-- A few useful Microsoft SQL Server T-SQL function samples
@Thorium
Thorium / ollama.fsx
Created October 2, 2025 14:11
Using local LLMs from F#
// Using local LLMs from F#
// Download and install Ollama: https://ollama.com/
// Ollama is a free common host for multiple different LLM-models
// like Google Gemma, OpenApi's GPT-OSS, Deepseek, etc.
#r "nuget:OllamaSharp"
open OllamaSharp
// For better Collections.Generic.IAsyncEnumerable<_> support for F#:
#r "nuget:FSharp.Control.TaskSeq"
open FSharp.Control
@Thorium
Thorium / Client.fsx
Created September 29, 2025 10:45
ModelContextProtocol with FSharp (MCP with F#)
#r "nuget: ModelContextProtocol,0.4.0-preview.1"
open ModelContextProtocol.Client
open ModelContextProtocol.Protocol
open System
open System.Threading.Tasks
module McpClient =
let clientTransport =
StdioClientTransport(
StdioClientTransportOptions(
@Thorium
Thorium / weightedAvg.fs
Created September 15, 2025 08:54
Takes a list of (quantity/amount and price/rate) as decimals, and gives a weighted average
/// Takes a list of (quantity/amount and price/rate) as decimals, and gives a weighted average
let weightedAvg mylist =
let weightedValue = mylist |> List.sumBy(fun (isum,irate) -> isum*irate)
let weightedSum = mylist |> List.sumBy(fun (isum,irate) -> isum)
match weightedSum with
| 0m<GBP> -> 0m
| x -> weightedValue / x