中文圈程序员的碎碎念
509 subscribers
3.52K photos
21 videos
129 files
28.7K links
嘿!你也来看码农又在写啥BUG了吗
Download Telegram
bits 0x37 - Calender Week 03, 2024

Ok ok, get myself back on track.

§§§ Rants

(This is just ranting, I don’t hold accountability for whatever I claim. The actual references are concealed)

I really hate the {some programming manuals}: the formatting is chaotic and sometimes the text is confusing at best, plain WRONG at worst.

the {some programming manual} is {>10k} fucking pages and there is no split version of it, unlike {another programming manual} who provides per-volume besides split version alongside the all-in-one version.

In their {>10k} pages manual the text is sparse as atoms in the space; The text manages to be verbose yet missing key informations – sometimes you need to read between the lines; Typos are spotted here and there; The web version disgree with the PDF version (when they are supposed to be exactly the same thing).

ffs, if you ever care about it, as a company who haves {some billion} USD revenue, pay some specilists to edit your manual – don’t just let your HW and SW developers squish their notes into a gigantic document and call it a day.

If anything good: the content table is in details and very informative. Which means I don’t have to do a full text search for a keyword (imagine searching one word from {>10k} pages), instead I can search the index and jump right to what I need.

§§§ Good Reads

Faster Shell Startup With Shell Switching by Laurence Tratt https://tratt.net/laurie/blog/2024/faster_shell_startup_with_shell_switching.html

§§§ Learns

PID: Proportional–integral–derivative control https://www.omega.co.uk/prodinfo/pid-controllers.html

How to Design an ISA https://queue.acm.org/detail.cfm?id=3639445

“Constructors Are Broken” – rust vs. c++ constructors https://www.youtube.com/watch?v=KWB-gDVuy_I

§§§ Fun

§§§ MISC

Bioinformatics related discussions: https://vnil.de/notice/AdwuXSDX903fZYZPHM

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x40 - Calender Week 06, 2024 [VOID]

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x41 - Calender Week 07, 2024 [VOID]

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x42 - Calender Week 08, 2024 [VA]

§§§ Good Reads

The 10 Operating System Concepts Software Developers Need to Remember https://jameskle.com/writes/operating-systems

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x43 - Calender Week 09, 2024 [VOID]

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x44 - Calender Week 10, 2024

My first conference
Things seem to get back on track. I managed to (with the help from the prof and colleague) write up a 2-pages “fast abstract” for EDCC24 and get it accepted. One lesson learned: reproducibility is the key. Whatever experiment you do, keep it well documented, even if the stuffs are deemed unnecessary at the moment.

I’ll go to Belgium in April, thankfully with that fast abstracted to be presented, the uni will cover my travel expense.

On the other hand, I do think the academic conferences are expensive: typically it costs each attendee ~1000 Euro (conference admission + travel + accommodation) . This really isn’t cost effective. In most cases the expenses are covered by the institutes and … tax payers.

Starting the syswiki project
I have been ranting about the poorly readable tech manuals for forever. Not anymore, I decide to compile my own knowledge in a wiki format, one that is similar to the osdev wiki. It’s very much premature at the moment but I’ll work on this as a long-term project. I’ll also invite colleagues to share their knowledge.

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x45 - Calender Week 11, 2024

§§§ Default to light mode

I do my best to make my site as “flat” as possible so that any client-side modification could opt-in without any issue. There are people who can’t read white on black as well as those who can’t read white on black. Some people need extra big fonts and some people need screen reader. Anyways the “hacker aesthetics” should not get in the way.

I used a dark theme as default because it reads better for my eyes. I never bothered to try to invert the theme to the light mode because I thought it would be trivial given how “plaintext” my site is. However I just learned that (e.g. with the plugin “dark reader”) making a dark site light is not as easy as making a light site dark.

