diff options
-rw-r--r-- | cont/fourcorners.html | 19 | ||||
-rw-r--r-- | cont/index.html | 1 | ||||
-rw-r--r-- | cont/jankime.html | 92 | ||||
-rw-r--r-- | cont/mit.html | 15 | ||||
-rw-r--r-- | cont/network.html | 12 | ||||
-rw-r--r-- | cont/orion.html | 74 | ||||
-rw-r--r-- | cont/unihome.html | 187 | ||||
-rw-r--r-- | fourcorners.html | 44 | ||||
-rw-r--r-- | index.html | 13 | ||||
-rw-r--r-- | jankime.html | 117 | ||||
-rw-r--r-- | mit.html | 40 | ||||
-rw-r--r-- | network.html | 37 | ||||
-rw-r--r-- | omnicom.pdf | bin | 1459918 -> 1458363 bytes | |||
-rw-r--r-- | orion.html | 99 | ||||
-rw-r--r-- | unihome.html | 212 |
15 files changed, 677 insertions, 285 deletions
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 index 935e4b0..9cafa24 100644 --- a/cont/index.html +++ b/cont/index.html @@ -20,7 +20,6 @@ Who are you? How do I tell you your site is ugly? Email:0@hairydiode.xyz <a href="https://hairydiode.xyz/key">Public Key</a> - Phone:(Two Four Oh)-938-1333 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> 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/mit.html b/cont/mit.html deleted file mode 100644 index a737471..0000000 --- a/cont/mit.html +++ /dev/null @@ -1,15 +0,0 @@ -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->[TITLE] [DATE] --------------------------------------------------------------------------------- -[SETTITLE]MIT Decisions Countdown Clock -[SETDATE]3-09-2019 - -Can't wait for that rejection. -<img src="img/mit/scr.png" alt="Screenshot of the script"`></img> -<a href="https://hairydiode.xyz/cgit/mitclock">Code</a> - -Yeah I know you're not supposed to abuse "date" like that but it's a fun toy -script. - -UPDATE: yeah I got the fat rejection. UC Hicago too. diff --git a/cont/network.html b/cont/network.html deleted file mode 100644 index c289f82..0000000 --- a/cont/network.html +++ /dev/null @@ -1,12 +0,0 @@ -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->[TITLE] [DATE] --------------------------------------------------------------------------------- -[SETTITLE]A Distributed Network Idea -[SETDATE]1-3-2018 -So recently I had this idea for a distributed network that i'm planning on -trying to build. To start off with I'm making my own SDR development device -called an Omnicom, which I'll write about later. -You can read about it <a href="https://hairydiode.xyz/network.pdf">here</a>, but I warn you it's not actually a -properly formatted LaTeX file, and it's mostly a rough outline of what I'm -doing. A more fleshed out copy should come sometime next week. diff --git a/cont/orion.html b/cont/orion.html deleted file mode 100644 index 00c9af6..0000000 --- a/cont/orion.html +++ /dev/null @@ -1,74 +0,0 @@ -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->[TITLE] [DATE] --------------------------------------------------------------------------------- -I'm stepping down as vice president of ORION, below is my reasoning for leaving. - -- - - - - - - - - - - - ---=[Why I'm Leaving ORION]=--- - - - - - - - - - - - - - --Preface: - - To start off, I'd like to say that I don't think there's anything -objectively wrong with ORION, and that I'm leaving mostly because it wasn't what -I expected it to be. I wish the remaining members of ORION good luck on their -mission. - --The Mandelbots: - - ORION was founded initally as a way for us to get funding for our -robotics team, The Mandelbots. This was the reason I joined ORION, but after the -last competition season I feel that that's no longer the case. ORION has moved -on to different goals, and I feel has distracted us from robotics. - Despite efforts by all of us to avoid them, we ran into the same issues -of bad time management that we did last year. In order to fund our team we had -to apply for grants through ORION, most of which only came in close to our -qualifier date. As a result the parts that we needed to build our robot came in -3 days before the qualifier, giving us only 3 days to build. However, the -late-coming grants don't explain why for the months before that, little or no -progress was made on the aspects of robotics that weren't so dependent on new -parts. For example, coding started only about a week before the competition, and -very few prototypes were built with the parts that we had from last season. - During those months without parts, we spent most of our meetings working -on other things. I admit, I too am guilty of this, but the one thing that has -taken up the most time in our robotics meetings was ORION. The thing with ORION -work is that the tasks it involves like applying for grants and planning for -future projects are all official business related to robotics, but nonetheless -are not robotics. So in my opinion they merely presented us with a more -acceptable way to procrastinate on the robot. We even had members of the team -who spent almost every meeting working on ORION projects that had nothing to do -with robotics. - There's nothing inherently wrong with focusing on ORION with our time, -but it's not what I signed up for and it's not why I agreed to host our robotics -meetings. - --The Future of ORION: - - "ORION is a stem nonprofit ..." is how we would always introduce -ourselves while doing outreach, but it doesn't say much about our goals and how -we aim to acheive them. What ORION currently has in the works is a python class -and a potential robotics camp in Ghana. Personally, I disagree with these -projects, but this is in no way some sort of indictment. - For one, a single member of ORION has been the only one working on the -python class, and has requested that they be the only one to teach it. In the -months they have been working on the curriculum they have never even shown it to -other members of ORION, as far as I am aware of. There's nothing objectively bad -about this but I personally feel that given the python class is one of our main -focuses, there should be more collaboration involving all of us. - Ghana on the otherhand, I disagree with on the basis that it's too -misdirected. Why is it that we are running these camps in far off places with a -vaguely humanitarian goal? Shouldn't we focus on our own communities, and don't -they deserve to be taught by people from their own communities? The implication -has always been that because of economic reasons those communities can not set -up camps of their own, but if this is true then there are deeper issues to be -solved. To do things like set up a camp for them is like giving a band-aid to -someone who's just lost an arm. - --Conclusion: - - It is because of all this that i'd like to leave ORION and will no -longer mention my previous association elsewhere. I wish the rest of ORION the -best of luck. This document will be hosted on my personal site, and any current -members of ORION are welcome to have any comments they have be hosted alongside -it if they email them to me at 1339802534.kk@gmail.com. -[SETTITLE]Leaving ORION -[SETDATE]2-9-2018 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/fourcorners.html b/fourcorners.html new file mode 100644 index 0000000..23cebdf --- /dev/null +++ b/fourcorners.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<head> +<title>Four Corners Input Method for ibus-table</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> + +-------------------------------------------------------------------------------- +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->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 無法分別小鍵盤上的鍵, 要不該輸入法可英漢同時輸入。其外統一碼的數據不全,所 +以以后我該用『異體字字典』之類的數據。 + +<a href="https://hairydiode.xyz/cgit/ibus-table-fourcorners.git">源碼/Code</a> +</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 +--> @@ -38,26 +38,25 @@ Who are you? How do I tell you your site is ugly? Email:0@hairydiode.xyz <a href="https://hairydiode.xyz/key">Public Key</a> - Phone:(Two Four Oh)-938-1333 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 -<a href="https://hairydiode.xyz/matrix">[Matrix Homeserver] 3-17-2019</a> -<a href="https://hairydiode.xyz/mit">[MIT Decisions Countdown Clock] 3-09-2019</a> +<a href="https://hairydiode.xyz/fourcorners">[Four Corners Input Method for ibus-table] 11-25-2023</a> +<a href="https://hairydiode.xyz/unihome">[We Have Unicode at Home] 6-30-2023</a> +<a href="https://hairydiode.xyz/jankime">[Janky IME] 6-29-2023</a> <a href="https://hairydiode.xyz/key">[PGP Public Key] 6-26-2018</a> -<a href="https://hairydiode.xyz/csc-new">[Control Systems Club Web Controlled Servo Instructions] 1-24-2019</a> <a href="https://hairydiode.xyz/csc-workflow">[Control Systems Club Project Workflow] 1-24-2019</a> -<a href="https://hairydiode.xyz/iokalant">[𘤝𘤞𘤀𘤛・𘤌𘤛𘤧𘤁・𘤊𘤡・𘤈𘤝-Iokalant Writing System-优卡文字系] 1-26-2018</a> +<a href="https://hairydiode.xyz/matrix">[Matrix Homeserver] 3-17-2019</a> <a href="https://hairydiode.xyz/meta2">[Moving This Site] 6-26-2018</a> <a href="https://hairydiode.xyz/meta">[Making This Site] 11-13-2017</a> -<a href="https://hairydiode.xyz/network">[A Distributed Network Idea] 1-3-2018</a> <a href="https://hairydiode.xyz/omnicom">[Omnicom Writeup] 1-12-2018</a> -<a href="https://hairydiode.xyz/orion">[Leaving ORION] 2-9-2018</a> <a href="https://hairydiode.xyz/csc">[Control Systems Club] 2-21-2018</a> +<a href="https://hairydiode.xyz/csc-new">[Control Systems Club Web Controlled Servo Instructions] 1-24-2019</a> <a href="https://hairydiode.xyz/doodle">[Some Doodles] 2-27-2018</a> <a href="https://hairydiode.xyz/earbud">[Earbud Holders] 3-7-2018</a> +<a href="https://hairydiode.xyz/iokalant">[𘤝𘤞𘤀𘤛・𘤌𘤛𘤧𘤁・𘤊𘤡・𘤈𘤝-Iokalant Writing System-优卡文字系] 1-26-2018</a> </pre> </div> <br> diff --git a/jankime.html b/jankime.html new file mode 100644 index 0000000..3c54176 --- /dev/null +++ b/jankime.html @@ -0,0 +1,117 @@ +<!DOCTYPE html> +<head> +<title>Janky IME</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> + +-------------------------------------------------------------------------------- +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->Janky IME 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. +</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/mit.html b/mit.html deleted file mode 100644 index 739f697..0000000 --- a/mit.html +++ /dev/null @@ -1,40 +0,0 @@ -<!DOCTYPE html> -<head> -<title>MIT Decisions Countdown Clock</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> - --------------------------------------------------------------------------------- -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->MIT Decisions Countdown Clock 3-09-2019 --------------------------------------------------------------------------------- - -Can't wait for that rejection. -<img src="img/mit/scr.png" alt="Screenshot of the script"`></img> -<a href="https://hairydiode.xyz/cgit/mitclock">Code</a> - -Yeah I know you're not supposed to abuse "date" like that but it's a fun toy -script. - -UPDATE: yeah I got the fat rejection. UC Hicago too. -</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/network.html b/network.html deleted file mode 100644 index 7aa71ca..0000000 --- a/network.html +++ /dev/null @@ -1,37 +0,0 @@ -<!DOCTYPE html> -<head> -<title>A Distributed Network Idea</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> - --------------------------------------------------------------------------------- -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->A Distributed Network Idea 1-3-2018 --------------------------------------------------------------------------------- -So recently I had this idea for a distributed network that i'm planning on -trying to build. To start off with I'm making my own SDR development device -called an Omnicom, which I'll write about later. -You can read about it <a href="https://hairydiode.xyz/network.pdf">here</a>, but I warn you it's not actually a -properly formatted LaTeX file, and it's mostly a rough outline of what I'm -doing. A more fleshed out copy should come sometime next week. -</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/omnicom.pdf b/omnicom.pdf Binary files differindex dcb4cdf..ded486a 100644 --- a/omnicom.pdf +++ b/omnicom.pdf diff --git a/orion.html b/orion.html deleted file mode 100644 index 33eb220..0000000 --- a/orion.html +++ /dev/null @@ -1,99 +0,0 @@ -<!DOCTYPE html> -<head> -<title>Leaving ORION</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> - --------------------------------------------------------------------------------- -<!-- -123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 -一二三四-->Leaving ORION 2-9-2018 --------------------------------------------------------------------------------- -I'm stepping down as vice president of ORION, below is my reasoning for leaving. - -- - - - - - - - - - - - ---=[Why I'm Leaving ORION]=--- - - - - - - - - - - - - - --Preface: - - To start off, I'd like to say that I don't think there's anything -objectively wrong with ORION, and that I'm leaving mostly because it wasn't what -I expected it to be. I wish the remaining members of ORION good luck on their -mission. - --The Mandelbots: - - ORION was founded initally as a way for us to get funding for our -robotics team, The Mandelbots. This was the reason I joined ORION, but after the -last competition season I feel that that's no longer the case. ORION has moved -on to different goals, and I feel has distracted us from robotics. - Despite efforts by all of us to avoid them, we ran into the same issues -of bad time management that we did last year. In order to fund our team we had -to apply for grants through ORION, most of which only came in close to our -qualifier date. As a result the parts that we needed to build our robot came in -3 days before the qualifier, giving us only 3 days to build. However, the -late-coming grants don't explain why for the months before that, little or no -progress was made on the aspects of robotics that weren't so dependent on new -parts. For example, coding started only about a week before the competition, and -very few prototypes were built with the parts that we had from last season. - During those months without parts, we spent most of our meetings working -on other things. I admit, I too am guilty of this, but the one thing that has -taken up the most time in our robotics meetings was ORION. The thing with ORION -work is that the tasks it involves like applying for grants and planning for -future projects are all official business related to robotics, but nonetheless -are not robotics. So in my opinion they merely presented us with a more -acceptable way to procrastinate on the robot. We even had members of the team -who spent almost every meeting working on ORION projects that had nothing to do -with robotics. - There's nothing inherently wrong with focusing on ORION with our time, -but it's not what I signed up for and it's not why I agreed to host our robotics -meetings. - --The Future of ORION: - - "ORION is a stem nonprofit ..." is how we would always introduce -ourselves while doing outreach, but it doesn't say much about our goals and how -we aim to acheive them. What ORION currently has in the works is a python class -and a potential robotics camp in Ghana. Personally, I disagree with these -projects, but this is in no way some sort of indictment. - For one, a single member of ORION has been the only one working on the -python class, and has requested that they be the only one to teach it. In the -months they have been working on the curriculum they have never even shown it to -other members of ORION, as far as I am aware of. There's nothing objectively bad -about this but I personally feel that given the python class is one of our main -focuses, there should be more collaboration involving all of us. - Ghana on the otherhand, I disagree with on the basis that it's too -misdirected. Why is it that we are running these camps in far off places with a -vaguely humanitarian goal? Shouldn't we focus on our own communities, and don't -they deserve to be taught by people from their own communities? The implication -has always been that because of economic reasons those communities can not set -up camps of their own, but if this is true then there are deeper issues to be -solved. To do things like set up a camp for them is like giving a band-aid to -someone who's just lost an arm. - --Conclusion: - - It is because of all this that i'd like to leave ORION and will no -longer mention my previous association elsewhere. I wish the rest of ORION the -best of luck. This document will be hosted on my personal site, and any current -members of ORION are welcome to have any comments they have be hosted alongside -it if they email them to me at 1339802534.kk@gmail.com. -</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/unihome.html b/unihome.html new file mode 100644 index 0000000..476ad0b --- /dev/null +++ b/unihome.html @@ -0,0 +1,212 @@ +<!DOCTYPE html> +<head> +<title>We Have Unicode at Home</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> + +-------------------------------------------------------------------------------- +<!-- +123456789-223456789-323456789-423456789-523456789-623456789-723456789-8234567890 +一二三四-->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 <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 │ +</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 +--> |