Add some more shit

master
Miloslav Ciz 2 years ago
parent cf9b87dc08
commit a0e9a5e376

73
c.md

@ -54,4 +54,75 @@ You can replace `gcc` with other compilers (e.g. `clang`, `tcc`, `g++` etc.), th
- `-O3`: optimize for program speed, greatly speeds up your program (you can also use less aggressive `-O2` and `-O1`)
- `-Os`: optimize for smaller program size
- `-g`: include debug info, you want this so that debuggers can point to your source code
- `-std=c99`: use the C99 standard
- `-std=c99`: use the C99 standard
## Cheatsheet
It's pretty important you learn C, so here's a little cheat sheet for you.
**data types** (just some):
- **int**: signed integer, at least 16 bits (-32767 to 32767) but usually more
- **unsigned int**: unsigned integer, at least 16 bit (0 to 65535) but usually more
- **char**: smallest integer of at least 8 bits (1 byte, 256 values), besides others used for containing [ASCII](ascii.md) characters
- **unsigned char**: like char but unsigned (0 to 255)
- **float**: [floating point](float.md) number (usually 32 bit)
- **double**: like float but higher precision (usually 64 bit)
- **short**: smaller signed integer, at least 16 bits (32767 to 32767)
- **long**: bigger signed integer, at least 32 bits (-2147483647 to 2147483647)
- **pointer**: memory address (size depends on platform), always tied to a specific type, e.g. a pointer to integer: `*int`, pointer to double: `*double` etc.
- **array**: a sequence of values of some type, e.g. an array of 10 integers: `int[10]`
- **struct**: structure of values of different types, e.g. `struct myStruct { int myInt; chat myChar; }`
- note: header *stdint.h* contains fixed-width data types such as *uint32_t* etc.
- note: there is no **string**, a string is an array of *char*s which must end with a value 0 (string terminator)
- note: there is no real **bool** (actually it is in header *stdbool*), integers are used instead (0 = false, 1 = true)
**branching aka if-then-else**:
```
if (CONDITION)
{
// do something here
}
else // optional
{
// do something else here
}
```
**for loop** (repeat given number of times):
```
for (int i = 0; i < MAX; ++i)
{
// do something here, you can use i
}
```
**while loop** (repeat while CONDITION holds):
```
while (CONDITION)
{
// do something here
}
```
**do while loop** (same as *while* but CONDITION at the end):
```
do
{
// do something here
} while (CONDITION);
```
**function definition**:
```
RETURN_TYPE myFunction (TYPE1 param1, TYPE2, param2, ...)
{ // return type can be void
// do something here
}
```

