Inside Job: TV series review

Futurama but at current times. Various conspiracy theory instead of sci-fi fantacy. Reagan as Leela the leader, Brett as Fry the fool, with their colleagues as the office members.

Blowing one's mindset just like Rick and Morty but more usually in terms of morality sarcasm. What they do have in common, the despise of hypocritic morality, the confidence of running the world (literally), the respect for reason, science, and knowledge, the sense of liberty and freedom of souls.



I chose React as the framework of the frontend. Despite I have been developing using React, this is the first React project of mine that starts from scratch. MUI seems pretty handy.

So it went online now.

There are still a lot of bugs to fix and features to add, but I'll take a breath before carrying on. Atm, finding costomers with requirement prevails my service to provide.

structured data in database

Consider the following data structure to implement in a database:

class ComponentBase:
	name: str
	def serialize(self):
		assert False

class ComponentA(ComponentBase):
	def serialize(self):

class ComponentB(ComponentBase):
	def serialize(self):


class ComponentList(ComponentBase):
	children: list[ComponentWrapper | ComponentList | ComponentSet | ComponentA | ComponentB ...]
	def serialize(self):

class ComponentSet(ComponentBase):
	children: set[ComponentWrapper | ComponentList | ComponentSet | ComponentA | ComponentB ...]
	def serialize(self):

class ComponentWrapper(ComponentBase):
	target: ComponentList | ComponentSet | ComponentA | ComponentB
	def serialize(self):

The purpose of a database implementation is to query like 'which componentWrapper recursively includes a given componentA?', 'get all the related componentB of a gievn componentWrapper', and such.

And the trouble arises not only because there is a list to maintain (performance concern), but also, there are unions of types (how? all in one table?), and loops in definition (safety concern, unknown depth problem).

The current approach uses json field to store the data above, which solves all the problem at the expense of additional backend workload (it basically reads everything into memory) which I intend to avoid.

Well it all depends on actual requirements. Reading the database recursively is actually acceptable compared to loading the entire table into memory. Saving list as a json value is acceptable when the lists only have length of like 10.

Best solution would be the recursive approach with cache field to avoid deep loop when querying. However, this would make configuration harder as pure json appoach is much more human readable than nested sql table entries. Moreover, it means the updating certain value of database will now have to go through the backend to ensure the cache is valid. Even then, the cache updating is more complicated than normal one-way cache. It has to be in both direction, allowing it to propagate through any cache that it relys on, and that relys on it. Consider all of these troubles the price of performance. Such huge modification would mean some fundamental change of the program... Maybe when I have time.

If I do it, this would be the 4th major version of this program, by major I mean none of these versions is back compatible. The cause of such iteration is that the need of requirement and need of performance is quite divided, and I am kinda stuck in between. It's difficult to vision all the requirement in advance, and optimization usually limits future functions.

Pantheon: TV series review



Steve, founder and CEO of the best company of his time, tried to upload human mind to Matrix and almost succeeded. To ensure the job is kept on even after his eraly death of some incurable cancer, he opted to make a clone of himself. The clone would then be nurtured in the Truman Show based on Steve's own biography to ensure his genius.

  • Steve Jobs, the reality layer.
  • Trumen Show, the connection layer and sideline.
  • Matrix, the sci-fi layer, the metaverse.

It's good TV series in terms of story, great anime production in terms of visulization, but still, it lacks true sci-fi innovation of concept, and not quite consistant in character personality development and logic, in other words it feels awkward to watch from time to time.

plot holes

With the ability to manipulte the entire internet with root access to every device connected, the 'gods' seem quite unimaginative.

The antagonist turns out to have mental problems, which lowers the credibility of the entire set.

The latest development includes some very interesting settings about immortality. I guess the story hasn't quite prepared to introduce the ture enternity. The flaw, that the uploaded mind will decay over usage shows significant similarity to those of original life, which is both reasonable and disappointing. Having such a limit on its core sci-fi setting creates a sense that it's just a common story with some sci-fi tech, restricting further development.

easter eggs

The antagonist, an Indian, shared the tech with 'nations of top cyber', which turns out to be US, Russia, UK, Isreal, Iran, and China. Cannot say if he is trying to protect India by not letting them know such technology. Also, France is the only absent P5.
P.S. 20221005 I just learned that the writer, Ken Liu, is a Chinese... all make sense now.


It takes the life of a protagonist to make an antagonist. Classic Joffery move. But too many plotholes,too may stereotypes.

Why no backup when everything is digitalized?
Why physical annihilation when code injection is much more easy and cost effective?

As to the classic 'Chinese people are kind and reasonble it's CCP causing problems'... It would definitely be interesting to find out how a Chinese degenerated into a white left. Sure, it might not be the problem of Ken but the ideology gets across nontheless.


20220925 损伤自诊













膝关节内侧副韧带(medial collateral ligament,MCL)由 MCL 浅层(superficial MCL,sMCL)、深层(deep MCL,dMCL)以及后斜韧带(posterior oblique ligament,POL)三部分组成,是维持膝关节外翻及旋转稳定性的重要结构。sMCL 是 MCL 中最表浅的韧带,是维持膝关节外翻稳定性的主要结构,也是维持膝关节旋转稳定性的次要结构[1-2]。POL 是维持膝关节内旋稳定性的主要结构,也是维持膝关节外翻和外旋稳定性的次要结构[3-5]。生物力学研究发现,膝关节屈曲 25° 时,sMCL 提供 78% 的抗外翻和外旋应力;而膝关节屈曲 0°~30° 时,POL 对维持内旋稳定性发挥关键作用[1, 6]。因此,同时有效地修复 sMCL 和 POL,对恢复膝关节稳定性和生物力学性能起着重要作用。

MCL 损伤是临床常见的运动损伤类型,根据 Hughsyon 标准[7]分为 3 级。单纯 Ⅰ、Ⅱ级损伤无需手术治疗[8];合并前交叉韧带(anterior cruciate ligament,ACL)损伤的 Ⅲ 级损伤需要手术干预,以避免膝关节外翻松弛及旋转不稳,进而继发膝关节骨关节炎及外翻畸形,影响患者运动水平及生活质量[9-10]。


考虑到直行走路尚可,因此交叉韧带损伤概率低(即使损伤也需要伤2周后再手术),认为是Ⅰ或Ⅱ 级损伤,因此维持现状保守治疗,尽可能卧床休息,保持直腿或在15度弯曲内,降低sMCL受力(疼痛为准),观察至两周。



20220930 损伤自诊










20221003 转诊海宁市人民医院



20221004 MRI





20221010 康复






20221014 自诊










  1. Xie W, Zhu W. Biomechanical comparison of single-bundle and anatomical double-bundle reconstructions for grade Ⅲ medial collateral ligament injury]. Zhongguo Xiu Fu Chong Jian Wai Ke Za Zhi. 2020 Jun 15;34(6):720-725. Chinese. doi: 10.7507/1002-1892.201911057. PMID: 32538562; PMCID: PMC8171538. ↩︎

  2. 后交叉韧带损伤机制及治疗方法 ↩︎ ↩︎ ↩︎

  3. 这36种骨折,影像医生值夜班时千万不要漏诊! - 知乎 ↩︎

  4. 儿童胫骨髁间棘骨折 - 好大夫在线 ↩︎

Electric Long Board

This is going to be a long sequal.

20220831 1st try

While I was at Berkeley, a girl Lin taught me how to ride a skateboard. I remember I shot the photo of the tall grass right next to the training course that night. That 1.5 hour of practice was all I had with skateboard before I decided to buy an electric one. Technically I do have childhood experience on toy boards, which was driven by twisting, could be a reason why I learned fast.

It paid well. Within the first half hour I was able to cruise at 20 km/h and do normal turns with radius of 3 meters at lower speed. I tried to reach top speed but the board began to shake heavily before I can reach that fast.

20220905 2nd try, reach top speed

4 days of raining stopped my training.

I learned from reddit and Youtube that the 'shaking' I experienced at high speed was called wobbling and it is due to my feet position. By putting my front foot right on the front wheel, I can now accelerate to top speed (but still too cautious to look at the speed meter, it was about 38km/h according to the seller) without any problem.

It is still dangerous to go on road at this stage because I still cannot make sharp turns and fast stops.

On my search for how to make sharp turns, I found there is actually a style called carving in some Youtube videos [1][2]. I will practise that next time.

20220906 carving

I can now pass the corner at 20 km/h, within lane. The actual top speed is 35 km/h at half battery.

Carving is interesting, but I can not drift yet. It could be due to wrong posture, or simply because the board has too good a grip. No matter what, carving is definitely a good way to learn to control the board.

I tried to look for some groups on telegram, facebook, or QQ. Some of these groups are really active, and gave me some really good advice.

For example I was adviced to get a regular board to practise sharp turns and stop. I vaguely remember I could do a sharp turn on a regular board though.

20220912 first accident

I've been using the eskateboard for commuting in the past few days. Today I falled from a skateboard and crashed on land for the first time in my life. It was due to fast break (from >30km/h) before the turn.

