RSSAmplifier

Blog

Home on Away From Keyboard

Recent content in Home on Away From Keyboard

nohzafk.github.ioRSS feed ↗126 posts

Latest posts

从 Mac mini 到 iPhone:把 Obsidian AI 守门员迁到 Open Minis 的完整实践

我的 Obsidian 知识库靠一个"AI 守门员" ( Obsidian Gatekeeper )打理:新笔记自动分类、打标签、提炼概念( High-Order Notes / HON ),以及做语义检索。这套系统最初跑在一台远程 Mac mini 上——Node.js 服务 + better-sqlite3 + sqlite-vec 向量扩展,手机端每次整理都要跨网络调它。 好用,但有代价。后来我把整条链路搬进了 iPhone 上的 Open Minis——一个内置 iSH ( Alpine Linux )终端环境的 AI 助手 App :原生编译向量扩展、用纯 Python 标准库写检索工具、把守门员规则注册进 Agent 技能系统让新会话也能自动识别。本文记录这次迁移的完整路径,分三步走,你可以在自己的设备上照着复现。 为什么迁:远程守门员的三个痛点 旧架构的核心问题,一句话概括:…

什么语言最适合 LLM 生成代码?数据、迷思与我的 Lisp 体验

网上一直流传一个说法:动态语言比静态语言更适合 LLM 写代码,因为省略类型声明让代码更紧凑、更省 token 。最常被引用的数据是 Alderson 的一个 eval : Clojure 平均 109 tokens 就能解一道题, J 只要 70 ,而 C 要 2.6 倍。 Google 的 AI 摘要甚至直接把这个结论当作常识输出。 我一开始也信了。直到认真读了 Dan Luu 的反驳研究 ,再对照自己用 elle-lisp 、 emacs-lisp 给 LLM 写代码的亲身经验,才发现这个结论远没有表面那么干净。 玩具题陷阱: 70 个 token 能写完的题,不是题 Dan Luu 指出了流传 eval 的根本问题: 题目太 trivial 了 。一个 J 用 70 tokens 、 Clojure 用 109 tokens…

A Floating HUD for Emacs with xwidget-webkit and egui

Emacs has an unusually flexible UI, but most of that flexibility still lives inside a rigid layout model. Buffers, windows, side windows, mode lines, minibuffers, and popups all compete for the same rectangular grid. Everything you see is, in the end, a region of that grid. I wanted to try a different shape. Not another buffer fighting for space, but a small floating HUD pinned to the Emacs frame,…

Why My Mermaid Arrows Disappeared in Emacs

I’m building a real-time Mermaid preview for Markdown in Emacs. The idea is straightforward: grab a fenced Mermaid block, pipe it through mmdflux , get SVG back, and display it inline in the buffer. It almost worked on the first try. Nodes rendered. Labels rendered. Edges rendered. But the arrowheads were gone. The Broken Diagram This block should obviously have arrows: flowchart LR…

Claude Code Output Style: Ops Room

I like to read agent output, but the default style talks too much. Every response starts with an apology or a promise. “I’d be happy to help,” “let me take a look,” “great question.” None of that moves me forward. I skip it every time. So I wanted something brief. But pure brevity has its own problem, the agent moves faster than I read. If it compresses everything, I lose the thread. I stop…

What I've Learned Writing Gleam

Coming from Python, picking up Gleam required a fundamental shift in how I approach writing code. It’s not just learning new syntax—it’s adopting a different mental model. Here’s what clicked for me after spending time with the language. Think in Function Signatures First In Python, I often dive straight into implementation. I’ll start typing the function body and figure…

Previewing Markdown in Emacs with grip-mode

Emacs’s markdown-mode offers several preview options, but finding one that “just works” took some exploration. The xwidget-webkit Approach My first attempt used markdown-live-preview-window-function with xwidget-webkit—Emacs’s embedded WebKit browser. The idea: render markdown to HTML and display it in a split window. ( defun my/markdown-live-preview-window-xwidget ( file )…

How I Use CLI2ELI to Streamline Text Transformation in Emacs

I frequently work with escaped SQL strings from API logs and debugging sessions. The typical workflow involved copying the string, finding an online unescaper, pasting, copying the result, then finding a SQL formatter, pasting again… you get the idea. Too many context switches. I wanted something like M-| (shell-command-on-region) but with predefined commands I could invoke by name. CLI2ELI made…

Integrating rumdl with Emacs A Fast Markdown Formatter via Apheleia

Markdown files deserve the same format-on-save treatment we give to code. I recently integrated https://github.com/rvben/rumdl , a Rust-based markdown linter, into my Emacs setup using Apheleia. Here’s what I learned. Why rumdl? rumdl is fast—benchmarks show it processing 478 markdown files in under a second. It implements 54 lint rules, supports automatic fixing, and provides stdin/stdout…

Multi-Agent AI Orchestration When It's Worth It (And When It Isn't)