I wanted to have a “switch theme” button but it would break my promise of not using javascript. And even if I used javascript, it still requires a overhaul of the stylesheet, e.g. making every color a “variable”. There was an alternative: I prepare two stylesheets, one for light mode and one for dark mode. The javascript button simply switches between the two stylesheets. However when you replace the href field of the stylesheet link to another theme, the browser is too lazy to re-render the page to reflect the changes and I still haven’t succeeded with this approach.

So, fuck it, I’ll just default to the light theme, the stylesheet should define no more color than necessary1. I’d like to repeat (perhaps too radical) the WebUI sanity guideline:
“looks good/cool/easy to read” is subjective. Ship no more than the content. Let the readers decide how they want to read it.


§§§ Moving to aerc, maybe?

It took me a while to get adapted to neomutt, and it has been great. But still it’s a pain to configure it…. aerc is an promising alternative that has vim-binding builtin and the configuration is straight-forward.

There is one bump though… Let’s see how it goes..

UPDATE: I fixed it in the ugly way…. Or should I say, gnupg did it the ugly way? Ugly problems demand ugly solutions!

(or perhaps I can learn Go and fix it myself?)

§§§ Good Reads

Fun with Timers and cpuid by Jim Cownie https://cpufun.substack.com/p/fun-with-timers-and-cpuid

----------------------

1. a background color (because still want something softer than plain #ffffff), an alt background color for block quotes, and one or two accent colors for e.g. the menu. Other colors, such as text and links, are all html-default. 

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x46 - Calender Week 12, 2024

§§§ public keyservers … am I doxing myself?

One feature of keyservers is, if you upload a certificate, it never goes away.

And in most cases, the certificates are only monotonic incremental, the problem is, you can not remove a subkey or keyid without revoking it, and even if you revoked it, the information together with the revocation cert, stays on the keyserver.

For example, here is my pgp key: here I have 3 keyids and 2 subkeys.
$ gpg --list-secret-keys -------------------------------
sec rsa4096 2020-06-07 [SC]
DA2939BC46EF7A36FA08B89FBBEEC43923F0E695
uid [ultimate] shrik3 &LTshrik3@riseup.net>
uid [ultimate] shrik3 &LTshrik3@vnil.org>
uid [ultimate] Tianhao Wang (school mail) &LTtianhao.wang2@mailbox.tu-dresden.de>
ssb rsa4096 2020-06-07 [E] [expires: 2025-12-11]
ssb rsa4096 2022-11-15 [S] [expires: 2025-12-11]

Once the pubkey is uploaded to a keyserver, there is no going back. If I decided that I shouldn’t associate my name and school email to my legal name, I can only revoke those identities by uploading a revocation cert. It’s impossible to take it down for good1.

As matter of fact I’m already regretting uploading my certificates to the keyservers. Anyways from now on I won’t upload any certificate to keyservers other than openpgp anymore…

Why monoton?
It may sound horrible that your information can’t be deleted from the keyserver, but there are some certain security concerns. For example if the revoked identities and keys are removed from the keyserver together with the revocation cert

For people who do not have your old certificates, there is no way to validate a signature created before the revocation.
For people who already hold your old certificates, there would be no way to pass the words “hey, xyz is revoked, don’t use them anymore”: They will not invalidate a subkey or identity unless they see a revocation cert

spamming?
I can imagine a DoS attack on the keyservers…..

§§§ Fuck it, I’ll fix it myself

One good thing about open source is that if a program is broken or missing some features, I can

§§§ Latex

https://tug.org/levels.html
https://xkcd.com/2347/
https://en.wikipedia.org/wiki/Monotype_system
https://tex.stackexchange.com/a/244126
https://ultrasparky.org/school/pdf/Rhatigan_Monotype_4-line_math.pdf

§§§ Good Reads

Learn X in Y Minutes
What’s the matter with PGP? - by Matthew Green
GPG And Me
Ligatures in programming fonts: hell no
Inside Yubikey Neo

----------------------

1. keys.openpgp.org allows to edit key via web interface, with an authentication email sent to one of the keyid addresses. keyserver.ubuntu.com and pgp.mit.edu does not allow editting at all. 

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x47 - Calender Week 13, 2024

> What programmers are they????

I saw some videos popping up on my youtube front page from “software engineers” or so… And out of interest I clicked into their channel. There are A LOT of videos and many of them are popular. But it feels… weird. Take these titles:

How I became a software engineer
Programmer’s desk setup
What keyboard should a programmer use
How to start coding
Tech interview tipps
How to stay motivated …
A day of a software engineer.

And … They NEVER talk about anything technical. I mean, literally, they don’t talk about any technical topic in programming, they don’t show a single line of code – they never talk about programming itself.

So I have two questions:

what are they?
what’s the fan base of these people?

Smoke and mirrors
The phrase “smoke and mirrors” has entered common English use to refer to any proposal that, when examined closely, proves to be an illusion. The earliest known use of the idiom came from the biography How the Good Guys Finally Won: Notes from an Impeachment Summer, published in 1975. It was written by American political journalist James Breslin, who accounted the Watergate political scandal in Washington first-hand. Breslin described politics as the theatrical use of “mirrors and blue smoke” to make people see what they wish to see. https://en.wikipedia.org/wiki/Smoke_and_mirrors
why not matrix https://telegra.ph/why-not-matrix-08-07

Oppenheimer / Interstellar / Nolan
This is a rather unpopupar opinion.

I hate the soundtracks. Let me put it this way: 3 hours of “epic” is not epic, it’s spam. The Oppenheimer soundtracks are spamming Arpeggio on strings with 200% reverb. As a die hard extreme metal fan, I had Tinnitus sitting in the cinema. “Anxiety and unease, that’s what Nolan wants the audience to feel” – that pretty much the same as spamming jump scares for a “good horror”. Music taste is a very subjective thing. For me, the movie soundtracks are torture.

§§§ Good Reads

Flipping Pages: An analysis of a new Linux vulnerability in nf_tables and hardened exploitation techniques
https://pwning.tech/nftables/

§§§ Learns

§§§ Fun

§§§ MISC

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x48 - Calender Week 14, 2024

> Why I like writing low level code (a selfish take):
because I don’t need to wrap my head around other people’s shitty inconsistent broken ABIs. Instead I write my own broken ABIs and let it be other people’s problem. (Well still, I need to read the shitty HW documentations…But the HW vendors would have more motivations to write better documentations to sell their products to OEMs.)

The X-Y Problem
The XY problem is asking about your attempted solution rather than your actual problem. This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. https://xyproblem.info/
Keyboards

IBM Model M, while I really want one, I can’t use it. It’s a necessity for tilling window manager to have a Modifier key, which should be 1) easily accessible on the keyboard and 2) has to practical usage so setting it to a dedicated WM modifier won’t hinder other software. And you guessed it, we are talking about the Win key. That’s a perfect useless key to be given the righteous purpose.

