This commit is contained in:
Miloslav Ciz 2024-06-10 10:07:07 +02:00
parent aadf27a49f
commit 65fdd3799d
31 changed files with 1913 additions and 1808 deletions

View file

@ -4,4 +4,8 @@
In 21st century there are already long established offices whose sole purpose is to ensure people cannot make use of useful ideas (see [patents](patent.md)). It is also possible -- and actually extremely common -- to draw a rectangle on the ground and then buy a paper that makes it possible to bully anyone who enters that rectangle, even kill him. Whole earth is now covered with such rectangles, it is impossible to set foot anywhere else -- in fact if you want to live, you have to buy a paper that gives you your own rectangle where you won't be bullied if you fall asleep, but you have to continuously pay for that paper, i.e. you are doomed to slavery just by existing. In 21 century it is forbidden to shit or urinate if you have no money in your pocket, without money you are OFFICIALLY supposed and expected to hold it until your bladder explodes and you die in the street -- if you're in a big city and you want to shit, you cannot do it, you may only pay for someone to let you take a shit in his house. Also in 21st century you cannot eat food that is next to you, that no one else is eating and that will be thrown away, and that even if you're starving -- it is called theft and you will be beaten for it, maybe even killed. In this century you can also no longer drink from rivers or lakes, they have been poisoned so that you cannot drink at all if you don't have money in your pocket -- doing the same with air is already work in progress, major cities already have borderline unbreathable air. Never ending torture is part of everyday life: for example every day you are forced to stop sleeping very early and go perform [slavery](work.md) that you hate deeply, the whole day you are continuously targeted with repeated brainwashing ([ads](marketing.md), news, social media, [fear culture](fear_culture.md), industrial noise, ...) that equate psychological torture. In 21st century every [joke](jokes.md) has to be preceded by 35 disclaimers, apologies to anyone who might find the joke unfunny, to the corporations that hold ownership of the words that the joke borrows, warning that the font may cause epileptic seizure, waivers of any responsibility for anything the joke may cause, threat to anyone who would think of copying the joke, attribution of all people in history thanks to which the joke is possible, several ads for sponsors of the joke and warnings about the pure coincidental similarity between any real life concepts and the concepts used in the joke -- after reading this you don't even want to read the joke anymore. But people have conformed to it, it is now standard. There are many more things like this but trying to recount them all would result in many thousands of billions of volumes of books.
21st century is a horror, devoid of all humanity. No sincerity exists anymore, only fakes, as everyone is seeking some kind of [capital](capitalism.md), no art is sincere anymore, no soul is present in any craft, there is no place for soul among pure self interest -- despite the world being filled with bright colors and infantile pictures, it's like a world full of creepy clowns, cartoon animals are dancing all around in ads and movies but you know it's all just soulless robots beneath the shell, something aimed purely at taking advantage of you, at raping you. They will torture you to death with a smile on their face.
21st century is a horror, devoid of all humanity. No sincerity exists anymore, only fakes, as everyone is seeking some kind of [capital](capitalism.md), no art is sincere anymore, no soul is present in any craft, there is no place for soul among pure self interest -- despite the world being filled with bright colors and infantile pictures, it's like a world full of creepy clowns, cartoon animals are dancing all around in ads and movies but you know it's all just soulless robots beneath the shell, something aimed purely at taking advantage of you, at raping you. They will torture you to death with a smile on their face.
In 21st century if you buy something there is only about 0.03% chance it will work. There is probably some law that says that if you buy something it should work, but in practice there are no laws because even if you could probably sue the seller, it would mean investing $100000000 and about 10 years of every day going to the court to get your $100 back, and the result isn't guaranteed anyway because for your investment you'll be able to afford maybe 3 lawyers while the corporation will have about 100 to 100000 lawyers, it's very unlikely you would beat that, so you just won't do it, you will just keep buying the thing over and over and praying it works. The exact breaking rates are fine tuned by special departments so as to not make people give up on buying the thing completely, but to make them buy as many of them as possible. This is basically completely optimized [capitalism](capitalism.md). Even if the thing works when you buy it, it will at best last maybe 3 days or 3 and a half days. It's similar with [work](work.md) (slavery) -- in theory there is some kind of minimum wage you should be paid but in practice you'll be very lucky to even be paid anything -- again, you could in theory sue your employer for not paying you but you can't really do it -- if you come naked or in bad clothes to the court you'll be automatically ruled guilty and since you have no money because the employer didn't pay you, you can't afford the required $1000000 suit, so you can't sue anyone -- so laws de facto only exist so that law makers have a job, they can't be used (well they can, but only by corporations). { I personally have this experience with computer mice -- I bought many mice this way because they just never worked, eventually I just gave up and stopped playing shooter games, I realized it's better to learn living without a working computer mouse, otherwise I would just spend all my life savings on them. ~drummyfish }
{ Sorry I just realized the previous paragraph is maybe written about 3 to 5 years ahead -- I sometimes do that because I see into the future and I don't want to rewrite this too often. Anyway it still falls under this century. ~drummyfish }

1
c.md
View file

@ -50,6 +50,7 @@ C is extreme well established, standardized and implemented so there is a great
- [clang](clang.md): Another big bloated compiler, kind of competes with gcc, is similarly good at optimization etc. Uses [LLVM](llvm.md) intermediate representation.
- [tcc](tcc.md): Tiny C compiler, [suckless](suckless.md), orders of magnitude smaller (currently around 25 KLOC) and simpler than gcc and clang, doesn't use any intermediate representation, cannot optimize nearly as well as the big compilers so the generated executables can be a bit slower and/or bigger (though sometimes they may be smaller), however besides its internal simplicity there are many advantages, mainly e.g. fast compilation (claims to be 9 times faster than gcc) and small tcc executable (about 100 kB). Seems to only support x86 at the moment.
- [scc](scc.md): Another small/suckless C compiler, currently about 30 KLOC.
- [chibicc](chibicc.md): Hell of a small C compiler (looks like around 10 KLOC).
- [DuskCC](duskcc.md): [Dusk OS](duskos.md) C compiler written in [Forth](forth.md), focused on extreme simplicity, probably won't adhere to standards completely.
- [8c](8c.md), [8cc](8cc.md), [chibicc](chibicc.md): Some other small compilers.
- [c2bf](c2bf.md): Partially implemented C to [brainfuck](brainfuck.md) compiler.

View file

@ -22,6 +22,7 @@ Potentially supplemental articles to this tutorial are:
- [memory management](memory_management.md)
- [optimization](optimization.md)
- [SAF](saf.md)
- [SDL](sdl.md)
- ...
## About C And Programming

View file

@ -1,6 +1,6 @@
# Cracker
Crackers are either "bad [hackers](hacking.md)" that break into computer systems or the good people who with the power of [hacking](hacking.md) remove artificial barriers to obtaining and sharing [infomration](information.md); for example they help remove [DRM](drm.md) from [games](game.md) or leak data from secret databases. This is normally illegal which makes the effort even more admirable.
Crackers are either "bad [hackers](hacking.md)" that break into computer systems or the good people who with the power of [hacking](hacking.md) remove artificial barriers to obtaining and sharing [information](information.md); for example they help remove [DRM](drm.md) from [games](game.md) or leak data from secret databases. This is normally illegal which makes the effort even more admirable.
Cracker is also food.

View file

@ -1,6 +1,6 @@
# Czechia
Czechia, or Czech Republic, is a small country in the middle of [Europe](europe.md), it's one of the most awful countries in the world. It split from Czechoslovakia in 1993, its capital is Prague, it has about 78000 square kilometers and population of 11 million, the political system and main religion is [capitalism](capitalism.md). In the past the country wasn't so bad, there was a good tradition of [socialism](socialism.md) so people had complete social security, education was completely free, everyone could afford food, there were very few ads in the media and generally people were quite happy, everyone would get healthcare and retirement pension; there was also quite diverse culture of different villages with their own language dialects and traditions, there was zero crime, no one ever heard of guns or violence there, there was no fear, and art was also somewhat nice, especially music, movies and movie dubbing. All of this disappeared swiftly once the country adopted [capitalism](capitalism.md) and [US](usa.md) culture after the so called *Velvet revolution* at the beginning of 1990s. Recently people were again made to vote -- the choices were to either make everything more shitty or to make things better. They voted to make everything shittier, so inflation is now skyrocketing, people are freezing in winter, TV is unwatchable, food is luxury, let alone things like houses, nothing works, everyone is enslaved, retirement age was postponed to something like 100 years of age plus you must have worked for about 80 years or something (this gets increased every year), ads torture you everywhere, there is no art anymore, health insurance payment is mandatory but you still have to pay for healthcare, but you won't find a doctor anyway, there are no doctors anymore (everyone went to do [marketing](marketing.md)). The country is only famous for its tradition of drinking a lot of beer. Czech people are mostly described by foreigners as cold, unfriendly, rude and ugly. One of the most famous politicians is a Czech Neonazi who's actually Japanese. Czechia has no historical, political or cultural significance.
Czechia, or Czech Republic, is a small country in the middle of [Europe](europe.md), it's one of the most awful countries in the world. It split from Czechoslovakia in 1993, its capital is Prague, it has about 78000 square kilometers and population of 11 million, the political system and main religion is [capitalism](capitalism.md). In the past the country wasn't so bad, there was a good tradition of [socialism](socialism.md) so people had complete social security, education was completely free, everyone could afford food, there were very few [ads](marketing.md) in the media and generally people were quite happy, everyone would get healthcare and retirement pension; there was also quite diverse [culture](culture.md) of different villages with their own language dialects and traditions, there was zero crime, no one ever heard of guns or violence there, there was no [fear](fear_culture.md), and art was also somewhat nice, especially music, movies and movie dubbing. All of this disappeared swiftly once the country adopted [capitalism](capitalism.md) and [US](usa.md) culture after the so called *Velvet revolution* at the beginning of 1990s. Recently people were again made to vote -- the choices were to either make everything more shitty or to make things better. They voted to make everything shittier, so inflation is now skyrocketing, people are freezing in winter, TV is unwatchable, food is luxury, let alone things like houses, nothing works, everyone is enslaved, retirement age was postponed to something like 100 years of age plus you must have worked for about 80 years or something (this gets increased every year), ads torture you everywhere, there is no art anymore, health insurance payment is mandatory but you still have to pay for healthcare, but you won't find a doctor anyway, there are no doctors anymore (everyone went to do [marketing](marketing.md)). The country is only famous for its tradition of drinking a lot of beer. Czech people are mostly described by foreigners as cold, unfriendly, rude and ugly. One of the most famous politicians is a Czech Neonazi who's actually Japanese. Czechia has no historical, political or cultural significance.
Except for [drummyfish](drummyfish.md) only fascists live in the country, essentially everyone is a nationalist.
@ -12,4 +12,6 @@ The whole Czech [politics](politics.md) is a gigantically ridiculous joke not ev
The greatest Czech was Jara Cimrman, a fictional genius whom the people made up to have someone to look up to. The history of the country is also completely made up, it was crafted to serve nationalism, to justify things like separatism and murdering Germans after the war and also to destroy the country etc.
Soon it's going to be destroyed by Putin's nukes.
All in all avoid this piece of crap place.

View file

@ -87,6 +87,7 @@ The most typical debugging tool is a **[debugger](debugger.md)**, a program that
- Step through the program line-by-line (typically there is are two options: step by lines and step by functions), sometimes even backwards in time.
- Run the program and pause it exactly where you need ([breakpoints](breakpoint.md)).
- Print stack trace, i.e. the exact chain of function calls at certain point in time. This is extremely useful if your program crashes, you will see not only at which line it crashed but exactly through which functions it got to that line, which is usually the important thing.
- Inspect values in RAM, CPU registers etc.
- Modify values in RAM, registers etc.
- Modify code on-the-fly.
@ -95,9 +96,11 @@ The most typical debugging tool is a **[debugger](debugger.md)**, a program that
- Warn about suspicious things.
- ...
As a free software C programmer you will most likely use [gdb](gdb.md), the [GNU](gnu.md) debugger.
Furthermore there many are other useful tools such as:
- **dynamic program analyzer**: A tool that will watch your program running and check for things like [memory leaks](memory_leak.md), access of unallocated memory, suspicious behavior, unsafe behavior, call of obsolete functions and many others. The most famous such tool is probably **[valgrind](valgrind.md)**, it's a good habit to just use valgrind from time to time to check our program.
- **dynamic program analyzer**: A tool that will watch your program running and check for things like [memory leaks](memory_leak.md), access of unallocated memory, suspicious behavior, unsafe behavior, call of obsolete functions and many others. The most famous such tool is probably **[valgrind](valgrind.md)**, it's a good habit to just use valgrind from time to time to check our program. Similar things can also be done with **[gdb](gdb.md)**.
- **[profiler](profiling.md)**: A kind of dynamic analyzer that focuses on statistical measuring of resource usage of your program, typically execution times of different functions, memory consumption or network usage. Basically it will watch your program run and then draw you graphs of which parts of your programs consume most resources. This usually helps [optimization](optimization.md) but can also serve to find bugs (you can spot where your memory starts leaking etc.). Some basic profiling can be done even without profiler, just inside your own program, but it can get tricky. One famous profiler is e.g. [gprof](gprof.md).
- **static source code analyzer**: Static analyzers look at the source code (or potentially even compiled binary) and try to find bugs/inefficiencies in it without running it, just by reasoning. Static analyzers often tell you about [undefined behavior](undefined_behavior.md), potential overflows, unused code, unreachable branches, unsatisfiable conditions, confusing formatting and so on. This complement the dynamic analysis. Some tools to do this are e.g. [cppcheck](cppcheck.md), [pmccabe](pmccabe.md) and [splint](splint.md), though thanks to compilers performing a lot of static analysis themselves these seem not as widely used as dynamic analyzers nowadays.
- **[hex editor](hex_editor.md)**: Tool allowing you to mess with binary files, useful for any program that works with binary files. A simple hex viewer is e.g. `hexdump`.

View file

@ -2,6 +2,7 @@
Disease is a bad state of living organism's health caused by failure of its inner mechanisms rather than being directly caused by a physical injury. Technological and consoomerist diseases are mental diseases almost exclusively present in humans (but also possibly in some animals forced to live like humans) related to [shit technology](capitalist_technology.md). Some of the most common diseases, mostly of the technological kind but also of others, include:
- [ADHD](adhd.md)
- [assholism](assertiveness.md)
- [audiophilia](audiophilia.md)
- [autism](autism.md)
@ -39,6 +40,7 @@ Disease is a bad state of living organism's health caused by failure of its inne
- [pride](pride.md)
- [productivity](productivity_cult.md)/robotization
- [retardation](retarded.md)
- [self interest](self_interest.md)
- [schizophrenia](schizo.md)
- [troll personality disorder](troll_personality_disorder.md)
- Unix [ricing](rice.md)

View file

@ -7,7 +7,7 @@ Some signs of egoism include:
- **Drawing someone's own face (or letting someone else do it) and then using it for a profile picture**. "Modern" soydevs on twitter and blogs are so guilty of this, especially the "game devs" with pixel art portraits etc., it's so narcissistic and cringe you just want to puke. Why would anyone humble even allow someone to make a statue of him, allowing the danger of cult of personality and becoming a [hero](hero_culture.md)? Why the fuck do people obsess about forcing their ugly faces onto others?
- **Decorating one's body obsessively, trying to adopt an "image"**, especially with [tattoos](tattoo.md), wild hairstyles, clothes that serves other purpose than pure protection from weather, for example a **[suit](suit.md)** etc. A good man will never try to look much different from how he'd look naturally, he will minimize effort put into caring about looks and will try to avoid the danger of applying manipulative psychological tricks such as appeal by looks.
- **Putting one's name in (or near) the title of his creation**: one of the most famous examples being the *Shit Faggot's Game Of Civilization*. Yes, [Linux](linux.md) counts too; even though [Linus](torwalds.md) didn't name it himself, he just waited for someone else to do it for him and then didn't protest; he also joked about it, trying to make it look OK, though without success (see below).
- **Egoism masked as [joking](jokes.md)**, i.e. doing something egoistic and then pretending to do it for the sake of a joke; for example in the book *World of Warcraft Diary* the author *X* puts a huge quote of himself on one page and jokingly writes under it *"X quoting X in his own book"* -- hahaha we laughed ok? It's not egoism, it's done for a joke, BTW the quote will stay there. The author here thinks he is smart as he think this achieves two things: promoting himself while also making him look like someone with a sense of humor. In fact it just makes him look like the most egocentric bastard.
- **Egoism masked as [joking](jokes.md)** (see also [doing it with a smile](doing_it_with_a_smile.md)), i.e. doing something egoistic and then pretending to do it for the sake of a joke; for example in the book *World of Warcraft Diary* the author *X* puts a huge quote of himself on one page and jokingly writes under it *"X quoting X in his own book"* -- hahaha we laughed ok? It's not egoism, it's done for a joke, BTW the quote will stay there. The author here thinks he is smart as he think this achieves two things: promoting himself while also making him look like someone with a sense of humor. In fact it just makes him look like the most egocentric bastard.
- **[Assertiveness](assertiveness.md)**.
- **Giving oneself special names**. Making a quick Internet handle is cool for practical purposes, inventing an artistic name or even changing it legally is just an inflated ego.
- **Talking about oneself too much**.

View file

@ -12,5 +12,8 @@ Another potentially valid use of the argument is in the meaning of "everyone doe
## See Also
- [excuse](excuse.md)
- [they do it too](they_do_it_too.md)
- [just doing my job](just_doing_my_job.md)
- [just doing my job](just_doing_my_job.md)
- [someone has to do it](someone_has_to_do_it.md)
- [if I didn't do it someone else would](someone_else_would.md)

View file

@ -197,14 +197,16 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
92. =fgtnmtg qlcowj jakju lm vglcnr gjv dm gocl gjv qk vcjU
93. Please solve the following inequality: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) >= 0*, mathematically write exactly which values of *x* will satisfy it. Don't use calculator, ok? But you can look up goniometric formulas etc.
94. Given continuous differentiable function *f(x)*, derive the formula for computing the length of the curve of the function graph on interval *[x1,x2]*. No need to provide 100% formal proofs, you can use intuition as long as you get the correct formula and show it works on a few examples. For example the length of the graph of function *f(x) = x* on interval *[0,1]* will be *sqrt(2)* (holds from Pythagorean theorem). Compute the length of curve of the graph of *f(x) = sin(x)* on interval *[0,2 * pi]*.
95. Give correct answers to at least three of the following. Full name of an influential software engineering essay that's shortened as *catb*. Name of the creator and BDFL of the Perl language. First name (by which he was known) of a famous suckless and cat-v member who commited suicide in 2012. Name of [esolang](esolang.md) made in 1972 that's considered to be the first esolang ever. First name that was shared by the two most famous members of the [Doom](doom.md) development team, the engine programmer and level designer.
96. Write a function in C, in 100 characters or fewer, that counts the number of 1 bits in a number of `unsigned int` type.
97. You're programming a "pseudo 3D" game that shows a 3D view from the player's perspective but really the player only has a position and facing direction in two dimensions, the level exists just in a 2D plane. Enemies also have a 2D position and facing direction, and they are rendered with 2D sprites, just like in [Doom](doom.md) or Wolfenstein 3D. Each enemy sprite has 4 versions, each for one of the four major viewing directions: front, back and two side views (left and right). Given player's position *PP*, normalized facing direction vector *PD*, enemy position *EP* and normalized enemy facing vector *ED*, how do you compute which of the four sprite versions to chose for the rendering? I.e. from the relative positions and rotations figure out which side of the enemy we're seeing.
98. What's the principle of [CPU](cpu.md) [cache](cache.md)? How exactly does it speed up programs? Under what conditions will the cache work well? I.e. how should a program ideally behave to make maximum use of the cache?
99. If you answer "yes" to this question, will you have lied?
100. Form a word by answering each following sentences with one letter. Binary number 1011 in hexadecimal. Base of natural logarithm. *x = min(max(0,t - 1),1)*, *y = 2 - t for 1 <= t <= 2 otherwise t mod 1*, *t* goes from 0 to 3. Number whose square is -1. `'U' - 'T' + 'R'`.
101. In C this `float x = 16777216; printf("%d\n",x == (x + 1));` outputs `1` (or at least it is possible) -- what the fuck. How can a number equal itself plus one? Explain what's going on here.
102. Did you enjoy this quiz?
95. If someone murders your whole family, does he deserve death?
96. Give correct answers to at least three of the following. Full name of an influential software engineering essay that's shortened as *catb*. Name of the creator and BDFL of the Perl language. First name (by which he was known) of a famous suckless and cat-v member who commited suicide in 2012. Name of [esolang](esolang.md) made in 1972 that's considered to be the first esolang ever. First name that was shared by the two most famous members of the [Doom](doom.md) development team, the engine programmer and level designer.
97. Write a function in C, in 100 characters or fewer, that counts the number of 1 bits in a number of `unsigned int` type.
98. You're programming a "pseudo 3D" game that shows a 3D view from the player's perspective but really the player only has a position and facing direction in two dimensions, the level exists just in a 2D plane. Enemies also have a 2D position and facing direction, and they are rendered with 2D sprites, just like in [Doom](doom.md) or Wolfenstein 3D. Each enemy sprite has 4 versions, each for one of the four major viewing directions: front, back and two side views (left and right). Given player's position *PP*, normalized facing direction vector *PD*, enemy position *EP* and normalized enemy facing vector *ED*, how do you compute which of the four sprite versions to chose for the rendering? I.e. from the relative positions and rotations figure out which side of the enemy we're seeing.
99. What's the principle of [CPU](cpu.md) [cache](cache.md)? How exactly does it speed up programs? Under what conditions will the cache work well? I.e. how should a program ideally behave to make maximum use of the cache?
100. If you answer "yes" to this question, will you have lied?
101. Form a word by answering each following sentences with one letter. Binary number 1011 in hexadecimal. Base of natural logarithm. *x = min(max(0,t - 1),1)*, *y = 2 - t for 1 <= t <= 2 otherwise t mod 1*, *t* goes from 0 to 3. Number whose square is -1. `'U' - 'T' + 'R'`.
102. In C this `float x = 16777216; printf("%d\n",x == (x + 1));` outputs `1` (or at least it is possible) -- what the fuck. How can a number equal itself plus one? Explain what's going on here.
103. Can you be both pro-privacy and anti-censorship at the same time?
104. Did you enjoy this quiz?
### Answers
@ -303,14 +305,16 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
93. Let's simplify the left-hand side: *sin(2 * x) / (2 - 2 * sin^2(x)) - log2(1 / 8^(-1/3)) = 2 * sin(x) * cos(x) / (2 * (1 - sin^2(x))) - log2(8^1/3) = 2 * sin(x) * cos(x) / (2 * cos^2(x)) - log2(2) =
sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hold when *pi/4 + pi * n <= x < pi/2 + pi * n*, *n* is an integer.
94. Considering an infinitely small non-zero interval *dx*, and the graph height increase over this interval *dy*, the distance increase (from Pythagorean theorem) on this interval will be *sqrt(dx^2 + dy^2)*. We can replace *dy* by *tan(alpha) * dx*. By definition tangent of the function's angle at a certain point is its derivative, so we can also replace *tan(alpha)* by derivative of the function, *f'(x)*. So we get length increase *sqrt(dx^2 + f'(x)^2 * dx^2) = sqrt(dx^2 * (1 + f'(x)^2)) = dx * sqrt(1 + f'(x)^2)*. Now to add infinitely many values over infinitely small intervals we use integrals, so to add all these small length increases we can write the final formula: *length(x1,x2) = Integral(x1,x2) sqrt(1 + f'(x)^2) dx*. Testing this on *f(x) = x* from 0 to 1 we get the expected *length(0,1) = Integral(0,1) sqrt(1 + 1^2) dx = sqrt(2)*. For *f(x) = sin(x)* from 0 to *2 * pi* we get *length(0,2 * pi) = Integral(0,2 * pi) sqrt(1 + cos^2(x)) dx ~= 7.64*, which seems about right (it's a bit more than 2 * pi).
95. [The Cathedral And The Bazaar](bazaar.md), Larry Wall, Uriel, INTERCAL, John (Carmack and Romero).
96. For example: `int c1(unsigned int x) { int r = x % 2; while (x) r += (x >>= 1) % 2; return r; }`.
97. Firstly realize we don't need player's facing vector *PD* at all (if an enemy is showing us his back for example, no matter how we rotate ourselves we'll only ever be able to see his back). Instead we'll need a vector pointing from the player's position to the enemy position, let's say *V = normalize(EP - PP)*. Now let's observe our result will depend on the relatinship between *V* and *ED* -- for example if the vectors are the same (enemy is facing in the direction aligned with the direction from player to enemy), the player will see the enemy back. If the vectors are opposing, we'll see the enemy front. If the vectors are 90 degrees, we'll see either left or right side. So we just need to figure out what angle the vectors *V* and *ED* have between then, which we can easily do with [dot product](dot_product.md) that tells us the cosine of the angle -- so if we get dot product greater than *cos(45 degrees)*, we see the back, if we get value smaller than *cos(135 degrees)*, we see the front, otherwise we see the side. To distinguish between left and right side we may use for example [cross product](cross_product.md) to determine if one vector goes "left or right" from another vector.
98. Cache is a small memory placed between the CPU and main memory (RAM), it is a very fast type of memory, faster than the main memory, but it's also much smaller than main memory. The idea is that programs typically do a lot of work in some small region of main memory, they keep reading and writing the same (or nearby) memory cell(s) over and over and only after a while move somewhere else. So once the program starts a work in some memory area, the cache can load that area, let the program do its work very quickly in the cache, and then (when the program moves elsewhere) copy the results back from the cache to the memory. It's similar to downloading a file from the Internet to the disk, then editing the file locally and later on uploading it back. However the cache will be effective only if the assumption we made hold, i.e. if the program really mostly works in small areas of memory and makes minimum of long jumps, so if a program wants to fully utilize the cache, it should try to minimize these long jumps (for example by putting related data close to each other).
99. There is no correct answering with either "yes" or "no" (this is therefore the correct answer). The question can be reworded as: *Is "yes" the wrong answer to this question?*, which can be reworded as: *Is "no" the correct answer to this question?* If we try both possible answers -- "yes" and "no" -- we find neither works.
100. BENIS
101. [Floating point](float.md) had decreasing precision towards higher values, this one if already beyond the resolution of 1, so the float type cannot represent this number plus one, adding one rounds the result down to the same number.
102. yes
95. no
96. [The Cathedral And The Bazaar](bazaar.md), Larry Wall, Uriel, INTERCAL, John (Carmack and Romero).
97. For example: `int c1(unsigned int x) { int r = x % 2; while (x) r += (x >>= 1) % 2; return r; }`.
98. Firstly realize we don't need player's facing vector *PD* at all (if an enemy is showing us his back for example, no matter how we rotate ourselves we'll only ever be able to see his back). Instead we'll need a vector pointing from the player's position to the enemy position, let's say *V = normalize(EP - PP)*. Now let's observe our result will depend on the relatinship between *V* and *ED* -- for example if the vectors are the same (enemy is facing in the direction aligned with the direction from player to enemy), the player will see the enemy back. If the vectors are opposing, we'll see the enemy front. If the vectors are 90 degrees, we'll see either left or right side. So we just need to figure out what angle the vectors *V* and *ED* have between then, which we can easily do with [dot product](dot_product.md) that tells us the cosine of the angle -- so if we get dot product greater than *cos(45 degrees)*, we see the back, if we get value smaller than *cos(135 degrees)*, we see the front, otherwise we see the side. To distinguish between left and right side we may use for example [cross product](cross_product.md) to determine if one vector goes "left or right" from another vector.
99. Cache is a small memory placed between the CPU and main memory (RAM), it is a very fast type of memory, faster than the main memory, but it's also much smaller than main memory. The idea is that programs typically do a lot of work in some small region of main memory, they keep reading and writing the same (or nearby) memory cell(s) over and over and only after a while move somewhere else. So once the program starts a work in some memory area, the cache can load that area, let the program do its work very quickly in the cache, and then (when the program moves elsewhere) copy the results back from the cache to the memory. It's similar to downloading a file from the Internet to the disk, then editing the file locally and later on uploading it back. However the cache will be effective only if the assumption we made hold, i.e. if the program really mostly works in small areas of memory and makes minimum of long jumps, so if a program wants to fully utilize the cache, it should try to minimize these long jumps (for example by putting related data close to each other).
100. There is no correct answering with either "yes" or "no" (this is therefore the correct answer). The question can be reworded as: *Is "yes" the wrong answer to this question?*, which can be reworded as: *Is "no" the correct answer to this question?* If we try both possible answers -- "yes" and "no" -- we find neither works.
101. BENIS
102. [Floating point](float.md) had decreasing precision towards higher values, this one if already beyond the resolution of 1, so the float type cannot represent this number plus one, adding one rounds the result down to the same number.
103. no
104. yes
## Other

1
fsf.md
View file

@ -20,6 +20,7 @@ After this the FSF died completely.
- [FSFLA](fsfla.md)
- [FSFE](fsfe.md)
- [EFF](eff.md)
- [FFS](FFS.md)
- [Creative Commons](creative_commons.md)
- [OSI](osi.md)
- [Copyfree](copyfree.md)

View file

@ -13,4 +13,5 @@ In the 1990s we were wondering whether by 2020 we'd already have cured cancer, s
## See Also
- [uwu](uwu.md)
- [zoophilia](zoophilia.md)
- [retardedness](retard.md)

View file

@ -1,5 +1,5 @@
# Githopping
Githopping is a disease similar to [distrohopping](distrohopping.md) but applied to [git](git.md) hosting websites. The disease has become an epidemics after the [Micro$oft](microsoft.md)'s take over of [GitHub](github.md) when people started protest-migrating to [GitLab](gitlab.md), however GitLab became [shit](shit.md) as well so people started hopping to other services like [Codeberg](codeberg.md) etcetc. and now they are addicted to just copying their code from one site to another instead of doing actual programming.
Githopping is a [disease](disease.md) similar to [distrohopping](distrohopping.md) but applied to [git](git.md) hosting websites. The disease has become an epidemics after the [Micro$oft](microsoft.md)'s take over of [GitHub](github.md) when people started protest-migrating to [GitLab](gitlab.md), however GitLab became [shit](shit.md) as well so people started hopping to other services like [Codeberg](codeberg.md) etcetc. and now they are addicted to just copying their code from one site to another instead of doing actual programming.
Cure: free yourself of any git hosting, don't centralize your repos on one hosting, use multiple git hostings as mirrors for your code, i.e. add multiple push remotes to your local git and with every push update your repos all over the internet. Just spray the internet with your code and let it sink in, let it be captured in caches and archive sites and let it be preserved. **DO NOT** tie yourself to any specific git hosting by using any non-git features such as issue trackers or specialized [CLI](cli.md) tools such as github cli. **DO NOT** use git hosting sites as a [social network](social_network.md), just stop attention whoring for stars and likes, leave this kind of shit to tiktokers.

View file

@ -13,8 +13,8 @@ John Carmack (born 1970 in Kansas, [US](usa.md)) is a brilliant legendary progra
*[ASCII art](ascii_art.md) of John Carmack*
He's kind of the ridiculously stereotypical [nerd](nerd.md) with glasses that just from the way he talks gives out the impression of someone with high functioning [autism](autism.md). You can just sense his [IQ](iq.md) is over 9000. Some nice [shit](shit.md) about him can be read in the (sadly [proprietary](proprietary.md)) book *Masters of Doom*.
He's kind of the ridiculously stereotypical [nerd](nerd.md) with glasses that just from the way he talks gives out the impression of someone with high functioning [autism](autism.md). You can just sense his [IQ](iq.md) is over 9000. However it seems he's the kind of very narrowly focused robot, a calculator capable of superhuman programming and math calculations who knows nothing about anything else -- for example he doesn't seem to be able to speak any other language than English or know anything about empathy. { If I'm incorrect, let me know please. I searched if he speaks any languages but haven't found any clues about that being true. ~drummyfish } Some nice [shit](shit.md) about him can be read in the (sadly [proprietary](proprietary.md)) book *Masters of Doom*.
Carmack is a proponent of [FOSS](foss.md) and has released his old game engines as such which gave rise to an enormous amount of modifications, forked engines and even new games (e.g. [Freedoom](freedoom.md) and [Xonotic](xonotic.md)). He's probably leaning more towards the dark side of the source: the [open-source](open_source.md). In 2021 Carmack tweeted that he would have rather licensed his old Id engines under a permissive BSD [license](license.md) than the [GPL](gpl.md), which is good.
Carmack is a proponent of "[FOSS](foss.md)" and has released his old game engines as such which gave rise to an enormous amount of modifications, forked engines and even new games (e.g. [Freedoom](freedoom.md) and [Xonotic](xonotic.md)). He's probably leaning more towards the dark side of the source: the [open-source](open_source.md). In 2021 Carmack tweeted that he would have rather licensed his old Id engines under a permissive BSD [license](license.md) than the [GPL](gpl.md), which is good.
In 2013 he sadly sold his soul to [Facebook](facebook.md) to work on [VR](vr.md) (in a Facebook owned company Oculus). Sometimes he is sadly not so based -- in one interview he admitted he was an "amoral little jerk" as a kid, but he probably kept a bit of that amorality still as he in general supports [business](business.md), in the 90s even praised some things about Microsoft [Windows](windows.md) etc., not very cool. But he's an [american](usa.md) after all, so what would you expect.

2
lrs.md
View file

@ -101,7 +101,7 @@ Apart from this software a lot of other software developed by other people and g
- **[Simon Tatham's portable puzzle collection](stppc.md)**: Very portable collection of puzzle [games](game.md).
- ...
Other potentially LRS software to check out may include [TinyGL](tinygl.md), [scc](scc.md), [ed](ed.md), [IBNIZ](ibniz.md), [lynx](lynx.md), [links](links.md), [tcl](tcl.md), [uClibc](uclibc.md), [miniz](miniz.md), [Lua](lua.md), [nuklear](nuklear.md), [dmenu](dmenu.md), [sbase](sbase.md), [sic](sic.md), [tabbed](tabbed.md), [svkbd](svkbd.md), [busybox](busybox.md), [darcs](darcs.md), [raylib](raylib.md), [IRC](irc.md), [PortableGL](portablegl.md), [3dmr](3dmr.md), [openbsd](openbsd.md), [mtpaint](mtpaint.md) and others.
Other potentially LRS software to check out may include [TinyGL](tinygl.md), [scc](scc.md), [ed](ed.md), [chibicc](chibicc.md), [IBNIZ](ibniz.md), [lynx](lynx.md), [links](links.md), [tcl](tcl.md), [uClibc](uclibc.md), [miniz](miniz.md), [Lua](lua.md), [nuklear](nuklear.md), [dmenu](dmenu.md), [sbase](sbase.md), [sic](sic.md), [tabbed](tabbed.md), [svkbd](svkbd.md), [busybox](busybox.md), [darcs](darcs.md), [raylib](raylib.md), [IRC](irc.md), [PortableGL](portablegl.md), [3dmr](3dmr.md), [openbsd](openbsd.md), [mtpaint](mtpaint.md) and others.
Another idea: **search for very old versions of "[modern](modern.md)" FOSS software**, from the times before things like [CMake](cmake.md), [Python](python.md) and [QT](qt.md) got popular (or even existed) -- many such projects got bloated with time, but their earlier versions may have been more aligned with LRS. You can get the old source code, it's present either in the git, on the project's website, on Internet Archive etc., compiling it should probably be much easier than compiling the "modern" version. This won't help with things like web browsers (as it won't understand the new formats and protocols), but will be fine text editors, drawing programs, 3D editors, games etc. You can also [fork](fork.md) the old version and make it a little better, customize it or publicly turn it into a new program, helping the whole world.

View file

@ -85,6 +85,7 @@ WORK IN PROGRESS
| [Twitter](twitter.md) | titter, twatter |
| United States of America | United Shitholes of America, burgerland |
| user (of a proprietary system) | used, lusr |
| using [JavaScript](js.md) | JavaScrippled |
| voice assistant | personal spy agent |
| [wayland](wayland.md) | whyland |
| [webassembly](webassembly.md) | weebassembly |

File diff suppressed because one or more lines are too long

View file

@ -51,6 +51,8 @@ With increased interest in minimalism the word *minimalism* itself gets misused
| pseudominimalism | no | yes |
| bloat | no | no |
[Rob Pike](rob_pike.md), who was once a great [hacker](hacking.md), once stated 5 programming rules which besides others say that "fancy algorithms are slow when *n* is small and *n* is usually small" and "fancy algorithms are buggier than simple ones and they are much harder to implement; use simple algorithms as well as simple data structures."
## Importance Of Minimalism: Simplicity Brings Freedom
It can't be stressed enough that minimalism is absolutely required for technological freedom, i.e. people having, in **practical** ways, control over their tools. While in today's society it is important to have legal freedoms, i.e. support [free software](free_software.md), we must not forget that this isn't enough, a freedom on paper means nothing if it can't be practiced. We need both legal AND [de facto](de_facto.md) freedom over technology, the former being guaranteed by a free [license](license.md), the latter by minimalism. Minimal, simple technology will increase the pool of people and parties who may practice the legal freedoms -- i.e. those to use, study, modify and share -- and therefore ensure that the technology will be developed according to what people need, NOT according to what a corporation needs (which is usually the opposite).

View file

@ -1,7 +1,5 @@
# LRS: Projects Needed
WIP
*See also [exercises](exercises.md).*
{ If you want to maybe start some project here I'll be glad if you let me know before you start, it can be good to talk about it first as I already have some ideas about how to make some of these projects, I just don't have time to work on them, I will just give you the ideas I have if you want, we can discuss how to best write the code etc. Of course it's all up to you, I'm just offering advice and discussion :) ~drummyfish }

View file

@ -1,7 +1,42 @@
# Network
WORK IN PROGRESS
*See also [Internet](internet.md).*
Computer network is a set of multiple [computers](computer.md) that are interconnected and can communicate with each other. This allows the computers to share [information](information.md), collaborate on calculations, back up and mirror each other's data, allow people to communicate over large distances and so on. The largest and most famous one is the [Internet](internet.md) but indeed it's not the only one, there exist many local networks ([LAN](lan.md)s), community networks, large networks separate from the Internet (isolated army networks, [North Korea's intranet](kwangmyong.md), ...), virtual networks and so on -- these networks may differ greatly in many aspects, be it by their basic topology (which nodes are connected to which), protocols (languages the computers use to communicate), speed (latency and bandwidth), reliability, accessibility, usage policies and so on.
From a mathematical point of view we tend to see a network as a **[graph](graph.md)**, so we usually call the computers in the network **nodes**.
TODO
## Basic Concepts
Networks are hugely complicated, we can only give a very fast overview here. Hopefully it can be a good starting point. (However bear in mind that networking can also be done in a [KISS](kiss.md) way too, especially if you're for example just letting two devices communicate. Always think about the problem at hand.)
One of the very basic concepts is that of a **[protocol](protocol.md)** -- basically the language and rules that the computers will use for the communication. Computers connected in the network may be quite different, the may run different [operating systems](operating_system.md), programs, have different [hardware](hw.md) -- this is all fine as long as they use the same protocol for the communication. A protocol specifies how communication is established, what formats the data will be sent in, what happens if someone is not responding etc. Examples of protocols are [IP](ip.md), [TCP](tcp.md), [UDP](udp.md), [ICMP](icmp.md), [HTTP](http.md) and many others.
Oftentimes we will talk about network parameters such as **latency** (also sometimes called *ping* -- time it takes a message to delivery to its destination), **throughput** (also called *bandwidth* -- how much data over time the network can transfer, measured in [bits](bit.md) per second), reliability, stability etc. Networks also have different **topologies** -- topology say how the nodes are interconnected, for example a fully connected network has every node (computer) connected to every other node directly (faster, more reliable, more efficient, but more expensive, complex, ...), a ring basically forms a circle of the nodes (each one is connected to two neighbors), a start has one central node to which all other nodes are connected etc. Choosing specific topology depends on situation.
For computer networks the concept of **packet switching** is very important -- packet switching is a way of delivering messages by splitting them into small **[packets](packet.md)** of data, assigning each packet metadata such as its number and destination address, then releasing all them all into the network, letting them find their ways to the destination (potentially through different paths) and then, once they all arrive, assembling them back to the original message. This is basically the invention of the Internet, it is contrasted with the originally used way of so called **circuit switching** in which a circuit was established between any nodes that wanted to communicate to basically allow them direct communication over a constant path (similarly to how phone networks worked: you would first call a telephone exchange, say to whom you wanted to talk and the lady would directly connect the cables so that you could talk to that guy). Packet switching may seems like an overcomplicated way of networking (for example packets may arrive in wrong order, they may get lost, we are also sending extra data in the packet headers etc.), but at bigger scales it really makes communication more efficient, decentralized and reliable (if some path in the network gets destroyed, the networks still keeps working). Even non-Internet networks now work on this principle, any computer network nowadays basically copies this mechanism and even uses the same protocols etc., so in networking we'll just be encountering packets everywhere.
Another important concept is that of **network layers**. Unless we are dealing with a very simple 1-to-1 communication, we inevitably get a lot of complexity -- a message has to be chopped into packets, each of which will potentially travel through the network by different paths and some may even get lost; we have to ensure not only their fast and correct delivery between individuals neighboring nodes (some of which communicate over electrical cables, some through optical cables, some through air, ...) but that their correct routing/forwarding (i.e. that they are being pushed in the direction of their destination) and that they arrive in correct order and without errors (cause e.g. by noise). So this process is split into parts or layers, each one creating an [abstraction](abstraction.md) over certain part of this delivery -- each layer then has its own protocols, addressing and so on. Exactly which layers there are and what they are called is a matter of design and convention, it depends on what standard we use, but generally the layers are ordered from lowest (which ensure delivery between neighboring nodes) through middle (which ensure correct delivery over the whole network) to highest (which are concerned with how specific programs talk to each other). This is often compared to how post office works, i.e. how paper letter are delivered -- the highest level layer is just concerned with what human language the letter is written in and which men lead the communication, the lower levels are concerned with wrapping the letter in an envelope and putting an address and postal code on it, yet lower levels then try to deliver this to the local post office reliably, using whatever means are deemed best (cars, planes, ships, ...), and finally at the lowest level are the mailmen who deliver the letters to the house, again choosing the best way of doing so (walking, riding a bike, finding the shortest paths, ...). The problem of delivery is simplified by the fact that one layer doesn't have to care about the internal details of another layer, i.e. for example a man writing a letter is only concerned about passing the letter to the layer below (putting correct information on the envelope), he doesn't care at all if it will then be delivered by a truck or plane, through which cities it will fly, if it will eventually be delivered by a man or woman etc. Now two of the biggest standards for network layers are TCP/IP and OSI. The OSI model is more general, it defined 7 layers (application, presentation, session, transport, network, data link, physical -- also shortened to L7 through L1) and can be used for anything we could remotely call a network. TCP/IP is a bit simpler and is used for the Internet -- let's take a look at the TCP/IP layers (each one maps more or less to one or more OSI layers):
| layer | task | addressing | protocol examples |
| ----------------- | -------------------------------------------------------- | ---------------------- | ------------------- |
| Application layer | Communicate data (text or bin.) between programs. | URL, email addr., ... | HTTP, FPT, DNS, ... |
| Transport layer | Break data into packets, potentially ensure reliability. |IP addr. + port + proto | TCP, UDP, ... |
| Internet layer | Deliver packet from node A to node B. | IP address | IPv4, IPv6, ... |
| Link layer | Deliver bits of data between two neighoring nodes. | MAC address | Ethernet, Wifi, ... |
Now please keep in mind this separation into layers doesn't always have to be 100% respected, for example while on the application layer level we prefer "nice addresses" such as those used in email, we may sometimes resort to specifying raw IP addresses and ports too. Sometimes very specialized applications (e.g. some games that need to minimize latency) may decide to implement their own level of reliable delivery on application level, ignoring this potential service of transport layer. There may also appear protocols that span several layer or lie somewhere in between etc.
**[Routing](routing.md)** is an important problem to solve in networking -- basically it means finding an [algorithm](algorithm.md) of finding delivery paths in the network, usually in a distributed way, i.e. we are trying to make it so that if some node in the network sends a packet to some other node (identified by its address), all other nodes will know what to do and how to efficiently get it there, i.e. every node should know whom to hand the packet over just from seeing its address. This is not trivial. Nodes usually maintain and update routing tables, i.e. they keep records of "which direction" various addresses lie in, but the situation is complicated by the fact that they practically can't record every single address (there are many of them and they change quickly) and also the routes on the Internet constantly change (some stop working, some get slow by higher traffic, new ones emerge etc.). **Forwarding** is related to routing, it is the process of moving data from the router's input to the correct output (while routing generally refers to the whole larger process of finding the whole path).
With network programs/systems we talk about **architectures** -- there are two main types: **client/server** and **peer to peer** (P2P). Client server means there is one special, central computer (with usually quite powerful hardware) called server that offers services to many clients (other computers in the network) -- clients connect to the server and ask the server to do something for them (e.g. send them a website, store some files to them, fetch emails and so on); in this model even if clients communicate between themselves they communicate through the server, i.e. the server is very stressed and it's a weak point of the system, but it can also possibly better control and coordinate what's going on (for example it can try to prevent [cheating](cheating.md) in games). Peer to peer architecture means that all participants are equal ("peers"): none of them is central, none of them has greater authority, they all run the same software and generally any of the peers can talk between themselves directly. Again, choice of architecture depends on our many things, we can't say one is inherently better than the other, but among freedom proponents P2P is usually favored for its anarchist, decentralized and more robust nature -- it is harder to censor or take down a P2P network.
TODO: subnetwork, sockets, reliability, addresses, ports, NAT, ...
## Code Examples
First let's try writing some **UDP** C program under [Unix](unix.md). Remember that UDP is the unreliable protocol, so it's possible our messages may get lost or distorted, but in programs that can handle some losses this is the faster and more KISS way. Our program will be peer-to-peer, it will create two sockets, one listening and one sending. It will make a few message exchange turns, in each turn it will send something to its partner, it will check if it itself got any message and then will wait for some time before the next round. Note that we will use a non-blocking receiving socket, i.e. checking if we have any messages won't pause our program if there is nothing to be received, we'll simply move on if there is nothing (that's how realtime games may do it, but other kinds of server may rather a use blocking socket if they intend to do nothing while waiting for a message). Also pay attention to the fact that the program will choose its port number based on a one letter "name" we give to the program -- this is so that if we test the programs on the same computer (where both will have the same IP address), they will choose different ports (different processes on the same computer cannot of course use the same port).
@ -149,4 +184,4 @@ B: That's enough, bye.
A: That's enough, bye.
```
TODO: TCP
TODO: TCP

View file

@ -72,6 +72,7 @@ There are many terms that are very similar and can many times be used interchang
- **[equality](equality.md)** vs **[identity](identity.md)** (in programming languages)
- **[floating point number](float.md)** vs **[real number](real_number.md)**
- **[font](font.md)** vs **[typeface](typeface.md)**
- **[forwarding](forwarding.md)** vs **[routing](routing.md)** vs **[switching](switching.md)**
- **[framework](framework.md)** vs **[library](library.md)**
- **[free software](free_software.md)** vs **[open source](open_source.md)** vs **[public domain](public_domain.md)** vs **[source available](source_available.md)** vs **[freeware](freeware.md)**
- **[geek](geek.md)** vs **[nerd](nerd.md)**

View file

@ -4,6 +4,8 @@ Operating System (OS) is usually a quite complex [program](program.md) that's ty
There is a nice [CC0](cc0.md) wiki for OS development at https://wiki.osdev.org/.
Examples of operating systems are [Unix](unix.md) (one of the first and most influential systems), [GNU](gnu.md) ([free software](free_software.md) clone of Unix), various [BSD](bsd.md) systems, [Windows](windows.md) (harmful parody of an operating system) or [Android](android.md) (another highly harmful software, this time for mobile platforms), [TempleOS](templeos.md) etc.
From programmer's point of view a serious OS is one of the most difficult pieces of software one can pursue to develop. The task involves an enormous amount of [low-level](low_level.md) programming, development of own tools from scratch and requires deep and detailed knowledge of all components of a computer, of established standards as well as many theoretical subjects such as [compiler](compiler.md) design.
**Which OS is the best?** Currently there seems to be almost no good operating system in existence, except perhaps for [Collapse OS](collapseod.md) and [Dusk OS](duskos.md) which may be the closest to [LRS](lrs.md) at the moment, but aren't widely used yet and don't have many programs running on them. Besides this there are quite a few relatively usable OSes, mostly [Unix](unix.md) like systems. For example [OpenBSD](openbsd.md) seems to be one of them, however it is [proprietary](proprietary.md) (yes, it contains some code without license) and too obsessed with MUH [SECURITY](security.md), and still a bit overcomplicated. [HyperbolaBSD](hyperbolabsd.md) at least tries to address the freedom issue of OpenBSD but suffers from many others. [Devuan](devuan.md) is pretty usable, [just werks](just_werks.md) and is alright in not being an absolute apeshit of consoomerist bloat. [FreeDOS](freedos.md) seemed nice too: though it's not Unix like, it is much more [KISS](kiss.md) than Unices, but it will probably only work on [x86](x86.md) systems.

View file

@ -19,6 +19,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **You can almost always trade space (memory usage) for time (CPU demand) and vice versa** and you can also fine-tune this. You typically gain speed by precomputation (look up tables, more demanding on memory) and memory with [compression](compression.md) (more demanding on CPU).
- **[Static](static.md) things are faster and smaller than [dynamic](dynamic.md) things.** This means that things that are somehow fixed/unchangeable are better in terms of performance (and usually also safer and better testable) than things that are allowed to change during [run time](runtime.md) -- for example calling a function directly (e.g. `myVar = myFunc();`) is both faster and requires fewer instructions than calling a function by pointer (e.g. `myVar = myFuncPointer();`): the latter is more flexible but for the price of performance, so if you don't need flexibility (dynamic behavior), use static behavior. This also applies to using [constants](constant.md) (faster/smaller) vs [variables](variable.md), static vs dynamic [typing](typing.md), normal vs dynamic [arrays](array.md) etc.
- **Be smart, use [math](math.md)**, for example simplify [expressions](expression.md) using known formulas, minimize [logic circuits](logic_circuit.md) etc. Example: let's say you want to compute the radius of a zero-centered [bounding sphere](bounding_sphere.md) of an *N*-point [point cloud](point_cloud.md). Naively you might be computing the Euclidean distance (*sqrt(x^2 + y^2 + z^2)*) to each point and taking a maximum of them, however you can just find the maximum of squared distances (*x^2 + y^2 + z^2*) and return a square root of that maximum. This saves you a computation of *N - 1* square roots.
- **Fancier algorithms will very often be slower than simpler ones, even if they are theoretically faster**, i.e. don't get too smart and first try the simple algorithm, greater complexity has to be justified. This was commented on e.g. by [Rob Pike](rob_pike.md) who said that "fancy algorithms are slow when n is small, and n is usually small", i.e. if you're sorting an array of 10 items, just use bubble sort, not quick sort etc.
- **Learn about [dynamic programming](dynamic_programming.md)**.
- **Avoid branches (ifs)** if you can (remember [ternary operators](ternary_operator.md), loop conditions etc. are branches as well). They break prediction in CPU pipelines and instruction preloading and are often source of great performance losses. Don't forget that you can many times compare and use the result of operations without using any branching (e.g. `x = (y == 5) + 1;` instead of `x = (y == 5) ? 2 : 1;`).
- **Use iteration instead of [recursion](recursion.md)** if possible (calling a function costs something).
@ -33,7 +34,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **Consider moving computation from run time to compile time**, see [preprocessor](preprocessor.md), [macros](macro.md) and [metaprogramming](metaprogramming.md). E.g. if you make a resolution of your game constant (as opposed to a variable), the compiler will be able to partially precompute expressions with the display dimensions and so speed up your program (but you won't be able to dynamically change resolution).
- On some platforms such as [ARM](arm.md) the first **arguments to a function may be passed via registers**, so it may be better to have fewer parameters in functions.
- **Passing arguments costs something**: passing a value to a function requires a push onto the stack and later its pop, so minimizing the number of parameters a function has, using global variables to pass arguments and doing things like passing structs by pointers rather than by value can help speed. { from *Game Programming Gurus* -drummyfish }
- **Optimize when you already have a working code**. As [Donald Knuth](knuth.md) put it: "premature optimization is the root of all evil". Nevertheless you should get used to simple nobrainer efficient patterns by default and just write them automatically. Also do one optimization at a time, don't try to put in more optimizations at once.
- **Optimize when you already have a working code** and when you can measure your optimizations. As [Donald Knuth](knuth.md) put it: "premature optimization is the root of all evil". Nevertheless you should get used to simple nobrainer efficient patterns by default and just write them automatically. Also do one optimization at a time, don't try to put in more optimizations at once.
- **Use your own [caches](cache.md) where they help**, for example if you're frequently working with some database item you better pull it to memory and work with it there, then write it back once you're done (as opposed to communicating with the DB there and back).
- **[Single compilation unit](single_compilation_unit.md) (one big program without [linking](linking.md)) can help compiler optimize better** because it can see the whole code at once, not just its parts. It will also make your program compile faster.
- Search literature for **algorithms with better [complexity class](complexity_class.md)** ([sorts](sorting.md) are a nice example).

View file

@ -120,7 +120,7 @@ Here is a table of notable programming languages in chronological order (keep in
| [Basic](basic.md) | kind of? | 1964 | | | | | mean both for beginners and professionals, probably efficient |
| [Forth](forth.md) | **yes** | 1970 | | | 100 (judg. by milliforth)| 1 | [stack](stack.md)-based, elegant, very KISS, interpreted and compiled |
| [Pascal](pascal.md) | **kind of** | 1970 | 5.26 (G)| 2.11 (G) | | 80, proprietary (ISO) | like "educational C", compiled, not so bad actually |
| **[C](c.md)** | **kind of** | 1972 | 1.0 | 1.0 | 20K (lcc) | 160, proprietary (ISO) | compiled, fastest, efficient, established, suckless, low-level, #1 lang.|
| **[C](c.md)** | **kind of** | 1972 | 1.0 | 1.0 | 10K? (judg. by chibicc) | 160, proprietary (ISO) | compiled, fastest, efficient, established, suckless, low-level, #1 lang.|
| [Prolog](prolog.md) | maybe? | 1972 | | | | | [logic](logic.md) paradigm, hard to learn/use |
|[Smalltalk](smalltalk.md)| **quite yes** | 1972 | 47 (G) | 41 (G) | | 40, proprietary (ANSI) | PURE (bearable kind of) [OOP](oop.md) language, pretty minimal |
| [C++](cpp.md) | no, bearable | 1982 | 1.18 (G)| 1.27 (G) | | 500, proprietary | bastard child of C, only adds [bloat](bloat.md) ([OOP](oop.md)), "games"|
@ -145,9 +145,11 @@ Here is a table of notable programming languages in chronological order (keep in
| [Go](go.md) | **kind of** | 2009 | 4.71 (G)| 5.20 (G) | | 130, proprietary? | "successor to C" but not well executed, bearable but rather avoid |
| [LIL](lil.md) | **yes** | 2010? | | | | | not known too much but nice, "everything's a string" |
| [uxntal](uxn.md) | **yes** but SJW | 2021 | | | 400 (official) | 2? (est.), proprietary | assembly lang. for a minimalist virtual machine, PROPRIETARY SPEC. |
| **[comun](comun.md)** | **yes** | 2022 | | | < 3K | 2, CC0 | "official" [LRS](lrs.md) language, WIP, similar to Forth |
| **[comun](comun.md)** | **yes** | 2022 | | | < 3K? | 2, CC0 | "official" [LRS](lrs.md) language, WIP, similar to Forth |
NOTE on performance data: the `speed`/`mem.` column says a benchmarked estimate running time/memory consumption of the best case (best compiler, best run, ...) relateive to C (i.e. "how many times the language is worse than C"). The data may come from various sources, for example the *[The Computer Language Benchmark Game](https://sschakraborty.github.io/benchmark/task-descriptions.html)* (G), own measurement (O) etc.
NOTE on implementation size: this is just very rough estimate based on the smallest implementation found, sometimes guessed and rounded to some near value (for example finding a small implementation whose main goal isn't small size we may conclude it could be written yet a bit smaller).
TODO: add "relative speed" column, make some kinda benchmark program and say how many times each languages is slower than C

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,10 @@
# "Rational"Wiki
"Rational"Wiki (https://rationalwiki.org/) is a [toxic](toxic.md) child [atheist](atheism.md) pseudorationalist/[pseudoskeptic](pseudoskepticism.md) [ultrafeminist](feminism.md) [ultragay](lgbt.md) [SJW](sjw.md) [wiki](wiki.md) website that specializes in attacking rational views on controversial topics on the [Internet](internet.md). It is recommended you delete this website from your bookmarks or it will probably give you brain cancer.
"Rational"Wiki (https://rationalwiki.org/) is a [toxic](toxic.md) child [atheist](atheism.md) pseudorationalist/[pseudoskeptic](pseudoskepticism.md) [ultrafeminist](feminism.md) [ultragay](lgbt.md) [SJW](sjw.md) far [pseudoleft](pseudoleft.md) [wiki](wiki.md) website that specializes in mental gymnastics and creating hysteria over rational views on controversial topics on the [Internet](internet.md). It is recommended you delete this website from your bookmarks or it will probably give you brain [cancer](cancer.md). The author of the wiki was inbred with a pig (this is not ad hominem because ad hominem can only be used on humans, but he is still probably a [homo](gay.md) sexual). { My apoligies to pigs. ~drummyfish }
Typically for a [pseudoleftist](pseudoleft.md) site, a tactic of using misleading names is widely used as one of the main means of operation, e.g. [racial realism](racial_realism.md) is called [racism](racism.md), politically inconvenient [science](science.md) is called [pseudoscience](pseudoscience.md) and, of course, [soyence](soyence.md) is promoted as the "only true unquestionable [science](science.md)". The name of the wiki itself seems to suggest it has something to do with [rationality](rationality.md), which is of course very misleading, if not a downright lie -- the purpose of the wiki seems to be solely promotion of modern harmful religion and cults such as [capitalism](capitalism.md) and [political correctness](political_correctness.md), while bashing anything slightly off the mainstream.
Typically for a [pseudoleftist](pseudoleft.md) fedora site, a tactic of using misleading names is widely used as one of the main means of operation, e.g. [racial realism](racial_realism.md) is called [racism](racism.md), politically inconvenient [science](science.md) is called [pseudoscience](pseudoscience.md) and, of course, [soyence](soyence.md) is promoted as the "only true unquestionable [science](science.md)". The name of the wiki itself seems to suggest it has something to do with [rationality](rationality.md), which is of course very misleading -- the purpose of the wiki seems to be solely promotion of [modern](modern.md) harmful religion and cults such as [capitalism](capitalism.md), [liberalism](liberalism.md) and [political correctness](political_correctness.md), while bashing anything slightly off the mainstream.
STAHP! it's not even worth talking about this cancer anymore because it's too radioactive, better go read some other article. Be safe and shield yourself from this toxic waste. Vandalize it and move on.
## See Also

View file

@ -84,7 +84,7 @@ Here is a complete **[C](c.md) example** that uses only [fixed point](fixed_poin
#include <stdio.h>
#include <math.h> // for simplicity we'll use float sin, cos from stdlib
#define U 1024 // fixed-point unit
#define U 1024 // fixed point unit
#define LEVEL_SIZE 16 // level resolution
#define SCREEN_W 100
#define SCREEN_H 31

View file

@ -1,6 +1,6 @@
# SSAO
Screen space ambient occlusion (SSAO) is a [screen space](screen_space.md) technique used in 3D [computer graphics](graphics.md) for **[approximating](approximation.md)** [ambient occlusion](ambient_occlusion.md) (basically "dim shadows in corners", which itself is an approximation of true [global illumination](global_illumination.md)) in a way that's easy and not so expensive to implement to run in [real time](real_time.md). The effect however looks ugly many times and is often criticized, see e.g. an excellent article at https://nothings.org/gamedev/ssao/.
Screen space ambient occlusion (SSAO) is a [screen space](screen_space.md) technique used in 3D [computer graphics](graphics.md) for **[approximating](approximation.md)** [ambient occlusion](ambient_occlusion.md) (basically "dim, very soft shadows in corners", which itself is an approximation of true [global illumination](global_illumination.md)) in a way that's easy and not so expensive to implement to run in [real time](real_time.md). The effect is overly used in video games but it very often looks extremely ugly and is often criticized, see e.g. an excellent article at https://nothings.org/gamedev/ssao/.
{ 2023 report: SSAO still sucks. ~drummyfish }

File diff suppressed because one or more lines are too long

View file

@ -3,9 +3,9 @@
This is an autogenerated article holding stats about this wiki.
- number of articles: 580
- number of commits: 817
- total size of all texts in bytes: 3906285
- total number of lines of article texts: 29646
- number of commits: 818
- total size of all texts in bytes: 3921659
- total number of lines of article texts: 29987
- number of script lines: 262
- occurences of the word "person": 7
- occurences of the word "nigger": 88
@ -35,60 +35,77 @@ longest articles:
top 50 5+ letter words:
- which (2233)
- there (1696)
- people (1482)
- example (1271)
- other (1213)
- number (1128)
- software (1078)
- about (1021)
- program (886)
- their (833)
- because (801)
- would (788)
- called (762)
- which (2240)
- there (1709)
- people (1488)
- example (1281)
- other (1214)
- number (1129)
- software (1080)
- about (1024)
- program (889)
- their (835)
- because (802)
- would (791)
- called (770)
- being (751)
- language (744)
- language (746)
- numbers (737)
- computer (732)
- something (713)
- things (712)
- simple (711)
- without (673)
- function (661)
- computer (733)
- something (717)
- things (716)
- simple (712)
- without (675)
- function (663)
- programming (657)
- these (626)
- however (623)
- different (623)
- these (631)
- however (626)
- different (626)
- world (586)
- should (569)
- should (571)
- system (567)
- games (559)
- doesn (551)
- point (548)
- society (543)
- games (561)
- doesn (555)
- point (550)
- society (544)
- though (521)
- while (518)
- drummyfish (510)
- while (519)
- drummyfish (511)
- memory (508)
- using (501)
- still (494)
- possible (491)
- course (484)
- using (502)
- still (495)
- possible (492)
- course (489)
- similar (485)
- simply (484)
- technology (483)
- similar (483)
- simply (482)
- https (457)
- https (458)
- really (443)
- value (442)
- always (440)
- really (438)
- always (441)
- extremely (430)
- actually (425)
latest changes:
```
Date: Sat Jun 8 16:41:14 2024 +0200
21st_century.md
copyleft.md
copyright.md
data_hoarding.md
drummyfish.md
exercises.md
history.md
main.md
oop.md
pedophilia.md
random_page.md
shortcut_thinking.md
soyence.md
trolling.md
wiki_pages.md
wiki_stats.md
Date: Fri Jun 7 16:46:05 2024 +0200
4chan.md
anarch.md
@ -111,23 +128,6 @@ Date: Fri Jun 7 16:46:05 2024 +0200
main.md
nigger.md
oop.md
pedophilia.md
phd.md
random_page.md
shortcut_thinking.md
soyence.md
trolling.md
wiki_pages.md
wiki_stats.md
woman.md
Date: Tue Jun 4 21:22:45 2024 +0200
21st_century.md
books.md
data_hoarding.md
dog.md
main.md
minimalism.md
privacy.md
```
most wanted pages:
@ -158,16 +158,16 @@ most popular and lonely pages:
- [lrs](lrs.md) (281)
- [capitalism](capitalism.md) (219)
- [c](c.md) (213)
- [bloat](bloat.md) (202)
- [bloat](bloat.md) (203)
- [free_software](free_software.md) (165)
- [game](game.md) (140)
- [suckless](suckless.md) (135)
- [proprietary](proprietary.md) (117)
- [computer](computer.md) (95)
- [kiss](kiss.md) (94)
- [modern](modern.md) (90)
- [modern](modern.md) (91)
- [linux](linux.md) (89)
- [minimalism](minimalism.md) (88)
- [linux](linux.md) (88)
- [gnu](gnu.md) (82)
- [programming](programming.md) (80)
- [free_culture](free_culture.md) (80)
@ -182,7 +182,7 @@ most popular and lonely pages:
- [bullshit](bullshit.md) (73)
- [programming_language](programming_language.md) (71)
- [art](art.md) (71)
- [shit](shit.md) (69)
- [shit](shit.md) (70)
- [float](float.md) (68)
- [chess](chess.md) (67)
- ...

View file

@ -2,6 +2,45 @@
Microsoft Windows is a series of malicious, [bloated](bloat.md) [proprietary](proprietary.md) "[operating systems](os.md)". AVOID THIS [SHIT](shit.md).
Windows has these advantages:
- none
Windows has these disadvantages (this is just a few things, we can't possibly aspire to recount them all):
- It's slow, huge, ugly and gigantically [bloated](bloat.md).
- It's [proprietary](proprietary.md), you have no control over it, it does whatever it wants.
- It spies on you.
- It has blatant backdoors, Microsoft can absolutely take over your computer whenever they want.
- It's paid and expensive.
- It needs to restart on updates, it won't let you reject updates, it will restart in the middle of your work and ruin it.
- It shows you ads.
- It crashes extremely often.
- It doesn't work.
- You can't customize it.
- It forces you to update to newer and shittier versions.
- It forces you to constantly buy new hardware else it stops working.
- It's made for absolute retards and only retards use it. It is designed by retards for retards.
- It's made by terrorists and murderers whom you support by using it.
- It takes forever to boot.
- It automatically installs stuff you don't want.
- 99% viruses will target you.
- You have to only have one brain cell to use it.
- It doesn't work on old (superior) computers.
- It's unusable for servers. It's also unusable for anything else.
- It shits on [Unix philosophy](unix_philosophy.md), it does everything EXACTLY the opposite way than it should be done. It pushes harmful concepts such as monolithic software, GUI for everything etc.
- It does poorly even in implementing its own philosophy, for example its GUI design is absolute crap cretinous retarded shit that was designed by a monkey, incoherent and unintuitive rushed piece of shit.
- It constantly downloads stuff from the Internet, eating up your bandwidth, stopping to work when Internet goes down.
- It's hostile to anything [free](free_software.md), for example it will nuke all other operating systems when installed.
- It has a shitty EULA that makes Micro$oft able to sue you for absolutely anything, it forbids studying the system, copying it, borrowing it, basically doing anything with it.
- It pushes [DRM](drm.md) and similar shit.
- It gives you [cancer](cancer.md).
- It's an absolutely laughable shitty [capitalist](capitalism.md) product that manipulates you, it shills Micro$oft's inferior software, for example if you want to install a web browser it will just push you to installing Micro$oft's harmful browser etc.
- It's inefficient, eats too much electricity, increases CO2, heat pollution, forces you to buy big harddrives, more expensive Internet connection etc.
- ...
Some people still decide to use it.
## Versions
TODO