racket

Origin link 2024-3-17

 racket is one of scheme dialect and I want to use racket to learn "the litte schemer". One of problem I meet is how to load file with scheme code (not racket code) into REPL and run relate function. In guile, it is very simple: guile -l my_function.scm. but in racket, it is little complex.

 it could work "racket -if <my_function.scm>" but my_function.scm should not start with "#lang racket". it is same with load function
Racket has concept of module, every file is module and each module need "initial-module-path" which is "The #lang at the start of a module file begins a shorthand for a module form"

First, like import in python, you could use (require my_function.scm) in source code and "-t " in command line to import a module, but you need to list which function is export by (provide function) in my_function.scm, or (provide (all-defined-out)) to export all functions. 

 -t <file>, --require <file> Like -e '(require (file "<file>"))' [*]

Another trick point is you need "racket -i -t my_function.scm" instead of "racket -t  my_function.scm -i". I don't know why but I guess it is related to "If -t/-l/-p/-u appears before the first -i/-e/-f/-r, -n is added".

Second, you could config initial-module in command line with "racket -I typed/racket" (#lang typed/racket in source code). The magic of of initial-module-path is you could define a new language with different syntax.

Third, you could always start "racket -i" and use ",enter my_function.scm" or "racket -i -e '(enter! "my_function.scm")'" to go to my_function namespace.

git remote repository with bare

Origin link 2023-12-1

 if you want a remote repository and put local source into remote, you need to set up remote repository with  "git init bare . ", not "git init ."

link1, link2


xmlrpc on rtorrent

Origin link 2023-11-24

rotorrent could use xmlrpc to send command remotely without any ui interface.

WSL with gpu accelerator and webgpu

Origin link 2023-11-24

GPU accelerator on WSL need WDDM 2.9 (link ). Windows 10 support WDDM from 20H2 (link) but Intel driver only support WDDM > 2.9 from Windows 11 (link). You could use "dxdiag" to check WDDM version on your windows.

My laptop is Intel GPU + Windows 10. Intel driver doesn't support WDDM v2.9 or later on Windows 10 but it is OK on Windows 11. It means WSL couldn't support GPU accelerator on Windows 10.

If you want to use webgpu under wsl2, use following chrome command since webgpu on chrome only support vulkan now according to Chrome ships WebGPU






GCC

Origin link 2023-4-26


some tips when i trying compile opengl programs in conda
(opengl) hongy19@WSL opengl$ gcc glfw-1.cpp -static -lglfw -lGL
/usr/sbin/ld: cannot find -lglfw: No such file or directory
/usr/sbin/ld: cannot find -lGL: No such file or directory
collect2: error: ld returned 1 exit status

X11 and wayland

Origin link 2023-4-22

 

see Environment variables for Wayland hackers and Wayland-specific environment variables for detail and what is setting in wsl2.

gtk3/gtk3 in conda has disabled wayland support, see link.  
  (gtk) hongy19@WSL cairo$ GDK_BACKEND=help python test1.py
  Supported GDK backends: x11

keyboard

Origin link 2023-4-16

 

According to Archlinux wiki and How Keys Are Turned Into Actions , here comes how keystroke information is transferred in computer.
And there are two types of key (see link )
.inputrc is readline initialization file and used to map key sequence to readline function like "end-of-history". Then you need to use text to describe "special keys" or "escape sequences", see following example.
You could use "showkey -k" or "od -c" to show escape sequence of special keys.

Wayland and weston

Origin link 2023-4-10

font, 2D drawing on linux

Origin link 2023-4-10

 Here come several basic concept for font, drawing on linux




remote desktop on linux

Origin link 2023-4-7

old page page 1 new page