Latest post

Mar 2, 2026, 00:07:43

I am using #Thunar as my #filemanager and #Ghostty as my #terminal. One thing that bugs me is that clicking "open terminal here" in Thunar opens Ghostty in the default working directory instead. I just fixed this today by changing the command to `TERM_PROGRAM=dumb exo-open --working-directory %f --launch TerminalEmulator`, i.e., adding an environment variable `TERM_PROGRAM`. The value does not matter, but it has to have some value for exo-open to work. No idea why.

follow me on Mastodon

Articles

  • Writing a DSL with commands split by space

    Article cover image with no practical usageDSL means domain-specific language. Ruby is a powerful script language in terms of building DSLs (as sublanguages of Ruby). In this article, I implemented my idea of a DSL with commands split by space. For example, you may just write a b c to run the commands a, b, and c one after another! This trick is heavily applied in my project alda-rb. How do I achieve this?

  • Running Jekyll myself

    Article cover image with no practical usageI have got tired of letting GitHub Pages to run Jekyll for me. I cannot use custom plugins! I decide to run Jekyll myself and push the built result to GitHub repo. I wrote a script to do this.

  • Algebraic structure of chemicals

    Article cover image with no practical usageRegarding balancing chemical equations, actually we are trying to find a non-trivial linear combination of some chemicals to get zero. The interesting thing is that the coefficients can only be integers (Z\mathbb Z), which is not a field, so the algebraic structure of chemicals is not linear space. They actually live in a free Z\mathbb Z-module. See how I formalize this idea in mathematical language.

  • The concentration change of gas in reversible reactions

    Article cover image with no practical usageA reversible elementary reaction takes place inside a closed, highly thermally conductive container of constant volume, whose reactants are all gases. Given the reaction equations and the reaction rate constants, a natural question to ask is how the concentration of each gas changes w.r.t. time. In this article, I will answer this question by proposing a general approach to solve it.

  • Snippet: O, ’tis too true!

    Article cover image with no practical usageO, ’tis too true!

  • The structure of a basic RM game

    Article cover image with no practical usageIn this article, I present minimal examples of a RM game. They only illustrate the basic concepts of how a RM game is structured and what is the running logic of it.

  • The frequency assignment of musical notes

    Article cover image with no practical usageThis article explores the concept which I call the frequency assignment, which is a mapping from NN (the set of notes) to R+\mathbb R^+ (the set of frequencies). Concepts such as octaves, intervals, and equal temperaments are introduced.

  • Normal vectors of a scalar field

    Article cover image with no practical usageThis article gives the formula for the normal vectors of a surface defined by a scalar field on Rn\mathbb R^n. The normal vector of the graph of the function y=f ⁣(x)y=f\!\left(\mathbf x\right) at (x0,f ⁣(x0))\left(\mathbf x_0,f\!\left(\mathbf x_0\right)\right) is (f ⁣(x0),1)\left(\nabla f\!\left(\mathbf x_0\right),-1\right). This also provides us a way to recover a scalar field from the normal vectors of its graph: normalizing the vectors so that the last component is 1-1, and then integrate the rest components.

  • It is Feb 29 today!

    Article cover image with no practical usageIt is Feb 29 today. The date appears once for as long as 4 years!

  • Monkey-patching graciously

    Article cover image with no practical usageMonkey-patching is a powerful tool in programming. In this article, I used techniques of Ruby metaprogramming to define a series of methods def_after, def_before, etc. to help monkey-patching. They look graciously in that we can use it to shorten the codes for monkey-patching (avoiding aliasing and repeating codes).

subscribe via Atom