diff options
author | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-06 16:17:24 -0700 |
---|---|---|
committer | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-06 16:17:24 -0700 |
commit | 416999e8b22ceb6265b3c31555b1ba72170773c1 (patch) | |
tree | 08b97a38aea914c21d2cec81fc0b4211fae6bd10 |
Rebasing everything into a new repo
-rw-r--r-- | cont/csc-new.html | 86 | ||||
-rw-r--r-- | cont/csc-workflow.html | 84 | ||||
-rw-r--r-- | cont/csc.html | 27 | ||||
-rw-r--r-- | cont/doodle.html | 32 | ||||
-rw-r--r-- | cont/earbud.html | 13 | ||||
-rw-r--r-- | cont/fourcorners.html | 19 | ||||
-rw-r--r-- | cont/index.html | 28 | ||||
-rw-r--r-- | cont/jankime.html | 92 | ||||
-rw-r--r-- | cont/key.html | 61 | ||||
-rw-r--r-- | cont/matrix.html | 35 | ||||
-rw-r--r-- | cont/meta.html | 28 | ||||
-rw-r--r-- | cont/meta2.html | 53 | ||||
-rw-r--r-- | cont/ptyim.html | 47 | ||||
-rw-r--r-- | cont/unihome.html | 187 | ||||
-rw-r--r-- | cont/xkbabuse.html | 107 | ||||
-rw-r--r-- | src/footer.html | 9 | ||||
-rw-r--r-- | src/header.html | 18 |
17 files changed, 926 insertions, 0 deletions
diff --git a/cont/csc-new.html b/cont/csc-new.html new file mode 100644 index 0000000..9b14c91 --- /dev/null +++ b/cont/csc-new.html @@ -0,0 +1,86 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Control Systems Club Web Controlled Servo Instructions +[SETDATE]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. +<a href="https://www.w3schools.com/html/html_forms.asp">W3 Forms Tutorial</a> +<a href="https://www.w3schools.com/html/html_css.asp">Inline CSS Tutorial</a> +<a href="https://www.w3schools.com/cssref/pr_class_display.asp">CSS Display Property Tutorial</a> + +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. +<a href="https://golang.org/doc/articles/wiki/">Go net/http and html/template Libraries Tutorial</a> + +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. +<a href="https://www.teuniz.net/RS-232/">RS-232 Library</a> +<a href="https://hairydiode.xyz/cgit/ROBOARM.git/tree/">RS-232 Example</a> +<a href="https://curl.haxx.se/libcurl/c/">cURL API</a> +<a href-"https://curl.haxx.se/libcurl/c/example.html">cURL Code Examples</a> + +The Arduino Firmware will commands over the USB Serial Wire, and output that to +the servo. +<a href="https://www.arduino.cc/en/tutorial/SoftwareSerialExample">Arduino Serial Tutorial</a> +<a href="https://www.arduino.cc/en/Tutorial/Knob">Arduino Servo Tutorial</a> + +Devops should refer to the workflow page as well as read this page about systemd +unit files. +<a +href="https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files">Systemd Services</a> diff --git a/cont/csc-workflow.html b/cont/csc-workflow.html new file mode 100644 index 0000000..b7cdfbc --- /dev/null +++ b/cont/csc-workflow.html @@ -0,0 +1,84 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Control Systems Club Project Workflow +[SETDATE]1-24-2019 + +First, create an ssh key. Intructions below: +<a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2">SSH Generation Tutorial</a> +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/cont/csc.html b/cont/csc.html new file mode 100644 index 0000000..756dba3 --- /dev/null +++ b/cont/csc.html @@ -0,0 +1,27 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Control Systems Club +[SETDATE]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. + <a href="https://math.mit.edu/~gs/linearalgebra/">Introduction to Linear Algebra</a> + <a href="https://gen.lib.rus.ec/book/index.php?md5=3A039E6BB43D417004D63149C7A97163">Non-linear Control for Underactuated Mechanical Systems</a> + + 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/cont/doodle.html b/cont/doodle.html new file mode 100644 index 0000000..43700e5 --- /dev/null +++ b/cont/doodle.html @@ -0,0 +1,32 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Some Doodles +[SETDATE]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 +</pre> +<img src="https://hairydiode.xyz/img/doodle/watch.png" ></img> +<pre> +Ear bud holders +</pre> +<img src="https://hairydiode.xyz/img/doodle/budholder.png" ></img> +<pre> +A tower +</pre> +<img src="https://hairydiode.xyz/img/doodle/scene.png" ></img> +<pre> +Layout +</pre> +<img src="https://hairydiode.xyz/img/doodle/archi1.png" ></img> +<pre> +More layout +</pre> +<img src="https://hairydiode.xyz/img/doodle/archi2.png" ></img> +<pre> +Even more layout +</pre> +<img src="https://hairydiode.xyz/img/doodle/archi6.png" ></img> diff --git a/cont/earbud.html b/cont/earbud.html new file mode 100644 index 0000000..74c31e9 --- /dev/null +++ b/cont/earbud.html @@ -0,0 +1,13 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Earbud Holders +[SETDATE]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 <a href="https://hairydiode.xyz/earbud.pdf">here</a>. + +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/cont/fourcorners.html b/cont/fourcorners.html new file mode 100644 index 0000000..2994c29 --- /dev/null +++ b/cont/fourcorners.html @@ -0,0 +1,19 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Four Corners Input Method for ibus-table +[SETDATE]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 無法分別小鍵盤上的鍵, 要不該輸入法可英漢同時輸入。其外統一碼的數據不全,所 +以以后我該用『異體字字典』之類的數據。 + +<a href="https://hairydiode.xyz/cgit/ibus-table-fourcorners.git">源碼/Code</a> diff --git a/cont/index.html b/cont/index.html new file mode 100644 index 0000000..9cafa24 --- /dev/null +++ b/cont/index.html @@ -0,0 +1,28 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四--> [TITLE] +-------------------------------------------------------------------------------- + ________ + |,------- + ||_____. + `-- --.| + // || + // // + // // + // // + // + 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 + <a href="https://hairydiode.xyz/key">Public Key</a> +Where's all the other stuff you host from this domain? + <a href="https://hairydiode.xyz/cgit">My Git Repos</a> + <a href="https://social.hairydiode.xyz">My Mastodon Instance</a> +Where's all the content? + Scroll Down +[SETTITLE]Home diff --git a/cont/jankime.html b/cont/jankime.html new file mode 100644 index 0000000..1f3a94f --- /dev/null +++ b/cont/jankime.html @@ -0,0 +1,92 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Janky IME +[SETDATE]6-29-2023 +UPDATE: This IME is now tmux based, old xdotool version is still <a href="https://hairydiode.xyz/cgit/bim.git/tree/ims">here</a> + +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 <a href="https://hairydiode.xyz/unihome.html">we have unicode at home</a> + +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 <a href="https://www.rcsb.org/">PDB</a>, 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 <a href="https://github.com/jdh8/ibus-boshiamy">here</a>. + + 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 + + <a href="https://hairydiode.xyz/cgit/bim.git/tree/imt">CODE:</a> + 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 + + <a href="https://hairydiode.xyz/cgit/bim.git/tree/imt">CODE:</a> + 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 + + <a href="https://hairydiode.xyz/cgit/bim.git/tree/imt">CODE:</a> + 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/cont/key.html b/cont/key.html new file mode 100644 index 0000000..2b769dd --- /dev/null +++ b/cont/key.html @@ -0,0 +1,61 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]PGP Public Key +[SETDATE]6-26-2018 + +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFwIIQMBEADBtwzeFxGYuEpsgNPAVkt8SE88jEFpyspxJrBAQJz3K5Zmfd24 +8w+KDSsZNSD4okiORSX3YuEAxONfwjZKjahdwXIhb4KvpbauvKfpR1M7eKhZ4StQ +0ax3cG3xR2pXHHnDOxAjt90vrx3lT3O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0AEQEAAYkCPAQYAQgAJhYhBP88hF+HeVg6jrIZ8T1a +domdAfUSBQJcCCEDAhsMBQkFo5qAAAoJED1adomdAfUSsmEP/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----- + +<a href="https://hairydiode.xyz/key.txt">plaintext version</a> diff --git a/cont/matrix.html b/cont/matrix.html new file mode 100644 index 0000000..83287be --- /dev/null +++ b/cont/matrix.html @@ -0,0 +1,35 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Matrix Homeserver +[SETDATE]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/cont/meta.html b/cont/meta.html new file mode 100644 index 0000000..09791e2 --- /dev/null +++ b/cont/meta.html @@ -0,0 +1,28 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Making This Site +[SETDATE]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: <a href="https://github.com/knolax/hairydiode">https://github.com/knolax/hairydiode</a>. +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 <a href="https://github.com/knolax/hairydiode/tree/master/cont">cont/</a>. What I write is for the most part plaintext, with +the exception of links and images. Then I run a script <a href="https://github.com/knolax/hairydiode/blob/master/gen.sh">《gen.sh》</a>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. +<img src="img/meta/source.png" ></img> + diff --git a/cont/meta2.html b/cont/meta2.html new file mode 100644 index 0000000..91f3f39 --- /dev/null +++ b/cont/meta2.html @@ -0,0 +1,53 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Moving This Site +[SETDATE]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 <a href="https://hairydiode.xyz/iokalant">Iokalant</a>. + +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 <a href="https://hairydiode.xyz/cgit/hairydiode">hairydiode git repo</a> +-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 <a href="https://certbot.eff.org/">certbot</a> 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 <a +href="https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps">Git Deployment</a>, and <a href="https://www.digitalocean.com/community/tutorials/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps">Setting Up Apache</a>. Also <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">This Guide</a> +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/cont/ptyim.html b/cont/ptyim.html new file mode 100644 index 0000000..6fff58b --- /dev/null +++ b/cont/ptyim.html @@ -0,0 +1,47 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四--> +[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Non-Janky Input Method for the Linux Console (and other Terminals) +[SETDATE]09-06-2025 + +I've implemented boshiamy in a lot of convoluted ways so far. I've done it using +<a href="https://hairydiode.xyz/jankime">bash scripts</a> and using <a href="https://hairydiode.xyz/xkbabuse">xkb compose rules</a>. + +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 <a href="https://github.com/jdh8/ibus-boshiamy">ibus boshiamy implementation</a> I based my IM table + off of + - Linux Akesson for this <a href="https://www.linusakesson.net/programming/tty/">writeup</a> which explained a everything + about how ttys work on linux + +Code and further reading are in a git repo <a href="https://hairydiode.xyz/cgit/ptyim">here</a> diff --git a/cont/unihome.html b/cont/unihome.html new file mode 100644 index 0000000..30b8dd7 --- /dev/null +++ b/cont/unihome.html @@ -0,0 +1,187 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]We Have Unicode at Home +[SETDATE]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 <a href="https://hairydiode.xyz/cgit/bbrll.git/tree/bbrll">here</a> + +----------------=[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 <a href="https://hairydiode.xyz/cgit/bbrll.git/tree/fontd">here</a> + +-------------------------=[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 <a href="https://hairydiode.xyz/cgit/bbrll.git/tree/fontd">here</a> + +----------------------------=[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 <a href="https://hairydiode.xyz/cgit/bim.git">code</a> and <a href="https://hairydiode.xyz/jankime">writeup</a> + + +"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/cont/xkbabuse.html b/cont/xkbabuse.html new file mode 100644 index 0000000..b658621 --- /dev/null +++ b/cont/xkbabuse.html @@ -0,0 +1,107 @@ +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四--> +[TITLE] [DATE] +-------------------------------------------------------------------------------- +[SETTITLE]Abusing X11's xkb for fun and profit +[SETDATE]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 <a href="https://github.com/jdh8/ibus-boshiamy">ibus boshiamy implementation</a> 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 <a href="https://hairydiode.xyz/cgit/xkb-boshiamy">here</a> diff --git a/src/footer.html b/src/footer.html new file mode 100644 index 0000000..8354c6c --- /dev/null +++ b/src/footer.html @@ -0,0 +1,9 @@ +</pre> +</div> +<br> +<br> +</body> +<!-- +if you're digging in the src you might be interested in how this site works +here: https://hairydiode.xyz/meta2 +--> diff --git a/src/header.html b/src/header.html new file mode 100644 index 0000000..29b26c5 --- /dev/null +++ b/src/header.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<head> +<title>[TITLE]</title> +<meta charset="utf-8"/> +<link rel="stylesheet" href="https://hairydiode.xyz/style.css"/> +<link rel="icon" type="image/png" href="https://hairydiode.xyz/img/fav/logo.png"/> +</head> +<body> +<div class="content"> +<pre> +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四 +-->-------------------------------------------------------------------------------- + +<a href="https://hairydiode.xyz">>HairyDiode</a> + +-------------------------------------------------------------------------------- |