-
The Broken Parity Fable by TD Lee
Tsung-Dao Lee and Chen Ning Yang won the Nobel Prize in Physics in 1957, for their work on the violation of the parity law in weak interactions, which Chien-Shiung Wu experimentally proved.
In the article Broken Parity, TD Lee wrote about his relationship with CN Yang, regarding the eventual breakup of their companionship, for the disagreement on who discovered the violation of the parity first. At the very start of that article, there’s an interesting short fable written by Lee about the discovery of the theory. For a long time I couldn’t find the original English version of it, with the arrival of TD Lee’s Selected Papers Volume 3 Random Lattices to Gravity, it’s finally unveiled to me. Here’s the original version of the fable.
-
Embedded Programming Notes
Embedded Programming Interview Prep
C programming
- Keywords
volatile: Prevents optimization restrict: Allows optimization but while preventing pointer aliasing const: Restricts writing
- Signed integer + left shift («) is chaotic, mostly because overflowing
-
Automating the Howard Chu Homepage
This is done via
github webhookandsystemd. When github receives a push (likely from local branch), it notifies the remote server that it should pull. The remote server pulls from github, and runsdocker buildto build the website, and serves it withnginx.The auto-build program is a
Flaskscript managed bysystemd, setup by generating asystemdservice file using theauto-build-setup.shshell script.service="[Unit] Description=howard-chu-www auto build daemon [Service] Type=simple WorkingDirectory=$(pwd) ExecStart=$(pwd)/.venv/bin/flask run --host 0.0.0.0 --port 5000 Restart=on-failure RestartSec=3 KillSignal=SIGKILL Environment="FLASK_ENV=production" Environment="PYTHONUNBUFFERED=1" User=root [Install] WantedBy=multi-user.target" echo "$service" > /etc/systemd/system/howard-chu-www.service sudo systemctl daemon-reload sudo systemctl enable howard-chu-www sudo systemctl start howard-chu-wwwUser=rootneeded for git pull’s stored credentials -
Study notes on the C++ template
overload > specialization > general template
specialization:
// special version of compare to handle pointers to character arrays template <> int compare(const char* const &p1, const char* const &p2) { return strcmp(p1, p2); } // this is also specialization: template <class T> struct ValidityError; template <> struct ValidityError<core::Signal*> { enum { value = HSA_STATUS_ERROR_INVALID_SIGNAL }; }; template <> struct ValidityError<core::Agent*> { enum { value = HSA_STATUS_ERROR_INVALID_AGENT }; }; -
Using lldb to read C++ standard library
C++ standard library can be hard to read, using a debugger to help with learning can be a good approach.
My machine is a mac so this will be
clang’s std library. And I’m usinglldbbecause it’s better supported thangdb. Here’s how to do it.Install
lldb, typically usexcode-select --install -
How to contribute to perf
TL;DR:
- Clone the repo:
git clone https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/ # switch to perf-tools-next branch git checkout perf-tools-next # cd into the perf's directory cd tools/perf -
perf trace: Add support for enum arguments
perf tracenow supports pretty printing for enum argumentsWell, that been said, there is only one argument that can be pretty printed in all syscalls, which is
enum landlock_rule_type rule_typefrom syscalllandlock_add_rule.This feature is implemented using the BPF Type Format.
Here is
perf tracebefore:perf $ ./perf trace -e landlock_add_rule 0.000 ( 0.008 ms): ldlck-test/438194 landlock_add_rule(rule_type: 2) = -1 EBADFD (File descriptor in bad state) 0.010 ( 0.001 ms): ldlck-test/438194 landlock_add_rule(rule_type: 1) = -1 EBADFD (File descriptor in bad state) -
Shared vim clipboard when using SSH
- For Windows, download MobaXterm or Xming; for Mac, download XQuartz as the X server. After downloading, open the application.
Note that on Mac XQuartz works after I uncheck the
Enable Syncing, and check it back again. Link And tmux doesn’t work well on Mac’s default Terminal.app. For sharing clipboard you need to install tmux-yank plugin - In the server’s SSH configuration file located at
/etc/ssh/sshd_config, enableX11Forwarding yes. - Based on personal experience, use the X server address provided in MobaXterm and set the Windows environment variable
$env:DISPLAYto that address. This can be done inEdit System Environment Variables.
- For Windows, download MobaXterm or Xming; for Mac, download XQuartz as the X server. After downloading, open the application.