Posts

Plan 9: LighTuning Fingerprint Reader

Image
LighTuning Fingerprint Reader working in Plan 9 on ASUS Vivobook. It uses EgisTec Match-on-Chip (MOC) fingerprint sensor. $ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 1c7a:0586 LighTuning Technology Inc. ETU905A88-E    Usage: nusb/fprint [-d] devid info | list | enroll [label] | verify | delete id | clear     Code https://gitlab.com/atamariya/plan9front/-/blob/front/sys/src/cmd/nusb/fprint/egis.c     References libfprint  

Plan 9: Data Visualization

Image
  Visualize data using graph and plot. Graph generates plot commands from the input data. Plot renders the image. graph < data | plot  # data 1 2 3 4 2 3 5 4 3 4 4 6 Data is X followed by Y.  Use -t for column major data.   Type Command Notes Image Line graph -o 3 -p rgb -k 'cpu,mem,disk' -X 'time (s)' -Y load <data | plot -o n gives n lines. Bar graph -T bar -o 3 -k 'cpu,mem,disk' <data | plot -o n gives n grouped bars per x. Histogram graph -T hist -n 12 <data | plot One value per line. Default is 10 bins. Area graph -T area -o 3 -M -W 2 -k 'a,b,c' <data | plot Fills down to y=0. Later curves cover earlier ones. Pie graph -T pie -M -A 50 -l title <data | plot One value per slice, with an optional qu...

Plan 9: 3D Printing

Image
  Slice Slice the STL ( stereolithography )   model to generate Gcode for the printer. stl2m <part.stl | place -c | layers -l 200 | walls | skin | infill | support | gcode -p ender3 > part.gcode   You can also set PRINTER3D=ender3 to avoid passing it in the command line. The profiles are looked up in the /lib/slicer directory.    Visualize Visualize the STL, OBJ (file format originally developed by Wavefront Technologies) or the gcode file. 3dview part.stl 3dview -g part.gcode    # convert OBJ to STL for viewing obj2stl -Y bunny.obj > bunny.stl   Keyboard shortcuts: Arrows:  rotate (left/right yaw, up/down pitch), 5 degrees per press. + / -: zoom in/out. o: toggle orthogonal and perspective. w: cycle wire, shaded, shaded+edges. Meshes only - ignored for gcode. r: reset the view. q or Del: quit. Mouse: Button 1 drag: rotate. Button 2 drag: pan. Wheel: zoom. Button 1 on the bottom bar (gcode): layer slider.   Pri...

Plan 9: Local LLM

Image
    Local LLM Inference Engine (LIE) in action   It's running in QEMU with 4G memory (atleast 2G needed) on Intel Core i5 14th Generation. LLM model is QWEN2 coder with tool support (675MB). A model trained for tool support generates tool activation using <tool_call></tool_call> markup.  lie qwen2.5-coder-0.5b-instruct-q8_0.gguf -t 0 -m chat --softmax-mode 1   -t temperature is 0 for repeatable output -m chat mode (use -i for one shot query)   Chat Template A Chat template defines what the model accepts as special instructions.  ggufinfo -c qwen2.5-coder-0.5b-instruct-q8_0.gguf {%- if tools %}     {{- '<|im_start|>system\n' }}     {%- if messages[0]['role'] == 'system' %}         {{- messages[0]['content'] }}     {%- else %}         {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}     {%- endif %}     {{- "\n\n# Tools...

Plan 9: Compressed Archives

Image
Plumb Zip file   View files inside a zip compressed file via Plumber without extraction. Zip file contents are accessible at /n/tapefs. (Note: sam displays the UTF Byte-Order-Mark (BOM) as is - the garbage in the beginning of the first line). #zip file content in a new window type    is    text data    matches    '([a-zA-Z¡-ï¿¿0-9_\-.,/]+)\.zip' arg    isfile    $0 plumb    start    window fs/zipfs $file; cd /n/tapefs; ls; rc   Plumber process, usually running in the parent process, does not have visibility into the folders mounted by the child process because of namespace isolation. Hence, you need the following changes: zipfs (or 32vfs, cpiofs, tapfs, tarfs, tpfs, v6fs, v10fs etc.) must expose a service in the /srv directory. ( fs.c ) plumber must mount the zipfs for paths starting with /n/tapefs before checking for file existence. ( match.c )    Archive Edit  Use shell co...

Plan 9: Remembering Winamp Skins

Image
Recreating Winamp-style media player skins. Change appearance of an application without recompiling. Shape applications in non-rectangular form e.g. rounded corners or eyes.  Application code and assets are in /sys/src/cmd/skin/ directory.   Background Sprite sheet (buttons)    Shape Mask (An image used as a mask - white is visible and black is invisible)    API int    setwindowmask(Image*, Image*, Point);     Lessonts Learnt libmemlayer treats every layer as opaque. A window covers what is behind it, and the save area holds only the pixels it hides. Real translucency means compositing a layer against the layers behind it on every draw, and redrawing it whenever anything behind it changes.   Code https://gitlab.com/atamariya/plan9front  

Plan 9: Window Management

Image
    Window management using riow (window operations and workspaces) and winwatch (modified). The modification adds thumbnails (-t), monitor app (-i) and animations.    Code https://gitlab.com/atamariya/plan9front