Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / gud-auto-center-source-buffer.el
Created April 25, 2026 23:36
emacs gdb auto-center source buffer around current line
;; references:
;;
;; * https://superuser.com/a/118138
;; * https://superuser.com/a/1680006
;; * http://kousik.blogspot.com/2005/10/highlight-current-line-in-gdbemacs.html
(defadvice gud-display-line (after my-gud-display-line-center activate)
;; true-file is an argument to the original function
(let* ((buffer (gud-find-file true-file)))
(save-excursion
(with-selected-window (get-buffer-window buffer)
@sogaiu
sogaiu / notes.md
Created April 25, 2026 04:03
janet near far regalloc
JanetSlot janetc_value(JanetFopts opts, Janet x) {
    JanetSlot ret;
    JanetCompiler *c = opts.compiler;
    // ...
    /* Special forms */
    if (spec) {
        const Janet *tup = janet_unwrap_tuple(x);
        ret = spec->compile(opts, janet_tuple_length(tup) - 1, tup + 1);
@sogaiu
sogaiu / gist:ca62b9d09d810a1ae3a8ddcc701caccc
Last active April 21, 2026 10:26
emacs and tree-sitter compatibility(?) issue
* compiling emacs 30.2 with too recent of a tree-sitter version (0.26.x?) may cause issues with existing
queries.
* https://gitlab.archlinux.org/archlinux/packaging/packages/emacs/-/work_items/13
* https://github.com/emacs-mirror/emacs/commit/b01435306a36e4e75671fbe7bacea351f89947d5
Number Opcode Name Signature Arity Type Bytes Description
0 JOP_NOOP noop (noop) 0 JINT_0 Does nothing.
1 JOP_ERROR err (err message) 1 JINT_S A Throw error $message.
2 JOP_TYPECHECK tchck (tchck slot types) 2 JINT_ST A:E Assert $slot matches types
3 JOP_RETURN ret (ret val) 1 JINT_S D:A Return $val
4 JOP_RETURN_NIL retn (retn) 0 JINT_0 A Return nil
5 JOP_ADD_IMMEDIATE addim (addim dest lhs im) 3 JINT_SSI B:CS:A $dest = $lhs + im
6 JOP_ADD add (add dest lhs rhs) 3 JINT_SSS B:C:A $dest = $lhs + $rhs
7 JOP_SUBTRACT_IMMEDIATE subim (subim dest lhs im) 3 JINT_SSI B:CS:A $dest = $lhs - im
8 JOP_SUBTRACT sub (sub dest lhs rhs) 3 JINT_SSS B:C:A $dest = $lhs - $rhs
@sogaiu
sogaiu / clojure-ts-mode-extras.el
Last active April 7, 2026 15:01
"some option to infer the closing parentheses before it gets passed to whatever tree representation this mode is operating on"
;; from: https://github.com/clojure-emacs/clojure-ts-mode/issues/134#issuecomment-4178337890
;; by: https://github.com/sstraust
;; the thought is to temporarily insert the parens just before sending to
;; treesitter, and then remove them so they don't impact the user's working
;; buffer
(defun treesitter-parens--compute-closing-chars ()
(save-excursion
(save-restriction
@sogaiu
sogaiu / notes.md
Last active March 27, 2026 03:16
trying out clj-android sample

steps

jdk, android sdk, etc.

  • make sure jdk 21+ (<26) is installed
    $ java --version
    openjdk 21.0.10 2026-01-20
    OpenJDK Runtime Environment (build 21.0.10+7-Ubuntu-124.04)
    OpenJDK 64-Bit Server VM (build 21.0.10+7-Ubuntu-124.04, mixed mode, sharing)
    
@sogaiu
sogaiu / notes.md
Last active March 16, 2026 12:56
slm (zero-attribution) + rag (common corpus code or similar)

it looks like there have been attempts to use small language models with retrieval augmented generation. here is one such effort from 2024 that seems to have had some level of success.

perhaps it's possible to train a small language model on a subset of code that does not require attribution for reuse (e.g. 0-clause bsd, mit no attribution, etc. [1]) and then to have it work with a much larger body of code (i.e. include stuff that requires attribution) via retrieval augmented generation.

the idea is not to replicate the full capabilities of what major dark boxen provide atm, but rather to see what is possible. it would be interesting to see what kinds of tasks this sort of thing could be useful for. i think at least from the legal and ethical perspectives, one might be in the clear because the parts that would require attribution would be traceable [2].


[1] i know there isn't as much of this kind of thing compared to stuff that requires attribution.

2025-12-31

  • Writer Ted Chiang on AI and grappling with big ideas - Avery Keatley, Scott Detrow, Patrick Jarenwattananon
  • ChatGPT Is a Blurry JPEG of the Web - Ted Chiang - version archived elsewhere as original is paywalled

    In 2013, workers at a German construction company noticed something odd about their Xerox photocopier: when they made a copy of the floor plan of a house, the copy differed from the original in a subtle but significant way. In the original floor plan, each of the house’s three rooms was accompanied by a rectangle specifying its area: the rooms were 14.13, 21.11, and 17.42 square metres, respectively. However, in the photocopy, all three