Skip to content

Instantly share code, notes, and snippets.

@LCamel
LCamel / Load2.hs
Created February 26, 2026 06:59
Load2.hs
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
module Server.Load2 where
import Data.IntMap (IntMap)
import Data.Text (Text)
import Error (Error (..))
import GCL.Predicate (Hole, PO, Spec)
import GCL.Range (Range)
@LCamel
LCamel / a.sh
Last active February 9, 2026 16:32
xpra
cp -rL /usr/share/xpra $HOME/xpra_copy
sed -i 's/getboolparam("swap_keys", Utilities\.isMacOS())/getboolparam("swap_keys", false)/' \
"$HOME/xpra_copy/www/index.html"
xpra start --bind-tcp=0.0.0.0:8080 --html=$HOME/xpra_copy/www --start=emacs-lucid
@LCamel
LCamel / 0.txt
Last active January 30, 2026 02:59
GCL early load
% grep Trace /tmp/a.txt
[Trace - 2:45:29 AM] Sending request 'initialize - (0)'.
[Trace - 2:45:29 AM] Received response 'initialize - (0)' in 7ms.
[Trace - 2:45:29 AM] Sending notification 'initialized'.
[Trace - 2:45:29 AM] Sending notification 'textDocument/didOpen'.
[Trace - 2:45:29 AM] Sending request 'gcl/reload - (1)'.
[Trace - 2:45:29 AM] Received request 'client/registerCapability - (1)'.
[Trace - 2:45:29 AM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 2:45:29 AM] Sending notification 'workspace/didChangeConfiguration'.
[Debug] VFS: opening file:///workspaces/gcl[Trace - 2:45:29 AM] Received request 'workspace/configuration - (2)'.
@LCamel
LCamel / keybindings.json
Created January 15, 2026 13:43
VS Code terminal key mapping: user_data_dir/User/keybindings.json
[
{
"key": "shift+enter",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u001b\r"
},
"when": "terminalFocus"
}
]
@LCamel
LCamel / yt_thumb.sh
Created January 15, 2026 13:38
yt_thumb.sh
#!/bin/bash
# Usage: ./yt_thumb.sh VIDEO_ID [WIDTH] [OUTPUT_FILE]
# Example: ./yt_thumb.sh hcx0SSvk7zg 480 thumbnail.jpg
VIDEO_ID="$1"
WIDTH="${2:-}"
OUTPUT="${3:-yt_thumb_${VIDEO_ID}.jpg}"
if [ -z "$VIDEO_ID" ]; then
@LCamel
LCamel / a.md
Created November 21, 2025 09:55
GCL line column offset Loc Range coordinate

如果我們把 Lexer.hs 中的 translateLoc 和 update 改成

import Debug.Trace (trace)
...

    translateLoc (TsToken (L loc x) rest) = TsToken (L (update' loc x) x) (translateLoc rest)
      where
        update' NoLoc x = NoLoc
        update' before@(Loc start (Pos path l c co)) x = result'
          where result = Loc start (Pos path l (c + 1) (co + 1))
@LCamel
LCamel / discuss.txt
Created October 19, 2025 12:51
vscode haskell extension / ghcup
╭─── Claude Code v2.0.22 ─────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back LCamel! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ ▐▛███▜▌ │ Recent activity │
│ ▝▜█████▛▘ │ No recent activity │
│ ▘▘ ▝▝ │ │
│ │ │
│ Sonnet 4.5 · Claude Pro │ │
│ /Users/lcamel/vc/vscode-haskell │
@LCamel
LCamel / hls.py
Created October 19, 2025 12:31
find hls by ghc version
#!/usr/bin/env python3
# % python3 hls.py 9.8.4 | grep -i Unknown
# "2.10.0.0", "A_64", "Linux_UnknownLinux"
# "2.10.0.0", "A_ARM64", "Linux_UnknownLinux"
# "2.11.0.0", "A_64", "Linux_UnknownLinux"
# "2.11.0.0", "A_ARM64", "Linux_UnknownLinux"
import sys
import json
LoopInvariant (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 1 0) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 2 1)) (Lit (LitBool True /workspaces/gcl-all/gcl-vscode/example/bug.gcl [2-6] 1:3-7)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 7 6) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 8 7)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 9 8) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 12 11)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 12 11) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 13 12)) (Lit (LitInt 0 /workspaces/gcl-all/gcl-vscode/example/bug.gcl [13-14] 1:14-15)) (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 16 15) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 1 17 16)),Do (Token (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 2 1 17) (Pos "/workspaces/gcl-all/gcl-vscode/example/bug.gcl" 2 3 19)) (Head (GdCmd (Lit (LitBool False /workspaces/gcl-all/gc
@LCamel
LCamel / 0_fail.js
Last active August 7, 2025 21:53
mutual recursion
var MkIsOdd = (other) => ( (x) => x == 0 ? false : other(x - 1) );
var MkIsEven = (other) => ( (x) => x == 0 ? true : other(x - 1) );
// // doesn't work: isEven is undefined
// var isOdd = MkIsOdd(isEven), isEven = MkIsEven(isOdd);
// // the line above will be translated to something like:
var isOdd = undefined;
var isEven = undefined;
isOdd = MkIsOdd(isEven); // doesn't work: isEven is undefined
isEven = MkIsEven(isOdd);