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,…
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…
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…
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…
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 )…
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…
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…
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.
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 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,…
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 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 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…
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…
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…
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…
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…
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…
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
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…
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
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
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…
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…
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 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 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…
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:
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: 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…
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
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…
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…
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…
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 ) (…
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…
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…
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…
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.
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.
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
I want to share what I’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.
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’t have to member all the black magic that a short…
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’s important to note that Gleam doesn’t have objects in the traditional sense. All data structures, including…
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…