Another C Code Joke

$ pcat goes-to.c #include <stdio.h> int main() { int x = 5; // while x goes to 0: while (x --> 0) { printf("%d ", x); } printf("\n"); return 0; } $ gcc goes-to.c && ./a.out 4 3 2 1 0

March 27, 2022 · 1 min · un01s

What is Freud's single greatest contribution?

Freud already answered this question, of course, when he said that whereas Darwin decentered the human animal from the apex of creation, Copernicus decentered the earth from the center of the universe, Freud had decentered humanity in itself. No longer was the human immanent. Lacan’s answer is perhaps even better: “That is why the unconscious was invented—so that we would realize that man’s desire is the Other’s desire, and that love, while it is a passion that involves ignorance of desire, nevertheless leaves desire its whole import” ...

March 23, 2022 · 1 min · un01s

Rebuild

$ brew install hugo -f yml $ hugo version hugo v0.94.2+extended darwin/arm64 BuildDate=unknown $ hugo new site notes $ cd notes $ git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod $ echo "theme: \"PaperMod\"" >> config.yml

March 20, 2022 · 1 min · un01s

C Code Jokes

Here are some C code with the JavaScript quirks. Credits to luna. #include <stdio.h> int main() { puts("-0.5" + 1); printf("%d\n", 50 ** "2"); return 0; } To build and run the above code, just do the following and ignore the warnings. $ gcc c-js.c && ./a.out 0.5 2500 Let’s look at the warnings first. c-js.c:4:15: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] puts("-0.5" + 1); ~~~~~~~^~~ c-js.c:4:15: note: use array indexing to silence this warning puts("-0.5" + 1); ^ & [ ] 1 warning generated. Now let’s explain it. ...

March 18, 2022 · 1 min · un01s

Fish and Pond

Think of your mind like a pond full of fish and each fish is a feeling. Try to be the pond, not the fish. Life is nothing but time given to us, short or long. For all of us, a day is long and a year is short. We use our days to trade for years. We trade our time for food, clothes, houses and cars. In the end, time is the only thing we do not have. ...

March 6, 2022 · 1 min · un01s

Toit Imports

Toitlang uses import to use code from other libraries. local import starting with . $ tree . └── my_lib ├── my_lib.toit ├── other.toit └── sub └── sub.toit Assume we are importing sub.toit into my_lib.toit. import .sub.sub Shorten version: import .sub global import import math Then for customizations, import math as m import math show sin cos

March 3, 2022 · 1 min · un01s

Cron is fun

March 2, 2022 · 0 min · un01s

Reading Toit Code (002)

After toit_start(), we have toit_esp32.cc to read. The first one is toit::start(). Toit here is just a namespace. As we know that toit supports OTA (over-the-air update) through WiFi and esp32 device is set to be a station (STA instead of AP). What we have here is as follows: RtcMemory::set_up(); FlashRegistry::set_up(); OS::set_up(); esp_partition_find_first(); setup_program(support_ota); Scheduler::ExitState exit_state; VM vm; vm.load_platform_event_sources(); int groud_id = vm.scheduler()->next_group_id(); exit_state = vm.scheduler()->run_boot_program(program, null, group_id); OS::tear_down(); FlashRegistry::tear_down(); After these, esp32 may go to deep sleep. ...

March 1, 2022 · 1 min · un01s

Reading Toit Code (001)

When I started to port the code to ESP32S3 following the example of ESP32C3, I realized I had to read the code closely. Here are the notes along the way. Where does the code get started on esp32? Based on esp-idf, Toit (I like to pronounce it as tight) creates a new platform with a new programming language for developers. For the code to start on the esp32 device, check all the files inside toolchains/esp32/. They contains all the building details for esp32. Inside its subfolder main, there is a toit.c. The function app_main() is the entry point. Inside toit_start() is called. ...

February 25, 2022 · 1 min · un01s

Invasion!

Today Putin ordered troops into pro-Russian region of eastern Ukraine in the name of peacekeeping. Ukraine invaded. Then I saw the news of Dr. Paul Farmer. “The idea that some lives matter less is the root of all that is wrong with the world.”

February 21, 2022 · 1 min · un01s