The same goes for vim: I use the Esc more frequently than any modifier key. I swapped the CapsLock with Esc and my whole muscle memory is built on top of it. Some keyboard manufactures(like HHKB) realizes that the CapsLock key is a waste of space so they move it elsewhere.

In other words, all keyboard layouts are terrible. Some are so terrible that you can repurpose some keys for the better. WE NEED MORE BLANK KEYS! .. I think the idea of thumb cluster may be a good idea: the space bar doesn’t need to be this big and we can savage a lot of space from it to add more keys..

§§§ Learns

How I program C by Eskil Steenberg. A 2 hours long video on C programming. Maybe I’ll save it for later .. This guy, uses .c files as slides. What a champ.

iframe (www.youtube.com)

§§§ Fun

§§§ MISC

Dead Internet Theory, The Internet Is Empty via Pseudiom

iframe (www.youtube.com)

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x49 - Calender Week 15, 2024

Meta-meta-meta, but does it work?
“However, in practice” is the unsurpring plot-twist.

§§§ Good Reads

I/O Multiplexing: The select and poll Functions
https://notes.shichao.io/unp/ch6/

§§§ Learns

Cache Allocation Technology (CAT, Intel): cache allocation policy configurable at runtime, supported by linux

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x50 - Calender Week 16, 2024