This accident proves that the decision to protect myself using only engineering gloves was necessary and almost sufficient under such circumstances. There are further risk of grazing my elbow or bumping my head should I get unlucky though. It turns out 20km/h might be the safe boundry for daily commute.

20220916 ride on the other side

I borrowed a regular board from another classmate. It is slightly shorter, has wheels of half the size, and a much softer bridge. It turned out accelerating on a regular board is much harder.

I taught one of my friends to ride a eskaeboard too.

I also start practising riding on the other side, i.e. with my right foot in front, contrary to normal.

20220917 Yuquan campus

I went to another campus with my eskateboard today. It turned out I have mastered the riding on busy and unfamiliar streets.

I continued to practise on the other side. It seems most of the balance control memory are not transferrable and I have to learn them from like 0. Obviously, balance control is something beyond conciousness. I expect twice or third learning period since I will not use this side for daily commuting.

20220920 Accident

  1. How To Slide Your Electric Skateboard or Longboard EASY - YouTube ↩︎

  2. How To Corner & Carve Like a Pro on Your Evolve Skateboard! - YouTube ↩︎


Go, GORM, and gRPC

v2ray-core is written in Go.

So I tried GORM as yet another alternative to SQLAlchemy and Django. GORM can manage the database by migration just as Django does, and this part works fluently.

As to the config side, it feels uncomfortably hard to implement a model-based configurator in Go. Despite I can get all the struct directly from v2ray-core, they come with very strict type definitions. Implementing another model feels unnecessary, and is troublesome too - no type union, no constructor, no default value for functions. Indeed, Go is not an object-oriented language.

For scenarios where performance is not a problem, Python will do so I am going to save the trouble of reimplementing the whole project yet again in Go.

However, I do still need Go for gRPC for some features of v2ray to work. I can either use a Python package for that, or I can use the GORM model defined earlier to write gRPC directly in Go. The first approach is considered better in the long run because I can save the trouble of aligning the Python and Go ORM model.


ordered list in a database

Previous development reveals that relation-based databases cannot properly handle arrays that need insert() method.

A hack is to use a string-based index that allows gaps between indexes so that insertion can be realized without reordering the rest of the entries. [1]

This is feasible on the SQL level but the availability under ORM tools still needs investigation.

ORM: SQLAlchamy vs Django

On the ORM side, I also tried Django as an alternative to SQLAlchamy.

Some major difference includes:

  • Django builds the database according to the model, while SQLAlchamy requires manual mapping. This may be a desired feature for fast development but comes at a cost of less extensibility as an ORM
  • Django model object links to each other by a query manager while SQLAlchamy object links to each other directly. The Django way will cause a problem in type hint that would require further hacks like django_hint and manual type decalration everytime a query is made. I consider this as a feature missing bug of Django
  • Django comes with a lot of other features since it's developed as more of a website backend than a simple ORM

  1. Django: define a name for reverse ForeignKey - Stack Overflow ↩︎



I spent 2 days redeveloping a v2ray config generator to fulfill my increasing demand for proxy server configuration.

Currently, I have more than 20 different simple configurations (i.e. one-level proxy) for more than 10 servers. Despite a lot of them being just servers of different domains to balance the load across CDN, managing all of them with complex proxy chains is a headache. A typical proxy chain configuration can reach 500+ lines of JSON, which is quite some work to write even one. Moreover, several of my friends are using the services too, which makes the configuration even harder.

I wrote a super long python script to work with a sqlite3 database one year ago trying to automate the process. It worked well until the demand for proxy chains arises. Due to the lack of knowledge and foresight, I use raw SQL to extract information into python dictionaries. This works at a simple level, but the model information is lost during the process. The work became exponentially more difficult as the requirement became complex.

With all the knowledge acquired last year, I re-implement the program with python and sqlite3, again. But this time I use sqlalchamy and jsonpickle so that I can model the configuration instead of using just dictionaries. It turned out that such a method facilitates my development to a great extent.

I also rebuild the database model. The complete database structure is shown below.

service.chain and virtual_server.chain actually depends on address_group, server, reverse_server, and virtual_server. However, these information are stored in JSON so can not be seen from the database structure.

At this stage, I only implement the config class of my requirement so a lot of functions of v2ray are neglected, thus not ready to be published as a public library.

Asymmetric routing and campus firewall

the problem

Despite Zhejiang University having a clear university-wide policy on domain registration, a Haining campus Information Technology Services (ITS) officer Z told me the campus has its own policy that refuses to follow due to 'security concern'. In other words, the Haining campus refuses to assist with University domain reverse proxy, such that any user who wants to have an Internet-accessible server will have to have its server located elsewhere. In my situation, it means an extra ¥2200/year cost to rent a VPS from ZJU main campus.

The actual scenario is, the Haining campus has internal connections with other ZJU campuses. In my situation, with the service still deployed on a local server, with a forwarded proxy from main campus VPS, any security breach would still happen locally, meaning the 'security concern' is nothing but a poorly made excuse.

Well, since the administrative board is not responsible for users in a typical Chinese-style organization, I will have to fix this issue by myself.

Interestingly, the reverse proxy can be actually configured from the main campus alone, and it should work without problem. So I circumvent the Haining campus ITS and registered a domain reverse proxy directly with the main campus.

The result is, strange. I noticed the server is indeed Internet accessible when applying for an HTTPS certificate, but local tests show that it can not be accessed from within China. In other words, it is accessible only from abroad.

the cause

I spent an entire afternoon trying to figure out why, and with hints from the main campus IT support and traceroute output, I finally discovered that the problem lies in asymmetric routing.

More detailly, all outgoing traffic from the Haining campus is redirected according to its destination. Traffic going abroad is going through the main campus exit, while others directly through the local campus exit. Now since the incoming traffic is all from the main campus entrance, this path is symmetrically routed, and the other one is not. The asymmetric routing will be blocked by the firewall due to DDOS attack prevention.

the fix

Now that I know the cause of the problem, the dillema arises that I still need Haining campus ITS's assistance to fix the issue. I need to make sure even those administrative roles like Z saw my request, they would not understand my true purpose. Considering Z's earlier response, she was either in an administrative position, or is really rookie in the network engineering field, both case I bet she would not want, or be designated to look into some issues too technical to understand.

A ticket is then sent to the Haining campus ITS to request all outgoing traffic of a specific ip to go through the main campus network gateway 'due to asymmetric routing' for 'research purpose, and to avoid incidental firewall block', together with some specified gateway ip I got from traceroute log. It turned out Z was not designated to the ticket.

Now that this is an existed routing, they accepted the reqest 'after requesting superior instruction'. Problem solved.

the bureaucracy

The is a typical bureaucracy 'there are policies and measures to counter' incident.

It turned out, I got lucky because incompetent officer like Z is indeed, incompetent. But this also means tragedy for all those who can not conceive a counter, and thus have to live with trash policies made by those incompetent officers.

On the other hand, trash policy actually works because not enough people know how to counter it, so the incompetent officer can remain in position.

To knowledge.

Reveal all HSAP without 'modified' tag

This is a log rather than a tutorial. It does one very specific thing, to reveal all HSAPs without getting 'modified' tag. Though I think the method of injecting/calling script without modified tag is worth sharing.


I have my HQ deployed at Unclaimed Sector behind Xenon Secot 524. So When I learned there could be a Unclaimed Sector beta but it's not in my game due to some game start randomness I try to bring it back without losing my game progress or getting a 'modified' tag.



  • write a script z.cheat.mkmark.revealall.hsap.xml to reveal all HSAPs based on cycrow's revealall cheat script, and add a fake signiture
  • extract plugin.turbo.hotkey.xml from corresponding pck file, backup the pck, then replace the pck by a modified xml where z.cheat.mkmark.revealall.hsap are replaced by plugin.turbo.activate
  • follow the 'Unmodifier' instruction to launch a game
  • activate turbo boost in game

the plain script of z.cheat.mkmark.revealall.hsap.xml

$main.universe = get global variable: name='main.universe'
skip if $main.universe -> exists
  $main.universe = get sector from universe index: x=0, y=0
skip if $main.universe -> exists
  $main.universe = [PLAYERSHIP] -> get sector

$x = get max sectors in x direction
while $x
  $y = get max sectors in y direction
  dec $x =
  while $y
    dec $y =

    $sector = get sector from universe index: x=$x, y=$y
    skip if $sector -> exists

    $flags = [Find.ExcludeTerranGates] | [Find.ExcludeGates] | [Find.Hyperspeed]
    $hsap = find gate: flags=$flags, refobj=$sector, max dist=null, refpos=null
    if $hsap -> exists
      if $hsap ->is hyperspeed access point
        if not $hsap ->is hsap discoverable
          if is valid route between sectors $main.universe and $sector
            $hsap -> set hsap discoverable [TRUE]

