These are the best articles ever authored by Ciro Santilli, most of them in the format of Stack Overflow answers.
Ciro posts update about new articles on his Twitter accounts.
A chronological list of all articles is also kept at: Section "Updates".
Some random generally less technical in-tree essays will be present at: Section "Essays by Ciro Santilli".
- Trended on Hacker News:
- CIA 2010 covert communication websites on 2023-06-11. 190 points, a mild success.
- x86 Bare Metal Examples on 2019-03-19. 513 points. The third time something related to that repo trends. Hacker news people really like that repo!
- again 2020-06-27 (archive). 200 points, repository traffic jumped from 25 daily unique visitors to 4.6k unique visitors on the day
- How to run a program without an operating system? on 2018-11-26 (archive). 394 points. Covers x86 and ARM
- ELF Hello World Tutorial on 2017-05-17 (archive). 334 points.
- x86 Paging Tutorial on 2017-03-02. Number 1 Google search result for "x86 Paging" in 2017-08. 142 points.
- x86 assembly
- What does "multicore" assembly language look like?
- What is the function of the push / pop instructions used on registers in x86 assembly? Going down to memory spills, register allocation and graph coloring.
- Linux kernel
- What do the flags in /proc/cpuinfo mean?
- How does kernel get an executable binary file running under linux?
- How to debug the Linux kernel with GDB and QEMU?
- Can the sys_execve() system call in the Linux kernel receive both absolute or relative paths?
- What is the difference between the kernel space and the user space?
- Is there any API for determining the physical address from virtual address in Linux?
- Why do people write the
#!/usr/bin/env
python shebang on the first line of a Python script? - How to solve "Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"?
Figure 2. Path from init/main.c until bzImage in the Linux kernel 4.19. Source. From: What is the difference between the following kernel Makefile terms: vmLinux, vmlinuz, vmlinux.bin, zimage & bzimage?- Single program Linux distro
- QEMU
- gcc and Binutils:
- How do linkers and address relocation works?
- What is incremental linking or partial linking?
- GOLD (
-fuse-ld=gold
) linker vs the traditional GNU ld and LLVM ldd - What is the -fPIE option for position-independent executables in GCC and ld? Concrete examples by running program through GDB twice, and an assembly hello world with absolute vs PC relative load.
- How many GCC optimization levels are there?
- Why does GCC create a shared object instead of an executable binary according to file?
- C/C++: almost all of those fall into "disassemble all the things" category. Ciro also does "standards dissection" and "a new version of the standard is out" answers, but those are boring:
- What does "static" mean in a C program?
- In C++ source, what is the effect of
extern "C"
? - Char array vs Char Pointer in C
- How to compile glibc from source and use it?
- When should
static_cast
,dynamic_cast
,const_cast
andreinterpret_cast
be used? - What exactly is
std::atomic
in C++?. This answer was originally more appropriately entitled "Let's disassemble some stuff", and got three downvotes, so Ciro changed it to a more professional title, and it started getting upvotes. People judge books by their covers. notmain.o 0000000000000000 0000000000000017 W MyTemplate<int>::f(int) main.o 0000000000000000 0000000000000017 W MyTemplate<int>::f(int)
Code 1.. From: What is explicit template instantiation in C++ and when to use it?nm
outputs showing that objects are redefined multiple times across files if you don't use template instantiation properly
- IEEE 754
- What is difference between quiet NaN and signaling NaN?
- In Java, what does NaN mean?
Without subnormals: +---+---+-------+---------------+-------------------------------+ exponent | ? | 0 | 1 | 2 | 3 | +---+---+-------+---------------+-------------------------------+ | | | | | | v v v v v v ----------------------------------------------------------------- floats * **** * * * * * * * * * * * * ----------------------------------------------------------------- ^ ^ ^ ^ ^ ^ | | | | | | 0 | 2^-126 2^-125 2^-124 2^-123 | 2^-127 With subnormals: +-------+-------+---------------+-------------------------------+ exponent | 0 | 1 | 2 | 3 | +-------+-------+---------------+-------------------------------+ | | | | | v v v v v ----------------------------------------------------------------- floats * * * * * * * * * * * * * * * * * ----------------------------------------------------------------- ^ ^ ^ ^ ^ ^ | | | | | | 0 | 2^-126 2^-125 2^-124 2^-123 | 2^-127
Code 2.Visualization of subnormal floating point numbers vs what IEEE 754 would look like without them. From: What is a subnormal floating point number?
- Computer science
- Algorithms
- Is it necessary for NP problems to be decision problems?
- Polynomial time and exponential time. Answered focusing on the definition of "exponential time".
- What is the smallest Turing machine where it is unknown if it halts or not?. Answer focusing on "blank tape" initial condition only. Large parts of it are summarizing the Busy Beaver Challenge, but some additions were made.
- Algorithms
- Git
| 0 | 4 | 8 | C | |-------------|--------------|-------------|----------------| 0 | DIRC | Version | File count | ctime ...| 0 | ... | mtime | device | 2 | inode | mode | UID | GID | 2 | File size | Entry SHA-1 ...| 4 | ... | Flags | Index SHA-1 ...| 4 | ... |
tree {tree_sha} {parents} author {author_name} <{author_email}> {author_date_seconds} {author_date_timezone} committer {committer_name} <{committer_email}> {committer_date_seconds} {committer_date_timezone} {commit message}
Code 4.Description of the Git commit object binary data structure. From: What is the file format of a git commit object data structure?- How do I clone a subdirectory only of a Git repository?
- Python
- Web technology
- OpenGL
Figure 8. Example of a texture atlas containing glyphs. Source.Image by Nicolas P. Rougier, author of Freetype GL.Used on Ciro Santilli's answer: How to draw text using only OpenGL methods?- What are shaders in OpenGL?
- Why do we use 4x4 matrices to transform things in 3D?
Figure 10. . Source. - Image Processing with GLSL shaders? Compared the CPU and GPU for a simple blur algorithm.
- Node.js
- Ruby on Rails
- POSIX
- What is POSIX? Huge classified overview of the most important things that POSIX specifies.
- Systems programming
- What do the terms "CPU bound" and "I/O bound" mean?
Figure 12. Plot of "real", "user" and "sys" mean times of the output of time for CPU-bound workload with 8 threads. Source. From: What do 'real', 'user' and 'sys' mean in the output of time?+--------+ +------------+ +------+ | device |>---------------->| function 0 |>----->| BAR0 | | | | | +------+ | |>------------+ | | | | | | | +------+ ... ... | | |>----->| BAR1 | | | | | | +------+ | |>--------+ | | | +--------+ | | ... ... ... | | | | | | | | +------+ | | | |>----->| BAR5 | | | +------------+ +------+ | | | | | | +------------+ +------+ | +--->| function 1 |>----->| BAR0 | | | | +------+ | | | | | | +------+ | | |>----->| BAR1 | | | | +------+ | | | | ... ... ... | | | | | | +------+ | | |>----->| BAR5 | | +------------+ +------+ | | | ... | | | +------------+ +------+ +------->| function 7 |>----->| BAR0 | | | +------+ | | | | +------+ | |>----->| BAR1 | | | +------+ | | ... ... ... | | | | +------+ | |>----->| BAR5 | +------------+ +------+
Code 5.Logical struture PCIe device, functions and BARs. From: What is the Base Address Register (BAR) in PCIe?
- Electronics
- Raspberry Pi
Figure 13. . Image from answer to: How to hook up a Raspberry Pi via Ethernet to a laptop without a router? Figure 14. . Image from answer to: How to hook up a Raspberry Pi via Ethernet to a laptop without a router? Figure 15. . Image from answer to: How to emulate the Raspberry Pi 2 on QEMU? Figure 16. Bare metal LED blinker program running on a Raspberry Pi 2. Image from answer to: How to run a C program with no OS on the Raspberry Pi?
- Raspberry Pi
- Computer security
- Media
Video 2. Canon in D in C. Source.The original question was deleted, lol...: How to programmatically synthesize music?- How to resize a picture using ffmpeg's sws_scale()?
- Is there any decent speech recognition software for Linux? ran a few examples manually on
vosk-api
and compared to ground truth.
- Eclipse
- Computer hardware
- Scientific visualization software
Figure 17. VisIt zoom in 10 million straight line plot with some manually marked points. Source. From: Section "Survey of open source interactive plotting software with a 10 million point scatter plot benchmark by Ciro Santilli"
- Numerical analysis
Video 3. Real-time heat equation OpenGL visualization with interactive mouse cursor using relaxation method by Ciro Santilli (2016)Source.
- Computational physics
Figure 18. gnuplot plot of the y position of a sphere bouncing on a plane simulated in Bullet Physics. Source. From: What is the simplest collision example possible in a Bullet Physics simulation?
- Register transfer level languages like Verilog and VHDL
- Verilog:
Figure 19. . See also: Section "Verilator interactive example"
- Verilog:
- Android
Video 4. Android screen showing live on an Ubuntu laptop through ADB. Source. From: How to see the Android screen live on an Ubuntu desktop through ADB?
- Debugging
- Program optimization
- What is tail call optimization?
Figure 21. gprof2dot image generated from the gprof data of a simple test program. Source.The answer compares gprof, valgrind callgrind, perf and gperftools on a single simple executable.
- Data
Figure 22. Mathematics dump of Wikipedia CatTree. Source. In this project, Ciro Santilli explored extracting the category and article tree out of the Wikipedia dumps.
- Mathematics
Figure 23. Diagram of the fundamental theorem on homomorphisms by Ciro Santilli (2020)Shows the relationship between group homomorphisms and normal subgroups.- Section "Formalization of mathematics": some early thoughts that could be expanded. Ciro almost had a stroke when he understood this stuff in his teens.
Figure 24. Simple example of the Discrete Fourier transform. Source. That was missing from Wikipedia page: en.wikipedia.org/wiki/Discrete_Fourier_transform!
- Network programming
- Physics
- What is the difference between plutonium and uranium?
Figure 25. Spacetime diagram illustrating how faster-than-light travel implies time travel. From: Does faster than light travel imply travelling back in time?
- Biology
Figure 27. Mass fractions in a minimal growth medium vs an amino acid cut in a simulation of the E. Coli Whole Cell Model by Covert Lab. Source. From: Section "E. Coli Whole Cell Model by Covert Lab"
- Quantum computing
- Section "Quantum computing is just matrix multiplication"
Figure 28. Visualization of the continuous deformation of states as we walk around the Bloch sphere represented as photon polarization arrows. From: Understanding the Bloch sphere.
- Bitcoin
- GIMP
Figure 29. GIMP screenshot part of how to combine two images side-by-side in GIMP?.
- Home DIY
Figure 30. Total_Blackout_Cassette_Roller_Blind_With_Curtains.Source. From: Section "How to blackout your window without drilling"
- China
Given enough computational power per dollar, AGI is inevitable, but it is not sure certain ever happen given the end of end of Moore's Law.
Alternatively, it could also be achieved genetically modified biological brains + brain in a vat.
Imagine a brain the size of a building, perfectly engineered to solve certain engineering problems, and giving hints to human operators + taking feedback from cameras and audio attached to the operators.
This likely implies transhumanism, and mind uploading.
Ciro Santilli joined the silicon industry at one point to help increase our computational capacity and reach AGI.
Ciro believes that the easiest route to full AI, if any, could involve Ciro's 2D reinforcement learning games.
Random fun mentions:
- en.wiktionary.org/wiki/roflcopter | knowyourmeme.com/memes/roflcopter
- www.ludd.ltu.se/~vk/pics/ascii/junkyard/misc/who's_who.txt "Who's who in the ascii art world" contains a list of well known artists with their signatures
z
^
| *------*
| /| /
| / | /|
top -------*------* |
| | *----|-*
| |/ | /
| | |/
bottom ----*------*
| | |
+--|------|-----> y
/ | |
/ | |
x / | |
v
left right
Code 1.
3D cube plot ASCII art by Ciro Santilli (2021)
Collections and overviews:
- asciiart.website/index.php?art=people/naked%20ladies "Naked Ladies - Nude Women" category
- if you value medium over content, Ciro found two of the images reproduced in
asciiart.website
above also reproduced in the Bitcoin blockchain as described at: ASCII art, that should definitely turn you on, horny nerd
- if you value medium over content, Ciro found two of the images reproduced in
- www.reddit.com/r/ASCII_porn/ on Reddit boring
- www.vice.com/en/article/nepapk/ascii-pr0n-porn-predates-the-internet-but-its-still-everywhere-rule-34 ASCII Porn Predates the Internet But It's Still Everywhere by Vice News (2019)
You just couldn't resist Googling it and clicking this page, could you? You naughty, naughty bearded programmer nerd. Yes, I'm talking to you.
TODO it is quite hard to actually find non-automatically generated ASCII art of people fucking, most of them are just sexy/horny women drawn by bearded nerds, likely and based on sticky physical paper porn magazines from the 80's, good old days.
|
|
Tank Man |
by Ciro Santilli 00 |
2021 CC-BY-SA 4.0 \\ +-|-+
\\/ /|-+o
\\--+ / /o
/|\\ |/ /oo
| / ----- /oo
| / /oo
| +-------+oo
| oo+---+ooo
00 | oo oo
\\ +-|-+
\\/ /|-+o
\\--+ / /o
/|\\ |/ /oo
| / ----- /oo
| / /oo
| +-------+oo
| oo+---+ooo
00 | oo oo
\\ +-|-+
\\/ /|-+o
\\--+ / /o
/|\\ |/ /oo
/ ----- /oo
/ /oo
+-------+oo
oo+---+ooo
oo oo
xx
--
/||\
|--|
o||0
||
/\
Code 1.
Tank man ASCII art by Ciro Santilli (2021)
This image depicts the Chinese government fucking 1 million Chinese people in the ass during the Tiananmen Square Protests, which was undoubtedly one of the largest gang bangs of the late 20th century:The IBM 1401 mainframe runs "Edith" by CuriousMarc
. Source. 1960's punched card ASCII porn. Vintage. EDITH is also mentioned e.g. at: www.threedee.com/jcm/aaa/index.html. No ASCII uploads found however: www.reddit.com/r/programming/comments/a2pser/the_ibm_1401_mainframe_runs_edith/.Tis term was invented by Ciro Santilli, it refers to ASCII art of text, essentially creating a typeface. in that medium..
All interests are based on fetishes.
The fetish of beauty. The fetish if intelligence. The fetish of kindness.
What's wrong with the fetish of Asianess?
Whenever Ciro's wife starts with "the Asian fetish talk", Ciro reminds her of her own claimed "tall person fetish", and they call it quits.
Asian fetish is much more than sex. It is about the culture, the history, the language. It is the same fetish that makes great mathematicians an Artists do what they do.
When Ciro Santilli was at École Polytechnique, he had to do a presentation for his stupid English courses that all students were forced to take, no matter how good their English was.
The topic was likely something like "pick a country", and Ciro was delighted when he managed to pick "China", after it had gone around a table with many many people before him.
The PowerPoint presentation Ciro made over the weekend was so amazing (and making it was actually fun to make, Ciro actually remembers it a bit!), drawing partly from stuff his wife then girlfriend showed him, that at the end the one of the other students asked him if he had lived in China.
It is a shame Ciro couldn't find the presentation when he wrote this line many many years later. Anything that is not in a BLOB-free monorepo, will disappear, heed my words. But he's certain about two things which it contained:
- century eggs
- Chinese traditional painting
en.wikipedia.org/wiki/Asian_fetish#History_of_originssubservient, passive, mysterious are understandable. But Hyper-sexual and villainous? OMG have these people never seen real Asians?
en.wikipedia.org/wiki/Asian_fetish#Pornography:
In the United States, women of East and Southeast Asian descent are sometimes stereotyped as subservient, passive, mysterious, villainous in nature, and hyper-sexual.
en.wikipedia.org/wiki/Asian_fetish#Pornography:
Several studies have implied that Asian women are over-represented in the American pornography industry. Asian women make up perhaps 20% of all female performers, despite being roughly 2.5% of the U.S. population. Asian men also appear to be considerably over-represented, at 10% of male actors.
As of 2020 leading makers of the most important fab photolithography equipment.
ASML: TSMC's Critical Supplier by Asianometry (2021)
Source. How ASML Won Lithography by Asianometry (2021)
Source. First there were dominant Elmer and Geophysics Corporation of America dominating the market.
Then a Japanese government project managed to make Nikon and Canon Inc. catch up, and in 1989, when Ciro Santilli was born, they had 70% of the market.
youtu.be/SB8qIO6Ti_M?t=240 In 1995, ASML had reached 25% market share. Then it managed the folloging faster than the others:
- TwinScan, reached 50% market share in 2002
- Immersion litography
- EUV. There was a big split between EUV vs particle beams, and ASML bet on EUV and EUV won.
- youtu.be/SB8qIO6Ti_M?t=459 they have an insane number of software engineers working on software for the machine, which is insanely complex. They are big on UML.
- youtu.be/SB8qIO6Ti_M?t=634 they use ZEISS optics, don't develop their own. More precisely, the majority owned subsidiary Carl Zeiss SMT.
- youtu.be/SB8qIO6Ti_M?t=703 IMEC collaborations worked well. Notably the ASML/Philips/ZEISS trinity
- www.youtube.com/watch?v=XLNsYecX_2Q ASML: Chip making goes vacuum with EUV (2009) Self promotional video, some good shots of their buildings.
A human readable way to write instructions for an instruction set architecture.
One of the topics covered in Ciro Santilli's Linux Kernel Module Cheat.
Ciro Santilli likes to learn astronomy a bit like he learns geography: go down some lists of "stuff that seems most relevant in some criteria to us!", possibly at different size scales e.g.:
How an atomic clock works, and its use in the global positioning system (GPS) by EngineerGuy (2012)
Source. Shows how conceptually an atomic clock is based on a feedback loop of two hyperfine structure states of caesium atoms (non-radioactive caesium-133 as clarified by the Wikipedia page). Like a quartz clock, it also relies on the piezoelectricity of quartz, but unlike the quartz clock, the quartz is not shaped like a tuning fork, and has a much larger resonating frequency of about 7 MHz. The feedback is completed by producing photons that resonate at the right frequency to excite the caesium.Inside the HP 5061A Cesium Clock by CuriousMarc (2020)
Source. A similar model was used in the Hafele-Keating experiment to test special relativity on two planes flying in opposite directions. Miniaturization was key.
Contains a disposable tube with 6g of Caesium. You boil it, so when it runs out, you change the tube, 40k USD. Their tube is made by Agilent Technologies, so a replacement since that opened in 1999, and the original machine is from the 60s.
Detection is done with an electron multiplier.
youtu.be/eOti3kKWX-c?t=1166 They compare it with their 100 dollar GPS disciplined oscillator, since GPS satellites have atomic clocks in them.
Quick presentation of the atomic clock at the National Physical Laboratory (2010)
Source. Their super accurate setup first does laser cooling on the caesium atoms.Their website, and in particular the recruitment section, are so creepy.
There's not mention of bombs. No photos of atomic explosions. The words "atomic" and "weapon" do not even show up in the front page!!! The acronym AWE is instead used everywhere as an euphemism.
In the recruitment section we can see a bunch of people smiling: web.archive.org/web/20211007213222/https://www.awe.co.uk/careers/working-at-awe/, suggesting:There's even children outreach!!!
We make nukes, and we do it with a smile!
Ciro Santilli is not against storing a few nukes to be ready against dictatorships. But don't be such a pussy! Just say what the fuck you are doing more clearly! You are making weapons to kill people and destroy things in order to maintain the Balance of power. If the public can't handle such facts, then shut down the fucking program.
This is one of Ciro Santilli's most important principles.
Steve Jobs has a great quote about this. He's totally right on this one!
You've got to start with the customer experience and work backwards to the technology. You can't start with the technology and try to figure out where you're going to sell it.
Steve Jobs Insult Response excerpt from the 1997 WWDC
. Source. TODO understand the context of the question a bit better. It is something to do with an OpenDoc thing and Java.Decide your goal first, and then do whatever is needed to how to reach it.
Don't start randomly learning tech, because that means you will waste a lot of time learning useless stuff.
There is of course some level chicken-and-egg paradox in this, as highlighted by Dilbert, since choosing an achievable goal in the first place requires some level of technical understanding.
Dilbert cartoon about designing a nuclear power plant from user requirements (2002)
Source. This cartoon illustrates well how when doing deep tech and fighting against the laws of physics, you can't just start from user requirements, but you also have to also think "what can we actually get done at all with this new technique".
The best research engineers are able to identify what is just on the cusp of the "possible", but which has the greatest value. This is the endless dance between the tech push, and the market/need pull.
However, it is much more common that people will get way too involved in learning useless stuff and lose sight of the useful end goals.
Rather, take an iterative approach:
- start with an ambitious end goal
- learn a bit of tech to try and reach it
- realize that you can't reach your end goal and pivot a bit to a related end goal that seems more realistic: the side effects of ambitious goals are often the most valuable thing achieved
- loop
There is some truth to the counter argument that "but if you don't spend a lot of time learning the basics, you can never find solutions".
However, these people underestimate your brain. The brain is beautiful, and human intuition is capable of generating interest towards the things that are actually useful to reach your goal. When you feel like learning something related to your goal, by all means, give yourself the time to do so. But this still be much more efficient than just learning random things that other people tell you to learn.
Bibliography:
- Ciro Santilli and many many others believe that backward design is a fundamental principle that should be considered by the educational system rather than wasting 90% of everyone's time with the 90% of mandatory curricula they don't care about:
- notably that school should be personalized and project driven:
- www.cartalk.com/content/rant-and-rave-36 "The New Theory of Learning" by Thomas L. Magliozzi section "Premise III: THE BACKWARDS LEARNING THEORY" says the exact same thing. Ciro actually found this when writing Cool data embedded in the Bitcoin blockchain.
- several well known teaching methods:
- a Coding Horror software specific take on this issue: blog.codinghorror.com/please-dont-learn-to-code/
- x.com/7etsuo/status/1784787045157900697: George Hotz
Everyone I've met who can program well learned it the same way: they had an idea, and then they built it.
Someone who is not a pussy.
Someone once called Ciro Santilli that: archive.is/W1ocv. It's an overstatement, considering that Ciro's parents have some money. Not infinite. But still. Changes everything. A real Based God is someone like Charles Bukowski, who had to work decades at the post office.