@ -5,6 +5,7 @@ Here let be listed exercises for the readers of this wiki. You can allow yoursel
1. What's the difference between [free software](free_software.md) and [open source](open_source.md)?
2. Write a program in [C](c.md) that computes the value of [pi](pi.md) without using float/double and any libraries except for `stdio.h` and `stdint.h` -- you can only use built-in integer types and those from `stdint.h`. The program must compute pi as accurately as possible (at least 2 decimals) and write the value out as base 10 decimal.
3. Say we have an algorithm that finds all pairs of equal numbers in an array of numbers of length *N* and adds all of these (unordered) pairs to a set *S*. The algorithm is: `for i := 0 to N: for j := 0 to N: if numbers[i] == numbers[j]: add(S,set(i,j))`. How can we optimize the algorithm in terms of its execution speed (i.e. make it perform fewer operations)? How did the asymptotic time complexity ("big O") class change?
4. In computer graphics, what is the difference between ray casting, ray tracing and path tracing?
## Solutions
@ -77,4 +78,8 @@ for i := 0 to N:
add(S,set(i,j))
```
While the first algorithm performs N^2 comparisons, the new one only needs N - 1 + N - 2 + N - 3 + ... ~= N * N / 2 = N^2 / 2 comparisons. Even though the new version is always twice as fast, its time complexity class remains the same, that is O(N^2).
While the first algorithm performs N^2 comparisons, the new one only needs N - 1 + N - 2 + N - 3 + ... ~= N * N / 2 = N^2 / 2 comparisons. Even though the new version is always twice as fast, its time complexity class remains the same, that is O(N^2).
**solution 4**:
They are all image-order methods of 3D [rendering](rendering.md). [Ray casting](ray_casting.md) casts a single ray for each screen pixel and determines the pixel color from a single hit of the ray. [Ray tracing](ray_tracing.md) is a [recursive](recursion.md) form of ray casting -- it recursively spawns secondary rays from the first hit to more accurately determine the pixel color, allowing for effects such as shadows, reflections or refractions. Path tracing is a method also based on casting rays, but except for the primary rays the rays are cast at random (i.e. it is a [Monte Carlo](monte_carlo.md) method) to approximately solve the rendering equation, progressively computing a more accurate version of the image (i.e. the image contains significant noise at the beginning which lowers with more iterations performed) -- this allows computing [global illumination](global_illumination.md), i.e. a very realistic lighting that the two previous methods can't achieve.

@ -0,0 +1,3 @@
# Femoid
See [woman](woman.md).

@ -0,0 +1,3 @@
# FLOSS
FLOSS is basically [FOSS](foss.md).

@ -0,0 +1,3 @@
# FOSS
FOSS ([Free](free_software.md) and [Open Source](open_source.md) Software, sometimes also [FLOSS](floss.md), adding *Libre*), is a kind of neutral term for software that is both free as in freedom and open source. It's just another term for this kind of software, as if there weren't enough of them :) People normally use this to stay neutral, to appeal to both free and open source camps or if they simply need a short term not requiring much typing.

@ -0,0 +1,3 @@
# Hardware
The article is [here](hw.md)!

@ -0,0 +1,3 @@
# Hardware
Hardware (HW), as opposed to [software](sw.md), are the physical parts of a [computer](computer.md), i.e. the circuits, the mouse, keyboard, the printer etc.

@ -1,6 +1,8 @@
# John Carmack
John Carmack is a brilliant legendary programmer that's contributed mostly to [computer graphics](graphics.md) and stands behind engines of such [game](game.md)s as [Doom](doom.md), [Wolfenstein](wolf3D.md) and [Quake](quake.md). He helped pioneer real-time 3D graphics, created many hacks and [algorithm](algorithm.md)s (e.g. the reverse shadow volume algorithm). He is also a rocket engineer.
John Carmack is a brilliant legendary programmer that's contributed mostly to [computer graphics](graphics.md) and stands behind engines of such [game](game.md)s as [Doom](doom.md), [Wolfenstein](wolf3D.md) and [Quake](quake.md). He helped pioneer real-time 3D graphics, created many hacks and [algorithm](algorithm.md)s (e.g. the reverse shadow volume algorithm). He is also a rocket [engineer](engineer.md).
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 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.

@ -18,7 +18,7 @@ This is not a trivial question, firstly because the term *public domain* is not
Corporations and [capitalism](capitalism.md) are highly hostile towards public domain and try to destroy it, make it effectively non-existing, as to eliminate "free" works competing with the consumerist creations of the industry. Over many years they have pushes towards creating laws that make it extremely difficult and rare for works to fall into public domain.
Sadly due to these shitty laws most works created in latest decades are NOT in the public domain because of the [copyright](copyright.md) [cancer](cancer.md): copyright is granted automatically, without any registration or fee, to the author of any shitty artistic creation, and its term lasts mostly for **the whole life of the author plus 70 year!** In some countries this is life + 100 years. In the US, copyright lasts 96 years from the publication of the work (every January 1st there is so called public domain day celebrating new works entering the US public domain). In some countries it is not even possible to legally waive (give up) one's copyright. And to make matters worse, copyright isn't the only possible restriction of an intellectual work, there are also [patents](patent.md), [trademarks](trademark.md) and other kinds of [intellectual property](intellectual_property.md).
Sadly due to these shitty laws most works created in latest decades are NOT in the public domain because of the [copyright](copyright.md) [cancer](cancer.md): copyright is granted automatically, without any registration or fee, to the author of any shitty artistic creation, and its term lasts mostly for **the whole life of the author plus 70 years!** In some countries this is life + 100 years. In the US, copyright lasts 96 years from the publication of the work (every January 1st there is so called public domain day celebrating new works entering the US public domain). In some countries it is not even possible to legally waive (give up) one's copyright. And to make matters worse, copyright isn't the only possible restriction of an intellectual work, there are also [patents](patent.md), [trademarks](trademark.md) and other kinds of [intellectual property](intellectual_property.md).
Another bad news is that works in a **"weak" public domain**, i.e. most recent PD works or works that entered PD by some obscure little law, may as well stop being PD by introducing some shitty retroactive law (which has happened). So one may not be feeling completely safe going crazy by utilizing some recent PD works.

@ -1,3 +1,5 @@
# Web
You dumbass! The article is actually [here](www.md).
*Ouch, this is embarrassing!*
The article is actually [here](www.md).

@ -1,5 +1,5 @@
# YouTube
YouTube, or JewTube, is a video propaganda website, since 2006 owned by [Google](google.md). It has become the monopoly "video platform", everyone uploads their videos there and so every one of us is forced to use the site from time to time.
YouTube, or JewTube, is a video propaganda website, since 2006 owned by [Google](google.md). It has become the monopoly "video platform", everyone uploads their videos there and so every one of us is forced to use the site from time to time. YouTube is based on video content consumerism and financed from aggressive ads and surveillance of its users.
YouTube is based on video content consumerism and financed from aggressive ads and surveillance of its users.
A [FOSS](foss.md) alternative to YouTube is e.g. [PeerTube](peertube.md), a federated video platform, however for intended use it requres [JavaScript](javascript.md). There also exist alternative YouTube [frontends](frontend.md) (normally also FOSS), e.g. HookTube, Invidious or FreeTube -- these let you access YouTube's videos via less [bloated](bloat.md) and more privacy-friendly interface. More hardcore people use [CLI](cli.md) tools such as [youtube-dl](youtube_dl.md) to directy download the videos and watch them in native players.
Loading…
Cancel
Save