I recently explored an interesting architecture pattern: using Claude Code to invoke Gemini CLI for large codebase analysis. The idea was compelling—combine Claude’s superior instruction-following with Gemini’s massive context window. Gemini reads everything, Claude thinks and acts. reddit post After building it out, I deleted it. Here’s what I learned.

Configing Ghostty Font and Color to match WezTerm

Rendering After years of using WezTerm, I decided to try Ghostty—the new GPU-accelerated terminal that’s been generating buzz. The installation was simple enough, but getting it to look like my carefully tuned WezTerm setup turned into a journey through terminal rendering differences. Here’s what I learned, and the configuration that finally got Ghostty looking right (almost). The…

teaching claude code to use ast-grep

Teaching Claude Code to Use ast-grep I wanted Claude Code to understand the difference between searching for code structure and searching for plain text . That meant teaching it when to reach for ast-grep instead of ripgrep —and to make that decision automatically. This is how I taught it to do that. Figuring Out the Right Tools Claude Code can be extended in several ways—skills, commands, hooks,…

The Dead Ends That Shaped My Obsidian System

Before arriving at a clean, stable setup in #Obsidian, I went through a long phase of experimentation. I tried to make it everything at once — a note-taking tool, an archive library, a task tracker, a project manager, even a reading queue. Most of those ideas didn’t last. Some sounded clever but created friction in the wrong places. Others blurred the purpose of the tool entirely. Over time,…

Note Taking Philosophy

Note Note format is important, use proper template to provide insights. Write learning note using your own words, for the mind to digest material.! DO NOT copy and paste, otherwise you are not learning and thinking, only collecting information. “If you’re thinking without writing, you only think you’re thinking.” — Leslie Lamport Adopt atomic note philosophy. When…

Per-Display Layout Configuration in Yabai Using spacespy

Per-Display Layout Configuration in Yabai Using spacespy The Problem When running yabai with multiple displays, you often want different layouts per screen: Built-in laptop display : Stack layout (one window at a time) External displays : BSP tiling (multiple windows side-by-side) The challenge? yabai -m query --displays gives you display indices but doesn’t tell you which is the built-in…

Checkpointing Conversations with Claude

2025-11-11-checkpointing-conversations-with-claude When I’m deep in a long Claude session, I use what I call a checkpoint strategy. It’s basically a conversational anchor. Let’s say Claude throws out a list of ideas or questions. Before diving into one of them, I’ll drop a quick line like: Use this as Checkpoint A for our conversation — when we come back, track the…

Authentication and Permission Logic in Django Rest Framework ViewSets

In django rest framework, a ViewSet class can have an authentication_classes with multiple authentication backend and a permission_classes with multiple permission backends. For the authentication backends, it is a OR relation, meaning one authentication backend returns None , the framework will try next backend. But for permission backends, it is a AND relation, meaning all permission backends…

django-migration-notes

Notes about Django migration generated SQL I have recently transitioned a service from Flyway to Django-migration based database management. To ensure a smooth data migration process, I need to verify that the Django-migrations generated DDL is compatible with the existing one. pytest-django: how to create empty database for test cases I am using pytest with the pytest-django plugin to write unit…

read file content in Gleam

To my surprise when you search for gleam read file in google, they are not much helpful information in the first page and no code example. There are a post in Erlang Forums where the author of Gleam language pointed to a module that no longer exists in gleam_erlang pacakge, and a abandoned pacakge call gleam_file, and a couple pacakges like simplifile . It turns out that Gleam has excellent FFI…

Django gRPC workflow

2025-02-19-django-grpc-workflow Django-socio-grpc (DSG) is a framework for using gRPC with Django. It builds upon django-rest-framework (DRF), making it easy for those familiar with DRF to get started with DSG. Although I decided to go back to DRF after exploring DSG, I chose to do so because I needed to get things done quickly. Using gRPC is considered a potential way to achieve performance…

Notes about list library in Gleam

Gleam language: how to find the min element in a list Gleam language standard library has a list.max to find the maximum element in a list, but to my surprise it doesn’t provide a counterpart list.min function, in order to do that, you have to use compare function with order.negate

Merge into main, but rebase feature branches

This git principle advocates for a workflow that balances a clear main branch history with efficient feature development. 1. Merge into main : Purpose: Keeps the main branch history clean and linear in terms of releases and major integrations. How it works: When a feature is complete and tested, it’s integrated into main using a merge commit . This explicitly marks the point in time when the…

