Posts

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  

Plan 9: Multi-touch Touchpad

Image
Multi-touch Gestures (pinch, swipe and rotate) demo. Synopsys DesignWare I²C on Intel LPSS (Alder Lake) The touchpad is connected through the Intel LPSS (Low Power Subsystem) I²C controller, which uses Synopsys DesignWare I²C IP. The following output demonstrates touch events being decoded and generated in userspace. n indicates the number of fingers reported by the touchpad. touch conf 1 tip 1 id 0 x 1377 y 1129 scan 13523 n 1 btn 0 touch conf 1 tip 1 id 0 x 1377 y 1129 scan 13691 n 1 btn 0 touch conf 1 tip 1 id 0 x 1377 y 1129 scan 14675 n 1 btn 0 touch conf 1 tip 1 id 0 x 1378 y 1129 scan 15659 n 1 btn 0 touch conf 1 tip 1 id 0 x 1381 y 1130 scan 16643 n 1 btn 0 touch conf 1 tip 1 id 0 x 1383 y 1131 scan 17627 n 1 btn 0 touch conf 1 tip 1 id 0 x 1386 y 1132 scan 18611 n 1 btn 0 touch conf 1 tip 0 id 0 x 1386 y 1132 scan 19599 n 1 btn 0 touch conf 1 tip 1 id 0 x 1580 y 1192 scan 34460 n 2 btn 0 touch conf 1 tip 1 id 0 x 1580 y 1192 scan 35343 n 2 btn 0 touch conf 1 tip 1 id 0...

Plan 9: Realtek PCI Wifi Driver

Realtek PCI Wifi Driver for RTL8851BE based on Linux rtw89 driver. The code covers firmware download and H2C communication.   Files /sys/src/9/port/etherrtw89.c /sys/src/9/port/rtw89/   Code https://gitlab.com/atamariya/plan9front  (rtw89 branch) References Linux Realtek PCI Wifi Driver rtw89   PCI passthrough setup for QEMU    

Plan 9: Play Invidious Video

Image
  Play Youtube videos directly in Plan 9 via Invidious.  Invidious is an alternative front-end to YouTube treason is the video player in Plan 9 nvi is the interface to Youtube (via Invidious API) and Peertube   nvi -A 140 -V 134 -s /mnt/v1 ciWzklgc98o # Use lang id when available  nvi -A 140 :lang -V 134 -s /mnt/v1 ciWzklgc98o # Exit echo exit > /mnt/v1/ctl    treason -a /mnt/v1/audio /mnt/v1/video   # Download mode nvi -A 140 -V 134 -a /tmp/audio -v /tmp/video  ciWzklgc98o   treason file.mp4      # Wrapper script. Default a=140, v=136 yt ciWzklgc98o # Lowest quality yt -l ciWzklgc98o # Highest quality yt -h ciWzklgc98o     Installation Download the treason package - includes codecs and mcfs. rm -rf /tmp/treason mkdir /tmp/treason cd /tmp/treason hget https://ftrv.se/_/treason.gz | gunzip | disk/mkext -d . ./treason/install.rc    Replace treason, nvi and mcfs from repositories listed in t...