Skip to content

Instantly share code, notes, and snippets.

@timlrx
timlrx / asqi_manifest.schema.json
Created August 21, 2025 06:25
asqi_manifest.schema
{
"$defs": {
"InputParameter": {
"description": "Defines a parameter that can be passed to the test container.",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"type": {
@timlrx
timlrx / asqi_score_card.schema.json
Created August 21, 2025 06:24
asqi_score_card.schema
{
"$defs": {
"AssessmentRule": {
"description": "Individual assessment outcome with condition.",
"properties": {
"outcome": {
"description": "Assessment outcome, e.g., 'PASS', 'FAIL', 'A', 'F'",
"title": "Outcome",
"type": "string"
},
@timlrx
timlrx / asqi_suite_config.schema.json
Created August 21, 2025 06:24
asqi_suite_config.schema
{
"$defs": {
"TestDefinition": {
"description": "A single test to be executed.",
"properties": {
"name": {
"description": "A unique, human-readable name for this test instance.",
"title": "Name",
"type": "string"
},
@timlrx
timlrx / asqi_suts_config.schema.json
Created August 21, 2025 06:24
asqi_suts_config.schema
{
"$defs": {
"SUTDefinition": {
"description": "A single System Under Test definition.",
"properties": {
"type": {
"description": "e.g., 'llm_api', 'rest_api'. Used to match with test container capabilities.",
"title": "Type",
"type": "string"
},
@timlrx
timlrx / run_workflow.py
Last active February 6, 2025 21:06
ComfyUI Execute Standalone Workflow
import json
import logging
import sys
import torch
from typing import Dict, Any, Optional, List, Set
from nodes import init_extra_nodes, NODE_CLASS_MAPPINGS
from comfy_execution.graph import DynamicPrompt, ExecutionList
from comfy_execution.caching import HierarchicalCache, CacheKeySetInputSignature, CacheKeySetID
from execution import validate_prompt, get_input_data, get_output_data, _map_node_over_list, ExecutionBlocker
@timlrx
timlrx / install-caddy.sh
Created June 10, 2024 02:29
Shell script to install caddy
#!/bin/bash
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
# Create a Caddyfile for reverse proxy
sudo tee /etc/caddy/Caddyfile > /dev/null <<EOF
@timlrx
timlrx / log.py
Created November 21, 2023 13:22
Pretty Python Logging
import logging
from rich.logging import RichHandler
logging.basicConfig(
level=logging.DEBUG,
format="%(message)s",
datefmt="[%X]",
handlers=[RichHandler(rich_tracebacks=True, omit_repeated_times=False)],
)
@timlrx
timlrx / extract-url-from-sitemap.js
Created April 21, 2023 02:52
Extract url from sitemap from browser console
// Extract the URLs from the sitemap on the current page
const urls = Array.from(document.getElementsByTagName("url")).map(url => url.getElementsByTagName("loc")[0].textContent.trim());
// Function to convert an array to a CSV string
function arrayToCSV(arr) {
return arr.map(row => row.join(",")).join("\n");
}
// Convert the URLs to a CSV string and log it to the console
const csv = arrayToCSV([["URL"], ...urls.map(url => [url])]);
@timlrx
timlrx / startup.sh
Created March 22, 2023 09:28
Shell script to install python (via pyenv), node (via nvm) and docker
#! /bin/bash
sudo apt-get update -y
# Basic packages
sudo apt-get install -y \
git \
apt-transport-https \
ca-certificates \
curl \
gnupg \
@timlrx
timlrx / toMotifFormat.js
Created April 22, 2021 09:34
neo4j to motif format
import Record from 'neo4j-driver/types/record';
export const buildNode = (n: any) => {
let node: Node = {
id: `node-${n.identity.toString()}`,
labels: n.labels[0],
};
if (n.properties) {
for (let [key, value] of Object.entries(n.properties)) {
node[key] = value instanceof Neo4j.types.Integer ? value.toInt() : value;