return null


  • (I generally followed Cheese's method but fixed the bug of extra missions)

Raspberry Pi libcamera low-latency http streaming

  • model: Raspberry Pi 4B
  • system: Ubuntu 22.04 aarch64

Through resources of Pi http streamings are widely available over the Internet, few address the libcamera library which is the only option under aarch64, and few address the low-latency part of the streaming.

I managed to achieve the above with the following:

This process has a very low latency due to the rendering workload being undertaken by the client, while Pi just hardware encoding the video into h264 and serving the binary directly.


Text is not SVG - cannot display


  • compile libcamera following the guide
  • compile libcamera-apps following the guide
  • install websockify following the guide
  • launch the following, or optionally create systemd services of these commands
libcamera-vid -t 0 --width 1920 --height 1080 --inline --listen -o tcp://
  • create static nginx html server with /rpicam/index.html as following
    <meta name="color-scheme" content="dark">
    <script type="text/javascript" src=""></script>
            margin: 0;
    <div id="container" style="width: 100%; margin: 0 auto;">
        <div class="vsc-controller"></div>
        <video width="100%" autoplay muted id="player"></video>
        function parse(data) {
            var input = new Uint8Array(data),
            video = input;

            return {
                video: video,

        window.onload = function () {
            var socketURL = document.location.href.replace('http', 'ws')+'ws/';
            var jmuxer = new JMuxer({
                node: 'player',
                mode: 'video',
                flushingTime: 0,
                fps: 30,
                debug: false

            var ws = new WebSocket(socketURL);
            ws.binaryType = 'arraybuffer';
            ws.addEventListener('message', function (event) {
                var data = parse(;
  • configure nginx server to serve /rpicam/ to static file directory, and /rpicam/ws/ to Typical configuration of the later is as following.
location /rpicam/ws/ {
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

known issues and solutions

  • current configuration can support only one client at a time
    • a dedicated backend to stream tcp/websocket data to multiple clients would be necessary
  • libcamera-vid will exit each time websocket is closed
    • auto restart is possible using systemd
    • if one have a dedicated backend this can be managed
  • no audio is served. jmuxer supports audio, to combine audio one will have to either
    • write a dedicated backend to repackage the binary data by adding audio and duration information
    • or serve audio through a seperate websocket, but could lead to audio/video being not synchronized

For now I am happy with the result, but a dedicated backend would be optimal/necessary to solve these issues.

Campus network exploitation

original plan with exploit

The campus has strange regulations to restrict outbound speed but not LAN speed. The goal was to utilize every accessible computer with wired LAN access to speed up my campus outbound connections. By using load balancer over a large number of computers the outbound bandwidth is combined for multithread downloading. n2n is used to connect devices with admin access for easy management, direct v2ray is deployed to devices without admin access but with fixed ip and port access, and v2ray of reverse proxy is to deploy to devices without fixed ip and admin access.

new exploits

While I was examing the campus HPC I noticed something strange: the outbound speed is not limited (in terms of LAN speed) on the HPC. This is reasonable consider that many people are using the cluster. Furthermore, the HPC is shared with commercial users from outside the campus, and further inspection confirms that the HPC outbound is a direct link to local China Telecom network instead of China Education and Research Network. This is a major advantage as the former one is much more reliable and efficient.

First of all, I only have a user account on the HPC, meaning opening ports on firewall is out of the quesiton, let alone creating tun devices. A common practise under such situation would be creating a reverse proxy to another server.

However, a port scan shows local 90 and 8080 port is open but unused. Port 90 is unavailable to common users, but 8080 is totally accessible. This is unexpected as well as hilarious. Nginx and v2ray is then deployed with ws+tls+vmess to provide maximum security. Crontab is configured to ensure availablity across reboot.

sudo nmap -n -Pn -sS -p0-65535 [ip]


Due to the unlimited outbound speed of HPC the connection bottle neck is now the campus LAN. Ping to various servers drops significantly due to the advantage of China Telecom over CERNET. Secure connections are established. While all operations are under campus regulation, some part of the process should be seen as exploits.

potential counter measures

To counter the exploits campus net admin would have to:

  • properly configure firewall of public workstations
  • block all ports of LAN devices to avoid NAT traversal, which is totally unreasonable, or
  • restrict the LAN speed to outbound speed, which is equivelantly unreasonable

Before that the campus network outbound speed limit is merely a trash policy, an inconvenience, rather than a restriction. Considering the inconvenience inflicted, and the total legal and reasonable process, I hardly find any motivation to report such exploits.

Backup and synchronization summary

Disk failure costs. As a general rule, all valuable data should be kept in copy, preferably on different devices, in real time, and with 2-way sychronization support.

In the early days I had been using robocopy with batch script, rsync with shell script, even adb-sync with batch/shell scripts. Configurations were complex, the backup system was vulnerable to various compatibility problems (typically system locale problems and path naming restrictions). The backup was also not in real time, nor does these methods support 2-way sychronization due to the absense of a database.

Commercial solution costs, while a lot of open-source solutions do not work in a real-time fashion.

Syncthing is a great tool to solve the problems above. It even comes with bundled NAT traversal capability. A typical backup network shows as below,

Text is not SVG - cannot display

where arrow shows backup direction, solid line represents user files, and dash line represents system files.

Some personal files are sychronized across devices as needed, while backup operations typically have the following ignore cases.

Linux user

.stignore at $HOME


Linux root

.stignore at /


Windows user

.stignore at %userprofile%

\Documents\Tencent Files\*\TIM\Registry2.0.db
\Documents\Tencent Files\*\TIM\Registry2.0.db-journal

Proxy summary

I built a proxy network allowing me to access various resources across the Internet. As shown in the figure below, servers on different locations are deployed and connected by either direct proxy (solid line) or reverse proxy (dash line). connection mapping are labelled in the format of '(x to y) * z', indicating z groups of x clients each connecting to y servers.

1 to m
1 to m
n2n edge
s to n
s to n
server * s
n2n supernode
server * s...
(n/k to 1) * k
(n/k to 1) * k
CDN server * n
CDN server * n...
VPS server * k
VPS server * k...
reverse proxy
1 to n
1 to n
1 to k
1 to k
China campus
China campus...
Internet VPS
Internet VPS...
Internet campus
Internet campus...
reverse proxy
server * (m-s)
n2n edge
server * (m-s)...
(m-s) to n
(m-s) to n
Text is not SVG - cannot display

by tools

  • v2fly/v2ray-core: secure proxy, balancer, router
    • Qv2ray/Qv2ray: v2ray gui for pc
    • SagerNet/SagerNet: v2ray gui for android
  • ntop/n2n: virtual LAN adaptor
  • alexkirsz/dispatch-proxy: adaptor combiner
  • nginx/nginx: server side http proxy, http reverse proxy, http port reuse
  • haad/proxychains: proxy chains, socks,http->app, for pc
  • proxifier: proxy chains, socks,http->app, for windows
  • ambrop72/badvpn/tun2socks: socks->adaptor
  • torproject/tor,tpo/applications/tor-browser: anonymous http
  • FelisCatus/SwitchyOmega: socks,http->browser

by application senario

bypass GFW with server port access

  • v2fly/v2ray-core+nginx/nginx: vmess+ws+tls->socks5, balancer, multiple domain cdn servers for acceleration and camouflage

bypass campus Internet outbound speed limit (campus has no LAN speed limit)

has LAN servers with server port access

  • v2fly/v2ray-core+nginx/nginx: vmess+ws->socks5, balancer, multiple in-campus servers for acceleration, speed *= number of servers

without servers

  • alexkirsz/dispatch-proxy: LAN + WLAN + USB LAN + USB hotspot: speed *= 4

reverse proxy without server port access

  • v2fly/v2ray-core: reverse proxy
  • microsoft/vscode: temporary port forwarding

LAN traversal with server root access

  • ntop/n2n


  • campus LAN should be seen as public with even more strict censorship but less decryption ability, never use unencrypted proxy in campus LAN
  • watch out for DNS leak, use firewall rules to block port 53 if necessary
  • if necessary use firewall rules to block all connections except localhost proxy

rss news

why rss

rss is the best solution to aggregate news with the advantages of being

  • free, no ads, no tracking, no targeting
  • highly customizable
  • across platform
  • decentralized

In short, by using rss we can choose sources rather than being targeted by algorithms with ads and propaganda.





The guideline is to choose from most unbiased media, i.e. AP and Reuters. Their positional (western) bias is then offset using TASS and 人民网 for voices from Russia and China.

This strategy covers:

  • Top 4 of the 5 UN security council members, with the exception of France
  • 3 of the 5 larget news agencies, with the exception of UPI which is yet another US news agency, and Agence France-Presse which does not provide mature english content.

Read More


  • 六子吃了两碗粉 - 让子弹飞
  • 伊拉克有生化武器 - US Congress
  • 新疆维吾尔族强迫劳动 - US Gov
  • 武汉病毒研究所制造新冠病毒 - US Gov
  • 中国要求俄罗斯奥运会结束再开战 - NY Times


体系:利益方 - 枪手 - 媒体 - 缺乏判断力的群众






  • 无视
  • 简单否认
  • 要求控方拿出切实有效的证据
  • 允许控方调查
  • 有公共认可的第三方,允许第三方调查
  • 反向污蔑/合理怀疑
  • 揭露控方诽谤的本质
  • 引诱控方犯下低级错误的诽谤



Russia seeks military equipment from China after Ukraine invasion -reports March 14, 2022 9:09 PM GMT+0

Chinese embassy says has never heard of Russian requests for help March 14, 2022 9:20 PM GMT+0


U.S. warns China not to help Russia as anti-war protest disrupts state TV

外交部发言人就美方签署所谓 “维吾尔强迫劳动预防法案”发表谈话

2021-12-24 08:46







2021/08/28   8月27日,美国国家情报总监办公室发布所谓“新冠病毒溯源调查报告”要点,认为目前看新冠病毒源自自然界和实验室泄漏的两种可能性都不能排除。报告诬蔑中方阻挠国际调查、拒绝共享信息并指责他国。白宫同日就新冠病毒溯源调查发布声明,妄称中方阻挠溯源工作的国际调查,缺乏透明度,企图纠集有关伙伴方对中方施压。中方对此坚决反对、强烈谴责。





















  1. 俄罗斯把乌克兰北东南三面合围以后不动了。既不合拢口袋,也不攻城。说明俄罗斯不着急。西乌部队肯定不会往口袋里钻,那无异于自杀。东乌政府军正面没有打赢的可能,长期来看除了撤退就是投降,没有别的选择。
  2. 俄罗斯没有切断乌西南即波兰罗马尼亚边境,甚至都没往西乌进军,尤其是北约武器现在在往西乌不断输送的情况下,说明俄对西乌没有任何兴趣。
  3. 表面上和乌克兰谈判但完全不停军事行动,说明俄罗斯没达到预期目标。
  4. 很多人说乌克兰会变成下一个阿富汗,我看未必。乌克兰地形缺乏打游击的条件,大平原重武器的对抗游击队根本活不了。乌克兰有抵抗意志但目前远没到阿富汗的血海深仇。



  1. 是否承认东乌各国独立
  2. 是否承诺永不入欧,永不入北约
  3. 是否承诺去军事化


Ukraine War



The biggest, if not only, winner of the event. The only one who wishes the event to happen, so that money can go back to US from EU (due to regional instability) to reduce the high inflation in US.

The only loss would be the confidence of US's allies accounting on its support.

If Russia does not invade Ukraine, NATO will be dancing at its doorstep which is super preferable to EU and US, but intolerable as to Russia.

If Russia invades Ukraine, EU and Russia will be against each other by sharing a military border, so that US (and UK) will have much less to worry about on these two opponents.


Has no advantage but military strength, has no means of diplomacy but threatening, has no choice but war. Pity.

European Union

Realize the event too late. Cannot do much. Now that Ukraine is under war, EU is bonded to US once more.


Stupid as fk. Lost everything because of some vague promise by US. Let war happen on its own soil due to some stupid and irresponsible politician breaching the status quo.


Cannot do anything. Cannot blame Ukraine as it's the victim. Cannot blame Russia since they are to some degree allies against US. Cannot defend Russia since Ukraine’s sovereign is threatened as a fact. Can blame US but few would listen, and the plot is just too good to believe.

Similar Event in History

Philippine on South China Sea

Stayed calm. Knows its position and is smart enough to avoid being used as pawns of US against China. US did not get anything but swear from Duterte to Obama.

Japan on Fishing Island

Japanese forced to lose its ground. US succeeded to break down the free trading pact between China and Japan.

South Korea on THAAD

Korea was forced to lose its ground. US succeeded to break down the free trading pact between China and South Korea.

Ukraine’s Only Options

Ukraine could be independent as North Korea if it did not give up its nuclear arsenal. Could be stable as Taiwan if it did not join any sides between NATO and Russia.



He is the main one accountable for this event due to lack of insight in foreign affairs and diplomacy status quo. He is not smart enough and has too much goodwill as the leader of a weak nation. He is bound to fail just as Allende in Chile.

If he dies he will become martyr of Ukraine Nationalism and neo-Nazism (ironically as a Jewish), and as an iron proof of Russia invasion. This is the last thing Russia would like to see, but the best thing US wants to see.

If he flees to US without public announcement he would probably be killed by US to fake the previous scenario.

If he flees to US with a public announcement, Ukraine Nationalism would suffer such a hit that Ukraine may just disappear as a country forever. The best thing Russia wants to see.

If he stays and is still the president after the Russian invasion, he will be a National traitor that sell his country to Russia.

In other words, his 'friends' wish he dies and his 'enemies' wish he lives.


He is what he is. He knows what Russia is good at and is not afraid to use its force when necessary. But honestly, he has no choice.

US Politicians

Still so good at manipulating the world.

X3 - Marines, and all the sarcasm

A deep discussion into the nature of development and authority, from the perspective of marines in the game X3.

X3FL - Board Q with 0 Casualty

Boarding a Xenon Q with 0 casualty was easy in TC since one can save load at each deck. Need a little more SL in AP, but was easier than P IIRC. Now it's very hard, but I finally made it after 717 attempts.

So I lower the Q's shield, launch 21 marines, initiate the jump sequence, keep shields low, and save right before boarding pods hit Q. After each reload, once the jump is completed, I open the property menu to watch the marine status, take a screenshot at the hacking stage, save the game, and copy the save to somewhere else.

I wrote a .ahk script to automate the above process, gathering a lot of saves and corresponding screenshots. The screenshots are later processed and clustered using python.

Of all the 793 scenarios recorded, 101 times Q launched a Firestorm Torpedo against me but ironically destroyed itself due to close-range detonation by my anti-missile system.

Of the remaining 692 scenarios, 447 times the marines did not survive till hacking the core. The other 245 (almost) successful scenarios have a distribution of remaining crews as follows at the hacking stage. Note there are occasions when less than 16 marines made it to this stage but were not eliminated.

Only in one scenario, at the 717th attempt, did all 21 crews survive the operation.


Autarky is the characteristic of self-sufficiency, usually applied to societies, communities, states and their economic systems.

Autarky - Wikipedia

I came to know this word as a Nazi Germany economy policy in 1930s. It triggers me deep, as even for an already industrialized country, autarky is still an option.

Read More

Design a Space Elvator

TV series Foundation shows a space elevator 911 event. How should a space elevator be designed and what will its collapse look alike?

Consider the space elevator to be a link with linear mass m^(l)\hat{m}(l) and a total length LL.

To have a straight link, everything below the Geosynchronous orbit, or GSO would be rotating too slow to support its own mass. To balance the effect one can choose from 2 sources of support: base reaction from the ground, or tension from above GSO.

The tension of link at height xx

T(x)=Fr0xGMm^(Re+l)2dl+0Lm^ωe2(Re+l)dlT(x) = - F_{r} - \int_0^x{\cfrac{GM\hat{m}}{(R_{e}+l)^2}}dl + \int_0^L{\hat{m}\omega_{e}^2(R_{e}+l)}dl

where ReR_e is earth radius, ωe\omega_e is earth rotating angular speed, FrF_r is base reaction force.

The boundry condition

T(L)=0T(L) = 0

Intuitively, a reasonable model will have the ground part in compression, but not that much of the entire gravity of things below synchronous orbit. The link at synchronous orbit will be in tension, so somewhere below there would be a zero force point.

The major payload should be deployed right at GSO, such that it doesn't pose any extra load into the link. Another benefit of the design is that the major payload can always survive any 911 attacks not targeted at it directly by simply cutting itself off the link. In such design, cut the link anywhere will have the lower part fall to Earth and upper part go into space. The TV series made a reasonable assumption.

Though seemingly unavoidable, it is by design inevitable for a (common civillian) building to fail a 911 attack due to economic concern, even a space elevator.

Axial force diagram should look like moment diagram of a cantilever beam under distributed load, and so should a reasonable section design be alike.

Project: Golden Horizon


A(n award winning) rural planning project, designed entirely by a group of Civil Engineer students (and newly graduated ones). The result is somehow not so bad since it at least won us an award, but I definitely wouldn't want to show it off. See the news report (in Chinese) for detail.

Read More























Analogy of life and society form

A topic over immortality triggered my extended thought over the similarity of life and society.

Read More

Zhejiang University Network

Had a chat with one of the local campus network admin, here is some of what I learned about the Zhejiang University network

  • the entire lab building is merely connected with 2 1-Gbps links
  • the new campus WIFI is restricted to 30 Mbps as requested by old main campus leader 'to ensure consistency'
  • office table network switches are trash with only 100 Mbps link speed
  • private router can cause DHCP problems thus DHCP should always be turned off, or they will ban the mac address
  • private router is against regulation as security might be breached that some connection can not be traced
  • all records are preserved permanently for security purpose
  • all connections to campus network can be traced to someone who is responsible
    • common link for sure can be traced to the account that is using it
    • direct link (static ip) can be traced to the applicant
    • most, if not all, direct link is bound to the device mac address
  • proxy service is detected using self developed software, through various techniques including using ip range pool











Project: NewLink Group Carbon Assessment Report 2021

First time InDesign user.

40p in 20 hours by InDesign, and a little Illustrator.

To be uploaded upon releasing.

Project: Terrain Modelling

This is a sub project of the ongoing project: Hengjin Villiage Plan.

Terrain Model Report

DEM data source

GoogleEarth - RenderDoc - Blender
not seamless, unable to use

SketchUp - Digital Globe

low resolution

picture 1

Dataset: ASTGTMV003_N29E121

DOI 10.5067/ASTER/ASTGTM.003
2000-03-01 00:00:00 - 2013-11-30 23:59:59
resolution of 1 arc second (approximately 30 meter horizontal posting at the equator)

picture 2

Dataset: ALPSRP133840570-RTC_HI_RES
2008-07-29 14:21:47 - 2008-07-29 14:21:55
resolution of 12m

picture 3

Satalite: TerraSAR-X
region not found

image data source

SketchUp - Digital Globe

Photoshop: remove excessive water print, and additional drawing
Illustrator: vectorization
caffe: scale up resolution

Satalite: Worldview-3
resolution of 0.3m
proposal required, need waiting within 14 days
owned by digital globe so potentially we may have already get it

Satalite: 高分二号
resolution of 0.8m

Read More

Project: X3-notoriety-hack


Turing machine on Hilbert's question on decidability

Math Has a Fatal Flaw - YouTube

Is it possible to tell beforehand if a program will halt or not on a particular input?

Turing's claim (or what Veritasium claims to be his claim)

let p(i)p(i) be any program with its inputs

assume h(p,i)h(p, i) satisfy the requirement, that it tells beforehand if a program will halt or not on a particular input, such that

h(p,i)={WILL_HALT,if p(i) will haltWILL_NOT_HALT,if p(i) will not halth(p, i) = \begin{cases} \text{WILL\_HALT}, & \text{if } p(i) \text{ will halt}\\ \text{WILL\_NOT\_HALT}, & \text{if } p(i) \text{ will not halt} \end{cases}

let h^\hat{h} be

h^(p,i)={[infinite loop],if h(p,i)=WILL_HALT0,if h(p,i)=WILL_NOT_HALT\hat{h}(p, i) = \begin{cases} \text{[infinite loop]}, & \text{if } h(p, i) = \text{WILL\_HALT}\\ 0, & \text{if } h(p, i) = \text{WILL\_NOT\_HALT} \end{cases}

consider h(h^,h^)h(\hat{h}, \hat{h})

h(h^,h^)={WILL_HALT,if h^(h^) will haltWILL_NOT_HALT,if h^(h^) will not halth(\hat{h}, \hat{h}) = \begin{cases} \text{WILL\_HALT}, & \text{if } \hat{h}(\hat{h}) \text{ will halt}\\ \text{WILL\_NOT\_HALT}, & \text{if } \hat{h}(\hat{h}) \text{ will not halt} \end{cases}

or equivalently

h(h^,h^)={WILL_HALT,if h(h^)=WILL_NOT_HALTWILL_NOT_HALT,if h(h^)=WILL_HALTh(\hat{h}, \hat{h}) = \begin{cases} \text{WILL\_HALT}, & \text{if } h(\hat{h}) = \text{WILL\_NOT\_HALT}\\ \text{WILL\_NOT\_HALT}, & \text{if } h(\hat{h}) = \text{WILL\_HALT} \end{cases}

The problem is, h^(h^)\hat{h}(\hat{h}) and h(h^)h(\hat{h}) does not exist as h^\hat{h} and hh takes two parameters, and there is no reason to assume (h^)=(h^,h^)(\hat{h}) = (\hat{h}, \hat{h}), leaving us no contradiction in the end.

The fix

To construct the paradox, we need to lower the input numbers. Instead of h^\hat{h} we define

h~(p)={[infinite loop],if h(p,p)=WILL_HALT0,if h(p,p)=WILL_NOT_HALT\tilde{h}(p) = \begin{cases} \text{[infinite loop]}, & \text{if } h(p, p) = \text{WILL\_HALT}\\ 0, & \text{if } h(p, p) = \text{WILL\_NOT\_HALT} \end{cases}


h(h~,h~)={WILL_HALT,if h~(h~) will haltWILL_NOT_HALT,if h~(h~) will not halth(\tilde{h}, \tilde{h}) = \begin{cases} \text{WILL\_HALT}, & \text{if } \tilde{h}(\tilde{h}) \text{ will halt}\\ \text{WILL\_NOT\_HALT}, & \text{if } \tilde{h}(\tilde{h}) \text{ will not halt} \end{cases}

or equivalently

h(h~,h~)={WILL_HALT,if h(h~,h~)=WILL_NOT_HALTWILL_NOT_HALT,if h(h~,h~)=WILL_HALTh(\tilde{h}, \tilde{h}) = \begin{cases} \text{WILL\_HALT}, & \text{if } h(\tilde{h}, \tilde{h}) = \text{WILL\_NOT\_HALT}\\ \text{WILL\_NOT\_HALT}, & \text{if } h(\tilde{h}, \tilde{h}) = \text{WILL\_HALT} \end{cases}

Philosophy, physics, and other thoughts

Until I figure the fix out I thought Veritasium is making fake assertions and baiting, turned out he's just been careless, and a paradox does exist.

The logic behind the problem is that, if there exists a program that can tell beforehand whether any problem has a solution, it cannot tell beforehand whether itself has a solution, thus vetoes its own existence.

An analogy would be, if a predictor exists, and we do adversely to whatever it predicts, then its prediction is wrong, and we conclude the predictor does not exist.

Now in terms of predictor people's been creative that in terms of whether things happen at a given future time, it may provide a possibility instead of a definite binary happens or not. The result does not collapse until the given future time, and the behavior of observation does have an influence over the outcome since we can now alternate the predicted future (in forms of possibility). This possibility model solves all the paradox mentioned above.

Back port the possibility model into the problem, there might be a program that can tell beforehand the possibility of whether any program has a solution (with further limits on observer) which is useless though.

The conclusion, however, does not necessarily escalate to 'whether all problems has a solution' since a problem does not necessarily equal a turing machine program. It does, imho, might escalte to 'whether all problems has a definite solution', as is in coherence with quantum physics.

Though I wonder whether mathematicians are satisfied with such conclusion like 'Goldbach conjecture' has a 99.9999... possibility to be true.

On the other hand, an interesting research direction is to prove that 'Goldbach conjecture' is impossible to prove.

-- 现代汉语词典



我认为情绪的宣泄与斥责,可以咒骂,但不宜有侮辱之意。虽然骂大多只是情绪的宣泄,但其必有来由。例如“傻逼”“智障”,不见得施法对象就真是“弱智”,但多有嫌弃“幼稚”“naive, too young”之意。在这一方面,长者可谓道行颇深。骂人幼稚,好歹还有长进的空间。


有些骂,看似侮辱,实则,确实侮辱。鲁迅先生曾专就此写过一篇杂文《论“他妈的!”》[3]。先生认为国骂出处或无据可考,但北魏有邢子才“卿何必姓王?”,颇有骂人仰仗门第之意。这解读多少与先生反封建的社会背景有关。现在有人再讲“他妈的”,含义基本等同于“肏他妈的”。放到白左嘴里这大概可以解读成中国人歧视侮辱女性了,当然他们自己也有"mother fucker",倒是巧合?回到国骂本身,倘若当面骂人“肏你妈的”,不见得真要行不轨之事,但侮辱之意甚矣。



Read More

Chengdu Trip

20210726 Chengdu

First impression, Chengdu feels just like any costal city of East China, with modern CBD, railway station, and subway. Living cost seems somehow lower though.

Food is not so good as one would normally claim, possibly due to my bad strategy to try to get accustomed to authentic local food. However some dessert does impress me as I had my first taste on sweet jellied Tofu, very much like pudding.

Local city feels like a strange combination of 2020 East coast CBD with 2000 East coast streets. Prostitutes advertisements are everywhere in hotel, and occasionally I can see one or two of them sharing an elevator.

The elder generally speaks only local accent which is a trouble for me. Good for me that my girlfriend can understand them quite well.

There has been an effort to modernize, or to renovate old streets as tourist spots all over China. What surprised me is that old Chengdu streets, feels just like any East China old street.

Panda, as one of the most famous local cultural element, can be seen everywhere in the city, i.e. posters, sculptures, clothes. Some of these sculptures are really interesting, and the one really impressed me was one built right in the middle of CBD, right on top of one building, featuring a climbing pose.

20210801 Dujiangyan

Ancient irrigation system.

Refer to as a general tour plan. Nothing too bad, yet nothing exceeding expectation either.

20210801 Qingchengshan

If I may say, just as Qingchengshan itself is a mountain developed for religious purpose, the best, and most interesting scenery, is local people.

Read More

The Complexity of Humanity

Everyone knows "complicated" is code for "bitch."
-Gone Girl (2014)

Read More

Project: X3FL dynamic relationships


Project: zju-health-reporter


Project: Prefabricated Engineered Bamboo Mobile House - BIM Modeling

Glubam is short for glue laminated bamboo, which is a new material[1].

This is the BIM modeling project for a new code: Technical specification for prefabricated engineered bamboo mobile house.

  1. Wu, Y., and Y. Xiao. "Steel and glubam hybrid space truss." Engineering Structures 171 (2018): 140-153. ↩︎

The 2nd Civil Engineering Computing and Simulation Technology Academic Conference

I would not put my half organized notes here.

I met some of the greatest Chinese scholars in the field. Watched their report, and found myself at a very strange position.

I love computing and simulation technology, but the deeper it goes the more clear its boundry is - technology is technology, civil engineering is engineering, not science.

Read More

Changsha Trip

True Fans
Changsha Culture and Art Center, by Zaha Hadid.

A true fans sees him everywhere.

20210509 College of Civil Engineering, Hunan University

Odd enough, the metro exit reads 'College of Civil Engineering, Hunan University' instead of just 'Hunan University', despite the entire campus is just outside of the exit and College of Civil Engineering is the one most far from the exit.

Project: Glubam Building

A real glubam project to be built in Changsha, Hunan, China.

It will be the first glubam[1] multistory office building in the world.

It is also my first calculation completely done in python. The code can be found here, in Chinese. You're always welcome to use google translate though.


The current accepted architecture proposal is

20210408 Glubam Building 4.6-2

Read More


Read More

TL-R473G Router Hack

I finally come back home to reset the router which was accidentally turned into brick half an year ago. With more experience in Linux I finally successfully gained root access to the device.

Read More

Math in Banished - Maximum Population

enfo13[1] posted a 4000+ population reddit yet I think some of the popular models/conclusions might be wrong so I decide to write this paper.

The majority of this paper is based on theory and is yet to be testified.

The game is so time consuming that I don't even know if I'll be able to test my theory.

Read More

San Francisco Night Drive

Night drive with Han Li, Xin Chen, and Siqi Yao.

For the first time I found out that Lombard Street exists more than just in GTA. > <

20210130201505 San Francisco - Oakland Bay Bridge from Treasure Island
20210130201505 San Francisco - Oakland Bay Bridge from Treasure Island

20210130210724 San Francisco - Oakland Bay Bridge from Inside
20210130210724 San Francisco - Oakland Bay Bridge from Inside

Blog Migration

TLDR, I moved from WordPress to Jekyll, then to Hexo, with WordPress still working as a CMS.

Read More

Chrome Dark Scroll Bar

Chrome now supports dark scroll bar as Github has implemented. After careful search and debug I finally located 2 syntax for its implementation, being:

A HTML meta tag telling Chrome supported color-schemes with preference by order. Chrome users with system-wide light/dark theme will find it respect this tag on page reload. The light theme remains what it was, while the dark theme features a default pure black background and pure white font color, with other colors like purple for hyperlinks.

<meta name="color-scheme" content="light dark">

A CSS property which can override previous meta tag and works without reloading the page

:root {
  color-scheme: dark;


Improved dark mode default styling with the color-scheme CSS property and the corresponding meta tag

Tall Grass

202101202110 Tall Grass

Night of first trials on tennis and skateboard, taught by and practised with Xinyu Hu, Han Li, Zhirong Lin, and Xin Chen.

Virtualize Dual-boot Linux

Comparing with WSL2

  • Pro
    • Allow maximum performance when using physical machine
    • Have Native GUI which can be accessed using VirtualBox
    • Native disk operation performance under virtual machine
  • Con
    • No app optimization and support in Windows, e.g. vscode, cuda (but vscode has ssh feature, and you have native linux cuda under physical machine)
    • Mapped file in RAM is not managed by Windows, naturally, thus requiring a larger RAM (Your RAM stores mapped files from both host Windows and VM Linux now)
  • Even
    • Other performance under windows, e.g disk operation across systems (using SMB)

Read More

Chrome OS on Surface Pro 7



except # Not Working

Not Working

  • Multi-touch Finger Input (Single-touch works)
  • Stylus Input
  • Camera
  • Surprise, dark mode hasn't been implemented in Chrome OS 87!

Have Problem Working

Speaker will make hissing noises with headphone injected


Chrome OS cannot be installed directly to PC due to hardware compatibility. Some hardware, e.g. the Intel Precise Touch Screen of Surface Pro, even requires special driver. Moreover, Chrome OS, or Android, are built to install on the entire disk (not a partition).

'brunch' is a framework project featuring these problems by including support for PC hardwares and installing Chrome OS on a .img disk mirror file.


sebanc/brunch: Boot ChromeOS on x86_64 PC (supports most Intel CPU/GPU or AMD Stoney Ridge)

Rammus recovery bin from CrOS Updates Serving

Bottle neck upstream repo

linux-surface/iptsd: Userspace daemon for Intel Precise Touch & Stylus

Install script

I use WSL to pack up the '.img' file. Due to the warning given by brunch readme, I made a special partition, a 32 GB NTFS 'G:', i.e. '/mnt/g/' in wsl for safety concern. The img size is thus set at 31 (GB).

The reason to use NTFS is to facilitate disk operation in Windows. An EXT4 file system will work too, but not FAT32 due to lack of support of large file.

sudo apt-get install pv
sudo apt-get install cgpt
sudo bash -src chromeos_13505.73.0_rammus_recovery_stable-channel_mp-v2.bin -dst /mnt/g/chromeos.img -s 31;


Need to disable Secure Boot and Bitlocker first.

Turning Secure Boot back on is an easy method to disable GRUB - thus booting directly into Windows.

I use grub2win for multi-boot. Add the boot code generated by brunch (next to the generated '.img' file) to grub.cfg to add the Chrome OS boot entry, and specify options=ipts in kernel parameters to enable touchscreen input.


Follow instructions of BiteDasher/brcr-update: Script to update Chrome OS installed using the brunch framework

Android Remote Control

A completely open-source solution, partly stimulated by TeamViewer's aggressive approach to classify personal users as commercial users. Btw, Chrome Remote Desktop is recommended for desktop remote control.

Read More

KaTeX with VSCode, Jekyll, and WordPress Markdown

I use KaTeX in VSCode extension Markdown All in One for notes and homework. It's by far the easiest and most flexible way.

Markdown is such a markup language (see the paradox? lol) without a widely-accepted, strong official organization regularizing its syntax and grammar. Typical standards includes:

Implementation of Javascript libraries into Markdown, such as KaTeX, is done independently by Markdown processors, thus creating even more variants of syntax and grammar.

In an attempt to use the same syntax and grammar throughout my Markdown documents, i.e KaTeX with VSCode, Jekyll, and WordPress Markdown, and considering the possible transplantation to LaTeX, I adopt the following configuration for most consistent experience.

Read More

Celestial Coordinate Systems

This work is from part of UCB CS289A 2020 Fall Project S Final. See Github repo for more information.

A physical model is evaluated so that we can understand the problem more properly.

Solar-centered ecliptic coordinate system

Solar-centered ecliptic coordinate system is centered at the sun, using spring equinox as x+x+ or polar axis, ecliptic as xyxy plane.

Earth location (polar)

xe=(re,θe,0)\mathbf{x}_e = (r_e, \theta_e, 0)


θe=2πTeyt+θe0\theta_e = \frac{2 \pi}{T_{ey}} t + \theta_{e0}

or (dirichlet)

xe=[recos(2πTeyt+θe0)resin(2πTeyt+θe0)0]\mathbf{x}_e = \begin{bmatrix} r_e \cos{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ r_e \sin{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ 0\\ \end{bmatrix}

other planets can have a similar definition.

Earth-centered ecliptic coordinate system

Solar-centered ecliptic coordinate system is centered at the earth, using spring equinox as x+x+ or polar axis, ecliptic as xyxy plane.

Equatorial coordinate system

Equatorial coordinate system is centered at the earth, using spring equinox as x+x+ or polar axis, equator as xyxy plane.

Planets location in such system is defined as right ascension α\alpha and declination δ\delta,

as (polar)

Xp=(Rp,π2δ,α)\mathbf{X}_p = (R_p, \frac{\pi}{2} - \delta, \alpha)

as we normally do with spherical coordinate system (r,θ,ϕ)(r,\theta,\phi)

or (dirichlet)

Xp=[RpcosδcosαRpcosδsinαRpsinδ]\mathbf{X}_p = \begin{bmatrix} R_p \cos\delta \cos\alpha\\ R_p \cos\delta \sin\alpha\\ R_p \sin\delta\\ \end{bmatrix}

Horizontal coordinate system

Horizontal coordinate system is centered at the observer, using local north as x+x+ or polar axis, local vertical up direction as z+z+.

Planets location in such system is defined as azimuth AA and altitude aa,

as (polar)

X^p=(Rp,π2a,A)\hat \mathbf{X}_p = (R_p, \frac{\pi}{2} - a, A)

as we normally do with spherical coordinate system (r,θ,ϕ)(r,\theta,\phi)

or (dirichlet)

X^p=[RpcosacosARpcosasinARpsina]\hat \mathbf{X}_p = \begin{bmatrix} R_p \cos a \cos A\\ R_p \cos a \sin A\\ R_p \sin a\\ \end{bmatrix}

Coordinate transformation

It is easy to transform between the solar-centered ecliptic coordinate system and the earth-centered ecliptic coordinate system. A planet with coordinate xp\mathbf{x}_p in solar-centered ecliptic coordinate system is at xpxe\mathbf{x}_p - \mathbf{x}_e in earth-centered ecliptic coordinate system.

xpxe=[rpcos(2πTpyt+θp0)recos(2πTeyt+θe0)rpsin(2πTpyt+θp0)resin(2πTeyt+θe0)0]\mathbf{x}_p - \mathbf{x}_e = \begin{bmatrix} r_p \cos{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \cos{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ r_p \sin{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \sin{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ 0\\ \end{bmatrix}

transformation from the earth-centered ecliptic to equatorial coordinate system [1]

[xequatorialyequatorialzequatorial]=[1000cosεsinε0sinεcosε][xeclipticyeclipticzecliptic]\begin{bmatrix} x_{\text{equatorial}}\\ y_{\text{equatorial}}\\ z_{\text{equatorial}}\\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0\\ 0 & \cos \varepsilon & -\sin \varepsilon \\ 0 & \sin \varepsilon & \cos \varepsilon \\ \end{bmatrix} \begin{bmatrix} x_{\text{ecliptic}}\\ y_{\text{ecliptic}}\\ z_{\text{ecliptic}}\\ \end{bmatrix}

where ecliptic obliquity


so we have

[RpcosδcosαRpcosδsinαRpsinδ]=[1000cosεsinε0sinεcosε][rpcos(2πTpyt+θp0)recos(2πTeyt+θe0)rpsin(2πTpyt+θp0)resin(2πTeyt+θe0)0]=[rpcos(2πTpyt+θp0)recos(2πTeyt+θe0)cosε(rpsin(2πTpyt+θp0)resin(2πTeyt+θe0))sinε(rpsin(2πTpyt+θp0)resin(2πTeyt+θe0))]\begin{aligned} \begin{bmatrix} R_p \cos\delta \cos\alpha\\ R_p \cos\delta \sin\alpha\\ R_p \sin\delta\\ \end{bmatrix} &= \begin{bmatrix} 1 & 0 & 0\\ 0 & \cos \varepsilon & -\sin \varepsilon \\ 0 & \sin \varepsilon & \cos \varepsilon \\ \end{bmatrix} \begin{bmatrix} r_p \cos{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \cos{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ r_p \sin{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \sin{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ 0\\ \end{bmatrix} \\ &= \begin{bmatrix} r_p \cos{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \cos{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})}\\ \cos \varepsilon (r_p \sin{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \sin{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})})\\ \sin \varepsilon (r_p \sin{(\cfrac{2 \pi}{T_{py}} t + \theta_{p0})} - r_e \sin{(\cfrac{2 \pi}{T_{ey}} t + \theta_{e0})})\\ \end{bmatrix} \end{aligned}

transformation from equatorial to horizontal coordinate system [2]

cosAcosa=cosϕsinδ+sinϕcosδcosH\cos A\cdot \cos a=-\cos \phi \cdot \sin \delta +\sin \phi \cdot \cos \delta \cdot \cos H

sinAcosa=cosδsinH\sin A\cdot \cos a=\cos \delta \cdot \sin H

sina=sinϕsinδ+cosϕcosδcosH\sin a=\sin \phi \cdot \sin \delta +\cos \phi \cdot \cos \delta \cdot \cos H


[cosAcosasinAcosasina]=[sinϕ0cosϕ010cosϕ0sinϕ][cosδcosHcosδsinHsinδ]\begin{aligned} \begin{bmatrix} \cos A\cdot \cos a\\ \sin A\cdot \cos a\\ \sin a\\ \end{bmatrix} &= \begin{bmatrix} \sin \phi & 0 & -\cos \phi\\ 0 & 1 & 0\\ \cos \phi & 0 & \sin \phi \\ \end{bmatrix} \begin{bmatrix} \cos\delta \cos H\\ \cos\delta \sin H\\ \sin\delta\\ \end{bmatrix} \\ \end{aligned}

where hour angle[3]

H(t,α)=GST(t)+λαH(t,\alpha) = GST(t) + \lambda - \alpha

One of the final goal of this project is to predict AA and aa with tt, given longitude λ\lambda and latitude ϕ\phi under specific model, which we are to try explaing.


  • Planets are actually in ellipse orbits instead of circle ones and zz is not 00 to be precise, here we made some simplification just to show the complexity of the problem
  • A slow motion of Earth's axis, precession, causes a slow, continuous turning of the coordinate system westward about the poles of the ecliptic, completing one circuit in about 26,000 years.


  1. Ecliptic coordinate system - Wikipedia, ↩︎

  2. Horizontal coordinate system - Wikipedia, ↩︎

  3. Hour angle - Wikipedia, ↩︎

Core Concepts in FEA


Before we start, some basic mathematic theorem[1][2].


v=vi,i∇·v = v_{i,i}

T=Tij,iej∇·T = T_{ij,i} e_j

Gradient (dim+1)

ϕ=ϕ,iei∇\phi = \phi_{,i} e_i

v=vi,jeiej∇v = v_{i,j} e_i⊗e_j

T=Tij,keiejek∇T = T_{ij,k} e_i⊗e_j⊗e_k

Curl (dim=)

×v=εijkvj,iek∇ × v =ε_{ijk} v_{j,i} e_k

×T=εijkTmj,iekem∇ × T =ε_{ijk} T_{mj,i} e_k⊗e_m

The product rule of differentiation

σν=σijνjei\because \bm{σ}·\bm{\nu} = \bm{σ}_{ij}\bm{\nu}_j e_i

(σν)=(σijνj),i=σij,iνj+σijνj,i\therefore ∇·(\bm{σ}·\bm{\nu}) = (\bm{σ}_{ij}\bm{\nu}_j)_{,i} = \bm{σ}_{ij,i}\bm{\nu}_j + \bm{σ}_{ij}\bm{\nu}_{j,i}


(σ)ν=σij,iνj(∇·\bm{σ})·\bm{\nu} = \bm{σ}_{ij,i} \bm{\nu}_j

ν:σ=νi,jσji∇\bm{\nu} : \bm{σ} = \bm{\nu}_{i,j}\bm{σ}_{ji}

or as Prof. Zohdi suggested

ν:σ=νi,jσij∇\bm{\nu} : \bm{σ} = \bm{\nu}_{i,j}\bm{σ}_{ij}

but since σ\bm{σ} is symmetric

σij=σji\bm{σ}_{ij} = \bm{σ}_{ji}


(σν)=(σ)ν+ν:σ(1)\tag{1} ∇·(\bm{σ}·\bm{\nu}) = (∇·\bm{σ})·\bm{\nu} + ∇\bm{\nu} : \bm{σ}

Divergence Theorem

RϕndA=RϕdV∫_{∂R} \phi n dA = ∫_{R} ∇·\phi dV

RvndA=RvdV(2)\tag{2} ∫_{∂R} \bm{v}·n dA = ∫_{R} ∇·\bm{v} dV

RTndA=RTdV∫_{∂R} \bm{T} n dA = ∫_{R} ∇·\bm{T} dV


RϕnidA=Rϕ,idV∫_{∂R} \phi n_i dA = ∫_{R} \phi_{,i} dV

RvinidA=Rvi,idV∫_{∂R} v_i n_i dA = ∫_{R} v_{i,i} dV

RTijnjdA=RTij,jdV∫_{∂R} T_{ij}n_j dA = ∫_{R} T_{ij,j} dV

Stokes theorem

Cϕdx=Sn×ϕdA∫_{C} \phi d\bm{x} = ∫_{S} n × ∇\phi dA

Cvdx=Sn×vdA∫_{C} v·d\bm{x} = ∫_{S} n·∇×v dA

CTdx=S(×T)TndA∫_{C} T d\bm{x} = ∫_{S} (∇×T)^T n dA


Cϕdxi=Sεijknjϕ,kdA∫_{C} \phi dx_i = ∫_{S} ε_{ijk} n_j \phi_{,k} dA

Cvidxi=Sniεijkvk,jdA∫_{C} v_i dx_i = ∫_{S} n_i ε_{ijk} v_{k,j} dA

CTijdxj=SεjpqTiq,pnjdA∫_{C} T_{ij} dx_j = ∫_{S} ε_{jpq} T_{iq,p} n_j dA


The SMALL deformation of the body is governed by (strong form):



σ=IE:u\bm{σ} = \bm{IE}:∇\bm{u}


f=ρg\bm{f} = ρ\bm{g}


σ+f=0∇·\bm{σ} + \bm{f} = 0

so we can write

Ω(σ+f)νdΩ=0∫_Ω (∇·\bm{σ} + \bm{f} ) · \bm{\nu} dΩ = 0

using (1)(1)

Ω((σν)ν:σ)dΩ+ΩfνdΩ=0∫_Ω (∇·(\bm{σ}·\bm{\nu})-∇\bm{\nu}:\bm{σ}) dΩ + ∫_Ω \bm{f}·\bm{\nu} dΩ = 0

using (2)(2)

Ων:σdΩ=ΩfνdΩ+ΩσνndA∫_Ω ∇\bm{\nu}:\bm{σ} dΩ = ∫_Ω \bm{f}·\bm{\nu} dΩ + ∫_{∂Ω} \bm{σ}·\bm{\nu}·n dA


t=σn\bm{t} = \bm{σ}·\bm{n}


Ων:σdΩ=ΩfνdΩ+ΓttνdA∫_Ω ∇\bm{\nu}:\bm{σ} dΩ = ∫_Ω \bm{f}·\bm{\nu} dΩ + ∫_{Γ_t} \bm{t}·\bm{\nu} dA

so we have the weak form

Find u,uΓu=u, such that ν,νΓu=0Ων:IE:udΩ=ΩfνdΩ+ΓttνdA\begin{array}{lcr} \text{Find }\bm{u}, \bm{u}|_{Γ_u} = \bm{u}^* \text{, such that }∀\bm{\nu}, \bm{\nu}|_{Γ_u}= 0 \\ \displaystyle∫_Ω ∇\bm{\nu}:\bm{IE}:∇\bm{u} dΩ = ∫_Ω \bm{f}·\bm{\nu} dΩ + ∫_{Γ_t} \bm{t}·\bm{\nu} dA \end{array}

where uu^* is the applied boundary displacement on ΓuΓ_u, t=tt = t^* on ΓtΓ_t

since the integrals must be finite, we improve the weak form as below

Find uH1(Ω),uΓu=u, such that νH1(Ω),νΓu=0Ων:IE:udΩ=ΩfνdΩ+ΓttνdA\begin{array}{lcr} \text{Find }\bm{u} ∈ \bm{H}^1(Ω), \bm{u}|_{Γ_u} = u^* \text{, such that }∀\bm{\nu} ∈ \bm{H}^1(Ω), \bm{\nu}|_{Γ_u}= 0 \\ \displaystyle∫_Ω ∇\bm{\nu}:\bm{IE}:∇\bm{u} dΩ = ∫_Ω \bm{f}·\bm{\nu} dΩ + ∫_{Γ_t} \bm{t}·\bm{\nu} dA \end{array}


H1(Ω):=[H1(Ω)]3\bm{H}^1(Ω) \vcentcolon= [H^1(Ω)]^3

explained as below

similar to the definition of uH1(Ω)u ∈ H^1(Ω) which states

uH1(Ω) if uH1(Ω)2:=Ωu,ju,jdΩ+ΩuudΩ<u ∈ H^1(Ω) \text{ if } ||u||_{H^1(Ω)}^2 \vcentcolon= ∫_Ω u_{,j}u_{,j} dΩ + ∫_Ω uudΩ < \infty

the definition of uH1(Ω)\bm{u} ∈ \bm{H}^1(Ω) states as below

uH1(Ω) if uH1(Ω)2:=Ωui,jui,jdΩ+ΩuiuidΩ<\bm{u} ∈ \bm{H}^1(Ω) \text{ if } ||\bm{u}||_{\bm{H}^1(Ω)}^2 \vcentcolon= ∫_Ω u_{i,j}u_{i,j} dΩ + ∫_Ω u_iu_idΩ < \infty


should u\bm{u}^* be different from the applied boundary displacement on ΓuΓ_u, weak form can be stated as below

Find uH1(Ω), such that νH1(Ω)Ων:IE:udΩ=ΩfνdΩ+ΓttνdA+PΓu(uu)νdA(3)\tag{3} \begin{array}{lcr} \text{Find }\bm{u} ∈ \bm{H}^1(Ω) \text{, such that }∀\bm{\nu} ∈ \bm{H}^1(Ω) \\ \displaystyle∫_Ω ∇\bm{\nu}:\bm{IE}:∇\bm{u} dΩ = ∫_Ω \bm{f}·\bm{\nu} dΩ + ∫_{Γ_t} \bm{t}·\bm{\nu} dA + P^\star∫_{Γ_u} (\bm{u}^*-\bm{u})·\bm{\nu} dA \end{array}


Find uH1(Ω), such that νH1(Ω)Ωνi,jIEijkluk,ldΩ=ΩfiνidΩ+ΓttiνidA+PΓuuiνiuiνidA\begin{array}{lcr} \text{Find }\bm{u} ∈ \bm{H}^1(Ω) \text{, such that }∀\bm{\nu} ∈ \bm{H}^1(Ω) \\ \displaystyle∫_Ω \nu_{i,j} IE_{ijkl} u_{k,l} dΩ = ∫_Ω f_i \nu_i dΩ + ∫_{Γ_t} t_i \nu_i dA + P^\star∫_{Γ_u} u^*_i \nu_i - u_i \nu_i dA \end{array}

where the (penalty) parameter PP^\star is a large positive number.


To have

{ϕ^i(ζ1,ζ2,ζ3)=1 , ζ1=ζi1,ζ2=ζi2,ζ3=ζi3ϕ^i(ζ1,ζ2,ζ3)=0 , others\begin{cases} \hat{\phi}_i(\zeta_1,\zeta_2,\zeta_3) = 1 &\text{ , } \zeta_1=\zeta_{i1},\zeta_2=\zeta_{i2},\zeta_3=\zeta_{i3} \\ \hat{\phi}_i(\zeta_1,\zeta_2,\zeta_3) = 0 &\text{ , } \text{others} \end{cases}

for each ϕ^i\hat{\phi}_i 8 functions (for each of the 8 points) with 8 unknowns, aka. ζ1mζ2nζ3k\zeta_1^m \zeta_2^n \zeta_3^k where m,n,k=0,1m,n,k=0,1 can be derived, leading to the only solution as following

{ϕ^1=18(1ζ1)(1ζ2)(1ζ3)ϕ^2=18(1+ζ1)(1ζ2)(1ζ3)ϕ^3=18(1+ζ1)(1+ζ2)(1ζ3)ϕ^4=18(1ζ1)(1+ζ2)(1ζ3)ϕ^5=18(1ζ1)(1ζ2)(1+ζ3)ϕ^6=18(1+ζ1)(1ζ2)(1+ζ3)ϕ^7=18(1+ζ1)(1+ζ2)(1+ζ3)ϕ^8=18(1ζ1)(1+ζ2)(1+ζ3)\begin{cases} \hat{\phi}_1 = \frac{1}{8} (1-\zeta_1) (1-\zeta_2) (1-\zeta_3) \\ \hat{\phi}_2 = \frac{1}{8} (1+\zeta_1) (1-\zeta_2) (1-\zeta_3) \\ \hat{\phi}_3 = \frac{1}{8} (1+\zeta_1) (1+\zeta_2) (1-\zeta_3) \\ \hat{\phi}_4 = \frac{1}{8} (1-\zeta_1) (1+\zeta_2) (1-\zeta_3) \\ \hat{\phi}_5 = \frac{1}{8} (1-\zeta_1) (1-\zeta_2) (1+\zeta_3) \\ \hat{\phi}_6 = \frac{1}{8} (1+\zeta_1) (1-\zeta_2) (1+\zeta_3) \\ \hat{\phi}_7 = \frac{1}{8} (1+\zeta_1) (1+\zeta_2) (1+\zeta_3) \\ \hat{\phi}_8 = \frac{1}{8} (1-\zeta_1) (1+\zeta_2) (1+\zeta_3) \end{cases}


IE\bm{IE} has the following symmetries [2:1][3]

IEijkl=IEklij=IEjikl=IEijlkIE_{ijkl} = IE_{klij} = IE_{jikl} = IE_{ijlk}

allowing us to rewrite (3)(3) in a more compact matrix form

Ω([D]{ν})T[IE]([D]{u})dΩ=Ω{ν}T{f}dΩ+Γt{ν}T{t}dA+PΓu{ν}T{uu}dA(4)\tag{4} \begin{aligned} ∫_Ω ([\bm{D}]\{\bm{\nu}\})^T [\bm{IE}] ([\bm{D}]\{\bm{u}\}) dΩ = &∫_Ω \{\bm{\nu}\}^T\{\bm{f}\} dΩ \\ &+ ∫_{Γ_t} \{\bm{\nu}\}^T\{\bm{t}^*\} dA \\ &+ P^\star∫_{Γ_u} \{\bm{\nu}\}^T\{\bm{u}^*-\bm{u}\} dA \end{aligned}


[D]:=[x1000x2000x3x2x100x3x2x30x1],{u}:={u1u2u3},{f}:={f1f2f3},{t}:={t1t2t3},(5)\tag{5} [\bm{D}] \vcentcolon = \begin{bmatrix} \cfrac{∂}{∂x_1} & 0 & 0 \\ 0 & \cfrac{∂}{∂x_2} & 0 \\ 0 & 0 & \cfrac{∂}{∂x_3} \\ \cfrac{∂}{∂x_2} & \cfrac{∂}{∂x_1} & 0 \\ 0 & \cfrac{∂}{∂x_3} & \cfrac{∂}{∂x_2} \\ \cfrac{∂}{∂x_3} & 0 & \cfrac{∂}{∂x_1} \\ \end{bmatrix}, \{\bm{u}\} \vcentcolon = \begin{Bmatrix} u_1 \\ u_2 \\ u_3 \\ \end{Bmatrix}, \{\bm{f}\} \vcentcolon = \begin{Bmatrix} f_1 \\ f_2 \\ f_3 \\ \end{Bmatrix}, \{\bm{t}^*\} \vcentcolon = \begin{Bmatrix} t^*_1 \\ t^*_2 \\ t^*_3 \\ \end{Bmatrix},