Skip to content

Instantly share code, notes, and snippets.

View tslmy's full-sized avatar

Ming tslmy

View GitHub Profile
@tslmy
tslmy / README.md
Created May 24, 2026 22:13
How expensive would a blur actually be?

The NEON rasterizer in neon_overlay.cpp is already the most taxing single pass in the pipeline. It runs only over the screen-space footprint of the dice — roughly 60,000–80,000 pixels per frame when several dice are in flight. Per batch of four pixels, the NEON path handles perspective-correct UV interpolation with two vector instructions, then falls back to scalar code for the texture fetch, tangent-space lighting, and framebuffer blend. Roughly ~20 floating-point operations per pixel, processed four at a time.

A separable Gaussian blur — the standard cheap blur — cannot skip empty pixels. It must iterate across the full framebuffer (750 × 560 = 420,000 pixels) in two passes (horizontal + vertical), reading $(2r+1)$ neighbor values per pixel per pass. For a radius-3 kernel (barely visible softening), that is 420,000 × 7 × 2 = 5.88 million memory reads plus the same number of multiply-accumulates. Expressed as "equivalent work" against the rasterizer:

$$\frac{420{,}000 \times 2(2r+1)}{80{,}000 \times 5}

@tslmy
tslmy / README.md
Created November 30, 2025 10:13
trying to get IOKit work for iOS 6.1

The framework I had to temper with is IOKit, for it didn't include header files by default:

darwin/Platform.c:30:10: fatal error: 'IOKit/IOKitLib.h' file not found
   30 | #include <IOKit/IOKitLib.h>
      |          ^~~~~~~~~~~~~~~~~~
darwin/Platform.c:30:10: note: did not find header 'IOKitLib.h' in framework 'IOKit' (loaded from '/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks')
9 errors generated.
@tslmy
tslmy / README.md
Last active October 13, 2024 02:32
Together AI API issue

Discovered this unexpected behavior while using Together AI as an OpenAI-compatible API with LlamaIndex:

        Settings.llm = OpenAILike(
            model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
            api_base="https://api.together.xyz/v1",
            temperature=0.1,
            api_key=api_key,
            is_function_calling_model=True,
@tslmy
tslmy / main.py
Created September 8, 2024 20:51
Use llama3.1's function-calling capability as a drop-in replacement for OpenAI LLM in LlamaIndex agents
#!/usr/bin/env python
import random
from llama_index.agent.openai import OpenAIAgent
from llama_index.core import Settings
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai_like import OpenAILike
from pydantic import Field
@tslmy
tslmy / main.py
Created March 26, 2024 05:02
Script to reproduce the neo4j dimensionality mismatch issue
from llama_index.core import (
Settings,
SimpleDirectoryReader,
StorageContext,
VectorStoreIndex,
)
from llama_index.legacy.vector_stores import Neo4jVectorStore
from llama_index.llms.ollama import Ollama
Settings.llm = Ollama(
@tslmy
tslmy / GitHubCheckHandler.py
Last active August 14, 2024 10:40
How to log messages from Python to GitHub as Checks within a Jenkinsfile
import logging
from datetime import datetime
from github import GitHubIntegration
class GitHubCheckHandler(logging.handler):
"""
A logging handler that sends messages to GitHub as a Check.
"""
@tslmy
tslmy / contract.yaml
Created October 15, 2022 06:59
OpenAPI 3.0 Contract of zgzgorg/iam-backend
openapi: 3.0.0
paths:
/account/approve_registers:
post:
responses:
"200":
description: approve accounts successful
"400":
description: approve accounts have some fails
summary: get account infomation from database
@tslmy
tslmy / build.gradle
Created September 16, 2022 19:09
To bump version numbers at release time with Gradle
plugins {
// The gradle-release plugin is designed to work similar to the Maven release plugin. (https://github.com/researchgate/gradle-release)
id 'net.researchgate.release' version '3.0.2'
}
@tslmy
tslmy / build.gradle
Created September 16, 2022 19:08
Gradle can simply read your Maven settings.xml for the credentials
plugins {
// Applies security defined for a repository in Maven's settings.xml file to MavenRepository elements in a Gradle build - both upload and download. (https://plugins.gradle.org/plugin/org.hibernate.build.maven-repo-auth)
id "org.hibernate.build.maven-repo-auth" version "3.0.4"
}
@tslmy
tslmy / settings.xml
Created September 16, 2022 19:08
Server authentication settings for Maven
<settings>
<servers>
<server>
<id>repo-for-snapshots</id>
<username>ming</username>
<password>{ABCDEFGHIJKLMNOP=}</password>
</server>
<server>
<id>repo-for-releases</id>
<username>ming</username>