From 9e6bca0b2fadeb55d55a27329a72e03b31d9998d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Sat, 6 Sep 2025 16:37:54 -0700 Subject: All the sites --- csc-new.html | 111 ++++++++++++++++++++++++++++ csc-workflow.html | 109 ++++++++++++++++++++++++++++ csc.html | 52 ++++++++++++++ doodle.html | 57 +++++++++++++++ earbud.html | 38 ++++++++++ fourcorners.html | 44 ++++++++++++ index.html | 68 ++++++++++++++++++ jankime.html | 117 ++++++++++++++++++++++++++++++ key.html | 86 ++++++++++++++++++++++ matrix.html | 60 ++++++++++++++++ meta.html | 53 ++++++++++++++ meta2.html | 78 ++++++++++++++++++++ ptyim.html | 72 +++++++++++++++++++ unihome.html | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ xkbabuse.html | 132 ++++++++++++++++++++++++++++++++++ 15 files changed, 1289 insertions(+) create mode 100644 csc-new.html create mode 100644 csc-workflow.html create mode 100644 csc.html create mode 100644 doodle.html create mode 100644 earbud.html create mode 100644 fourcorners.html create mode 100644 index.html create mode 100644 jankime.html create mode 100644 key.html create mode 100644 matrix.html create mode 100644 meta.html create mode 100644 meta2.html create mode 100644 ptyim.html create mode 100644 unihome.html create mode 100644 xkbabuse.html diff --git a/csc-new.html b/csc-new.html new file mode 100644 index 0000000..6bad2da --- /dev/null +++ b/csc-new.html @@ -0,0 +1,111 @@ + + +Control Systems Club Web Controlled Servo Instructions + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Control Systems Club Web Controlled Servo Instructions                 1-24-2019
+--------------------------------------------------------------------------------
+
+Ok everyone, we'r going to start a web controlled servo project.
+
+What we want, is a webpage where you click "move servo" and a servo moves.
+
+It will work like this, with 4 components we have to write:
+
+The Front End
+The Backend
+The Servo Controller
+The Arduino Firmware
+
++---Digital Ocean VPS--+                    +--Control Computer--+
+|HTML/CSS/JS Front End |   HTTPS POST       |C Servo Controller  |
+|Golang Backend        |====================|                    |
++----------------------+                    +--------------------+
+         ||                                          ||
+         ||H                                         ||U
+         ||T                                         ||S
+         ||T                                         ||B
+         ||P                                         ||
+         ||S                                         ||S
+         ||                                          ||e
+ +-Client Computer-+                                 ||r
+ |  Some sort of   |                                 ||i
+ |  Browser        |                                 ||a
+ |                 |                                 ||l
+ |                 |                                 ||
+ |                 |                        +----------------------+
+ +-----------------+                        |C/C++ Arduino Firmware|
+                                            |                      |
+                                            +----------------------+
+                                                     ||
+                                                     ||S
+                                                     ||e
+                                                     ||r
+                                                     ||v
+                                                     ||o
+                                                     ||
+                                                     ||W
+                                                     ||i
+                                                     ||r
+                                                     ||e
+                                                     ||
+                                                 +-Servo-+           
+                                                 |       |    
+                                                 +-------+     
+
+The Frontend will consist of html templates, as well as supporting css and js
+files, that will implement a simple UI that allows the user to click on a button
+that sends a POST request to the backend to move the servo.
+W3 Forms Tutorial
+Inline CSS Tutorial
+CSS Display Property Tutorial
+
+The Backend will be a Golang executable that will be listening for HTTPS
+connections, and serves the frontend, as well as listen for POST requests from
+both the Frontend and the Control Computer. A POST request from the frontend
+updates the desired state of the servo, and a POST request from the Control
+Computer will update the actual state. Both the Actual state and the desired
+state should also be served as well.
+Go net/http and html/template Libraries Tutorial
+
+The Servo Controller will poll the Backend for the desired state, communicate
+this to the Arduinoi via the RS-232 Library, and return this desired state via
+POST to the backend so as to update the actual state.
+RS-232 Library
+RS-232 Example
+cURL API
+cURL Code Examples
+
+The Arduino Firmware will commands over the USB Serial Wire, and output that to
+the servo.
+Arduino Serial Tutorial
+Arduino Servo Tutorial
+
+Devops should refer to the workflow page as well as read this page about systemd
+unit files.
+Systemd Services
+
+
+
+
+ + diff --git a/csc-workflow.html b/csc-workflow.html new file mode 100644 index 0000000..bd6db5f --- /dev/null +++ b/csc-workflow.html @@ -0,0 +1,109 @@ + + +Control Systems Club Project Workflow + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Control Systems Club Project Workflow                                  1-24-2019
+--------------------------------------------------------------------------------
+
+First, create an ssh key. Intructions below:
+SSH Generation Tutorial
+Email me "~/.ssh/id_rsa.pub", I will give you permission to the SSH server and
+to the production environment.
+
+In the meantime, clone the code repository from our server "ryugyong" at
+public IP 157.230.168.203.
+
+To do this, run the command
+
+git clone git@157.230.168.203:csc-code
+
+This will clone a repository named "csc-code"
+
+1. Go into the repository, and checkout to the development branch. Use:
+
+git checkout $branch
+
+where $branch could be:
+	arduino-devel
+	frontend-devel
+	backend-devel
+	controller-devel
+
+1.5. Set the upstream of your branch to sync to that branch on the git server. 
+
+git branch --set-upstream-to origin/$branch
+
+2. Make the changes you want to make, and commit them.
+
+type "git branch" to make sure you're on the development branch.
+
+git commit $file
+
+where file is the file you have changed, if it is new run
+
+git add $file
+
+3. Afterwards, ask for a code review from me or somebody else.
+
+Push your changes to the remote repository running on ryugyong
+
+git push
+
+if the code passes review, I will merge it with master.
+
+4. Put the code into production
+
+To put these changes into production on the server, ssh into ryugyong with
+
+	ssh root@157.230.168.203
+	cd ~/csc-code
+	git pull
+	cd backend; make
+	./backend
+
+To put these changes into production on the control computer, physically go to
+the control computer and run:
+
+	cd ~/csc-code
+	git pull
+	cd controller; make
+	./controller
+
+To put these changes into production on the arduino, Take the arduino to your
+computer.
+
+	git checkout master
+	git pull
+
+	Run Arduino IDE and flash the code onto the Arduino
+
+	git checkout $branch 
+
+5. GOTO 1
+
+
+
+
+
+
+ + diff --git a/csc.html b/csc.html new file mode 100644 index 0000000..50a86ea --- /dev/null +++ b/csc.html @@ -0,0 +1,52 @@ + + +Control Systems Club + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Control Systems Club                                                   2-21-2018
+--------------------------------------------------------------------------------
+What is Control Systems Club?
+	Control Systems Club is a club focussed on research projects related to
+robotics, mechatronics, programming, electronics and more. The purpose of this
+club is to provide a structured way for us to work and collaborate. I know that
+I struggle with finishing my projects when there is no external pressure. When
+done right, clubs like this provide motivation and stakes for us to finish our
+projects.
+	The project we are working on this week is an underactuated biped
+system.
+	The first week of Control Systems Club will revolve around a set of
+reading assignments so that all members can brought up to the same level of
+technical competency.
+	Introduction to Linear Algebra
+	Non-linear Control for Underactuated Mechanical Systems
+
+	In terms of organization, we will have meetings every week for planning,
+then assign the job of designing various parts of our system to each member to
+complete on their own schedule. Strong expectations are put in place for them to
+complete their tasks with good documentation.
+
+To apply, ask me for a form in person.
+
+
+
+
+ + diff --git a/doodle.html b/doodle.html new file mode 100644 index 0000000..66cca6e --- /dev/null +++ b/doodle.html @@ -0,0 +1,57 @@ + + +Some Doodles + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Some Doodles                                                      2-27-2018
+--------------------------------------------------------------------------------
+Taking notes, Ha!
+The following images are all 15 to 19 MB in size, so loading them will be super
+slow.
+A watchface
+
+ +
+Ear bud holders
+
+ +
+A tower
+
+ +
+Layout
+
+ +
+More layout
+
+ +
+Even more layout
+
+ + +
+
+
+ + diff --git a/earbud.html b/earbud.html new file mode 100644 index 0000000..a9c8c47 --- /dev/null +++ b/earbud.html @@ -0,0 +1,38 @@ + + +Earbud Holders + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Earbud Holders                                                          3-7-2018
+--------------------------------------------------------------------------------
+Oof, looks like I didn't put out the updates I promised. As some consolation
+hear some poorly drafted plans for an altoid tin earbud holder to show that i'm
+still alive. Pdf file here.
+
+If you're here for Control Systems Club updates, I'm going to be teaching
+everyone LibreCAD during today's meeting. Make sure you have it installed, The
+above is an example of what you can make with LibreCAD.
+
+
+
+
+ + diff --git a/fourcorners.html b/fourcorners.html new file mode 100644 index 0000000..23cebdf --- /dev/null +++ b/fourcorners.html @@ -0,0 +1,44 @@ + + +Four Corners Input Method for ibus-table + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Four Corners Input Method for ibus-table                              11-25-2023
+--------------------------------------------------------------------------------
+
+I noticed that ibus-table lacked a four corners input method online so I made
+one myself based off UniHan database data. One issue is that ibus does not
+distinguish between numpad and regular keyboard keys, otherwise this input
+method would allow for typing both Chinese and English without having to even
+switch IMEs. Also UniHan's data is incomplete, so I'll probably have to use data
+from the Variant Character Dictionary or something.
+
+我發現 ibus-table 沒有四角輸入法,因此我編了一方。數據來自統一碼漢字數據庫。可惜
+ibus 無法分別小鍵盤上的鍵, 要不該輸入法可英漢同時輸入。其外統一碼的數據不全,所
+以以后我該用『異體字字典』之類的數據。
+
+源碼/Code
+
+
+
+
+ + diff --git a/index.html b/index.html new file mode 100644 index 0000000..7fb529a --- /dev/null +++ b/index.html @@ -0,0 +1,68 @@ + + +Home + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+                                      Home                                      
+--------------------------------------------------------------------------------
+                                     ________
+                                    |,-------
+                                    ||_____. 
+                                    `-- --.| 
+                                      //  || 
+                                     //   // 
+                                    //   //  
+                                   //   //   
+                                       //    
+                                   HSD 刁浩然
+
+What is this?
+                                                                  hairydiode.xyz
+Who are you?
+                                                                  Haoran S. Diao
+How do I tell you your site is ugly?
+                                                          Email:0@hairydiode.xyz
+                                                                      Public Key
+Where's all the other stuff you host from this domain?
+                                                                    My Git Repos
+                                                            My Mastodon Instance
+Where's all the content?
+                                                                     Scroll Down
+[Janky IME] 6-29-2023
+[Non-Janky Input Method for the Linux Console (and other Terminals)] 09-06-2025
+[Abusing X11's xkb for fun and profit] 08-19-2025
+[Four Corners Input Method for ibus-table] 11-25-2023
+[We Have Unicode at Home] 6-30-2023
+[Matrix Homeserver] 3-17-2019
+[Control Systems Club Project Workflow] 1-24-2019
+[Control Systems Club Web Controlled Servo Instructions] 1-24-2019
+[PGP Public Key] 6-26-2018
+[Moving This Site] 6-26-2018
+[Control Systems Club] 2-21-2018
+[Earbud Holders] 3-7-2018
+[Some Doodles] 2-27-2018
+[Making This Site] 11-13-2017
+
+
+
+
+ + diff --git a/jankime.html b/jankime.html new file mode 100644 index 0000000..3c54176 --- /dev/null +++ b/jankime.html @@ -0,0 +1,117 @@ + + +Janky IME + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Janky IME                                                      6-29-2023
+--------------------------------------------------------------------------------
+UPDATE: This IME is now tmux based, old xdotool version is still here
+
+UPDATE2: I have created the most cursed thing in existance. Full unicode display
+and input support in the linux console using only userland bash/busybox and
+tmux. See we have unicode at home
+
+A new python version came out, so of course that means every python package on
+my rolling-release system has broken. This includes ibus, which I need for my
+input method. I'm currently running some web-crawling scripts that I don't want
+to stop, so while I wait for my machine to finish downloading all of PDB, I decided
+to write a janky bashscript implementation of ibus table so that I can still use
+嘸蝦米.
+
+Background:
+	嘸蝦米 (EN: Boshiamy) is a proprietary component-based input method for
+	Chinese. They offer paid software on iOS, Android, and Windows, but no
+	Linux version is available. On my phone I gladly pay for a Boshiamy
+	license, but on Linux I use this implementation of Boshiamy using ibus
+	table from here.
+
+	However, I urge that people pay for the license anyways as most of the
+	actual work in creating an IME is organizational. The technical aspects
+	of IMEs are fairly trivial as you'll see here.
+
+	In technical terms, it's just a very large TSV file with the first
+	column being the input code, the 2nd being the character, and the 3rd
+	being a ranking for ordering which character comes first when selecting
+	them.
+	
+	EX: 
+		typing wso[SPACE] or wso1 inputs 浩, typing wso2 inputs 澢
+			wso     浩      100
+			wso     澢      99
+
+		It can also be used for non-chinese characters such as è
+			,ne     è       100
+
+The Implementation:
+	I want this to work in the terminal, and I want it to only require bash,
+	and tmux, and it needs to work on all programs running in the terminal
+	regardless of whether they use cooked input(bash) or raw input(vim). 
+
+	So what I ended up on is a bash script that runs in a seperate tmux
+	panel and sends input to the previously active panel
+
+	Input is read with read in a loop
+
+	CODE:
+		OIFS=$IFS
+		export IFS=""; read -rsn1 i
+		IFS=$OIFS
+
+	IFS="" is done to make it read spaces as input, but this makes this
+	implementation very brittle and probably not portable depending on bash
+	versions. This also passes along control and special characters such as
+	delete and move left, and it seems tmux handles most of the differences
+	between terminals. An older version of this ime using xdotool did not
+	handle these control characters well.
+
+	I then simply run grep ^$code\s, rearrange the columns with awk and sort,
+	then take out the ranking column
+
+	CODE:
+		opt=$(grep "^$code\s" ~/lang/zh/boshiamy/ibus-boshiamy/boshiamy.txt |\
+					#remove simplfied
+					grep -v 98|\
+					awk '{print $3" "$2}' |\
+					sort -nr|\
+					awk '{print $2}')
+
+	finally, it inputs the selected character into tmux if the ime input is
+	1-9 or Space. NOTE: bash variables don't store newlines, so the
+	conversion of the input characters from line seperated to space
+	seperated was done for free.  However this makes the code less portable
+
+	CODE:
+		char=$(echo $opt | awk "{print \$1}")
+		...
+		tmux send-key -t "!" "$char"
+
+Downsides/The Future:
+	This works in the linux console but obviously the linux console has
+	limitations on what text it can display(by default the linux console can
+	not display fonts with more than 512 characters). I think I'm gonna
+	write a bash based cbrll implemntation and a character displayer as well
+	so that I can get full userland unicode display and input support.
+
+
+
+
+ + diff --git a/key.html b/key.html new file mode 100644 index 0000000..50a9563 --- /dev/null +++ b/key.html @@ -0,0 +1,86 @@ + + +PGP Public Key + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+PGP Public Key                                                         6-26-2018
+--------------------------------------------------------------------------------
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQINBFwIIQMBEADBtwzeFxGYuEpsgNPAVkt8SE88jEFpyspxJrBAQJz3K5Zmfd24
+8w+KDSsZNSD4okiORSX3YuEAxONfwjZKjahdwXIhb4KvpbauvKfpR1M7eKhZ4StQ
+0ax3cG3xR2pXHHnDOxAjt90vrx3lT3O21NTXcdpooGQqN+k3LcVmxjWiVgI5KUdb
+yUqmyefOrqkwfxAm3/qqUn49ew71kisMB/RMnm1N73uKsztG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SBQJcCCEDAhsMBQkFo5qAAAoJED1adomdAfUSsmEP/itooqmtskldb7iJ
+Mb/+YMBFyDbdQokk7SivoicRa3fJhr7/+Ry/+wVDtoP2ZKlcK8/xjJ+yX8mNDSq9
+f7i+7AXI6joGnMGJspEP72LTYD5KCi868epN7et826ziurdXufvP77iAoJ9GyGOg
+JiEFsH51lPVFQw7k6jZ1ADw0mYqwEKwL0oT4ycmZT/iYv8nHmLAGo2z0b6gSm4cj
+1OJfgU0HP2waGw6Pj3qmZ8UEBvdFZvAiSPoK069W7sE2KDMW/szdlefdewLUvpMc
+YDiknLQrhiTsK7E/2IWeyhMBRogWejcAkauoUhNYOubKGrk74ETYTSUqO5OEQvG/
+8kXr0VpjBFJXrzmJyszYLAQSPowBCA/ITMePkYhuZUiWjdZGZVGV/gkZ3coUcQnv
+MZOYrTauYA60KQNvZa6rBq56pKyKcIPB5EYX4XNmJVo5HGkp2A7b4TOg0hLqkbMR
+UTAhst2X0OYdbTuNPCOm6S0LZkwV1LwItbkp9qEgJBp6jLVlpnLcWdEwQ6IjEZ2v
+PY4Jo6TXyub0D9JfQqcpmL9Gfwi0hQUGHiY4kJ+bpxF1DnOfQNrgOxl9pbsIeMsM
+EwrbT2YeIHVRgWJW6x2/41jiLQ8fZbY9D2VVOUDtm+UBHPOAy7NJUHMc6kI7Fd5l
+u+C+WbX+si4fY2tEuxG9pa91sLep
+=MgYW
+-----END PGP PUBLIC KEY BLOCK-----
+
+plaintext version
+
+
+
+
+ + diff --git a/matrix.html b/matrix.html new file mode 100644 index 0000000..bd2e309 --- /dev/null +++ b/matrix.html @@ -0,0 +1,60 @@ + + +Matrix Homeserver + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Matrix Homeserver                                                      3-17-2019
+--------------------------------------------------------------------------------
+UPDATE:
+	Due to the lack of suitable clients and the lack of user adoption, my
+	Matrix Synapse has been taken offline
+
+--------------------------------------------------------------------------------
+I have a matrix now!
+
+@zero:hairydiode.xyz
+
+For those of you like me who ran nginx in front of synapse, the configuration
+given by the synapse documentation is incomplete. For the port 8448 server you
+need to include your ssl certificates just like you would for any other https
+server.
+
+For example, if you use letsencrypt, the following is the complete server config
+for port 8448:
+
+server {
+	listen 8448 ssl default_server;
+	listen [::]:8448 ssl default_server;
+	ssl_certificate /etc/letsencrypt/live/[domain]/fullchain.pem;
+	ssl_certificate_key /etc/letsencrypt/live/[domain]/privkey.pem;
+	server_name [domain];
+
+	location / {
+		proxy_pass http://localhost:8008;
+		proxy_set_header X-Forwarded-For $remote_addr;
+	}
+}
+
+
+
+
+ + diff --git a/meta.html b/meta.html new file mode 100644 index 0000000..19d872a --- /dev/null +++ b/meta.html @@ -0,0 +1,53 @@ + + +Making This Site + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Making This Site                                                      11-13-2017
+--------------------------------------------------------------------------------
+So you've stumbled on this ugly looking site and are wondering what the hell it
+is? Well I'll have you know that it looks like this on purpose! This a static
+site where the main content is text and the occasional picture, any styling I
+put on here is just bloat. It makes no sense to serve 1 megabyte pages just to
+deliver a couple kilobytes of text. After some experimentation I've decided to
+make this site as close to plaintext as possible.
+
+So how does this all work? Well first of all I'm not hosting this by myself,
+I'm using github.io to host this. Everything you see on this site comes from
+a git repo found here: https://github.com/knolax/hairydiode.
+This has some limitations however, with the way my domain registrar is set up,
+this site can't be HTTPS(or I haven't figured out how yet); and since github
+isn't exactly a CDN, image loading is a little slow.
+
+So how do I acheive this "wonderful" web-brutalist asthetic? Well to start off
+I write the pages in cont/. What I write is for the most part plaintext, with
+the exception of links and images. Then I run a script 《gen.sh》that appends
+headers and footers to what I write to make it an acceptable HTML page. The
+results are put in the root directory of the repo, and served up to you by
+github's servers when I push my changes.
+
+
+
+
+
+
+ + diff --git a/meta2.html b/meta2.html new file mode 100644 index 0000000..a6538aa --- /dev/null +++ b/meta2.html @@ -0,0 +1,78 @@ + + +Moving This Site + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+Moving This Site                                                       6-26-2018
+--------------------------------------------------------------------------------
+So I've recently just moved this site away from github to my own VPS, as well as
+all my git repos.
+
+For those of you that are new, you'll notice that this site is entirely static
+and all the pages are basically glorified text files. THat's the point, Text is
+main content of this site and I don't want to serve bloated multi-megabyte files
+just to deliver that. The fanciest thing I have on this site is a custom font
+for Iokalant.
+
+If you want to put a name to this style, call it web brutalist.
+
+The way the site works now is this:
+
+-I setup a bare git repo on my VPS containing the hairydiode git repo
+-In the post-receive hook of the repo it checks out the repository to
+ /var/www/html
+-Apache2 is setup to serve those files
+-The 'rewrite' module allowing me to remove the .html extensions from files, cgit
+ allows me to show my git repos in a web interface and I get my ssl certificates
+ from Let's Encrypt, whose certbot takes care of setting up https on the apache
+ server.
+
+
+It's a standard setup and if you want to read about it else where see the guide
+from Digital Ocean on Git Deployment, and Setting Up Apache. Also This Guide
+for setting up a git server.
+
+Some Caveats:
+-If you're cloning a repository from somewhere else make sure:
+  --That the repository is chowned to the user 'git'
+  --Make sure the repository is bare. To do this, simply replace the folder
+containing the repo with the .git folder beneath it, then type:
+
+$ git config --bool core.bare true
+
+  to tell git that the repo is now bare.
+
+-Make sure that the 'git' user has permisions to the deploy repository
+
+-When enabling cgit, make sure to enable cgi with:
+
+$ a2enmod cgi
+
+-When making any change to apache2, make sure to restart it with:
+
+$ systemctl restart apache2
+
+
+
+
+ + diff --git a/ptyim.html b/ptyim.html new file mode 100644 index 0000000..c16dc79 --- /dev/null +++ b/ptyim.html @@ -0,0 +1,72 @@ + + +Non-Janky Input Method for the Linux Console (and other Terminals) + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+
+Non-Janky Input Method for the Linux Console (and other Terminals)    09-06-2025
+--------------------------------------------------------------------------------
+
+I've implemented boshiamy in a lot of convoluted ways so far. I've done it using
+bash scripts and using xkb compose rules.
+
+But the reason I've been trying to do this to be able to use an input method in
+the Linux Console, and eventually a physical terminal. Back in the day they had
+zhcon, which was a userspace virtual console with the input method built in, but
+it's ugly and only supports dbcs encoding.
+
+I've also been building a real world physical serial terminal, and having the
+input method implemented in software saves me the trouble of trying to fit it
+inside of microcontroller ROM.
+
+One Idea I've had for a while is to simply write an input method that sits
+between the terminal/console and whatever program is running. If tmux can do it
+so can I, right?
+
+After digging through a LOT of manpages I finally made my idea true. It's a
+program that creates a pseudoterminal with a shell (or your program of choice)
+attached to it, and routes all input through an input method before it reaches
+the pseudo terminal. 
+
+I had to mess around with a bunch of stuff like low level POSIX termios
+libraries, obscure linux system calls, session/process groups, and even terminal
+escape codes. Luckily, almost everything I needed was in the manpages.
+
+The final implementation should be encoding agnostic, although it does make some
+assumptions about the terminal you're using. All this can be changed by
+modifying some macros.
+
+Testing so far it works on st, the linux console, kmscon and other terminal
+emulators. It's compatible with pretty much every ncurses program I tried. 
+
+Special Thanks to:
+	- 何震邦(jdh8) for this ibus boshiamy implementation I based my IM table
+	off of
+	- Linux Akesson for this writeup which explained a everything 
+	about how ttys work  on linux
+
+Code and further reading are in a git repo here
+
+
+
+
+ + diff --git a/unihome.html b/unihome.html new file mode 100644 index 0000000..476ad0b --- /dev/null +++ b/unihome.html @@ -0,0 +1,212 @@ + + +We Have Unicode at Home + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+We Have Unicode at Home                                                      6-30-2023
+--------------------------------------------------------------------------------
+So as we all know, the Linux console is limited to 512 characters, and lives in
+kernel space. So I wrote a workaround that displays unicode characters using
+braille (assuming your linux console font has braille characters) characters
+using only userland busybox.
+
+
+--------------------------=[Part I. Braille Graphics]=--------------------------
+Braille graphics are actually really easy, the braille block goes from  U+2800
+to U+28FF, with the lower 8 bits corresponding to the dots in each braille
+character in the following order:
+
+#0 3
+#1 4
+#2 5
+#6 7
+
+with 0 being the lowest bit and 7 being the highest bit. 
+
+utf-8 encodes this codepoint with three bytes 
+
+1110xxxx 	10xxxxxx 	10xxxxxx
+
+where x represents the bits of the codepoint, therefore U+2800 converted to
+UTF-8 is 0xE2A080 (big endian) or 14852224 in decimal (I'll explain why decimal
+is relevant later).
+
+If you take the pixel buffer, shift it according to the above chart (and
+adjusted for the utf-8 encoding position change), and OR the base codepoint, you
+get your desired braille character.
+
+The problem is that bash can not do bitwise operations, and that it calls a
+seperate process for conversion from hex to decimal. So our code ends up looking
+like this: 
+
+	if [ "${rawbuff[((1+4*$2))]:((1+2*$1)):1}" == "1" ];then
+                num=$(($num + 16))
+        fi
+
+	where $num starts off as 14852224, we have a raw pixel buffer where each
+	row is stored as a string where '1' represents a filled in pixel, and
+	the current braille block we are rendering's x and y position are at $2
+	and $1. 
+
+The above code takes the value of the raw pixel buffer at position (1,1)
+relative to the current code block, shifts it by 4, then ORs it with the
+rendered braille character.
+
+
+I also wrote some code to take commands that draw in the raw pixel buffer as
+well. 
+
+code here
+
+----------------=[Part 2, Rendering BDF fonts with only busybox]=---------------
+BDF is a human legible bitmap font format where each character entry looks like:
+
+STARTCHAR uni6D69
+ENCODING 28009
+SWIDTH 1000 0
+DWIDTH 8 0
+BBX 7 7 0 -1
+BITMAP
+98
+1C
+A8
+3E
+80
+9C
+9C
+ENDCHAR
+
+	Source: Misaki Mincho, also sidenote, the entire font is only 746K
+	despite the insanely inefficient format and large amount of characters
+	supported , meanwhile TeX Live is installing multiple 50 Megabyte fonts
+	that only support latin.
+
+The first line is the unicode codepoint, followed by some info I don't care
+about, and the bitmap data of the character where each row is a stored as a line
+converted to hex. You can tell if we convert the hex to binary, it will be the
+"raw pixel format" from before. so all we really need to do is write a small awk
+script to find the relevant bitmap lines, then convert to binary and display it
+with previous braille display script.
+
+Complete Character Display code here
+
+-------------------------=[Part 3. UTF-8 Shenanigans.]=-------------------------
+One annoying thing about utf-8, is that if you want to get the codepoint of a
+particular character in a utf-8 string, you have to do some iconv trickery where
+you first convert it to UTF-32, then convert it to hex.
+
+Another problem is that BDF stores the codepoint as DECIMAL!!!!!. You see that
+line "STARTCHAR uni6D69"? That's just the name of the character, it could
+theoretically be anything. The actual line storing the codepoint is 
+"ENCODING 28009", So we have to convert from hex to decimal, which is a
+surprisingly convoluted procedure in bash.
+
+All this is done in a wrapper script that displays all the input from stdin and
+displays it using all the fonts in a directory given as its argument 
+
+wrapper script code here
+
+----------------------------=[Part 4. Practical Use]=---------------------------
+So remember the janky bash based IM from last time? I modified it to use the
+braille display from before. I also wrote a little script that displays all the
+non-ASCII characters in the previously focused tmux pane, so together we can
+both display and input utf-8 characters in the linux console using tmux.
+
+see the code and writeup
+
+
+"Screenshots" below:
+
+Bash running in tmux
+[usernm@cm│[usernm@cmphostname ~]$ mkdir 帖                          │乔
+phostname │[usernm@cmphostname ~]$ cd 帖                             │pdr
+~]$ ud    │[usernm@cmphostname 帖]$ vim 天干                         │⢠⠋⣏⡁⡆⡇⠀⠀⠁
+⡤⡧⡄⠀⡧⠄⠀⠀  │                                                          │⢹⠔⢅⠇⡇⡇⠀⠀⠀
+⡇⡇⡇⡖⠓⡆⠀⠀  │                                                          │⠸⠠⠊⠀⠥⠇⠀⠀⠂
+⠁⠏⠁⠧⠤⠇⠀⠀  │                                                          │⣲⡪⢰⣓⣲⠀⠀⠀
+⡤⡧⡄⠀⡧⠄⠀⠀  │                                                          │⠒⣱⠘⡖⡞⠀⠀⠀
+⡇⡇⡇⡖⠓⡆⠀⠀  │                                                          │⠩⠜⠠⠃⠧⠇⠀⠀
+⠁⠏⠁⠧⠤⠇⠀⠀  │                                                          │⢠⠴⠥⠤⡄⠀⠀⠀
+⡤⡧⡄⠀⡧⠄⠀⠀  │                                                          │⠸⢭⠭⡭⠇⠀⠀⠀
+⡇⡇⡇⡖⠓⡆⠀⠀  │                                                          │⠤⠊⠀⠣⠤⠇⠀⠀
+⠁⠏⠁⠧⠤⠇⠀⠀  │                                                          │
+⠉⠉⢹⠉⠉⠁⠀⠀  │                                                          │
+⠉⠉⡝⡍⠉⠁⠀⠀  │                                                          │
+⠤⠊⠀⠈⠢⠄⠀⠀  │                                                          │
+⠈⠉⢹⠉⠉⠀⠀⠀  │                                                          │
+⠒⠒⢺⠒⠒⠂⠀⠀  │                                                          │
+⠀⠀⠸⠀⠀⠀⠀⠀  │                                                          │
+[usernm@cm│                                                          │
+phostname │                                                          │
+~]$       │                                                          │
+          │                                                          │
+Leftpane is displaying all the unicode characters in the primary terminal
+(remember, on the linux console they would all just be squares), and right pane
+is the input method, which displays candidate characters in bash.
+
+Vim running in tmux
+⡇⡇⡇⡖⠓⡆⠀⠀  │甲乙丙丁                                                  │之 鐻
+⠁⠏⠁⠧⠤⠇⠀⠀  │        最常用                                            │azn
+⡤⡧⡄⠀⡧⠄⠀⠀  │~                                                         │⠤⠤⠼⠤⢤⠀⠀⠀
+⡇⡇⡇⡖⠓⡆⠀⠀  │~                                                         │⠀⠀⣀⠔⠁⠀⠀⠀
+⠁⠏⠁⠧⠤⠇⠀⠀  │~                                                         │⠔⠉⠒⠤⠤⠄⠀⠀
+⡤⡧⡄⠀⡧⠄⠀⠀  │~                                                         │⣊⡂⣀⣗⣒⠀⠀⠀
+⡇⡇⡇⡖⠓⡆⠀⠀  │~                                                         │⢺⡂⣗⢗⡖⡃⠀⠀
+⠁⠏⠁⠧⠤⠇⠀⠀  │~                                                         │⠽⠴⠑⠝⠘⠄⠀⠀
+⠉⠉⢹⠉⠉⠁⠀⠀  │~                                                         │
+⠉⠉⡝⡍⠉⠁⠀⠀  │~                                                         │
+⠤⠊⠀⠈⠢⠄⠀⠀  │~                                                         │
+⠈⠉⢹⠉⠉⠀⠀⠀  │~                                                         │
+⠒⠒⢺⠒⠒⠂⠀⠀  │~                                                         │
+⠀⠀⠸⠀⠀⠀⠀⠀  │~                                                         │
+[usernm@cm│~                                                         │
+phostname │~                                                         │
+~]$ ud    │~                                                         │
+⣏⣉⣹⣉⣉⡇⠀⠀  │~                                                         │
+⠧⠤⢼⠤⠤⠇⠀⠀  │~                                                         │
+⠀⠀⠸⠀⠀⠀⠀⠀  │~                                                         │
+⠉⠉⢉⠝⠋⠀⠀⠀  │~                                                         │
+⢀⠔⠁⠀⠀⡀⠀⠀  │~                                                         │
+⠣⠤⠤⠤⠤⠃⠀⠀  │~                                                         │
+⣉⣉⣹⣉⣉⡁⠀⠀  │~                                                         │
+⡇⢀⠜⢄⠀⡇⠀⠀  │~                                                         │
+⠇⠁⠀⠀⠥⠇⠀⠀  │~                                                         │
+⠉⠉⢹⠉⠉⠁⠀⠀  │~                                                         │
+⠀⠀⢸⠀⠀⠀⠀⠀  │~                                                         │
+⠀⠠⠼⠀⠀⠀⠀⠀  │~                                                         │
+⢸⠭⠭⠭⢽⠀⠀⠀  │~                                                         │
+⢹⠭⡏⡭⠭⡅⠀⠀  │~                                                         │
+⠚⠉⠇⠬⠪⠄⠀⠀  │~                                                         │
+⡖⣓⣚⣒⡓⡆⠀⠀  │~                                                         │
+⢀⣓⣲⣒⣃⠀⠀⠀  │~                                                         │
+⠘⠀⠸⠀⠚⠀⠀⠀  │~                                                         │
+⢸⣉⣹⣉⣹⠀⠀⠀  │~                                                         │
+⢸⠤⢼⠤⢼⠀⠀⠀  │~                                                         │
+⠎⠀⠸⠀⠼⠀⠀⠀  │~                                                         │
+[usernm@cm│~                                                         │
+phostname │~                                                         │
+~]$       │-- INSERT --                            2,11-15       All │
+
+
+
+
+ + diff --git a/xkbabuse.html b/xkbabuse.html new file mode 100644 index 0000000..40d1fc8 --- /dev/null +++ b/xkbabuse.html @@ -0,0 +1,132 @@ + + +Abusing X11's xkb for fun and profit + + + + + +
+
+--------------------------------------------------------------------------------
+
+>HairyDiode                                             
+
+--------------------------------------------------------------------------------
+
+Abusing X11's xkb for fun and profit                                  08-19-2025
+--------------------------------------------------------------------------------
+
+Yesterday I was playing around with xkb keyboard layouts before I discovered
+that compose functionality for European (and other languages that use accents)
+keyboard layouts is implemented as a 5227 line long table that maps key symbols
+to unicode strings.
+
+ex: /usr/share/X11/locale/en_US.UTF-8/Compose on my computer
+# UTF-8 (Unicode) Compose sequences
+#
+# Spacing versions of accents (mostly)
+<dead_tilde> <space>                    : "~"   asciitilde # TILDE
+<dead_tilde> <dead_tilde>               : "~"   asciitilde # TILDE
+<Multi_key> <minus> <space>             : "~"   asciitilde # TILDE
+<Multi_key> <space> <minus>             : "~"   asciitilde # TILDE
+<dead_acute> <space>                    : "'"   apostrophe # APOSTROPHE
+...
+<dead_circumflex> <o>                   : "ồ   ocircumflex # LATIN SMALL LETTER O WITH CIRCUMFLEX
+...
+<Multi_key> <colon> <U2395>             : "⍠́   U2360 # : ⎕ APL FUNCTIONAL SYMBOL QUAD COLON
+
+For those of you who are unaware, if you use for example a German keyboard
+layout, pressing "^" followed by "o" will produce "ô". The circumflex "^" key is
+called a "dead key" in xkb terminology because it does not produce any
+characters by itself. In addition if you were to bind any key on your keyboard
+to "compose" it would allow you to type basically a wide range of unicode
+characters via various sequences of key presses. 
+
+This got me thinking, this functionality is identical to how ibus-table IMs work
+and would allow me to implement Chinese IMs in a way that requires no extra
+software and which would presumbaly be compatible with a far greater range of
+software since the functionality is built into X11. The fact that the default
+file is 5000 lines long tells me that X11 is more than capable of handling long
+tables.
+
+My first step was to take the ibus boshiamy implementation I already have on my
+computer and mutilate it into the above format using convoluted regex commands
+and a lot of whack a mole to turn 46000 lines of:
+
+aaa     100     鑫
+aaa     99      龘
+aaa     98      鑆
+
+	into
+
+<a> <a> <a>  <space>    : "鑫"
+<a> <a> <a>  <1>        : "龘"
+<a> <a> <a>  <2>        : "鑆"
+
+
+To my surprise, after moving this file to ~/.XCompose it worked exactly as I
+expected with no lag. The only issue then, is that there's no way to switch
+between compose sets in xkb. This explains why the en_US.UTF-8 compose set was
+so long, it had to essentially handle every possible dead-key or compose
+sequence for every keyboard layout.
+
+There's an easy solution to this though, which is to create a custom keyboard
+layout where the keys are mapped to custom key symbols (xkb's layer of
+abstraction above a physical keycode and below a text string) and have my
+compose table use those as the inputs instead of qwerty keys.
+
+Since I started this whole thing by messing with xkb layouts, it didn't take
+long for me to edit the us layout into something like this:
+
+    key <AD01>  {[       U9AD8,  Q              ]}; # 高
+    key <AD02>  {[       U4E94,  W              ]}; # 五
+    key <AD03>  {[       U4E00,  E              ]}; # 一
+    key <AD04>  {[       U4E8C,  R              ]}; # 二
+    key <AD05>  {[       U901A,  T              ]}; # 通
+    key <AD06>  {[       U76CA,  Y              ]}; # 益
+    key <AD07>  {[       U4EE5,  U              ]}; # 以
+    key <AD08>  {[       U5F8C,  I              ]}; # 後
+    key <AD09>  {[       U3007,  O              ]}; # 〇
+    key <AD10>  {[       U5099,  P              ]}; # 備
+
+And my compose table to look something like this:
+
+<U5C0D> <U5C0D> <U5C0D> <U4E8C>  <space>        : "鑆"
+<U5C0D> <U5C0D> <U5C0D>  <space>        : "鑫"
+<U5C0D> <U5C0D> <U5C0D> <U8981>  <space>        : "龘"
+
+Now if I set my keyboard layout to "boshiamy", it will be sending these custom
+key symbols which will be interpreted by my custom compose rules, and if I
+switch it back to the us layout the compose rules don't apply.
+
+The only issues there are with this method is that the functionality for user
+specific keyboard layouts is incredibly broken in xkb, so I had to add my
+custom layout to the system xkb data directory. Otherwise this whole
+implementation would consist entirely of two config files in the home directory.
+
+Also if you have ibus installed make sure to check "use system keyboard layout"
+in settings or else it'll keep switching your keyboard layout around.
+
+Also for those unfamilair with component based input methods, unlike phonetic
+input methods like Pinyin (derogatory) or Zhuyin (derogatory), the mapping for
+key presses to characters has very few if any conflicts, and therefore the
+system works in an open loop way. You can easily use somethign like CangJie or
+Boshiamy without the preview window or without any sort of predictive text.
+
+
+The files I've created and further reading are in a git repo here
+
+
+
+
+ + -- cgit v1.1