-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move diary from SichangHe/diary@c418928
- Loading branch information
Showing
13 changed files
with
1,019 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- toc --> | ||
# Back from Duke | ||
|
||
20230313 | ||
|
||
I have abandoned this diary for a long time since I went to Duke last fall | ||
semester. | ||
This could be reasoned at follows: | ||
|
||
- I was taking five courses at Duke and was busy. | ||
- I made suboptimal ex-relationship decisions that are time-consuming. | ||
- I was occupied with shiny new tech, trying out Neovim, Elixir, etc. | ||
|
||
## Duke semester | ||
|
||
Duke seemed like a real school. | ||
People walked around carrying books and talking to others. | ||
In all my classes (except perhaps CS 203), class activities were unmatched | ||
compared to DKU classes. | ||
|
||
The courses have loads of homework, almost as much homework as DKU courses | ||
each week. | ||
But, the courses are not difficult as DKU courses in that you have the time and | ||
chance to "breathe." | ||
Unlike crappy DKU seven-week courses, Duke courses last for 14 weeks, | ||
and give you one extra week for reviews, one extra week for final exams. | ||
|
||
I took: | ||
|
||
- CS 203, Discrete Mathematics for Computer Science | ||
- CS 205, Computer Architecture | ||
- CS 371, Intro to Machine Learning | ||
- MATH 401, Abstract Algebra | ||
- MATH 431, Real Analysis | ||
|
||
I have not much motivation to talk about them in details. | ||
|
||
In general, Duke CS classes taught me real stuff, unlike DKU CS classes… | ||
|
||
## Ex-relationship | ||
|
||
The relationship ended with a special COVID related drama that I could not | ||
foresee. | ||
|
||
What I did foresee, though, was its nature of temporariness. | ||
Back then, I wrote the relationship contract with a clause regarding break ups. | ||
|
||
What I think went wrong, was that I pet them too much and they behaved more and | ||
more like a pet, dependent, purposeless, and naughty. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!-- toc --> | ||
# Elixir Phoenix | ||
|
||
I need a back end technology. | ||
First, I thought Ruby on Rails was the most suitable. | ||
Now, I am turning to the Elixir Phoenix Framework. | ||
|
||
## Leaving Rails | ||
|
||
Rails was said to be the most productive back end framework. | ||
|
||
I learned Ruby and walked through the Rails "getting started" document | ||
last summer. | ||
Then, I made [a forum](https://github.com/SichangHe/forum). | ||
|
||
Pain started to increase when I was making the forum: | ||
|
||
- The template Rails generated became less useful as the project went on. | ||
- For adding functionalities such as history, tags, and search, | ||
I introduced more and more plugins, | ||
each of them: | ||
- needed me digging documentation to find my usecase | ||
- had part of their documentation out-of-date, | ||
so I had to dig the GitHub issues as well | ||
- introduced more "magic" to the codebase | ||
|
||
Main reasons why Rails suck: | ||
|
||
- Too much "magic." | ||
- Everything works highly relying on metaprogramming. | ||
- Global namespace pollution means it is hard to figure out | ||
what things are, where they are defined, | ||
and the language server couldn't find those either. | ||
- Backwards incompatibility. | ||
- Rails 7, as I was using, clearly made a lot of solutions that worked in | ||
Rails 6 not working any more. | ||
Devise, the authentication plugin, e.g., wouldn't work properly. | ||
- Hotwire was not fun to play with. | ||
|
||
It's like playing a puzzle game, instead of helping me. | ||
|
||
## Learning Elixir | ||
|
||
- Went through Elixir official doc. | ||
- Did a few Exercism exercises. | ||
- Went through *Functional Web Development with Elixir, OTP, and Phoenix* | ||
until they started to use Phoenix channels and the API has changed. | ||
- Technically, only learned about Elixir, not Phoenix. | ||
- GenServer is the main way to handle states and side effects. | ||
|
||
## Learning Phoenix | ||
|
||
I have not actually started using Phoenix yet. | ||
|
||
When following the *Functional Web Development* book, | ||
I wanted to separate the Elixir project into several modules, | ||
so I created an umbrella project and initialized a Phoenix project inside it. | ||
The project straight-up could not build. | ||
|
||
I then initialized a Phoenix umbrella project. | ||
It builds and runs fine. | ||
But, it creates a weird project structure that intertwines with Phoenix. | ||
So, I guess I will just not use umbrellas when I want true separation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!-- toc --> | ||
# Feeling Lost | ||
|
||
2022-05-15 | ||
|
||
It is 12 p.m. at night and I'm the only one up at home. | ||
I just had a shower and my hair is still half-dry. | ||
During the shower, | ||
I was thinking and I was feeling lost. | ||
I thought again about my Signature Work, | ||
which does not exist at the moment. | ||
|
||
I wrote to a computer science professor for recommendation for mentors. | ||
In that email, | ||
I stated that I wanted to deploy a server with Rust and WASM | ||
but I felt that it would be impossible to accomplish anything alone | ||
and I considered scientific computing as well. | ||
One move I think I did wrong was to mention a project | ||
with another computer science professor, | ||
who the professor I wrote to recommended for mentor without a reason. | ||
I guess they are just pushing me back to whatever I have. | ||
|
||
The reason I asked another professor for recommendation for mentors | ||
is right because I sensed that there are something wrong with the way | ||
the current project runs. | ||
I feel like that we are not doing anything special | ||
while getting excited | ||
—we are just reinventing the wheel and trying to enjoy it. | ||
Text searching and test processing, | ||
both are something that countless people have done before, | ||
and our team is just importing Python libraries, | ||
smashing it into the project and writing glue code, | ||
and calling it a progress. | ||
|
||
A while ago there was a seminar where computer science professors | ||
and students showed what they had done. | ||
All of them used machine learning to treat some problems | ||
that may or may not have any meanings. | ||
I have this impression that people are machines learning for machine learning. | ||
It looks tempting, | ||
but I know that machine learning is extremely data-demanding and therefore hard. | ||
I decided that machine learning would not be a main theme in any research of mine | ||
unless I really have a huge amount of preprocessed data, | ||
which I probably won't have. | ||
|
||
I have this feeling that computer science people in DKU tend to play with | ||
little toys that people from a more academic background would discard. | ||
This could be similar for data science people. | ||
I am considering to do some mathematics studies… | ||
I thought about it and recall that | ||
my mathematics is a huge pile of mess, | ||
being taking all these "applied" math classes at DKU. | ||
I just took the advanced linear algebra last session | ||
and I had zero motivation to study it along side with CS301 | ||
with our lockdown and online classes. | ||
I don't really know what the heck I learned in these courses. | ||
I know they have a lot of proofs that is important, | ||
but I don't really understand why any of them is constructed like that. | ||
I also did horrible in CS301, | ||
which I confirmed today by checking the final exam grade. | ||
|
||
I thought to myself that I don't care grades that much. | ||
I figured that I care more about my experiences. | ||
But, I do care about grades. | ||
The way this shows is that bad grades make me visibly unhappy, | ||
and good grades does not make me happy. | ||
It is just poisonous. | ||
|
||
I am now thinking that I really should reread the books that I ought to read | ||
but instead attended "slides classes." | ||
I think learning mathematics is not about taking those freaking classes. | ||
The classes that I did well, | ||
I learned them in advance by book. | ||
I am guessing that I actually learn much less effectively taking classes | ||
than reading books for the following classes. | ||
But, I have been too lazy to read all the books before taking all these classes. | ||
A lot of the time definitely went to YouTube. | ||
|
||
Right now, | ||
I'm learning JavaScript, | ||
while also planing for more Rust, | ||
Python, | ||
and C exercises. | ||
But, I suspect that these are not as important as reading more mathematics books for me. | ||
I need to change… |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!-- toc --> | ||
# Diary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
<!-- toc --> | ||
# Linux VM And Neovim | ||
|
||
20220806 | ||
|
||
After a long time, | ||
I decided that I should write something again. | ||
I've been sick multiple times during the months since coming back to Canton. | ||
I highly doubt that the pathogen density here is much higher than in Kunshan. | ||
Despite that, | ||
I have actually done quite a lot of stuff recently. | ||
|
||
## Linux VM on M1 MBP | ||
|
||
After fiddling with qemu and virt-manager on my M1 MBP, | ||
I gave up and went back to Parallels Desktop. | ||
|
||
### virt-manager and qemu | ||
|
||
I used virt-manager with qemu on Arch Linux and Ubuntu Linux. | ||
On M1 MBP, though, KVM does not exist, | ||
and virt-manager cannot connect to hvf in my experience. | ||
Therefore, I was merely using qemu's emulation and the performance was dreadful. | ||
|
||
### Parallels Desktop | ||
|
||
Having met obstacles using virt-manager, | ||
I decided to try out Parallels Desktop again. | ||
|
||
The problem was how to get it. | ||
|
||
At first, | ||
I searched for the good old Russian TNT. | ||
The search took a long time and the results were diminishing. | ||
I then looked for Chinese cracks. | ||
|
||
All of the Chinese cracks use PD runner, | ||
which I knew about and also tried. | ||
Basically, it is a standalone program that calls functions from Parallels Despite | ||
to launch VMs after the trail period has ended. | ||
Some sites even sell PD runner for quite an amount of money. | ||
|
||
I don't like the idea of getting a caller program somewhere randomly on the internet | ||
and using it just to launch an official program. | ||
I remembered vaguely that this thing was leaked from GitHub. | ||
And, that was the right place to search for it. | ||
The program was hidden behind a non-default branch for some reason, | ||
but I managed to download it. | ||
|
||
I simply got Parallels Desktop from their official website. | ||
It turned out later that the PD runner from GitHub works just fine. | ||
Now, the problem became which distro I should use. | ||
|
||
### The distro for the VM | ||
|
||
A big thing about Linux distros is that no all of them support ARM that well. | ||
It also come with the actual reason why I need a Linux VM. | ||
There are certain tools, | ||
such as valgrind, | ||
that cannot be used on macOS. | ||
And, I want to be able to get my hands on some of them. | ||
Because that's the reason, | ||
I decided that compatibility is the top requirement. | ||
Therefore, Alpine, which is very lightweight and "suckless," | ||
is excluded from my choices. | ||
I use Arch Linux for my other laptop, | ||
but I believe ARM is not a first class support for them. | ||
It usually comes to Ubuntu as the choice for such VMs. | ||
But, I dislike distros like Ubuntu because they fiddle on the original repos | ||
(like Debian's repos) | ||
and produce what effectively is a Frankenstein of repos. | ||
|
||
Their base, Debian is good though, | ||
but Debian stable provides packages that are on average one or two years old. | ||
Luckily, I recently got to know that Debian testing is actually very usable. | ||
It is also a rolling-release distro. | ||
It seems like a very good choice for development | ||
which is what I would do on the VM anyways. | ||
|
||
### Installing the VM | ||
|
||
I grabbed a weekly build ISO and installed it as a Parallels Desktop VM. | ||
The first time, I got it wrong. | ||
I used TUI install, partitioned the drive, | ||
gave it 100MB for the boot partition and the rest for the home partition. | ||
At the end of the installation I selected "install system utilities" | ||
and did not install any desktop environments. | ||
As the installation process proceeds, | ||
I was watching the virtual disk growing larger and larger in size on Finder. | ||
It grew from under 1G to over 2.5G. | ||
|
||
I wanted a minimum installation, and that was not. | ||
I deleted the VM and tried a second time. | ||
This time, I did not select anything to preinstall during the installation process. | ||
However, I made another mistake. | ||
At the end of the installation, | ||
it prompted me to remove the installation media, | ||
which I did later by deleting the ISO. | ||
What happened was, it said that the VM did not have any OS installed! | ||
I reconnected the ISO and booted into rescue mode, | ||
but I didn't know what to do to rescue it. | ||
So, I installed it again on the same virtual disk. | ||
|
||
Upon fresh install, the VM was about 2G, which makes me happy. | ||
However, I tried to install packages using sudo and found out that sudo wasn't installed. | ||
So, I used su to install doas | ||
because I heard that doas is smaller and simpler to use. | ||
I began to understand why people just stick to Ubuntu. | ||
Most people would not be able to handle this. | ||
They would just go online | ||
and type in whatever command they see in a guide to install something. | ||
And, the guide would most certainly tell they to sudo. | ||
I installed both clang and GCC and both of them are about 0.5G, | ||
therefore the VM grew much bigger. | ||
It was still much smaller than it could be if I were to install a desktop environment. | ||
My previous VMs took around 5G to 7G even without the compilers. | ||
|
||
I decided that I want to stick with the terminal for this VM. | ||
So, the text editor choice would naturally be Neovim. | ||
|
||
## Neovim | ||
|
||
My main text editor is Code - Insiders at the moment. | ||
The reason why I switched from VSCodium was | ||
that the fantastic Pylance extension would only run on Microsoft's builds. | ||
Also, the insider build is slightly faster in my experience. | ||
I also tried Emacs, but ended up not using it. | ||
That would be for another story. | ||
Previously, I was using SpaceVim, which is a Vim distribution. | ||
It has numerous plugins built-in and supports various languages out of the box. | ||
The problem though, is that it is large and hard to install. | ||
The installation depends on GitHub connection, | ||
but my VM is not guaranteed to have that. | ||
I decided to go vanilla on the VM. | ||
But, at the same time, | ||
I want to go full vanilla Neovim because that is how I can learn. | ||
|
||
I went ahead and read the neovim-lua guide on GitHub, | ||
and added the configurations I want to my pure-Lua config files. | ||
To keep things small, | ||
I found a theme on GitHub based on One Light and copied it to my repo. | ||
|
||
After all that was done, | ||
I was pretty happy about my Neovim setup on the VM. | ||
But, I was less happy about my Neovim setup on my Mac. | ||
I tried to port my configurations to the macOS side | ||
but apparently those conflict with SpaceVim settings. | ||
I finally decided to ditch SpaceVim, | ||
which also meant that I would need to have my own plugin manager. | ||
I landed on dein for its lazy-loading features for performance. | ||
It took two days to fiddle my Neovim setup and learn Lua. | ||
After using some language servers, | ||
I concluded that Neovim cannot replace VSCode for me. | ||
It is much more convenient to open up a file instantly from terminal with Neovim. | ||
But, it lacks features like toggling comments on keyboard shortcuts. | ||
Although one could probably configure Neovim to do all that, | ||
it take quite a amount of time. | ||
Also, the way VSCode is used is that you start it and let it stay, | ||
therefore, you get much faster startup speed when you open another file. | ||
But, you start and close Neovim frequently, | ||
and each time, the language server or whatever extensions you have loads for a while. | ||
|
||
### Lua | ||
|
||
However, I am largely happy about how the configurations turned out. | ||
I got to fiddle with Lua, | ||
which is a different beast than the other scripting languages I used. | ||
Lua's performance is simply fantastic while it sucks at not having arrays. | ||
It also took me a while to learn Lua's custom Regex. | ||
After gaining some familiarity with Lua, | ||
I decided to write the yabai helper in Lua. | ||
The helper takes the information about all of the windows in the current space | ||
and calculates the next window to switch to. | ||
In this way, | ||
I managed to let yabai switch window in a circular fashion, | ||
including the windows yabai does not manage. |
Oops, something went wrong.