Skip to content

Instantly share code, notes, and snippets.

View ngxson's full-sized avatar
🫠
My brain is melting (will be slow to reply)

Xuan-Son Nguyen ngxson

🫠
My brain is melting (will be slow to reply)
View GitHub Profile
@ngxson
ngxson / webgpu-result.log
Created May 30, 2026 23:52
webgpu test-backend-ops
<details>
<summary>Logs</summary>
<!-- Copy-pasted short logs go into the "console" area here -->
```console
Running test-backend-ops with args: -o MUL_MAT
Multithread enabled: false, pthreadPoolSize: 0
Loading "wllama.wasm" from "http://localhost:8080/compat/wasm/wllama.wasm"
ggml_webgpu: adapter_info: vendor_id: 0 | vendor: apple | architecture: apple | device_id: 0 | name: apple | device_desc: apple
Using async file read
@ngxson
ngxson / test_header.py
Created May 29, 2026 19:33
llama.cpp test timing http header
#!/usr/bin/env python3
import http.client
import json
import time
HOST = "127.0.0.1"
PORT = 8080
URL = "/v1/chat/completions"
payload = json.dumps({
@ngxson
ngxson / esphome_doorlock_interphone.yaml
Created August 29, 2025 11:37
ESPHome door lock + interphone demo
# NOTE: wifi configs are not included
esphome:
name: # you name it
comment: # you name it
esp32:
variant: esp32
switch:
@ngxson
ngxson / convert_smolvlm.sh
Last active April 21, 2025 18:55
Convert SmolVLM to GGUF and push to HF hub
#!/bin/sh
convert_and_upload() {
local src_user=$1
local src_model=$2
local has_q4=$3
local base_name=$src_model
target_model="$src_model-GGUF"
target_repo="ggml-org/$target_model"
@ngxson
ngxson / non-stream.txt
Created February 4, 2025 19:24
deepseek test API
{
"id": "00588a81-fd5a-448a-b1c6-5af879f7b2bf",
"object": "chat.completion",
"created": 1738697055,
"model": "deepseek-reasoner",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
@ngxson
ngxson / FAQ.md
Last active August 5, 2025 17:29
convert ARM NEON to WASM SIMD prompt

Why did you do this?

Relax, I only have one Sunday to work on idea, literally my weekend project. So I tried Deepseek to see if it can help. Surprisingly, it works and it saves me another weekend...

What is your setup?

Just chat.deepseek.com (cost = free) with prompts adapted from this gist.

Does it work in one-shot or I have to prompt it multiple times?

@ngxson
ngxson / test_processor.ipynb
Last active January 20, 2025 10:19
Test Processor
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ngxson
ngxson / make_fim_model.py
Created October 24, 2024 11:16
generate dummy model FIM
import gguf
def decode_field(field: gguf.ReaderField):
if field and field.types:
main_type = field.types[0]
if main_type == gguf.GGUFValueType.ARRAY:
sub_type = field.types[-1]
if sub_type == gguf.GGUFValueType.STRING:
@ngxson
ngxson / snake_functional.html
Last active July 22, 2024 20:32 — forked from straker/README.md
Basic Snake HTML and JavaScript Game - written in Functional programming style
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>Basic Snake HTML Game (Functional programming)</title>
<meta charset="UTF-8">
<style>
html, body {
height: 100%;
margin: 0;
import logging
import argparse
import contextlib
import json
import os
import re
import sys
import numpy as np
import math
import torch