> Public Licenses
GPL has been quite some headache for me recently: not in the way that I have problem with its progressive ideology, but the compatibility terms.

First, the GPL licenses are not necessarily compatible within the GPL family:
https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility

Take GPLv2 and GPLv3 or example, I want to incorporate two code components, A and B into my project (components as code, not libraries).
                        | License of Component A
|---------+-----------------------------+
| GPLv2 o | GPLv2 + | GPLv3 o | GPLv3 + |
------------+-----------+---------+---------+---------+---------+
License | GPLv2 o | Yes |
of |-----------+---------+---------+
Component | GPLv2 + | Yes | Yes |
B |-----------+---------+---------+---------+
| GPLv3 o | No | Yes | Yes |
|-----------+---------+---------+---------+---------+
| GPLv3 + | No | Yes | Yes | Yes |
------------+-----------+---------+---------+---------+---------+

o means only
+ means or-later
X imcompatible: there is no license that is compatible with both A and B

GPLv2-only (such as the linux kernel) and GPLv3-only/-or-later are not compatible.

Take another example: GPL also applies to library: if you write a kernel module, which is (and must be) linked against the linux kernel code, it has to be compatible with GPLv2-only (if you want a copyleft license).
GPLv3 is not compatible with GPLv2, sorry, you can not have GPLv3-only kernel modules, it’s impossible. https://github.com/jarun/spy/issues/1#issuecomment-147501332
GPL is hardly compatible with other copyleft licenses
I recently learned about the EUPL . It looks really appealing but then I see the issue:

https://joinup.ec.europa.eu/collection/eupl/matrix-eupl-compatible-open-source-licences

You can incorporate EUPL licensed code into GPL project but not vice versa! Well, GPL is immutable, that’s the point of GPL no?

Nevertheless, I’d like to try EUPL in the future.

§§§ Good Reads

Why X86 needs to die - by Julian Scheffers
https://hackaday.com/2024/03/21/why-x86-needs-to-die/

§§§ Learns

§§§ Fun

§§§ MISC

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x51 - Calender Week 17, 2024

§§§ Good Reads

My Rant on C++’s operator new - by David Mazières
https://www.scs.stanford.edu/~dm/home/papers/c++-new.html

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
interesting places to look at

§ Linux Signal Delivery

Notes on linux signal delivery on the low level: regarding context, pt_regs and stacks

Places to look at
arch/xyz/include/uapi/asm/ucontext.h
struct ucontext

arch/arm64/include/uapi/asm/sisgcontext.h
struct sigcontext

include/linux/signal_types.h
struct ksignal

kernel/signal.c
int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)

kernel/signal.c
arch/xyz/kernel/signal.c


man pages: signal (7) : signal - overview of signals

§ “important” places in the source tree:
arch/xyz/include/asm/processor.h
processor specific structs like `struct thread_struct`

include/linux/sched.h
struct task_struct

arch/arm64/kernel/signal.c
struct rt_sigframe {
struct siginfo info;
struct ucontext uc;
};

struct rt_sigframe_user_layout {
struct rt_sigframe __user *sigframe;
struct frame_record __user *next_frame;

unsigned long size; /* size of allocated sigframe data */
unsigned long limit; /* largest allowed size */

unsigned long fpsimd_offset;
unsigned long esr_offset;
unsigned long sve_offset;
unsigned long tpidr2_offset;
unsigned long za_offset;
unsigned long zt_offset;
unsigned long extra_offset;
unsigned long end_offset;
};

----------------------

Some random stuffs in the linux kernel source code.

task_struct in sched.h
/*
* WARNING: on x86, 'thread_struct' contains a variable-sized
* structure. It *MUST* be at the end of 'task_struct'.
*
* Do not put anything below here!
*/


via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))
bits 0x52 - Week 17~27, 2024 [VOID]

This is a placeholder for the a sad 10-week void in my journals

via home - SHRIK3 on SHRIK3 (author: i@shrik3.com (SHRIK3))