Fall of the comets

Original code from @XorDev vec2 p=(FC.xy-r*.5)/r.y*mat2(8,-6,6,8),v;for(float i,f=3.+snoise2D(p+vec2(t*7.,0));i++

Python Integer Hashing

TIL Python use the integer itself as the hash value, except for -1. hash value for -1 is -2. # For ordinary integers, the hash value is simply the integer itself (unless it's -1). class int : def hash_ ( self ): value = self if value == - 1 : value == - 2 return value source

Avoiding Offensive Strings in Random Name Generation

Some practice for avoiding bad words when generating “random” string: k8s removes vowels and 0, 1 and 3 when generating random string for resource name: Kubernetes pod naming convention - Stack Overflow Nix store hashes don’t use the letters e, o, u, t. edolstra phd-thesis

Enhanced Auto-venv for Fish Shell

Auto-venv is a Fish shell script that automatically activates and deactivates Python virtual environments when entering/leaving directory that contains virtual environment. Recently, I added multiple enhancements compare to the upstream version, now it handles edge cases more gracefully: It safely manages virtual environment inheritance in new shell sessions. It prevents shell exits during the…

Always use Wezterm from Applications

A raycast script command to start lowfi I recently create a Raycast script command to start the lowfi command effortlessly, so I can enjoy the lowfi music in no time and control it just using keyboard. Here is the gist , just place the lowfi.sh to the Raycast Script Directory . Run it the first time, a wezterm window will be created if lowfi process isn’t running, run it the second time, the…

Integrating Mermaid with Hugo Configuration

To add Mermaid support to Hugo, one key detail not explicitly covered in the official documentation is that code fences must be used to enable rendering hooks for code blocks. If code fences are not enabled, the rendering hook has no effect. Additionally, the condition for including Mermaid.js does not function as expected. Despite trying multiple approaches, I was unable to make it work reliably…

Notes on OAuth 2.0

Notes on OAuth 2.0 OAuth 2.0 is an open authorization framework that allows applications to access resources on behalf of a user, without exposing the user’s credentials. It enables secure access by providing access tokens for API requests, facilitating delegated permissions across services. Security: Tokens never exposed to browser Session cookie only contains session ID Session cookie…

programming concepts in SQL

Programming concepts in SQL CTEs (Common Table Expressions) as Variables/Functions Just like how you declare variables or functions in traditional programming, CTEs let you create named result sets that you can reference later Each CTE can be thought of as storing an intermediate result, similar to variable assignment They can be chained together like function calls, where one CTE uses results…

refreshing SQL skills

Recently I refreshed my SQL knowledge, and finished Learn Advanced SQL Tutorials | Kaggle . Highly recommend the Analytic Functions Exercise Section. I want to share some of my notes and the materials I used. This is going to be a long post. There are some topics that developers should be familiar with, even if they don’t work on database directly. There topics are:

Mocking Best Practices

The best approach to mocking is to mock the object where it is used, not where it is defined. - {= Why your mock doesn’t work | Ned Batchelder }

build your own workflow

Build Your Own Workflow: Automating Tasks for Efficiency Emacs is all about tailoring the text editor to fit your own needs, and Lisp program language is all about building the right abstraction for the problem. After years of using Emacs/writing Emacs lisp, one lesson stands out: whenever you find yourself repeating a task, it’s time to build your own tools and create a personalized…

NotebookLM

NotebookLM: A Helpful Tool for Passive Learning In my opinion, Google’s NotebookLM is a very useful tool. It’s great at turning information from high-density format into low-density, easier-to-understand one, which helps with passive learning. Take podcasts, for example—while they don’t pack as much information as books or articles, our brains are naturally tuned to language. By…

ChatGPT CO-STAR Prompt Optimizer Tool

I wrote an LLM prompt generator/optimizer ChatGPT - CO-STAR Prompt Optimizer base on How I Won Singapore’s GPT-4 Prompt Engineering Competition | by Sheila Teo | Towards Data Science

iOS Safari Web Console with Scriptable and Eruda

How to Open the Web Console in iOS Safari with Scriptable and Eruda Sometimes I just want to quickly inspect a webpage on my phone without needing a desktop browser. Unfortunately, iOS Safari doesn’t come with built-in developer tools. But, I found a way around it by combining Scriptable and the web console library Eruda - Console for Mobile Browsers | Eruda Here’s how you can do it…

Cheap and Capable `gpt4o-mini` Boosts Input Quality

API price for gpt4o-mini is very cheap yet the model is very capable, it is basically a nearly-free boost for the input quality for larger [[LLM]] models. Here is a prompt I used Enhance the following text to improve its quality for processing by a larger language model: 1. Correct any grammatical or spelling errors. 2. Improve sentence structure and flow. 3. Clarify any ambiguous or vague…

Game of Life in Threejs using WebGL

This Game of Life uses threejs to utilize GPUs. Implemented by Claude Sonnet 3.5 in 5 minutes. Update Grid Size Reset Step Pause

easy config for org-mode preview latex

It’s so pleasant to use [[nix]] to install and config complex software packages. Here is how to make emacs org work with latex config-latex.nix # https://nixos.wiki/wiki/TexLive # For a minimal set of packages needed for Emacs Orgmode { pkgs , lib , ... }: let tex = ( pkgs . texlive . combine { inherit ( pkgs . texlive ) scheme-basic dvisvgm dvipng # for preview and export as html wrapfig…

org src-block execute pytest

I recently wanted to practice some LeetCode and write documents and code in an org file. To quickly test the code, I wanted to use {#C-c C-c} on a src-block to run pytest . I created this snippet to enable that functionality. ( after! org ( defun org-babel-execute:python-with-pytest ( body params ) 'Execute a python source block with pytest if :pytest is specified.' ( if ( assq :pytest params ) (…

transducer

Introducing Transducers: A Powerful Tool for Functional Programming I recently learned the concept of transducer and implement it in [[Gleam]] language. GitHub - nohzafk/gtransducer: Transducer in Gleam language Transducers originated in Clojure, designed to tackle specific challenges in functional programming and data processing. If you’re working with large datasets, streaming data, or…

Minimum Probability and Temperature

LLM Sampling Techniques: Minimum Probability and Temperature Minimum Probability Sampling Definition Minimum probability sampling is a technique used in language model APIs to balance between diversity and coherence in the model’s output. How it works Sets a dynamic threshold for token selection based on the probability of the most likely token. The threshold is a fraction (determined by the…

Common pitfalls in Python

Python is a great language but not perfect. There are some common pitfalls, many of these are legacy issues retained for backward compatibility. I want to share some of them. Global Interpreter Lock (GIL) It’s 2024, but Python still struggles with multi-core utilization due to the Global Interpreter Lock (GIL). The GIL prevents multiple native threads from executing Python bytecode…

Prompt caching with Anthropic API

Anthropic AI just announced prompt caching What Prompt caching is a feature that allows developers to efficiently use large amounts of context or instructions in repeated API calls to Claude. While the entire prompt (including cached content) is sent with each request, the cached portion is processed more efficiently and charged at a reduced rate after the initial setup.

Centering Emacs Minibuffer with Perfect-Margin

I use Emacs with Vertico for completion and want to center the minibuffer content on my large monitor to avoid constantly looking at the left corner. After trying various solutions unsuccessfully, I finally found GitHub - mpwang/perfect-margin: [emacs] auto center emacs windows, work with minimap and/or linum-mode , which allows me to set the minibuffer margin effectively.

Custom Google Search Template in Obsidian

Nowadays I start a research of topic by writing a note on [[Obsidian]]. I use this template for Introduction - Templater to insert a link to start the search in Google app. [google search](google://search?q=<% tp.user.z_encode(tp.file.title) %>) this require a javascript file for user function, set Script file folder location to templates/js

focus on concrete problem

I want to share what I&rsquo;ve learned while porting The Little Learner from Racket to Gleam . I will compare some Racket code with Gleam. Gleam is a simple functional programming language. Checkout this great article why simple programming language matters.

abbr, don't alias

after reading When An Alias Should Actually Be An Abbr | sean henderson I completely abandon using alias in fish shell , use abbr ever since. abbr will expand the command into what it shorts for, before pressing enter to execute it. For me the biggest advantage is that when searching the shell history there is no hidden complexity , you don&rsquo;t have to member all the black magic that a short…

using record as dict key in Gleam

Records in Gleam: Comparison and Uniqueness Record Comparison In [[Gleam]], records are compared by value (deep nested comparison), which can present challenges when using them as dictionary keys, unlike in some other functional languages. Records are Compared by Value It&rsquo;s important to note that Gleam doesn&rsquo;t have objects in the traditional sense. All data structures, including…

Layers of Computation in Machine Learning

This is my thought about the layers of computation in Machine Learning while porting The Little Learner to Gleam . Bit-Level Representation : At the lowest level, data is stored as bits in memory. However, direct manipulation at this level is rarely necessary in modern ML. I learned how flat binary tensors are represented in memory and how to manipulate bit arrays for performing arithmetic…