diff --git a/21st_century.md b/21st_century.md new file mode 100644 index 0000000..ca24575 --- /dev/null +++ b/21st_century.md @@ -0,0 +1,3 @@ +# 21st Century + +21st century, known as the Age Of [Shit](shit.md), is already one of the worst centuries in history despite only being around shortly. \ No newline at end of file diff --git a/3d_rendering.md b/3d_rendering.md new file mode 100644 index 0000000..dfb93ba --- /dev/null +++ b/3d_rendering.md @@ -0,0 +1,85 @@ +# 3D Rendering + +In [computer graphics](graphics.md) 3D rendering is concerned with computing images that represent a projected view of 3D objects through a virtual camera. + +There are many methods and [algorithms](algorithm.md) for doing so differing in many aspects such as computation complexity, implementation complexity, realism of the result, representation of the 3D data, limitations of viewing and so on. If you are just interested in the [realtime](realtime.md) 3D rendering used in [gaymes](game.md) nowadays, you are probably interested in [GPU](gpu.md)-accelerated 3D [rasterization](rasterization.md) with [APIs](api.md) such as [OpenGL](opengl.md) and [Vulkan](vulkan.md). + +[LRS](lrs.md) has a 3D rendering library called [small3dlib](small3dlib.md). + +## Methods + +A table of some common 3D rendering methods follows, including the most simple, most advanced and some unconventional ones. Note that here we talk about methods and techniques rather than algorithms, i.e. general approaches that are often modified and combined into a specific rendering algorithm. For example the traditional triangle rasterization is sometimes combined with raytracing to add e.g. realistic reflections. The methods may also be further enriched with features such as [texturing](texture.md), [antialiasing](antialiasing.md) and so on. The table below should help you choose the base 3D rendering method for your specific program. + +The methods may be tagged with the following: + +- *2.5D*: primitive 3D, often called [pseudo 3D](pseudo_3d.md) or fake 3D, having significant limitations e.g. in degrees of freedom of the camera +- *off*: slow method usually used for offline (non-realtime) rendering (even though they indeed may run in real time e.g. with the help of powerful GPUs) +- *IO* vs *OO*: [image order](image_order.md) (rendering by pixels) vs [object order](object_order.md) (rendering by objects) + +| method | notes | +|------------------------------------------|------------------------------------| +|[3D raycasting](raycasting.md) |*IO off*, shoots rays from camera | +|[2D raycasting](raycasting.md) |*IO 2.5D*, e.g. [Wolf3D](wolf3D.md) | +|[beamtracing](beamtracing.md) |*IO off* | +|[billboarding](billboard.md) |*OO* | +|[BSP rendering](bsp.md) |*2.5D*, e.g. [Doom](doom.md) | +|[conetracing](conetracing.md) |*IO off* | +|"[dungeon crawler](dungeon_crawler.md)" |*OO 2.5D*, e.g. Eye of the Beholder | +|ellipsoid rasterization |*OO*, e.g. Ecstatica | +|flat-shaded 1 point perspective |*OO 2.5D*, e.g. Skyroads | +|reverse raytracing (photon tracing) |*OO off*, inefficient | +|[image based rendering](ibr.md) |generating inbetween views | +|[mode 7](mode7.md) |*IO 2.5D*, e.g. F-Zero | +|[parallax scrolling](parallax.md) |*2.5D*, very primitive | +|[pathtracing](pathtracing.md) |*IO off*, Monte Carlo, high realism | +|[portal rendering](portal_rendering.md) |*2.5D*, e.g. [Duke3D](duke3d.md) | +|prerendered view angles |*2.5D*, e.g. Iridion II (GBA) | +|[raymarching](raymaching.md) |*IO off*, e.g. with [SDFs](sdf.md) | +|[raytracing](raytracing.md) |*IO off*, recursive 3D raycasting | +|segmented road |*OO 2.5D*, e.g. Outrun | +|[shear warp rednering](shear_warp.md) |*IO*, volumetric | +|[splatting](splatting.md) |*OO*, rendering with 2D blobs | +|[triangle rasterization](rasterization.md)|*OO*, traditional in GPUs | +|[voxel space rendering](voxel_space.md) |*OO 2.5D*, e.g. Comanche | +|[wireframe rendering](wireframe.md) |*OO*, just lines | + +TODO: Rescue On Fractalus! + +TODO: find out how build engine/slab6 voxel rendering worked and possibly add it here (from http://advsys.net/ken/voxlap.htm seems to be based on raycasting) + +TODO: VoxelQuest has some innovative voxel rendering, check it out (https://www.voxelquest.com/news/how-does-voxel-quest-work-now-august-2015-update) + +## Mainstream Realtime 3D + +You may have come here just to learn about the typical realtime 3D rendering used in today's [games](game.md) because aside from research and niche areas this kind of 3D is what we normally deal with in practice. This is what this section is about. + +Nowadays this kind of 3D stands for a [GPU](gpu.md) accelerated 3D [rasterization](rasterization.md) done with rendering [APIs](api.md) such as [OpenGL](opengl.md), [Vulkan](vulkan.md), [Direct3D](d3d.md) or [Metal](metal.md) (the last two being [proprietary](proprietary.md) and therefore [shit](shit.md)) and higher level engines above them, e.g. [Godot](godot.md), [OpenSceneGraph](osg.md) etc. The methods seem to be evolving to some kind of rasterization/[pathtracing](pathtracing.md) hybrid, but rasterization is still the basis. + +This mainstream rendering uses an [object order](object_order.md) approach (it blits 3D objects onto the screen rather than determining each pixel's color separately) and works on the principle of **triangle rasterization**, i.e. 3D models are composed of triangles (or higher polygons which are however eventually broken down into triangles) and these triangles are projected onto the screen according to the position of the virtual camera and laws of [perspective](perspective.md). Projecting the triangles means finding the 2D screen coordinates of each of the triangle's three vertices -- once we have thee coordinates, we draw (rasterize) the triangle to the screen just as a "normal" 2D triangle (well, with some asterisks). + +Furthermore things such as [z-buffering](z_buffer.md) (for determining correct overlap of triangles) and [double buffering](double_buffering.md) are used, which makes this approach very memory ([RAM](ram.md)/[VRAM](vram.md)) expensive -- of course mainstream computers have more than enough memory but smaller computers (e.g. [embedded](embedded.md)) may suffer and be unable to handle this kind of rendering. Thankfully it is possible to adapt and imitate this kind of rendering even on "small" computers -- even those that don't have a GPU, i.e. with pure [software rendering](sw_rendering.md). For this we e.g. replace z-buffering with [painter's algorithm](painters_algorithm.md) (triangle sorting), drop features like [perspective correction](perspective_correction.md), [MIP mapping](mip_mapping.md) etc. (of course quality of the output will go down). + +Also additionally there's a lot of [bloat](bloat.md) added in such as complex [screen space](screen_space.md) shaders, [pathtracing](pathtracing.md) (popularly known as *raytracing*), [megatexturing](megatexturing.md), [shadow rendering](shadow.md), [postprocessing](postprocessing.md), [compute shaders](compute_shader.md) etc. This may make it difficult to get into "modern" 3D rendering. Remember to [keep it simple](kiss.md). + +On PCs the whole rendering process is hardware-accelerated with a [GPU](gpu.md) (graphics card). GPU is a special hardware capable of performing many operations in [parallel](parallelism.md) (as opposed to a [CPU](cpu.md) which mostly computes sequentially with low level of parallelism) -- this is great for graphics because we can for example perform mapping and drawing of many triangles at once, greatly increasing the speed of rendering ([FPS](fps.md)). However this hugely increases the [complexity](complexity.md) of the whole rendering system, we have to have a special [API](api.md) and [drivers](driver.md) for communication with the GPU and we have to upload data (3D models, textures, ...) to the GPU before we want to render them. [Debugging](debugging.md) gets a lot more difficult. + +GPU nowadays are kind of general devices that can be used for more than just 3D rendering (e.g. [crypto](crypto.md) mining) and can no longer perform 3D rendering by themselves -- for this they have to be programmed. I.e. if we want to use a GPU for rendering, not only do we need a GPU but also some extra code. This code is provided by "systems" such as [OpenGL](opengl.md) or [Vulkan](vulkan.md) which consist of an [API](api.md) (an [interface](interface.md) we use from a [programming language](programming_language.md)) and the underlying implementation in a form of a [driver](driver.md) (e.g. [Mesa3D](mesa3d.md)). Any such rendering system has its own architecture and details of how it works, so we have to study it a bit if we want to use it. + +The important part of a system such as OpenGL is its **rendering [pipeline](pipeline.md)**. Pipeline is the "path" through which data go through the rendering process. Each rendering system and even potentially each of its version may have a slightly different pipeline (but generally all mainstream pipelines somehow achieve rasterizing triangles, the difference is in details of how they achieve it). The pipeline consists of **stages** that follow one after another (e.g. the mentioned mapping of vertices and drawing of triangles constitute separate stages). A very important fact is that some (not all) of these stages are programmable with so called **[shaders](shader.md)**. A shader is a program written in a special language (e.g. [GLSL](glsl.md) for OpenGL) running on the GPU that processes the data in some stage of the pipeline (therefore we distinguish different types of shaders based on at which part of the pipeline they reside). In early GPUs stages were not programmable but they became so as to give a greater flexibility -- shaders allow us to implement all kinds of effects that would otherwise be impossible. + +Let's see what a typical pipeline might look like, similarly to something we might see e.g. in OpenGL. We normally simulate such a pipeline also in [software renderers](sw_rendering.md). Note that the details such as the coordinate system [handedness](handedness.md) and presence, order, naming or programmability of different stages will differ in any particular pipeline, this is just one possible scenario: + +1. Vertex data (e.g. 3D [model space](model_space.md) coordinates of triangle vertices of a 3D model) are taken from a vertex buffer (a GPU memory to which the data have been uploaded). +2. **Stage: [vertex shader](vertex_shader.md)**: Each vertex is processed with a vertex shader, i.e. one vertex goes into the shader and one vertex (processed) goes out. Here the shader typically maps the vertex 3D coordinates to the screen 2D coordinates (or [normalized device coordinates](ndc.md)) by: + - multiplying the vertex by a [model matrix](model_matrix.md) (transforms from [model space](model_space.md) to [world space](world_space.md), i.e. applies the model move/rotate/scale operations) + - multiplying by [view matrix](view_matrix.md) (transforms from [world space](world_space.md) to [camera space](camera_space.md), i.e. takes into account camera position and rotation) + - multiplying by [projection matrix](projection_matrix.md) (applies perspective, transforms from [camera space](camera_space.md) to [screen space](screen_space.md) in [homogeneous coordinates](homogeneous_coordinates.md)) +3. Possible optional stages that follow are [tessellation](tessellation.md) and geometry processing ([tessellation shaders](tessellation_shader.md) and [geometry shader](geometry_shader.md)). These offer possibility of advanced vertex processing (e.g. generation of extra vertices which vertex shaders are unable to do). +4. **Stage: vertex post processing**: Usually not programmable (no shaders here). Here the GPU does things such as [clipping](clipping.md) (handling vertices outside the screen space), primitive assembly and [perspective divide](perspective_divide.md) (transforming from [homogeneous coordinates](homogeneous coordinates.md) to traditional [cartesian coordinates](cartesian_coordinates.md)). +5. **Stage: [rasterization](rasterization.md)**: Usually not programmable, the GPU here turns triangles into actual [pixels](pixel.md) (or [fragments](fragment.md)), possibly applying [backface culling](backface_culling.md), [perspective correction](perspective_correction.md) and things like [stencil test](stencil_test.md) and [depth test](dept_test.md) (even though if fragment shaders are allowed to modify depth, this may be postpones to later). +6. **Stage: pixel/fragment processing**: Each pixel (fragment) produced by rasterization is processed here by a [pixel/fragment shader](fragment_shader.md). The shader is passed the pixel/fragment along with its coordinates, depth and possibly other attributes, and outputs a processed pixel/fragment with a specific color. Typically here we perform [shading](shading.md) and [texturing](texture.md) (pixel/fragment shaders can access texture data which are again stored in texture buffers on the GPU). +7. Now the pixels are written to the output buffer which will be shown on screen. This can potentially be preceded by other operations such as depth tests, as mentioned above. + + + +TODO: example of specific data going through the pipeline \ No newline at end of file diff --git a/42.md b/42.md new file mode 100644 index 0000000..4bc9932 --- /dev/null +++ b/42.md @@ -0,0 +1,5 @@ +# 42 + +42 is an even integer with prime factorization of 2 * 3 * 7. This number was made kind of famous (and later overused in pop culture to the point of completely destroying the joke) by Douglas Adams' book The Hitchhiker's Guide to the Galaxy in which it appears as the answer to the ultimate question of life, the Universe and everything (the point of the joke was that this number was the ultimate answer computed by a giant supercomputer over millions of years, but it was ultimately useless as no one knew the question to which this number was the answer). + +If you make a 42 reference in front of a TBBT fan, he will shit himself. \ No newline at end of file diff --git a/4chan.md b/4chan.md new file mode 100644 index 0000000..0a3b610 --- /dev/null +++ b/4chan.md @@ -0,0 +1,7 @@ +# 4chan + +4chan (https://4chan.org/) is the most famous [image board](image_board.md) and a place where a lot of [memes](meme.md) come to existence. As most image boards, 4chan has a nice, oldschool minimalist look, even though it contains shitty captchas for posting and the site's code is [proprietary](proprietary.md). The site tolerates a great amount of [free speech](free_speech.md) up to the point of being regularly labeled "right-wing extremist site" (although bans for stupid reasons are very common, speaking from experience). + +For us the most important part of 4chan is the technology board known as /g/ (for technoloGEE). Browsing /g/ can bring all kinds of emotion, it's a place of relative freedom and somewhat beautiful chaos where all people from absolute retards to geniuses argue about important and unimportant things, brands, tech news and memes, and constantly advise each other to kill themselves. Sometimes the place is pretty toxic and not good for mental health. + +2022 update: abandon ship, /g is officially unusable, a bunch of capitalist children arguing about brands, [productivity cult](productivity_cult.md), crypto, consumerism, "open soars", no trace of [free software](free_software.md). Not worth it anymore. You can still read very old thread on archives such as https://desuarchive.org/g/page/280004/. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff69470 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Less Retarded Wiki + +This is online at https://www.tastyfish.cz/lrs/main.html. + +Wiki about less retarded software and related topics. + +By contributing you agree to release your contribution under CC0 1.0, public domain (https://creativecommons.org/publicdomain/zero/1.0/). Please do **not** add anything copyrighted to this Wiki (such as copy pasted texts from elsewhere, images etc.). + +Start reading at the [main page](main.md). diff --git a/acronym.md b/acronym.md new file mode 100644 index 0000000..c9632f8 --- /dev/null +++ b/acronym.md @@ -0,0 +1,362 @@ +# Acronym + +Acronym is an abbreviation of a multiple word term by usually appending the starting letters of each word to form a new word. + +Here is a list of some acronyms: + +- **[AA](aa.md)** (anti [aliasing](aliasing.md)) +- **[AC](ac.md)** (alternating current, air conditioning) +- **[ACID](acid.md)** (atomicity consistency isolation durability) +- **[ACK](ack.md)** (acknowledgement) +- **[ADSL](adsl.md)** (asymmetric digital subscriber line) +- **[AF](af.md)** (as fuck) +- **[AFAIK](afaik.md)** (as far as I know) +- **[AJAX](ajax.md)** (asynchronous [JavaScript](js.md) and [XML](xml.md)) +- **[AFK](afk.md)** (away from keyboard) +- **[ALU](alu.md)** (arithmetic logic unit) +- **[AM](am.md)** (amplitude modulation) +- **[ANCAP](ancap.md)** (anarcho capitalist) +- **[ANPAC](anpac.md)** (anarcho pacifist) +- **[ANSI](ansi.md)** (american national standards institute) +- **[AO](ao.md)** (ambient occlusion) +- **[API](api.md)** (application programming interface) +- **[ARM](arm.md)** (advanced [RISC](risc.md) machines) +- **[ARPANET](arpanet.md)** (advanced research projects agency network) +- **[ASAP](asap.md)** (as soon as possible) +- **[ASCII](ascii.md)** (American standard code for information interchange) +- **[ASM](asm.md)** (assembly) +- **[ATM](atm.md)** (at the moment, automated teller machine) +- **[B](b.md)** (byte, bit) +- **[B4](b4.md)** (before) +- **[BASH](bash.md)** (bourne again shell) +- **[BASIC](basic.md)** (beginner all purpose symbolic instruction code) +- **[BBS](bbs.md)** (bulletin board system) +- **[BC](bc.md)** (bytecode) +- **[BCD](bcd.md)** (binary coded decimal) +- **[BDFL](bdfl.md)** (benevolent dictator for life) +- **[BF](bf.md)** (brainfuck) +- **[BG](bg.md)** (background, bad game) +- **[BGR](bgr.md)** (blue green red) +- **[BIOS](bios.md)** (basic [input/output](io.md) system) +- **[BJ](bj.md)** (blow job) +- **[BJT](bjt.md)** (bipolar junction transistor) +- **[BS](bs.md)** (bullshit) +- **[BTFO](btfo.md)** (blown the fuck out) +- **[CAD](cad.md)** (computer aided design) +- **[CAPTCHA](captcha.md)** (completely automated public Turing test to tell computers and humans apart) +- **[CC](cc.md)** (creative commons) +- **[CC0](cc0.md)** (creative commons zero) +- **[CD](cd.md)** (compact disc, change directory) +- **[CEO](ceo.md)** (chief executive officer) +- **[CGI](cgi.md)** (computer generated imagery) +- **[CISC](cisc.md)** (complex instruction set computer) +- **[CLI](cli.md)** (command line interface) +- **[CMOS](cmos.md)** (complementary metal oxide semiconductor) +- **[CMS](cms.md)** (content management system) +- **[CMYK](cmyk.md)** (cyan magenta yellow key) +- **[COMPSCI](compsci.md)** (computer science) +- **[CP](cp.md)** (child porn, copy) +- **[CPU](cpu.md)** (central processing unit) +- **[CRC](crc.md)** (cyclic redundancy check) +- **[CRT](crt.md)** (cathode ray tube) +- **[CSG](csg.md)** (constructive solid geometry) +- **[CSS](css.md)** (cascading style sheet) +- **[CSV](csv.md)** (comma separated values) +- **[DAC](dac.md)** (digital analog converter) +- **[DB](db.md)** (database) +- **[DC](dc.md)** (direct current) +- **[DDOS](ddos.md)** (distributed denial of service) +- **[DDR](ddr.md)** (double data rate) +- **[DE](de.md)** (desktop environment) +- **[DHCP](dhcp.md)** (dynamic host configuration protocol) +- **[DL](dl.md)** (download) +- **[DMA](dma.md)** (direct memory access) +- **[DMCA](dmca.md)** (digital millennium copyright act) +- **[DND](dnd.md)** (dungeons & dragons, do not disturb) +- **[DNS](dns.md)** (domain name system) +- **[DOM](dom.md)** (document object model) +- **[DOS](dos.md)** (disk operating system, denial of service) +- **[DPI](dpi.md)** (dots per inch) +- **[DRAM](dram.md)** (dynamic RAM) +- **[DRM](drm.md)** (digital restrictions management) +- **[DRY](dry.md)** (don't repeat yourself) +- **[DVD](dvd.md)** (digital versatile disc) +- **[EEPROM](eeprom.md)** (electronically erasable programmable ROM) +- **[ELF](elf.md)** (executable and linkable format) +- **[EMCAS](emacs.md)** (editor macros) +- **[ENIAC](eniac.md)** (electronic numerical integrator and computer) +- **[EOF](eof.md)** (end of [file](file.md)) +- **[EOL](eol.md)** (end of line, end of life) +- **[ESR](esr.md)** (Erik Steven Raymond) +- **[EULA](eula.md)** (end user license agreement) +- **[FAQ](faq.md)** (frequently asked questions) +- **[FE](fe.md)** (frontend) +- **[FET](fet.md)** (field effect transistor) +- **[FFS](ffs.md)** (for fuck's sake) +- **[FIFO](fifo.md)** (first in first out) +- **[FLAC](flac.md)** (free lossless audio codec) +- **[FLOSS](floss.md)** (free libre open source software) +- **[FM](fm.md)** (frequency modulation) +- **[FML](fml.md)** (fuck my life) +- **[FORTRAN](fortran.md)** (formula translation) +- **[FOSS](foss.md)** (free and open source software) +- **[FSF](fsf.md)** ([free software](free_software.md) foundation) +- **[FP](fp.md)** ([floating point](float.md)) +- **[FPGA](fpga.md)** (field programmable gate array) +- **[FPS](fps.md)** (frames per second, first person shooter) +- **[FQA](fqa.md)** (frequently questioned answers) +- **[FS](fs.md)** (file system) +- **[FTP](ftp.md)** (file transfer protocol) +- **[FU](fu.md)** (fuck you) +- **[FXAA](fxaa.md)** (full screen anti aliasing) +- **[FYI](fyi.md)** (for your information) +- **[GB](gb.md)** ([gigabyte/gigabit](memory_unit.md), GameBoy) +- **[GBPS](gbps.md)** (GB per second) +- **[GCC](gcc.md)** (GNU compiler collection) +- **[GDB](gdb.md)** (GNU debugger) +- **[GI](gi.md)** (global illumination) +- **[GIB](gib.md)** (gibibyte) +- **[GIF](gif.md)** (graphics interchange format) +- **[GIGO](gigo.md)** (garbage in garbage out) +- **[GIMP](gimp.md)** (GNU image manipulation program) +- **[GLUT](glut.md)** (OpenGL utility toolkit) +- **[GNOME](gnome.md)** (GNU network object model environment) +- **[GNU](gnu.md)** (GNU's Not Unix) +- **[GPG](gpg.md)** (GNU privacy guard) +- **[GPGPU](gpgpu.md)** (general purpose GPU) +- **[GPL](gpl.md)** (GNU General Public License) +- **[GPLv2](gpl.md)** (GPL version 2) +- **[GPLv3](gpl.md)** (GPL version 3) +- **[GPS](gps.md)** (global positioning system) +- **[GPU](gpl.md)** (graphics processing unit) +- **[GRUB](grub.md)** (grand unified boot loader) +- **[GSM](gsm.md)** (global system for mobile communication) +- **[GTK+](gtk_plus.md)** (GIMP toolking) +- **[GUI](gui.md)** (graphical user interface) +- **[H8](hate.md)** (hate) +- **[HD](hd.md)** (high definition) +- **[HDD](hdd.md)** (hard disc drive) +- **[HDMI](hdmi.md)** (HD multimedia interface) +- **[HW](hw.md)** (hardware) +- **[HTML](html.md)** ([hypertext](hypertext.md) markup language) +- **[HTTP](http.md)** (hypertext transfer protocol) +- **[HTTPS](https.md)** (HTTP secure) +- **[HURD](hurd.md)** (hird of unix replacing demons) +- **[HQ](hq.md)** (high quality) +- **[HZ](hz.md)** (hertz) +- **[IANA](iana.md)** (internet assigned number authority) +- **[IANAL](ianal.md)** (I am not a lawyer) +- **[ICMP](icmp.md)** (internet control message protocol) +- **[IDC](idc.md)** (I don't care) +- **[IDE](ide.md)** (integrated development environment) +- **[IEEE](ieee.md)** (institute for electrical and electronic +- **[IM](im.md)** (instant messaging) +- **[IMAP](imap.md)** (internet message access protocol) +- **[IMHO](imho.md)** (in my honest opinion) +- **[IMO](imo.md)** (in my opinion) +- **[INB4](inb4.md)** (in before) +- **[IO](io.md)** (input/output) +- **[IOT](iot.md)** (internet of things) +- **[IPS](ips.md)** (instructions per second) +- **[IP](ip.md)** (internet protocol, intellectual property) +- **[IPV4](ipv4.md)** (IP version 4) +- **[IPV6](ipv6.md)** (IP version 6) +- **[IRC](irc.md)** (internet relay chat) +- **[IRL](irl.md)** (in real life) +- **[ISA](isa.md)** (instruction set architecture) +- **[ISO](iso.md)** (international organization for standardization) +- **[ISP](isp.md)** (internet service provider) +- **[ISS](iss.md)** (international space station) +- **[IS](is.md)** (information system) +- **[IT](it.md)** (information technology) +- **[J2ME](j2me.md)** (java 2 micro edition) +- **[JB](jb.md)** ([jailbait](jailbait.md)) +- **[JDK](jdk.md)** (java development kit) +- **[JIT](jit.md)** (just in time) +- **[JK](jk.md)** (just kidding) +- **[JPEG/JPG](jpg.md)** (joint photographic expert group) +- **[JS](js.md)** (JavaScript) +- **[JSON](json.md)** (JavaScript object notation) +- **[K&R](k_and_r.md)** (Kernighan and Ritchie) +- **[KB](kb.md)** ([kilobyte/kilobit](memory_unit.md)) +- **[KBPS](kbps.md)** (KB per second) +- **[KDE](kde.md)** (K desktop environment) +- **[KEK](kek.md)** (a meme version of [LOL](lol.md) coming from World Of Warcraft) +- **[KHZ](khz.md)** (kilohertz) +- **[KIB](kib.md)** (kibibyte) +- **[KILL](kill.md)** (keep it [Linux](linux.md) loser) +- **[KISS](kiss.md)** (keep it simple stupid) +- **[KLOC](kloc.md)** (kilo LOC) +- **[KKK](kkk.md)** (ku klux klan) +- **[KYS](kys.md)** ([kill yourself](suicide.md)) +- **[LAMP](lamp.md)** (linux apache mysql php) +- **[LAN](lan.md)** (local area network) +- **[LCD](lcd.md)** (liquid crystal display) +- **[LED](led.md)** (light emitting diode) +- **[LGBT](lgbt.md)** (lesbian gay bisexual trans) +- **[LGBTQ](lgbt.md)** (lesbian gay bisexual trans queer) +- **[LGPL](lgpl.md)** (lesser GPL) +- **[LIFO](lifo.md)** (last in first out) +- **[LISP](lisp.md)** (list processing) +- **[LMAO](lmao.md)** (laughing my ass off) +- **[LOC](loc.md)** (lines of code) +- **[LOL](lol.md)** (laughing out loud) +- **[LQ](lq.md)** (low quality) +- **[LRS](lrs.md)** (less retarded software) +- **[LSB](lsb.md)** (least significant bit) +- **[LUT](lut.md)** (lookup table) +- **[MBR](mbr.md)** (master boot record) +- **[MHZ](mhz.md)** (megahertz) +- **[MIB](mib.md)** (mebibyte) +- **[MIME](mime.md)** (multipurpose internet mail extension) +- **[MIP](mip.md)** (multum in parvo) +- **[MIPS](mips.md)** (millions of instructions per second) +- **[MBPS](mpbs.md)** (MB per second) +- **[MCU](mcu.md)** (microcontroller unit) +- **[MD](md.md)** (markdown) +- **[MFW](mfw.md)** (my face when) +- **[MMO](mmo.md)** (massively multiplayer online) +- **[MMX](mmx.md)** (multimedia extension) +- **[MMORPG](mmorpg)** (MMO RPG) +- **[MOSFET](mosfet.md)** (metal oxide semiconductor field effect transistor) +- **[MPEG](mpeg.md)** (motion pictures experts group) +- **[MR](mr.md)** (merge request) +- **[MS/M$](ms.md)** (Micro$oft) +- **[MSB](msb.md)** (most significant bit) +- **[MSC](msc.md)** (master of science) +- **[MSG](msg.md)** (message) +- **[MUD](mud.mf)** (multi user dungeon) +- **[NAN](nan.md)** (not a number) +- **[NASA](nasa.md)** (national aeronautic and space administration) +- **[NAT](nat.md)** (network address translation) +- **[NC](nc.md)** (non commercial) +- **[NGL](ngl.md)** (not gonna lie) +- **[NOP](nop.md)** (no operation) +- **[NP](np.md)** (nondeterministic polynomial) +- **[NTFS](ntfs.md)** (NT file system) +- **[OEM](oem.md)** (original equipment manufacturers) +- **[OGL](ogl.md)** (OpenGL) +- **[OMG](omg.md)** (oh my god) +- **[OO](oo.md)** (object oriented) +- **[OOP](oop.md)** (object oriented/obsessed programming) +- **[OS](os.md)** (operating system, open source) +- **[OSS](oss.md)** (open source software) +- **[OSI](osi.md)** ([open source](open_source.md) initiative) +- **[P2P](p2p.md)** (peer to peer) +- **[PB](pb.md)** (petabyte, petabit, personal best) +- **[PBR](pbr.md)** (physically based rendering) +- **[PC](pc.md)** (personal computer, political correctness) +- **[PD](pd.md)** ([public domain](public_domain.md)) +- **[PDF](pdf.md)** (portable document format) +- **[PCM](pcm.md)** (pulse code modulation) +- **[PGP](pgp.md)** (pretty good privacy) +- **[PHD](phd.md)** (doctor of philosophy) +- **[PID](pid.md)** (process ID) +- **[PIN](pin.md)** (personal identification number) +- **[PNG](png.md)** (portable network graphics) +- **[POP3](pop3.md)** (post office protocol version 3) +- **[POSIX](posix.md)** (portable operating system interface) +- **[PPC](ppc.md)** (power PC) +- **[PR](pr.md)** (pull request) +- **[PS](ps.md)** ([Photoshop](photoshop.md), [Postscript](postscript.md), [PlayStation](playstation.md)) +- **[PS2](ps2.md)** (personal system 2) +- **[PTHC](pthc.md)** (preteen hardcore) +- **[QOS](qos.md)** (quality of service) +- **[RAID](raid.md)** (redundant array of inexpensive discs) +- **[RAM](ram.md)** (random access [memory](memory.md)) +- **[RC](rc.md)** (release candidate) +- **[RCL](raycastlib.md)** (raycastlib) +- **[REGEX](regex.md)** (regular expression) +- **[RFC](rfc.md)** (request for comments) +- **[RGB](rgb.md)** (red green blue) +- **[RGBA](rgba.md)** (red green blue alpha) +- **[RISC](risc.md)** (reduced instruction set computer) +- **[RIP](rip.md)** (rest in piece) +- **[RLE](rle.md)** (run length encoding) +- **[RMS](rms.md)** (Richard Matthew Stallman) +- **[RN](rn.md)** (right now) +- **[ROFL](rofl.md)** (rolling on floor laughing) +- **[ROM](rom.md)** ([read-only](read_only.md) memory) +- **[RPG](rpg.md)** (role playing game) +- **[RT](rt.md)** (real time) +- **[RTFM](rtfm.md)** (read the fucking manual) +- **[RTOS](rtos.md)** (real time operating system) +- **[S3L](small3dlib.md)** (small3dlib) +- **[SAAS](saas.md)** (software as a service) +- **[SAASS](saass.md)** (service as a software substitute) +- **[SAF](saf.md)** (smallabstractfish) +- **[SCL](smallchesslib)** (smallchesslib) +- **[SD](sd.md)** (standard definition, secure digital) +- **[SDF](sdf.md)** (signed distance function) +- **[SDK](sdk.md)** (software development kit) +- **[SDL](sdl.md)** (simple directmedia layer) +- **[SEO](seo.md)** (search engine optimization) +- **[SFX](sfx.md)** (sound effects) +- **[SGML](sgml.md)** (standard generalized markup language) +- **[SHA](sha.md)** (secure hash algorithm) +- **[SIG](sig.md)** (special interest group) +- **[SIM](sim.md)** (subscriber identity module) +- **[SIMD](simd.md)** (single [instruction](instruction.md) multiple [data](data.md)) +- **[SLOC](sloc.md)** (source lines of code) +- **[SMS](sms.md)** (short message service) +- **[SMTP](smtp.md)** (simple mail transfer protocol) +- **[SNTP](sntp.md)** (simple network time protocol) +- **[SOC](soc.md)** (system on chip) +- **[SQL](sql.md)** (structured query language) +- **[SRAM](sram.md)** (static RAM) +- **[SSAO](ssao.md)** (screen space ambient occlusion) +- **[SSD](ssd.md)** (solid state drive) +- **[SSH](ssh.md)** (secure shell) +- **[SSL](ssl.md)** (secure socket layer) +- **[STFU](stfu.md)** (shut the fuck up) +- **[SVG](svg.md)** (scalable vector graphics) +- **[SW](software.md)** (software) +- **[TAS](tas.md)** (tool assisted speedrun) +- **[TB](tb.md)** (terabyte, terabit) +- **[TCC](tcc.md)** (tiny [C](c.md) compiler) +- **[TCP](tcp.md)** (transmission control protocol) +- **[TFT](tft.md)** (thin filter transistor) +- **[TFW](tfw.md)** (that face when) +- **[TLA](tla.md)** (three letter acronym) +- **[TM](tm.md)** ([trademark](trademark.md), [Turing machine](turing_machine.md)) +- **[TOS](tos.md)** (terms of service) +- **[TTY](tty.md)** (teletype) +- **[TUI](tui.md)** (text user interface) +- **[UBI](ubi.md)** (universal basic income) +- **[UDP](udp.md)** (user datagram protocol) +- **[UI](ui.md)** (user interface) +- **[UML](uml.md)** (unified modeling language) +- **[URI](uri.md)** (uniform resource identifier) +- **[URL](url.md)** (uniform resource locator) +- **[USA](usa.md)** (united states of america) +- **[USB](usb.md)** (universal serial bus) +- **[UTC](utc.md)** (coordinated universal time) +- **[UTF](utf.md)** (unicode transformation format) +- **[UX](ux.md)** (user experience) +- **[VCS](vcs.md)** (version control system) +- **[VOD](vod.md)** (video on demand) +- **[VHS](vhs.md)** (video home system) +- **[VIM](vim.md)** ([vi](vi.md) improved) +- **[VFX](vfx.md)** (visual effects) +- **[VLAN](vlan.md)** (virtual LAN) +- **[VLIW](vliw.md)** (very long instruction word) +- **[VM](vm.md)** (virtual machine) +- **[VPN](vpn.md)** (virtual private network) +- **[VPS](vps.md)** (virtual private server) +- **[VRAM](vram.md)** (video RAM) +- **[W3C](w3c.md)** (world wide web consortium) +- **[WAN](wan.md)** (wide area network) +- **[WAP](wap.md)** (wireless application protocol) +- **[WIFI](wifi.md)** (wireless fidelity) +- **[WOW](wow.md)** (World Of Warcraft) +- **[WPA](wpa.md)** (WIFI protected access) +- **[WTF](wtf.md)** (what the fuck) +- **[WTFPL](wtfpl)** (do what the fuck you want to public [license](license.md)) +- **[WYSIWYG](wysiwyg.md)** (what you see is what you get) +- **[WM](wm.md)** (window manager) +- **[WWW](www.md)** (world wide web) +- **[XAML](xaml.md)** (extensible application markup language) +- **[XHTML](xhtml.md)** (extensible HTML) +- **[XML](xml.md)** (extensible markup language) +- **[YOLO](yolo.md)** (you only live once) +- **[ZOMG](zomg.md)** (when you want to write OMG but accidentally also hit Z) \ No newline at end of file diff --git a/ai.md b/ai.md new file mode 100644 index 0000000..87952ed --- /dev/null +++ b/ai.md @@ -0,0 +1,7 @@ +# Artificial Intelligence + +Artificial intelligence (AI) is an area of [computer science](compsci.md) whose effort lies in making computers simulate thinking of humans and possibly other biologically living beings. This may include making computers play [games](game.md) such as [chess](chess.md), understand and processing audio, images and text on high level of [abstraction](abstraction.md) (e.g. translation between natural languages), making predictions about complex systems such as stock market or weather or even exhibit a general human-like behavior. Even though today's focus in AI is on [machine learning](machine_learning.md) and especially [neural networks](neural_network.md), there are many other usable approaches and models such as "hand crafted" state tree searching algorithms that can simulate and even outperform the behavior of humans in certain specialized areas. + +There's a concern that's still a matter of discussion about the dangers of developing a powerful AI, as that could possibly lead to a [technological singularity](tech_singularity.md) in which a super intelligent AI might take control over the whole world without humans being able to seize the control back. Even though it's still likely a far future and many people say the danger is not real, the question seems to be about *when* rather than *if*. + +By about 2020, "AI" has become a [capitalist](capitalism.md) [buzzword](buzzword.md). They try to put machine learning into everything just for that AI label -- and of course, for a [bloat monopoly](bloat_monopoly.md). \ No newline at end of file diff --git a/algorithm.md b/algorithm.md new file mode 100644 index 0000000..c9f4ca1 --- /dev/null +++ b/algorithm.md @@ -0,0 +1,176 @@ +# Algorithm + +Algorithm is an exact description of how to solve a problem. Algorithms are basically what [programming](programming.md) is all about: we tell computers, in very exact ways (with [programming languages](programming_language.md)), how to solve problems -- we write algorithms. But algorithms don't have to be just computer programs, they are simply instruction for solving problems. + +Cooking recipes are sometimes given as an example of a non-computer algorithm. The so called wall-follower is a simple algorithm to get out of any maze: you just pick either a left-hand or right-hand wall and then keep following it. You may write a crazy algorithm for how to survive in a jungle, but it has to be **exact**; if there is any ambiguity, it is not considered an algorithm. + +Interesting fact: contrary to intuition there are problems that are mathematically proven to be unsolvable by any algorithm, see [undecidability](undecidability.md), but for most practically encountered problems we can write an algorithm (though for some problems even our best algorithms can be unusably slow). + +Algorithms are mostly written as a **series of steps** (or instructions); these steps may be specific actions (such as adding two numbers or drawing a pixel to the screen) or **conditional jumps** to other steps ("if condition X holds then jump to step N, otherwise continue"). These jumps can be used to create **[branches](branch.md)** (in programming known as *if-then-else*) and **[loops](loop.md)** (these two constructs are known as [control structures](control_structure.md) -- they don't express an action but control where we move in the algorithm itself). All in all, **any algorithm can be written with only these three constructs**: + +- **sequence**: A series of steps, one after another. +- **selection** (branches, *if-then-else*): Two branches (sequences of steps) preceded by a condition; the first branch is executed only if the condition holds, the second ("else") branch is executed only if the condition doesn't hold (e.g. "If user password is correct, log the user in, otherwise print out an error."). +- **iteration** (loops, repetition): Sequence of steps that's repeated as long as certain condition holds (e.g. "As long as end of file is not reached, read and print out next character from the file."). + +Note: in a wider sense algorithms may be expressed in other ways than sequences of steps (non-[imperative](imperative.md) ways, see [declarative languages](declarative.md)), even mathematical equations are often called algorithms because they *imply* the steps towards solving a problem. But we'll stick to the common meaning of algorithm given above. + +Additional constructs can be introduced to make programming more comfortable, e.g. [subroutines/functions](function.md) (kind of small subprograms that the main program uses for solving the problem) or [switch](switch.md) statements (selection but with more than two branches). Loops are also commonly divided into several types: counted loops, loops with condition and the beginning and loops with condition at the end (`for`, `while` and `do while` in [C](c.md), respectively). Similarly to mathematical equations, algorithms make use of [variables](variable.md), i.e. values which can change that have a specific name (such as *x* or *myVariable*). + +[Flowcharts](flowchart.md) are a way of visually expressing algorithms, you have probably seen some. [Decision trees](decision_tree.md) are special cases of algorithms that have no loops, you have probably seen some too. Even though some languages (mostly educational such as [Snap](snap.md)) are visual and similar to flow charts, it is not practical to create big algorithms in this way -- serious programs are written as a text in [programming languages](programming_language.md). + +## Example + +Let's write a simple algorithm that counts the number of divisors of given number *x* and check if the number is [prime](prime.md) along the way. (Note that we'll do it in a naive, educational way -- it can be done better). Let's start by writing the steps in plain [English](english.md): + +1. Read the number *x* from the input. +2. Set the *divisor counter* to 0. +3. Set *currently checked number* to 1. +4. While *currently checked number* is lower or equal than *x*: + a. If *currently checked number* divides *x*, increase *divisor counter* by 1. + b. Increase *currently checked number*. +5. Write out the *divisor counter*. +6. If *divisor counter* is equal to 2, write out the number is a prime. + +Notice that *x*, *divisor counter* and *currently checked number* are [variables](variable.md). Step 4 is a loop (iteration) and steps *a* and 6 are branches (selection). The flowchart of this algorithm is: + +``` + START + | + V + read x + | + V + set divisor count to 0 + | + V + set checked number to 1 + | + ------------>| + | | + | V no + | checked number <= x ? ------- + | | | + | | yes | + | V | + | checked number no | + | divides x ? -------- | + | | | | + | | yes | | + | V | | + | increase divisor | | + | count by 1 | | + | | | | + | V | | + --------------<------------- | + V no + divisor count = 2 ? ------ + | | + | yes | + V | + print "number is prime" | + | | + |<---------------| + V + END + +``` + +This algorithm would be written in [Python](python.md) as: + +``` +x = int(input("enter a number: ")) + +divisors = 0 + +for i in range(1,x + 1): + if x % i == 0: + divisors = divisors + 1 + +print("divisors: " + str(divisors)) + +if divisors == 2: + print("It is a prime!") +``` + +and in [C](c.md) as: + +``` +#include + +int main(void) +{ + int x, divisors = 0; + + scanf("%d",&x); // read a number + + for (int i = 1; i <= x; ++i) + if (x % i == 0) + divisors = divisors + 1; + + printf("number of divisors: %d\n",divisors); + + if (divisors == 2) + puts("It is a prime!"); + + return 0; +} +``` + +## Study of Algorithms + +As algorithms are at the heart of [computer science](scompsci.md), there's a lot of rich theory and knowledge about them. + +[Turing machine](turing_machine.md), created by [Alan Turing](turing.md), is the traditional formal tool for studying algorithms. From theoretical computer science we know not all problems are [computable](computability.md), i.e. there are problems unsolvable by any algorithm (e.g. the [halting problem](halting_problem.md)). [Computational complexity](computational_complexity.md) is a theoretical study of resource consumption by algorithms, i.e. how fast and memory efficient algorithms are (see e.g. [P vs NP](p_vs_np.md)). [Mathematical programming](mathematical_programming.md) is concerned, besides others, with optimizing algorithms so that their time and/or space complexity is as low as possible which gives rise to algorithm design methods such as [dynamic programming](dynamic_programming.md) ([optimization](optimization.md) is a less theoretical approach to making more efficient algorithms). [Formal verification](formal_verification.md) is a field that tries to mathematically (and sometimes automatically) prove correctness of algorithms (this is needed for critical software, e.g. in planes or medicine). [Genetic programming](generic_programming.md) and some other methods of [artificial intelligence](ai.md) try to automatically create algorithms (*algorithms that create algorithms*). [Quantum computing](quantum.md) is concerned with creating new kind of algorithms algorithms for quantum computers (a new type of still-in-research computers). [Programming language](programming_language.md) design is an art of finding best ways of expressing algorithms. + +## Specific Algorithms + +Following are some common algorithms classified into groups. + +- [graphics](graphics.md) + - [DDA](dda.md): line drawing algorithm + - [flood fill](flood_fille.md) + - [FXAA](fxaa.md) + - [Hough transform](hough_transform.md): finds shapes in pictures + - [painter's algorithm](painters_algorithm.md) + - [path tracing](path_tracing.md) + - [ray tracing](ray_tracing.md) +- [math](math.md) + - [Boot'h algorithm](booths_algorithm.md): algorithm for multiplication + - [Dijkstra's algorithm](dijkstras_algorithm.md) + - [Euclidean algorithm](euclidean_algorithm.md): computes greatest common divisor + - [numerical algorithms](numerical.md): approximate mathematical functions + - [sieve of Eratosthenes](sieve_of_eratosthenes.md): computes [prime numbers](prime.md) +- [sorting](sorting.md) + - [bogosort](bogosort.md) (stupid sort) + - [bubble sort](bubble_sort.md): simple, kind of slow but still usable sorting algorithm + - [heap sort](heap_sort.md) + - [insertion sort](insertion_sort.md) + - [merge sort](merge_sort.md) + - [shaker sort](shaker_sort.md) + - [selection sort](selection_sort.md) + - [slow sort](slow_sort.md) + - [quick sort](quick_sort.md): one of the fastest sorting algorithms +- [searching](searching.md) + - [binary search](binary_search.md) + - [linear search](linear_search.md) +- [other](other.md) + - [A*](a_start.md): path searching algorithm, used by [AI](ai.md) in many [games](game.md) + - [backpropagation](backpropagation.md) + - [fizzbuzz](fizzbuzz.md): problem/simple algorithm given in job interviews to filter out complete [noobs](noob.md) + - [FFT](fft.md): quickly converts signal (audio, image, ...) to its representation in frequencies, one of the most famous and important algorithms + - [Huffman coding](huffman_code.md): [compression](compression.md) algorithm + - [Kalman filter](kalman_filter.md) + - [k-means](k_means.md): [clustering](clustering.md) algorithm + - [MD5](md5.md): [hash](hash.md) function + - [minimax](minimax.md) plus [alpha-beta pruning](alpha_beta.md): used by many [AI](ai.md)s that play turn based games + - [proof of work](proof_of_work.md) algorithms: used by some [cryptocurrencies](crypto.md) + - [RSA](rsa.md) + - [Shor's algorithm](shors_algorithm.md): [quantum](quantum.md) factorization algorithm + - [YouTube](youtube.md) algorithm: secret algorithm YouTube uses to suggest videos to viewers, a lot of people hate it :) + + +## See Also + +- [programming](programming.md) +- [design pattern](design_pattern.md) +- [recursion](recursion.md) \ No newline at end of file diff --git a/aliasing.md b/aliasing.md new file mode 100644 index 0000000..09b9105 --- /dev/null +++ b/aliasing.md @@ -0,0 +1,47 @@ +# Aliasing + +Aliasing is a certain mostly undesirable phenomenon that distorts signals (such as sounds or images) when they are [sampled](sampling.md) [discretely](discrete.md) (captured at periodic intervals) -- this can happen e.g. when capturing sound with digital recorders or when [rendering](rendering.md) computer graphics. There exist [antialiasing](antialiasing.md) methods for suppressing or even eliminating aliasing. Aliasing can be often seen on small checkerboard patterns as a moiré pattern (spatial aliasing), or maybe more famously on rotating wheels or helicopter rotor blades that in a video look like standing still or rotating the other way (temporal aliasing, caused by capturing images at intervals given by the camera's [FPS](fps.md)). + +The following diagram shows the principle of aliasing: + +``` +^ original sampling period +| | | |<------------->| +| | _ | _ | _ | +| .'|'. .' '| .' '. | .' '. | +|/__|__\_______/____|\_______/_____\|______/_____\__|___ +| | \ / | \ / \ / \ | +| | '._.' | '._.' |'._.' '|_.' +| | | | | +| : : : : +V : : : : + : : : : +^ : : : : +| : : : : +|---o---...____ : : : +| | '''''o...____ : : +|___|_______________|______ ''''----o_______________:___ +| '''----___ | +| ''''O--- +| reconstructed +| +V +``` + +The top signal is a [sine](sin.md) function of a certain [frequency](frequency.md). We are sampling this signal at periodic intervals indicated by the vertical lines (this is how e.g. digital sound recorders record sounds from the real world). Below we see that the samples we've taken make it seem as if the original signal was a sine wave of a much lower frequency. It is in fact impossible to tell from the recorded samples what the original signal looked like. + +Let's note that signals can also be two and more dimensional, e.g. images can be viewed as 2D signals. These are of course affected by aliasing as well. + +The explanation above shows why a helicopter's rotating blades look to stand still in a video whose [FPS](fps.md) is synchronized with the rotation -- at any moment the camera captures a frame (i.e. takes a sample), the blades are in the same position as before, hence they appear to not be moving in the video. + +Of course this doesn't only happen with perfect sine waves. [Fourier transform](fourier_transform.md) shows that any signal can be represented as a sum of different sine waves, so aliasing can appear anywhere. + +**Nyquist–Shannon sampling theorem** says that aliasing can NOT appear if we sample with at least twice as high frequency as that of the highest frequency in the sampled signal. This means that we can eliminate aliasing by using a [low pass filter](low_pass.md) before sampling which will eliminate any frequencies higher than the half of our sampling frequency. This is why audio is normally sampled with the rate of 44100 Hz -- from such samples it is possible to correctly reconstruct frequencies up to about 22000 Hz which is about the upper limit of human hearing. + +Aliasing is also a common problem in [computer graphics](computer_graphics.md). For example when rendering textured 3D models, aliasing can appear in the texture if that texture is rendered at a smaller size than its resolution (when the texture is enlarged by rendering, aliasing can't appear because enlargement decreases the frequency of the sampled signal and the sampling theorem won't allow it to happen). (Actually if we don't address aliasing somehow, having lower resolution textures can unironically have beneficial effects on the quality of graphics.) This happens because texture samples are normally taken at single points that are computed by the texturing algorithm. Imagine that the texture consists of high-frequency details such as small checkerboard patterns of black and white pixels; it may happen that when the texture is rendered at lower resolution, the texturing algorithm chooses to render only the black pixels. Then when the model moves a little bit it may happen the algorithm will only choose the white pixels to render. This will result in the model blinking and alternating between being completely black and completely white (while it should rather be rendered as gray). + +The same thing may happen in [ray tracing](ray_tracing.md) if we shoot a single sampling ray for each screen pixel. Note that [interpolation/filtering](interpolation.md) of textures won't fix texture aliasing. What can be used to reduce texture aliasing are e.g. by [mipmaps](mip.md) which store the texture along with its lower resolution versions -- during rendering a lower resolution of the texture is chosen if the texture is rendered as a smaller size, so that the sampling theorem is satisfied. However this is still not a silver bullet because the texture may e.g. be shrink in one direction but enlarged in other dimension (this is addressed by [anisotropic filtering](anisotropic_filtering.md)). However even if we sufficiently suppress aliasing in textures, aliasing can still appear in geometry. This can be reduced by [multisampling](multisampling.md), e.g. sending multiple rays for each pixel and then averaging their results -- by this we **increase our sampling frequency** and lower the probability of aliasing. + +**Why doesn't aliasing happen in our eyes and ears?** Because our senses don't sample the world discretely, i.e. in single points -- our senses [integrate](integration.md). E.g. a rod or a cone in our eyes doesn't just see exactly one point in the world, it sees an averaged light over a small area, and it also doesn't sample the world at specific moments like cameras do, its excitation by light falls off gradually which averages the light over time, preventing temporal aliasing. + +So all in all, **how to prevent aliasing?** As said above, we always try to satisfy the sampling theorem, i.e. make our sampling frequency at least twice as high as the highest frequency in the signal we're sampling, or at least get close to this situation and lower the probability of aliasing. This can be done by either increasing sampling frequency (which can be done smart, some methods try to detect where sampling should be denser), or by preprocessing the input signal with a low pass filter or otherwise ensure there won't be too high frequencies. \ No newline at end of file diff --git a/analytic_geometry.md b/analytic_geometry.md new file mode 100644 index 0000000..8cdaacc --- /dev/null +++ b/analytic_geometry.md @@ -0,0 +1,49 @@ +# Analytic Geometry + +Analytic geometry is part of [mathematics](math.md) that solves [geometric](geometry.md) problems with [algebra](algebra.md); for example instead of finding an intersection of a line and a circle with ruler and compass, analytic geometry finds the intersection by solving an equation. In other words, instead of using pen and paper we use numbers. This is very important in computing as computers of course just work with numbers and aren't normally capable of drawing literal pictures and drawing results from them -- that would be laughable (or awesome?). Analytic geometry finds use especially in such fields as [physics simulations](physics_engine.md) ([collision](collision.md) detections) and [computer graphics](graphics.md), in methods such as [raytracing](raytracing.md) where we need to compute intersections of rays with various mathematically defined shapes in order to render 3D images. Of course the methods are used in other fields, for example [rocket science](rocket_science.md) and many other physics areas. Analytic geometry reflects the fact that geometric and algebraic problem are often analogous, i.e. it is also the case that many times problems we encounter in arithmetic can be seen as geometric problems and vice versa (i.e. solving an equation is the same as e.g. finding an intersection of some N-dimensional shapes). + +[Fun](fun.md) fact: approaches in the opposite direction also exist, i.e. solving mathematical problems physically rather than by computation. For example [back in the day](back_then.md) when there weren't any computers to compute very difficult [integrals](integral.md) and computing them by hand would be immensely hard, people literally cut physical function plots out of paper and weighted them in order to find the integral. Awesome oldschool [hacking](hacking.md). + +Anyway, **how does it work?** Typically we work in a 2D or 3D [Euclidean space](euclidean_space.md) with [Cartesian coordinates](cartesian_coords.md) (but of course we can generalize to more dimensions etc.). Here, geometric shapes can be described with [equations](equation.md) (or [inequalities](inequality.md)); for example a zero-centered circle in 2D with radius *r* has the equation *x^2 + y^2 = r^2* ([Pythagorean theorem](pythagorean_theorem.md)). This means that the circle is a set of all points *[x,y]* such that when substituted to the equation, the equation holds. Other shapes such as [lines](line.md), [planes](plane.md), [ellipses](ellipse.md), [parabolas](parabola.md) have similar equations. Now if we want to find intersections/unions/etc., we just solve systems of multiple equations/inequalities and find solutions (coordinates) that satisfy all equations/inequalities at once. This allows us to do basically anything we could do with pen and paper such as defining helper shapes and so on. Using these tools we can compute things such as angles, distances, areas, collision points and much more. + +Analytic geometry is closely related to [linear algebra](linear_algebra.md). + +## Example + +Let's say we want to find, in 2D, where a line *L* intersects a circle *C*. *L* goes through points *A = [-3,0.5]* and *B = [3,2]*. *C* has center at *[0,0]* and radius *r = 2*. + +The equation for the circle *C* is *x^2 + y^2 = 2^2*, i.e. *x^2 + y^2 = 4*. This is derived from [Pythagorean theorem](pythagorean_theorem.md), you can either check that or, if lazy, just trust this. Equations for common shapes can be looked up. + +One possible form of an equation of a 2D line is a "slope + offset" equation: *y = k * x + q*, where *k* is the [tangent](tangent.md) (slope) of the line and *q* is an offset. To find the specific equation for our line *L* we need to first find the numbers *k* and *q*. This is done as follows. + +The tangent (slope) *k* is *(B.y - A.y) / (B.x - A.x)*. This is the definition of a [tangent](tangent.md), see that if you don't understand this. So for us *k = (2 - 0.5) / (3 - -3) = 0.25*. + +The number *q* (offset) is computed by simply substituting some point that lies on the line to the equation and solving for *q*. We can substitute either *A* or *B*, it doesn't matter. Let's go with *A*: *A.y = k * A.x + q*, with specific numbers this is *0.5 = 0.25 * -3 + q* from which we derive that *q = 1.25*. + +Now we have computed both *k* and *q*, so we now have equations for both of our shapes: + +- circle *C*: *x^2 + y^2 = 4* +- line *L*: *y = 0.25 * x + 1.25* + +Feel free to check the equations, substitute a few points and plot them to see they really represent the shapes (e.g. if you substitute a specific *x* shape to the line equation you will get a specific *y* for it). + +Now to find the intersections we have to solve the above system of equations, i.e. find such couples (coordinates) *[x,y]* that will satisfy both equations at once. One way to do this is to substitute the line equation into the circle equation. By this we get: + +*x^2 + (0.25 * x + 1.25)^2 = 4* + +This is a [quadratic equation](quadratic_equation.md), let's get it into the standard format so that we can solve it: + +*x^2 + 0.0625 * x^2 + 0.625 * x + 1.5625 = 4* + +*1.0625 * x^2 + 0.625 * x - 2.4375 = 0* + +Note that this makes perfect sense: a quadratic equation can have either one, two or no solution (in the realm of [real numbers](real_number.md)), just as there can either be one, two or no intersection of a line and a circle. + +Solving quadratic equation is simple so we skip the details. Here we get two solutions: *x1 = 1.24881* and *x2 = -1.83704*. These are the x position of our intersections. We can further find also the y coordinates by simply substituting these into the line equation, i.e. we get the final result: + +- intersection 1: *[1.24881, 1.5622025]* +- intersection 2: *[-1.83704, 0.79074]* + +## See Also + +- [linear algebra](linear_algebra.md) \ No newline at end of file diff --git a/anarch.md b/anarch.md new file mode 100644 index 0000000..6962461 --- /dev/null +++ b/anarch.md @@ -0,0 +1,72 @@ +# Anarch + +Anarch is a [LRS](lrs.ms)/[suckless](suckless.md) first person shooter [game](game.md) similar to [Doom](doom.md), written by [drummyfish](drummyfish.md). It has been designed to follow the LRS principles very closely and set an example of how games, and software in general, should be written. + +Tge repo is available at https://codeberg.org/drummyfish/Anarch + or https://gitlab.com/drummyfish/anarch. Some info about the game can also be found at the [libregamewiki](lgw.md): https://libregamewiki.org/Anarch. + +``` +h@\hMh::@@hhh\h@rrrr//rrrrrrrrrrrrrrrrrrrr@@@@hMM@@@M@:@hhnhhMnr=\@hn@n@h@-::\:h +hMhh@@\\@@@\\h:M/r/////rrrrrrrrrrrrrrr//r@@@@@MMh@@hhh\\\=rMr=M@hh\hn\:\:h::\@\: +@nh==hhhMM@hrh\M/r/////rrrrrrrrrrrrrrr//@@@@@@hhM@h\MhhhMM\@@@@@M\hh\\\Mhh\\\\hh +:hh=@Mh/;;;@hr:M,///;;/////rrr//rrrrrr//@@@@@@hh\h@@hM:==h\@@::\\\:M\@\h\M:\:=@h +\=MhM@hr `hMhhM///@@@@@@@@@@@@@@@@@@@//@@@@@@rMM@n\M=:@M\\\\Mh\\\hr\n\--h-::r:r +:Mh@M@@` `rh@\@///@@@@@@@@@@@@@@@@@@@@@@@@@@@Mr\@@\h@:\h\h@\Mhh@@\M@@@@-n\rn@:h +:MhhMn@//r;;@/hM@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@MhMhh:M@MhMhMh@\\rM/@h@nn=-MrnM@:h +:nhhhhh\\//\::@M@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@rMM@@nh@M\=nh@@@M@..=hM@n@-@@@@@:h +\@\h@@rrrr/rr@=M@@@@@@@@@@@@@@nr@@@@@@@@@@@@@@Mrhn@\M@:nMh\@@@@@...h:::::@---::h +-M\h=h\` rhM\M@@@@@@@@@@@@@@@=@@@@@@@@@@@@@@MhM@\hh@M@Mhh@-\MMhrr\\\:MMh::\\-\ +h@hhh\h` `rMh\M@@@@@@@@@@@@@@nr;;;;rn@@@@@@@@r@r///=@\@\r\\hM@nrrr@\n\h\M\\\\\: +hn===hhM=;hhhh\MrMnrr=rrr=r@rhhr;.r,/hr=r=r=h=r@=/-;/MhhMr:h\@h=...r\@hMhM:/\h\= +@n==M\h@=;hhh\\Mrr=r=r=rMr=hrMMr;;;,;========MM@r=./;@:MMM\h=r=rM/rh@@@M-n---:-h +:\=hMn@@@=\hhh:M===============;/. ,,==========@r-/--@:@M\\@@@n@Mn:hM@n@-=\hr=-h +\hhnM@=@::@MM/h================;;;;.,======\h==M=/;r,//;;r=r=r=r@\=r=r=r=@rnMn:r +:Mrrr=rr==@rr=rrr=rrr=/=r===r==/:; ..===r\\-h==@r-,;-=r/;/;;;;;;rnrrr=rrr=rrr=r; +rrrrrrrr@=rrrrrrrrrrr//r=r=r=r=r;. ,.r=r\---hr=@r===-r=r=;;;r;;;hh@:;;;;;;;;;;-; +r=rrr=rr\\@rr=rrr=r/;/:rr=rrr=rr;r,..=r\--.-h=r@r----=rrr=rrr--:,;;:,;;;,;;;,;-- +rrrr:-@=====:,;,;-/;/:rrrrrrrrr;;....r\--.,\hrrrrrrrrrrrrrrrrrrrrr-----rrrrrrrrr +,;,:,; ;,;;;-;;;,;/:-rrrrrrrrrrrrrrrrr\-.,;\@rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +;,;,;,.,;,;,;,;,;,:rrrrrrrrrrrrrrrrrr\--.;,\Mrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr +,;,;.-.-.-::-:::--rr/rrr/rrr/rrr/rrr/\-.:;::@rrr/rrr/rrr/rrr/rrr/rrr/rrr/rrr/rrr +-.-.r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/\---;::\@/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/ +/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r\-.,;:,:@r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r/r +///////////////////////////////////\::-,;,-:@/////////////////////////////////// +;///;///;///;///;///;///;///;///;//,::-:,.,-@///;///;///;///;///;///;///;///;/// +//////////////////////////////////\----:-.,-h/////////////////////////////////// +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +nn..nnn...nn...nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...nnnnnnnnnnnnnn +nnn.nnn.n.nn.n.nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.n.nnnnnnnnnnnnnn +nnn.nnn.n.nn.n.nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.n.nnnnnnnnnnnnnn +nn...nn...nn...nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...nnnnnnnnnnnnnn +nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +``` + +*screenshot from the terminal version* + +Anarch has these features: + +- It is completely **[public domain](public_domain.md)** [free software](free_software.md)/[free culture](free_culture.md) under [CC0](cc0.md), including all code and assets which were all made from scratch by drummyfish. +- It has extremely low hardware demands, fitting into **256 kb** (WITH assets) and requiring only about **32 kb of [RAM](ram.md)** and **50 MHz [CPU](cpu.md)**. [GPU](gpu.md)s need not apply. +- It is written in pure [C99](c.md) without any [dependencies](dependency.md) (not even the standard library). It uses no [dynamic heap allocation](dynamic_allocation.md) and no [floating point](float.md). +- It is **extremely portable**, written against a very tiny I/O layer. As such it has been ported to many platforms such as [GNU](gnu.md)/[Linux](linux.md), [BSD](bsd.md), [Pokitto](pokitto.md), browser [JavaScript](javascript.md), [Raspberry Pi](rpi.md) and many others. +- It is written in a [single compilation unit](scu.md) and without any [build system](build_system.md). +- It is created with only free software. +- It is well documented. + +Gameplay-wise Anarch offers 10 levels and multiple enemy and weapon types. It supports mouse where available. + +## Technical Details + +Anarch's engine uses [raycastlib](raycastlib.md), a LRS library for advanced 2D [ray casting](ray_casting.md) which is often called a "pseudo 3D". This method was used by Wolf3D, but Anarch improves it to allow different levels of floor and ceiling which makes it look a little closer to Doom (which however used a different methods called [BSP](bsp.md) rendering). + +The music in the game is [procedurally generated](procedural_generation.md) using [bytebeat](bytebeat.md). + +All images in the game (textures, sprites, ...) are 32x32 pixels, compressed by using a 16 color subpalette of the main 256 color palette, and are stored in source code itself as simple [arrays](array.md) of bytes -- this eliminates the need for using [files](file.md) and allows the game to run on platforms without a [file system](file_system.md). + +The game uses a tiny custom-made 4x4 bitmap [font](font.md) to render texts. + +Saving/loading is optional, in case a platform doesn't have persistent storage. Without saving all levels are simply available from the start. + +In the suckless fashion, mods are recommended to be made and distributed as [patches](patch.md). \ No newline at end of file diff --git a/anarchism.md b/anarchism.md new file mode 100644 index 0000000..1d129e4 --- /dev/null +++ b/anarchism.md @@ -0,0 +1,11 @@ +# Anarchism + +Anarchism is a [socialist](socialism.md) political philosophy rejecting any social hierarchy and oppression. **Anarchism doesn't mean without rules, but without rulers**; despite popular misconceptions anarchism is not [chaos](chaos.md) -- on the contrary, it strives for a stable, ideal society of equal people that live in peace. The symbols of anarchism include the letter A in a circle and a black flag that for different branches of anarchism is diagonally split from bottom left to top right and the top part is filled with a color specific for that branch. + +Most things about anarchism are explained in the text *An Anarchist FAQ*, which is [free licensed](free_culture.md) and can be accessed e.g. at https://theanarchistlibrary.org/library/the-anarchist-faq-editorial-collective-an-anarchist-faq-full. + +Anarchism is a wide term and encompasses many flavors such as [anarcho communism](ancom.md), [anarcho pacifism](anpac.md), [anarcho syndicalism](ansyn.md), [anarcho primitivism](anprim.md) or [anarcho mutualism](anmut.md). Some of the branches disagree on specific questions, e.g. about whether [violence](violence.md) is ever justifiable, or propose different solutions to issues such as organization of society, however **all branches of anarchism are socialist** and all aim for **elimination of social hierarchy** such as social classes created by wealth, jobs and weapons, i.e. anarchism opposes [state](state.md) (e.g. police having power over citizens) and [capitalism](capitalism.md) (employers exploiting employees, corporations exploiting consumers etc.). + +There exist fake, pseudoanarchist ideologies such as ["anarcho" capitalism](ancap.md) (which includes e.g. so caleed [crypto "anarchism"](crypto_anarchism.md)) that deceive by their name despite by their very definition NOT fitting the definition of anarchism (just like [Nazis](nazi.md) called themselves [socialists](socialism.md) despite being the opposite). Also such shit as ["anarcha" feminism](anfem.md) are just fascist bullshit. The propaganda also tries to deceive the public by calling various violent criminals anarchists, even though they very often can't fit the definition of a true anarchist. + +[LRS](lrs.md) is an anarchist movement, specifically [anarcho pacifist](anpac.md) and [anarcho communist](ancom.md) one. \ No newline at end of file diff --git a/ancap.md b/ancap.md new file mode 100644 index 0000000..2c23c36 --- /dev/null +++ b/ancap.md @@ -0,0 +1,23 @@ +# "Anarcho" Capitalism + +*Not to be confused with [anarchism](anarchism.md).* + +So called "anarcho capitalism" (ancap for short, not to be confused with [anpac](anpac.md) or any form of [anarchism](anarchism.md)) is probably the worst, most retarded and most dangerous idea in the history of ever, and that is the idea of supporting [capitalism](capitalism.md) absolutely unrestricted by a state or anything else. No one with at least 10 brain cells and/or anyone who has spent at least 3 seconds observing the world could come up with such a stupid, stupid idea. We, of course, completely reject this shit. + +It has to be noted that **"anarcho capitalism" is not real [anarchism](anarchism.md)**, despite its name. Great majority of anarchists strictly reject this ideology as any form of capitalism is completely incompatible with anarchism -- anarchism is defined as opposing any social hierarchy and oppression, while capitalism is almost purely based on many types of hierarchies (internal corporate hierarchies, hierarchies between companies, hierarchies of social classes of different wealth etc.) and oppression (employee by employer, consumer by corporation etc.). Why do they call it *anarcho* capitalism then? Well, partly because they're stupid and don't know what they're talking about (otherwise they couldn't come up with such an idea in the first place) and secondly, as any capitalists, they want to deceive and ride on the train of the *anarchist* brand -- this is not new, [Nazis](nazi.md) also called themselves *socialists* despite being the complete opposite. + +The colors on their flag are black and yellow (this symbolizes shit and piss). + +It is kind of another bullshit kind of "anarchism" just like "[anarcha feminism](anarcha_feminism.md)" etc. + +## The Worst Idea In History + +As if [capitalism](capitalism.md) wasn't extremely bad already, "anarcho" capitalists want to get rid of the last mechanisms that are supposed to protect the people from corporations -- [states](state.md). We, as anarchists ourselves, of course see states as eventually harmful, but they cannot go before we get rid of capitalism first. Why? Well, imagine all the bad things corporations would want to do but can't because there are laws preventing them -- in "anarcho" capitalism they can do them. + +Firstly this means anything is allowed, any unethical, unfair business practice, including slavery, physical violence, blackmailing, rape, worst psychological torture, nuclear weapons, anything that makes you the winner in the jungle system. Except that this jungle is not like the old, self-regulating jungle in which you could only reach limited power, this jungle offers, through modern technology, potentially limitless power with instant worldwide communication and surveillance technology, with mass production, genetic engineering, AI and weapons capable of destroying the planet. + +Secondly the idea of getting rid of a state in capitalism doesn't even make sense because **if we get rid of the state, the strongest corporation will become the state**, only with the difference that state is at least *supposed* to work for the people while a corporation is only by its very definition supposed to care solely about its own endless profit on the detriment of people. Therefore if we scratch the state, McDonalds or Coca Cola or Micro$oft -- whoever is the strongest -- hires a literal army and physically destroys all its competition, then starts ruling the world and making its own laws -- laws that only serve the further growth of that corporation such as that everyone is forced to work 16 hour shifts every day until he falls dead. Don't like it? They kill your whole family, no problem. 100% of civilization will experience the worst kind of suffering, maybe except for the CEO of McDonald's, the world corporation, until the planet's environment is destroyed and everyone hopefully dies, as death is what we'll wish for. + +All in all, "anarcho" capitalism is advocated mostly by children who don't know a tiny bit about anything, by children who are being brainwashed daily in schools by capitalist propaganda, with no education besides an endless stream of ads from their smartphones, or capability of thinking on their own. However, these children are who will run the world soon. It is sad, it's not really their fault, but through them the system will probably come into existence. Sadly "anarcho" capitalism is already a real danger and a very likely future. It will likely be the beginning of our civilization's greatest agony. We don't know what to do against it other than provide education. + +God be with us. \ No newline at end of file diff --git a/anpac.md b/anpac.md new file mode 100644 index 0000000..11cb208 --- /dev/null +++ b/anpac.md @@ -0,0 +1,7 @@ +# Anarcho Pacifism + +Anarcho pacifism (anpac) is a form of [anarchism](anarchism.md) that completely rejects any violence. Anarcho pacifists argue that since anarchism opposes hierarchy and oppression, we have to reject violence which is a tool of oppression and establishing hierarchy. This would make it the one true purest form of anarchism. Anarcho pacifists use a black and white flag. + +Historically anarcho pacifists such as [Leo Tolstoy](tolstoy.md) were usually religiously motivated for rejecting violence, however this stance may also come from logic and other than religious beliefs, e.g. the simple belief that violence will only spawn more violence ("eye for an eye will only make the whole world blind"), or pure unconditional love of life. + +We, [LRS](lrs.md), advocate anarcho pacifism. We see how violence can be a short term solution, even to preventing a harm of many, however from the long term perspective we only see the complete delegitimisation of violence as leading to a truly mature society. We realize a complete, 100% non violent society may be never achieved, but with enough education and work it will be possible to establish a society with absolute minimum of violence, a society in which firstly people grow up in a completely non violent environment so that they never accept violence, and secondly have all needs secured so that they don't even have a reason for using violence. We should at least try to get as close to this ideal as possible. \ No newline at end of file diff --git a/antivirus_paradox.md b/antivirus_paradox.md new file mode 100644 index 0000000..215911f --- /dev/null +++ b/antivirus_paradox.md @@ -0,0 +1,9 @@ +# Antivirus Paradox + +{ I think this paradox must have had another established name even before antiviruses, but I wasn't able to find anything. If you know it, let me know. ~drummyfish } + +Antivirus paradox is the paradox of someone who's job it is to eliminate certain undesirable phenomenon actually having an interest in keeping this phenomenon existing so as to keep his job. A typical example is an [antivirus](antivirus.md) company having an interest in the existence of dangerous [viruses](virus.md) and malware so as to keep their business running; in fact antivirus companies themselves secretly create and release viruses and malware. + +It is a known phenomenon that many firefighters are also passionate arsonists because society simply rewards them for [fighting](fight_culture.md) fires (as opposed to rewarding them for the lack of fires). + +In [capitalism](capitalism.md) and similar systems requiring people to have jobs this paradox prevents progress, i.e. actual elimination of undesirable phenomena, hence capitalism and similar systems are anti-progress. And not only that, the system pressures people to artificially creating new undesirable phenomena (e.g. lack of [women](woman.md) in tech and similar [bullshit](bs.md)) just to create new [bullshit jobs](bs_job.md) that "[fight](fight_culture.md)" this phenomena. In a truly good society where people are not required to have jobs and in which people aim to eliminate [work](work.md) this paradox largely disappears. \ No newline at end of file diff --git a/app.md b/app.md new file mode 100644 index 0000000..f8f4d80 --- /dev/null +++ b/app.md @@ -0,0 +1,5 @@ +# App + +App is a retarded [capitalist](capitalist_software.md) name for [application](application.md); it is used by [soydevs](soydev.md), corporations and normalfaggots (similarly to how "[coding](coding.md)" is used for [programming](programming.md)). This word is absolutely unacceptable and is only to be used to mock these retards. + +Anything called an "app" is expected to be [bloat](bloat.md), badly designed and, at best, of low quality (and, at worst, malicious). \ No newline at end of file diff --git a/apple.md b/apple.md new file mode 100644 index 0000000..f5df366 --- /dev/null +++ b/apple.md @@ -0,0 +1,3 @@ +# Apple + +Apple is a [terrorist](terrorism.md) organization and one of the biggest [American](usa.md) computer fashion [corporations](corporation.md), infamously founded by [Steve Jobs](steve_jobs.md), it creates and sells overpriced, abusive, highly consumerist electronic devices. \ No newline at end of file diff --git a/approximation.md b/approximation.md new file mode 100644 index 0000000..396f8ea --- /dev/null +++ b/approximation.md @@ -0,0 +1,16 @@ +# Approximation + +Approximating means calculating something with lesser than best possible precision -- estimating -- purposefully allowing some margin of error in results and using simpler mathematical models than the most accurate ones: this is typically done in order to save resources (CPU cycles, memory etc.) and reduce [complexity](complexity.md) so that our projects stay manageable. Simulating real world on a computer is always an approximation as we cannot capture the infinitely complex and fine nature of the real world with a machine of limited resources, but even withing this we need to consider how much, in what ways and where to simplify. + +Using approximations however doesn't have to imply decrease in precision of the final result -- approximations very well serve [optimization](optimization.md). E.g. approximate metrics help in [heuristic](heuristic.md) algorithms such as [A*](a_star.md). Another use of approximations in optimization is as a quick preliminary check for the expensive precise algorithms: e.g. using bounding spheres helps speed up collision detection (if bounding spheres of two objects don't collide, we know they can't possibly collide and don't have to expensively check this). + +Example of approximations: + +- **Distances**: instead of expensive **Euclidean** distance (`sqrt(dx^2 + dy^2)`) we may use **Chebyshev** distance (`dx + dy`) or **Taxicab** distance (`max(dx,dy)`). +- **Engineering approximations** ("guesstimations"): e.g. **sin(x) = x** for "small" values of *x* or **pi = 3** (integer instead of float). +- **Physics engines**: complex triangle meshes are approximated with simple analytical shapes such as **spheres**, **cuboids** and **capsules** or at least **convex hulls** which are much easier and faster to deal with. They also approximate **relativistic** physics with **Newtonian**. +- **Real time graphics engines**, on the other hand, normally approximate all shapes with triangle meshes. +- **[Ray tracing](ray_tracing.md)** neglects indirect lighting. Computer graphics in general is about approximating the solution of the rendering equation. +- **Real numbers** are practically always approximated with [floating point](floating_point.md) or [fixed point](fixed_point.md) (rational numbers). +- **[Numerical methods](numerical.md)** offer generality and typically yield approximate solutions while their precision vs speed can be adjusted via parameters such as number of iterations. +- **[Taylor series](taylor_series.md)** approximates given mathematical function and can be used to e.g. estimate solutions of [differential equations](differential_equation.md). \ No newline at end of file diff --git a/arch.md b/arch.md new file mode 100644 index 0000000..8679565 --- /dev/null +++ b/arch.md @@ -0,0 +1,7 @@ +# Arch Linux + +*"BTW I use Arch"* + +Arch Linux is a [rolling-release](rolling_release.md) [Linux](linux.md) distribution for the "tech-savvy", mostly fedora-wearing weirdos. + +Arch is [shit](shit.md) at least for two reasons: it has proprietary packages (such as [discord](discord.md)) and it uses [systemd](systemd.md). [Artix](artix.md) Linux is a fork of Arch without systemd. \ No newline at end of file diff --git a/art.md b/art.md new file mode 100644 index 0000000..f2156e9 --- /dev/null +++ b/art.md @@ -0,0 +1,7 @@ +# Art + +Art is an endeavor that seeks discovery and creation of [beauty](beauty.md) and primarily relies on intuition. While the most immediate examples of art that come to mind are for example [music](music.md) and painting, even the most [scientific](science.md) and rigorous effort like [math](math.md) and [programming](programming.md) becomes art when pushed to the highest level, to the boundaries of current knowledge where intuition becomes important for further development. + +## See Also + +- [beauty](beauty.md) \ No newline at end of file diff --git a/ascii.md b/ascii.md new file mode 100644 index 0000000..afd3fef --- /dev/null +++ b/ascii.md @@ -0,0 +1,145 @@ +# ASCII + +ASCII (American standard code for information interchange) is a relatively simple standard for digital encoding of [text](text.md) that's one of the most basic and probably the most common format used for this purpose. For its simplicity and inability to represent characters of less common alphabets it is nowadays quite often replaced with more complex encodings such as [UTF-8](utf8.md) who are however almost always backwards compatible with ASCII (interpreting UTF-8 as ASCII will give somewhat workable results), and ASCII itself is also normally supported everywhere. ASCII is the [suckless](suckless.md)/[LRS](lrs.md)/[KISS](kiss.md) character encoding, recommended and [good enough](good_enough.md) for most programs. + +The ASCII standard assigns a 7 [bit](bit.md) code to each basic text character which gives it a room for 128 characters -- these include lowercase and uppercase [English](english.md) alphabet, decimal digits, other symbols such as a question mark, comma or brackets, plus a few special control characters that represent instructions such as carriage return which are however often obsolete nowadays. Due to most computers working with 8 bit bytes, most platforms store ASCII text with 1 byte per character; the extra bit creates a room for **extending** ASCII by another 128 characters (or creating a variable width encoding such as [UTF-8](utf8.md)). These extensions include unofficial ones such as VISCII (ASCII with additional Vietnamese characters) and more official ones, most notably [ISO 8859](iso_8859.md): a group of standards by [ISO](iso.md) for various languages, e.g. ISO 88592-1 for western European languages, ISO 8859-5 for Cyrillic languages etc. + +The ordering of characters has been kind of cleverly designed to make working with the encoding easier, for example digits start with 011 and the rest of the bits correspond to the digit itself (0000 is 0, 0001 is 1 etc.). + +ASCII was approved as an [ANSI](ansi.md) standard in 1963 and since then underwent many revisions every few years. The current one is summed up by the following table: + +| dec | hex | oct | bin | symbol | +|-----|-----|-----|-------|-----------------------| +| 000 | 00 | 000 |0000000| NUL: null | +| 001 | 01 | 001 |0000001| SOH: start of heading | +| 002 | 02 | 002 |0000010| STX: start of text | +| 003 | 03 | 003 |0000011| ETX: end of text | +| 004 | 04 | 004 |0000100| EOT: end of stream | +| 005 | 05 | 005 |0000101| ENQ: enquiry | +| 006 | 06 | 006 |0000110| ACK: acknowledge | +| 007 | 07 | 007 |0000111| BEL: bell | +| 008 | 08 | 010 |0001000| BS: backspace | +| 009 | 09 | 011 |0001001| TAB: tab (horizontal) | +| 010 | 0a | 012 |0001010| LF: new line | +| 011 | 0b | 013 |0001011| VT: tab (vertical) | +| 012 | 0c | 014 |0001100| FF: new page | +| 013 | 0d | 015 |0001101| CR: carriage return | +| 014 | 0e | 016 |0001110| SO: shift out | +| 015 | 0f | 017 |0001111| SI: shift in | +| 016 | 10 | 020 |0010000| DLE: data link escape | +| 017 | 11 | 021 |0010001| DC1: device control 1 | +| 018 | 12 | 022 |0010010| DC2: device control 2 | +| 019 | 13 | 023 |0010011| DC3: device control 3 | +| 020 | 14 | 024 |0010100| DC4: device control 4 | +| 021 | 15 | 025 |0010101| NAK: not acknowledge | +| 022 | 16 | 026 |0010110| SYN: sync idle | +| 023 | 17 | 027 |0010111| ETB: end of block | +| 024 | 18 | 030 |0011000| CAN: cancel | +| 025 | 19 | 031 |0011001| EM: end of medium | +| 026 | 1a | 032 |0011010| SUB: substitute | +| 027 | 1b | 033 |0011011| ESC: escape | +| 028 | 1c | 034 |0011100| FS: file separator | +| 029 | 1d | 035 |0011101| GS: group separator | +| 030 | 1e | 036 |0011110| RS: record separator | +| 031 | 1f | 037 |0011111| US: unit separator | +| 032 | 20 | 040 |0100000| ` `: space | +| 033 | 21 | 041 |0100001| `!` | +| 034 | 22 | 042 |0100010| `"` | +| 035 | 23 | 043 |0100011| `#` | +| 036 | 24 | 044 |0100100| `$` | +| 037 | 25 | 045 |0100101| `%` | +| 038 | 26 | 046 |0100110| `&` | +| 039 | 27 | 047 |0100111| `'` | +| 040 | 28 | 050 |0101000| `(` | +| 041 | 29 | 051 |0101001| `)` | +| 042 | 2a | 052 |0101010| `*` | +| 043 | 2b | 053 |0101011| `+` | +| 044 | 2c | 054 |0101100| `,` | +| 045 | 2d | 055 |0101101| `-` | +| 046 | 2e | 056 |0101110| `.` | +| 047 | 2f | 057 |0101111| `/` | +| 048 | 30 | 060 |0110000| `0` | +| 049 | 31 | 061 |0110001| `1` | +| 050 | 32 | 062 |0110010| `2` | +| 051 | 33 | 063 |0110011| `3` | +| 052 | 34 | 064 |0110100| `4` | +| 053 | 35 | 065 |0110101| `5` | +| 054 | 36 | 066 |0110110| `6` | +| 055 | 37 | 067 |0110111| `7` | +| 056 | 38 | 070 |0111000| `8` | +| 057 | 39 | 071 |0111001| `9` | +| 058 | 3a | 072 |0111010| `:` | +| 059 | 3b | 073 |0111011| `;` | +| 060 | 3c | 074 |0111100| `<` | +| 061 | 3d | 075 |0111101| `=` | +| 062 | 3e | 076 |0111110| `>` | +| 063 | 3f | 077 |0111111| `?` | +| 064 | 40 | 100 |1000000| `@` | +| 065 | 41 | 101 |1000001| `A` | +| 066 | 42 | 102 |1000010| `B` | +| 067 | 43 | 103 |1000011| `C` | +| 068 | 44 | 104 |1000100| `D` | +| 069 | 45 | 105 |1000101| `E` | +| 070 | 46 | 106 |1000110| `F` | +| 071 | 47 | 107 |1000111| `G` | +| 072 | 48 | 110 |1001000| `H` | +| 073 | 49 | 111 |1001001| `I` | +| 074 | 4a | 112 |1001010| `J` | +| 075 | 4b | 113 |1001011| `K` | +| 076 | 4c | 114 |1001100| `L` | +| 077 | 4d | 115 |1001101| `M` | +| 078 | 4e | 116 |1001110| `N` | +| 079 | 4f | 117 |1001111| `O` | +| 080 | 50 | 120 |1010000| `P` | +| 081 | 51 | 121 |1010001| `Q` | +| 082 | 52 | 122 |1010010| `R` | +| 083 | 53 | 123 |1010011| `S` | +| 084 | 54 | 124 |1010100| `T` | +| 085 | 55 | 125 |1010101| `U` | +| 086 | 56 | 126 |1010110| `V` | +| 087 | 57 | 127 |1010111| `W` | +| 088 | 58 | 130 |1011000| `X` | +| 089 | 59 | 131 |1011001| `Y` | +| 090 | 5a | 132 |1011010| `Z` | +| 091 | 5b | 133 |1011011| `[` | +| 092 | 5c | 134 |1011100| `\` | +| 093 | 5d | 135 |1011101| `]` | +| 094 | 5e | 136 |1011110| `^` | +| 095 | 5f | 137 |1011111| `_` | +| 096 | 60 | 140 |1100000| `` ` ``: backtick | +| 097 | 61 | 141 |1100001| `a` | +| 098 | 62 | 142 |1100010| `b` | +| 099 | 63 | 143 |1100011| `c` | +| 100 | 64 | 144 |1100100| `d` | +| 101 | 65 | 145 |1100101| `e` | +| 102 | 66 | 146 |1100110| `f` | +| 103 | 67 | 147 |1100111| `g` | +| 104 | 68 | 150 |1101000| `h` | +| 105 | 69 | 151 |1101001| `i` | +| 106 | 6a | 152 |1101010| `j` | +| 107 | 6b | 153 |1101011| `k` | +| 108 | 6c | 154 |1101100| `l` | +| 109 | 6d | 155 |1101101| `m` | +| 110 | 6e | 156 |1101110| `n` | +| 111 | 6f | 157 |1101111| `o` | +| 112 | 70 | 160 |1110000| `p` | +| 113 | 71 | 161 |1110001| `q` | +| 114 | 72 | 162 |1110010| `r` | +| 115 | 73 | 163 |1110011| `s` | +| 116 | 74 | 164 |1110100| `t` | +| 117 | 75 | 165 |1110101| `u` | +| 118 | 76 | 166 |1110110| `v` | +| 119 | 77 | 167 |1110111| `w` | +| 120 | 78 | 170 |1111000| `x` | +| 121 | 79 | 171 |1111001| `y` | +| 122 | 7a | 172 |1111010| `z` | +| 123 | 7b | 173 |1111011| `{` | +| 124 | 7c | 174 |1111100| `|` | +| 125 | 7d | 175 |1111101| `}` | +| 126 | 7e | 176 |1111110| `~` | +| 127 | 7f | 177 |1111111| DEL | + +## See Also + +- [Unicode](unicode.md) +- [ASCII art](ascii_art.md) \ No newline at end of file diff --git a/ascii_art.md b/ascii_art.md new file mode 100644 index 0000000..1c1f57f --- /dev/null +++ b/ascii_art.md @@ -0,0 +1,47 @@ +# ASCII Art + +ASCII art is the [art](art.md) of manually creating graphics and images only out of [fixed-width](fixed_width.md) [ASCII](ascii.md) characters. This means no [unicode](unicode.md) or extended ASCII characters are allowed, of course. ASCII art is also, strictly speaking, separate from mere [ASCII rendering](ascii_rendering.md), i.e. automatically rendering a bitmap image with ASCII characters in place of [pixels](pixel.md), and ASCII graphics that utilizes the same techniques as ASCII art but can't really be called art (e.g. computer generated diagrams). Pure ASCII art should make no use of [color](color.md). + +This kind of art used to be a great part of the culture of earliest [Internet](internet.md) communities for a number of reasons imposed largely by the limitations of old computers -- it could be created easily with a text editor and saved in pure text format, it didn't take much space to store or send over a network and it could be displayed on text-only displays and terminals. The principle itself predates computers, people were already making this kind of images with type writers. Nevertheless the art survives even to present day and lives on in the hacker culture, in [Unix](unix.md) communities, on the [Smol Internet](smol_internet.md) etc. ASCII diagram may very well be embedded e.g. in a comment in a source code to explain some spatial concept -- that's pretty [KISS](kiss.md). We, [LRS](lrs.md), highly advocate use of ASCII art whenever it's [good enough](good_enough.md). + +``` + _,,_ + / ';_ + . ( 0 _/ "-._ + |\ \_ /_==-"""' + | |:---' ( + \ \__." ) Steamer + '--_ __--' Duck! + |L_ + + + [] [][][][][] + [][][] [][] + [][] [] + [] XX XX[] + [] XXXX [] + [][] [] + [][][] [][] + [] [][][][][] + + SAF FTW + +^ +| +| _.--._ _.--._ +| .' '. .' '. +|/__________\____________/__________\______ +| \ / \ +| '. .' '. +| `'--'` `'- +| +V +``` + +## See Also + +- [ANSI art](ansi_art.md) +- [pixel art](pixel_art.md) +- [plain text](plain_text.md) +- [cowsay](cowsay.md) +- [figlet](figlet.md) \ No newline at end of file diff --git a/assembly.md b/assembly.md new file mode 100644 index 0000000..40e1f01 --- /dev/null +++ b/assembly.md @@ -0,0 +1,22 @@ +# Assembly + +*GUYS I AM NOT SUCH GREAT AT ASSEMBLY, correct my errors* + +Assembly is, for any given hardware platform ([ISA](isa.md)), the unstructured, lowest levels language -- it maps 1:1 to [machine code](machine_code.md) (the actual CPU instructions) and only differs from actual binary machine code by utilizing a more human readable form. Assembly is compiled by [assembler](assembler.md) into the the machine code. Assembly is **not** a single language, it differs for every architecture, and is therefore not [portable](portability.md)! + +## Typical Assembly Language + +The language is unstructured, i.e. there are no control structures such as `if` or `for` statements: these have to be manually implemented using labels and jump instructions. The typical look of an assembly program is therefore a single column of instructions with arguments, one per line. + +The working of the language reflects the actual hardware architecture -- usually there is a small number of registers (e.g. 16) which may be called something like R0 to R15. These registers are the fastest available memory (faster than the main RAM memory) and are used to perform calculations. Some registers are general purpose and some are special: typically there will be e.g. the FLAGS register which holds various 1bit results of performed operations (e.g. overflow, zero result etc.). Values can be moved between registers and the main memory. + +Instructions are typically written as three-letter abbreviations and follow some unwritten naming conventions so that different assembly languages at least look similar. Common instructions found in most assembly languages are for example: + +- MOV (move): move a number between registers and/or memory. +- JMP (jump): unconditional jump to far away instruction. +- BEQ (branch if equal): jump if result of previous comparison was equality. +- ADD (add): add two numbers. +- NOP (no operation): do nothing (used e.g. for delays). +- CMP (compare): compare two numbers and set relevant flags (typically for a subsequent conditional jump). + +Assembly languages may offer simple helpers such as macros. \ No newline at end of file diff --git a/assertiveness.md b/assertiveness.md new file mode 100644 index 0000000..b83d542 --- /dev/null +++ b/assertiveness.md @@ -0,0 +1,3 @@ +# Assertiveness + +Assertiveness is an [euphemism](euphemism.md) for being a [dick](dick.md). \ No newline at end of file diff --git a/atan.md b/atan.md new file mode 100644 index 0000000..2643028 --- /dev/null +++ b/atan.md @@ -0,0 +1,23 @@ +# Arcus Tangent + +Arcus tangent, written as *atan* or *tan^-1*, is the inverse [function](function.md) to the [tangent](tan.md) function. For given argument *x* (any real number) it returns a number *y* (from -[pi](pi.md)/2 to pi/2) such that *tan(y) = x*. + +**Approximation**: Near 0 *atan(x)* can very rougly be approximated simply by *x*. For a large argument *atan(x)* can be approximated by *pi/2 - 1/x* (as *atan*'s [limit](limit.md) is pi/2). The following formula { created by me ~drummyfish } approximates atan with a [poylnomial](polynomial.md) for non-negative argument with error smaller than 2%: + +*atan(x) ~= (x * (2.96088 + 4.9348 * x))/(3.2 + 3.88496 * x + pi * x^2)* + +``` + | y + pi/2 + + | _..---'''''' + | _.'' + | .' +-----------.+'-+--+--+--+--+--> x + _.' |0 1 2 3 4 5 + _-' | +.--'' | + -pi/2 + + | +``` + +*plot of atan(x)* \ No newline at end of file diff --git a/atheism.md b/atheism.md new file mode 100644 index 0000000..c04acf0 --- /dev/null +++ b/atheism.md @@ -0,0 +1,15 @@ +# Atheism + +*"In this moment I am euphoric ..."* --some retarded atheist + +An atheist is someone who doesn't believe in god or any other similar supernatural beings. + +An especially annoying kind is the **[reddit](reddit.md) atheist** who will DESTROY YOU WITH FACTS AND LOGIC^(TM). These atheists are 14 year old children who think they've discovered the secret of the universe and have to let the whole world know they're atheists who will destroy you with their 200 [IQ](iq.md) [logic](logic.md) and knowledge of all 10 [cognitive biases](cognitive_bias.md) and argument fallacies, while in fact they reside at the [mount stupid](mount_stupid.md) and many times involuntarily appear on other subreddits such as r/iamverysmart and r/cringe. They masturbate to [Richard Dawkins](richard_dawkins.md), love to read [soyentific](soyence.md) studiiiiiies about how race has no biological meaning and think that religion is literally [Hitler](hitler.md). They like to pick easy targets such as [flatearthers](flat_earth.md) and cyberbully them on [YouTube](youtube.md) with the power of SCIENCE and their enormously large thesaurus (they will never use a word that's among the 100000 most common English words). They are so [cringe](cringe.md) you want to [kill yourself](kys.md), but their discussions are sometimes entertaining to read with a bowl of popcorn. + +On a bit more serious note: we've all been there, most people in their teens think they're literal [Einsteins](einstein.md) and then later in life cringe back on themselves. However, some don't grow out of it and stay arrogant, ignorant fucks for their whole lives. The principal mistake of the stance they retain is they try to apply "science" (or whatever it means in their world) to EVERYTHING and reject any other approach to solving problems -- of course, [science](science.md) (the real one) is great, but it's just a tool, and just like you can't fix every problem with a hammer, you can't approach every problem with science. In your daily life you make a million of unscientific decisions and it would be bad to try to apply science to them; you cross the street not because you've read a peer-reviewed paper about it being the most scientifically correct thing to do, but because you feel like doing it, because you believe the drivers will stop and won't run you over. Beliefs, intuition, emotion, non-rationality and even spirituality are and have to be part of life, and it's extremely stupid to oppose these concepts just out of principle. With that said, there's nothing wrong about being a well behaved man who just doesn't feel a belief in any god in his heart, just you know, don't be an idiot. + +Among the greatest minds it is hard to find true atheists, even though they typically have a personal and not easy to describe faith. [Newton](newton.md) was a Christian. [Einstein](einstein.md) often used the word "[God](god.md)" instead of "nature" or "universe"; even though he said he didn't believe in the traditional personal God, he also said that the laws of physics were like books in a library which must have obviously been written by someone or something we can't comprehend. [Nikola Tesla](tesla.md) said he was "deeply religious, though not in the orthodox sense". There are also very hardcore religious people such as [Larry Wall](larry_wall.md), the inventor of [Perl](perl.md) language, who even planned to be a Christian missionary. The "true atheists" are mostly second grade "scientists" who make career out of the pose and make living by writing books about atheism rather than being scientists. + +## See Also + +- [stupidity](stupidity.md) \ No newline at end of file diff --git a/autoupdate.md b/autoupdate.md new file mode 100644 index 0000000..4e8cfc8 --- /dev/null +++ b/autoupdate.md @@ -0,0 +1,3 @@ +# Autoupdate + +Autoupdate is a malicious [software](software.md) [feature](feature.md) that frequently remotely modifies software on the user's device without asking, sometimes silently and many times in a forced manner without the possibility to refuse this modification (typically in [proprietary](proprietary.md) software). This is a manifestation of [update culture](update_culture.md). These remote software modifications are called "updates" to make the user think they are a good thing, but in fact they usually introduce more [bugs](bug.md), [bloat](bloat.md), security vulnerabilities, annoyance (forced reboots etc.) and [malware](malware.md) (even in "[open source](open_source.md)", see e.g. the many projects on [GitHub](github.md) that introduced intentional malware targeted at Russian users during the Russia-Ukraine war). \ No newline at end of file diff --git a/avpd.md b/avpd.md new file mode 100644 index 0000000..572b2a8 --- /dev/null +++ b/avpd.md @@ -0,0 +1,5 @@ +# Avoidant Personality Disorder + +TODO + +In many cases avoiding the problem really is the objectively best solution. \ No newline at end of file diff --git a/backpropagation.md b/backpropagation.md new file mode 100644 index 0000000..5bde5ad --- /dev/null +++ b/backpropagation.md @@ -0,0 +1,85 @@ +# Backpropagation + +{ Dunno if this is completely correct, I'm learning this as I'm writing it. There may be errors. ~drummyfish } + +Backpropagation, or backprop, is an [algorithm](algorithm.md), based on the chain rule of derivation, used in training [neural networks](neural_network.md); it computes the partial derivative (or [gradient](gradient.md)) of the function of the network's error so that we can perform a [gradient descent](gradient_descent.md), i.e. update the weights towards lowering the network's error. It computes the analytical derivative (theoretically you could estimate a derivative numerically, but that's not so accurate and can be too computationally expensive). It is called backpropagation because it works backwards and propagates the error from the output towards the input, due to how the chain rule works, and it's efficient by reusing already computed values. + +## Details + +Consider the following neural network: + +``` + w000 w100 + x0------y0------z0 + \ / \ / \ + \ / \ / \ + \/w010 \/w11O \_E + /\w001 /\w1O1 / + / \ / \ / + / \ / \ / + x1------y1------z1 + w011 w111 +``` + +It has an input layer (neurons *x0*, *x1*), a hidden layer (neurons *y0*, *y1*) and an output layer (neurons *z0*, *z1*). For simplicity there are no biases (biases can easily be added as input neurons that are always on). At the end there is a total error *E* computed from the networks's output against the desired output (training data). + +Let's say the total error is computed as the squared error: *E = squared_error(z0) + squared_error(z1) = 1/2 * (z0 - z0_desired)^2 + 1/2 * (z1 - z1_desired)^2*. + +We can see each non-input neuron as a function. E.g. the neuron *z0* is a function *z0(x) = z0(a(z0s(x)))* where: + +- *z0s* is the sum of inputs to the neuron, in this case *z0s(x) = w100 * y0(x) + +110 * y1(x)* +- *a* is the activation function, let's suppose the normally used [logistic function](logistic_function.md) *a(x) = 1/(1 + e^x)*. + +If you don't know what the fuck is going on see [neural networks](neural_network.md) first. + +What is our goal now? To find the **[partial derivative](partial_derivative.md) of the whole network's total error function** (at the current point defined by the weights), or in other words the **gradient** at the current point. I.e. from the point of view of the total error (which is just a number output by this system), the network is a function of 8 variables (weights *w000*, *w001*, ...) and we want to find a derivative of this function in respect to each of these variables (that's what a partial derivative is) at the current point (i.e. with current values of the weights). This will, for each of these variables, tell us how much (at what rate and in which direction) the total error changes if we change that variable by certain amount. Why do we need to know this? So that we can do a [gradient descent](gradient_descent.md), i.e. this information is kind of a direction in which we want to move (change the weights and biases) towards lowering the total error (making the network compute results which are closer to the training data). + +Backpropagation is based on the **chain rule**, a rule of derivation that equates the derivative of a function composition (functions inside other functions) to a product of derivatives. This is important because by converting the derivatives to a product we will be able to **reuse** the individual factors and so compute very efficiently and quickly. + +Let's write derivative of *f(x)* with respect to *x* as *D{f(x),x}*. The chain rule says that: + +*D{f(g(x)),x} = D{f(g(x)),g(x)} * D{g(x),x}* + +Notice that this can be applied to any number of composed functions, the product chain just becomes longer. + +Let's get to the computation. Backpropagation work by going "backwards" from the output towards the input. So, let's start by computing the derivative against the weight *w100*. It will be a specific number; let's call it *'w100*. Derivative of a sum is equal to the sum of derivatives: + +*'w100 = D{E,w100} = D{squared_error(z0),w100} + D{squared_error(z0),w100} = D{squared_error(z0),w100} + 0* + +(The second part of this sum became 0 because with respect to *w100* it is a constant.) + +Now we can continue and utilize the chain rule: + +*'w100 = D{E,w100} = D{squared_error(z0),w100} = D{squared_error(z0(a(z0s))),w100} = D(squared_error(z0),z0) * D{a(z0s),z0s} * d{z0s,w100}* + +We'll now skip the intermediate steps, they should be easy if you can do derivatives. The final results is: + +*'w100 = (z0_desired - z0) * (z0s * (1 - z0s)) * y0* + +**Now we have computed the derivative against w100**. In the same way can compute *'w101*, *'w110* and *'w111* (weights leading to the output layer). + +Now let's compute the derivative in respect to *w000*, i.e. the number *'w000*. We will proceed similarly but the computation will be different because the weight *w000* affects both output neurons ('z0' and 'z1'). Again, we'll use the chain rule. + +*w000 = D{E,w000} = D(E,y0) * D{a(y0s),y0s} * D{y0s,w000}* + +*D(E,y0) = D{squared_error(z0),y0} + D{squared_error(z1),y0}* + +Let's compute the first part of the sum: + +*D{squared_error(z0),y0} = D{squared_error(z0),z0s} * D{squared_error(z0s),y0}* + +*D{squared_error(z0),z0s} = D{squared_error(z0),z0} * D{a(z0s)),z0s}* + +Note that this last equation uses already computed values which we can reuse. Finally: + +*D{squared_error(z0s),y0} = D{squared_error(w100 * y0 + w110 * y1),y0} = w100* + +And we get: + +*D{squared_error(z0),y0} = D{squared_error(z0),z0} * D{a(z0s)),z0s} * w100* + +And so on until we get all the derivatives. + +Once we have them, we multiply them all by some value (**learning rate**, a distance by which we move in the computed direction) and subtract them from the current weights by which we perform the gradient descent and lower the total error. + +Note that here we've only used one training sample, i.e. the error *E* was computed from the network against a single desired output. If more example are used in a single update step, they are usually somehow averaged. diff --git a/bbs.md b/bbs.md new file mode 100644 index 0000000..4e5e649 --- /dev/null +++ b/bbs.md @@ -0,0 +1,19 @@ +# BBS + +{ I am too young to remember this shit so I'm just writing what I've read on the web. ~drummyfish } + +Bulletin board system (BBS) is, or rather used to be, a kind of [server](server.md) that hosts a community of users who connect to it via [terminal](terminal.md), who exchange messages, files, play [games](game.md) and otherwise interact -- BBSes were mainly popular before the invention of [web](www.md), i.e. from about 1978 to mid 1990s, however some still exist today. BBSes are powered by special BBS [software](software.md) and the people who run them are called sysops. + +Back then people connected to BBSes via dial-up [modems](modem.md) and connecting was much more complicated than connecting to a server today: you had to literally dial the number of the BBS and you could only connect if the BBS had a free line. **Early BBSes weren't normally connected through Internet** but rather through other networks like [UUCP](uucp.md) working through phone lines. I.e. a BBS would have a certain number of modems that defined how many people could connect at once. It was also expensive to make calls into other countries so BBSes were more of a local thing, people would connect to their local BBSes. Furthermore these things ran often on non-[multitasking](multitasking.md) systems like [DOS](dos.md) so allowing multiple users meant the need for having multiple computers. The boomers who used BBSes talk about great adventure and a sense of intimacy, connecting to a BBS meant the sysop would see you connecting, he might start chatting with you etc. Nowadays the few existing BBSes use protocols such as [telnet](telnet.md), nevertheless there are apparently about 20 known dial-up ones in north America. Some BBSes evolved into more modern communities based e.g. on [public access Unix](pubnix.md) systems -- for example [SDF](sdf.md). + +A BBS was usually focused on a certain topic such as technology, fantasy [roleplay](rolaplay.md), dating, [warez](warez.md) etc., they would typically greet the users with a custom themed [ANSI art](ansi_art.md) welcome page upon login -- it was pretty cool. + +The first BBS was CBBS (computerized bulletin board system) created by Ward Christensen and Randy Suess in 1978 during a blizzard storm -- it was pretty primitive, e.g. it only allowed one user to be connected at the time. After publication of their invention, BBSes became quite popular and the number of them grew to many thousands -- later there was even a magazine solely focused on BBSes (*BBS Magazine*). BBSes would later group into larger networks that allowed e.g. interchange of mail. The biggest such network was [FidoNet](fidonet.md) which at its peak hosted about 35000 nodes. + +{ Found some list of BBSes at http://www.synchro.net/sbbslist.html. ~drummyfish } + +## See Also + +- [public access Unix](pubnix.md) +- [Usenet](usenet.md) +- [tildeverse](tildeverse.md) \ No newline at end of file diff --git a/beauty.md b/beauty.md new file mode 100644 index 0000000..d89f78a --- /dev/null +++ b/beauty.md @@ -0,0 +1,21 @@ +# Beauty + +Beauty is an attribute that makes something extremely appealing. In [technology](technology.md), [engineering](engineering.md), [mathematics](math.md) and other [science](science.md) beauty is, despite it's relative vagueness and subjectivity, an important aspect of design, and in fact this "mathematical beauty" has lots of times some clearly defined shapes -- for example [simplicity](kiss.md) is mostly considered beautiful. + +Beauty can perhaps be seen as a [heuristic](heuristic.md), a touch of intuition that guides the expert in exploration of previously unknown fields, as we have come to learn that the greatest discoveries tend to be very beautiful. Indeed, beginners and [noobs](noob.md) are mostly concerned with learning hard facts, learning standards and getting familiar with already known ways of solving known problems, they often aren't able to recognize what's beautiful and what's ugly. But as one gets more and more experienced and find himself near the borders of current knowledge, there is suddenly no guidance but intuition, beauty, to suggest ways forward, and here one starts to get the feel for beauty. At this point the field, even if highly exact and rigorous, has become an [art](art.md). + +What is beautiful then? As stated, there is a lot of subjectivity, but generally the following attributes are correlated with beauty: + +- **[simplicity](minimalism.md)**, typically finding simplicity in complexity, e.g. a very short formula or algorithm that describes an infinitely complex [fractal](fractal.md) shape, a simple but valuable equation in physics (*e = m * c^2*), a short computer program that yields rich results ([demoscene](demoscene.md), [code golfing](golf.md), [suckless](suckless.md), ...). +- **generality**, i.e. if a simple equation can describe many problems, not just a specific case. +- **lack of exceptions**, i.e. when our equation works without having to deal with special cases (in programming represented by `if-then` branches). +- **[symmetry](symmetry.md)**, i.e. when we can e.g. swap variables in the equation and get some kind of opposite result. +- **aesthetics**, either of the equation itself or the generated thing (fractals, attractors, ...). +- TODO + +Examples of beautiful things include: + +- **Euler's identity**, an equation often cited as the most beautiful in mathematics: *e^{i*pi} + 1 = 0*. It is simple and contains many of the most important numbers: *e*, *pi*, *i* 1 and 0. +- **[minimalist software](suckless.md)**, **[Unix philosophy](unix_philosophy.md)** +- [fractals](fractal.md) TODO +- [bytebeat](bytebeat.md) diff --git a/bill_gates.md b/bill_gates.md new file mode 100644 index 0000000..eb4aa2b --- /dev/null +++ b/bill_gates.md @@ -0,0 +1,9 @@ +# Bill Gates + +William "Bill" Gates (28.10.1955 -- hopefully soon) is a [mass murderer and rapist](entrepreneur.md) (i.e. [capitalist](capitalism.md)) who established and led the terrorist organization [Micro$oft](microsoft.md). + +He is really dumb, only speaks one language and didn't even finish university. He also has no moral values, but that goes without saying for any rich businessman. He was owned pretty hard in [chess](chess.md) by Magnus Carlsen on some shitty TV show. + +Bill was mentally retarded as a child and as such had to attend a private school. In adolescence he raped little children. He never really understood programming but with a below average intelligence he had a good chance to succeed in [business](capitalism.md). Thanks to his family connections he got to Harvard where he met [Steve Ballmer](steve_ballmer.md) -- later he dropped out of the school due to his low intelligence. + +In 1975 he founded [Micro$oft](microsoft.md), a [malware](malware.md) company named after his dick. By a sequence of extremely lucky events combined with a few dick moves by Bill the company then became successful: when around the year 1980 [IBM](ibm.md) was creating the [IBM PC](ibm_pc.md), they came to Bill because they needed an [operating system](os.md). He lied to them that he had one and sold them a license even though at the time he didn't have any OS (lol). After that he went to a programmer named Tim Paterson and basically stole (bought for some penny) his OS named QDOS and gave it to IBM, while still keeping ownership of the OS (he only sold IBM a license to use it, not exclusive rights for it). He basically fucked everyone for money and got away with it, the American way. For this he is admired by Americans. \ No newline at end of file diff --git a/billboard.md b/billboard.md new file mode 100644 index 0000000..839bd4c --- /dev/null +++ b/billboard.md @@ -0,0 +1,33 @@ +# Billboard + +In [3D](3d.md) [computer graphics](graphics.md) billboard is a flat image placed in the scene that rotates so that it's always facing the camera. Billboards used to be greatly utilized instead of actual [3D models](3d_model.md) in old [games](game.md) thanks to being faster to render (and possibly also easier to create than full 3D models), but we can still encounter them even today and even outside retro games, e.g. [particle systems](particle_system.md) are normally rendered with billboards (each particle is one billboard). Billboards are also commonly called *[sprites](sprite.md)*, even though that's not exactly accurate. + +There are two main types of billboards: + +- Ones **rotating only about vertical axis**, i.e. billboards that change only their [yaw](yaw.md), they only face the camera in a top-down view of the scene. Such sprite may deform on the screen (when the camera is at different height level) just like 3D models do and when viewed completely from above will disappear completely. This may in some situations look better than other options (e.g. in [games](game.md) enemies won't appear lying on their back when seen from above). +- **Freely rotating** ones, i.e. ones that change all three [Euler angles](euler_angle.md) so that they ALWAYS face the camera from any possible angle. There may further be other two subtypes: billboards that align themselves with the camera's projection plane (they simply rotate themselves in the same way as the camera) which always end up on the screen as an undeformed and unrotated image, and billboards that face themselves towards the camera's position and copy the camera's [roll](roll.md) (though these may seem like two same things, they are not, for the latter we need to know the camera and billboard's positions, for the former we only need the camera's rotation). The former is simpler to implement and may also look better, so we normally don't even consider the latter. + +Some billboards also choose their image based on from what angle they're viewed (e.g. an enemy in a game viewed from the front will use a different image than when viewed from the side, as seen e.g. in [Doom](doom.md)). Also some billboards intentionally don't scale and keep the same size on the screen, for example health bars in some games. + +In older software billboards were implemented simply as image [blitting](blit.md), i.e. the billboard's scaled image would literally be copied to the screen at the appropriate position (this would implement the freely rotating billboard). Nowadays when rendering 3D models is no longer really considered harmful to performance and drawing pixels directly is less convenient, billboards are more and more implemented as so called [textured](texture.md) [quads](quad.md), i.e. they are really a flat square 3D model that may pass the same pipeline as other 3D models (even though in some frameworks they may actually have different [vertex shaders](vertex_shader.md) etc.) and that's simply rotated to face the camera in each frame (in [modern](modern.md) frameworks there are specific functions for this). + +[Fun](fun.md) fact: in the old games such as [Doom](doom.md) the billboard images were made from photographs of actual physical models from clay. It was easier and better looking than using the primitive 3D software that existed back then. + +## Implementation Details + +The following are some possibly useful things for implementing billboards. + +The billboard's position on the screen can be computed by projecting its center point in [world coordinates](world_space.md) with [modelview](modelview.md) and [projection](projection.md) matrices, just as we project vertices of 3D models. + +The billboard's size on the screen shall due to [perspective](perspective.md) be multiplied by *1 / (tan(FOV / 2) * z)* where *FOV* is the camera's [field of view](fov.md) and *z* is the billboard's distance from camera's projection plane (which is NOT equal to the mere distance from the camera's position, that would create a [fisheye](fisheye.md) lens effect -- the distance from the projection plane can be obtained from the above mentioned [projection matrix](projection.md)). (If the camera's FOV is different in horizontal and vertical directions, then also the billboard's size will change differently in these directions.) + +For billboards whose images depends on viewing angle we naturally need to compute the angle. We may do this either in 2D or 3D -- most games resort to the simpler 2D case (only considering viewing angle in a single plane parallel to the floor), in which case we may simply use the combination of [dot product](dot_product.md) and [cross product](cross_product.md) between the [normalized](normalization.md) billboard's direction vector and a normalized vector pointing from the billboard's position towards the camera's position (dot product gives the [cosine](cos.md) of the angle, the sign of cross product's vertical component will give the rest of the information needed for determining the exact angle). Once we have the angle, we [quantize](quantization.md) (divide) it, i.e. drop its precision depending on how many directional images we have, and then e.g. with a [switch](switch.md) statement pick the correct image to display. For the 3D case (possible different images from different 3D positions) we may first transform the sprite's 3D facing vector to [camera space](camera_space.md) with appropriate matrix, just like we transform 3D models, then this transformed vector will (again after quantization) directly determine the image we should use. + +When implementing the free rotating billboard as a 3D quad that's aligning with the camera projection plane, we can construct the [model matrix](model_matrix.md) for the rotation from the camera's normalized directional vectors: *R* is camera's right vector, *U* is its up vector and *F* is its forward vector. The matrix simply transforms the quad's vertices to the coordinate system with bases *R*, *U* and *F*, i.e. rotates the quad in the same way as the camera. When using [row vectors](row_vector.md), the matrix is following: + +``` +R.x R.y R.z 0 +U.x U.y U.z 0 +F.x F.y F.z 0 +0 0 0 1 +``` \ No newline at end of file diff --git a/binary.md b/binary.md new file mode 100644 index 0000000..d788eae --- /dev/null +++ b/binary.md @@ -0,0 +1,34 @@ +# Binary + +Binary refers to to having two choices; in [computer science](compsci.md) binary refers to the base 2 numeral system, i.e. a system of writing numbers with only two symbols, usually [1](one.md)s and [0](zero.md)s. Binary is used in computers because this system is easy to implement in electronics (a switch can be on or off, i.e. 1 or 0; systems with more digits were tried but unsuccessful, they failed miserably in reliability). The word *binary* is also sometimes used as a synonym for a native [executable](executable.md) program. + +One binary digit can be used to store exactly 1 [bit](bit.md) of [information](information.md). So the number of places we have for writing a binary number (e.g. in computer memory) is called a number of bits or bit **width**. A bit width *N* allows for storing 2^N values (e.g. with 2 bits we can store 4 values: 0, 1, 2 and 3). + +At the basic level binary works just like the [decimal](decimal.md) (base 10) system we're used to. While the decimal system uses powers of 10, binary uses powers of 2. + +For **example** let's have a number that's written as 10135 in decimal. The first digit from the right (5) says the number of 10^(0)s (= 1) in the number, the second digit (3) says the number of 10^(1)s (= 10), the third digit (1) says the number of 10^(2)s (= 100) etc. Similarly if we now have a number **100101** in binary, the first digit from the right (1) says the number of 2^(0)s (= 1), the second digit (0) says the number of 2^(1)s (= 2), the third digit (1) says the number of 2^(2)s (=4) etc. Therefore this binary number can be **converted to decimal** by simply computing 1 * 2^0 + 0 * 2^1 + 1 * 2^2 + 0 * 2^3 + 0 * 2^4 + 1 * 2^5 = 1 + 4 + 32 = **37**. + +To **convert from decimal** to binary we can use a simple [algorithm](algorithm.md) that's derived from the above. Let's say we have a number *X* we want to write in binary. We will write digits from right to left. The first (rightmost) digit is the remainder after integer division of *X* by 2. Then we divide the number by 2. The second digit is again the remainder after division by 2. Then we divide the number by 2 again. This continues until the number is 0. For example let's convert the number 22 to binary: first digit = 22 % 2 = **0**; 22 / 2 = 11, second digit = 11 % 2 = **1**; 11 / 2 = 5; third digit = 5 % 2 = **1**; 5 / 2 = 2; 2 % 2 = **0**; 2 / 2 = 1; 1 % 2 = **1**; 1 / 2 = 0. The result is **10110**. + +TODO: operations in binary + +In binary it is very simple and fast to divide and multiply by (powers of) 2, just as it is simply to divide and multiple by (powers of) 10 in decimal (we just shift the radix point, e.g. the binary number 1011 multiplied by 4 is 101100, we just added two zeros at the end). This is why as a programmer **you should prefer working with powers of two**. + +Binary can be very easily converted to and from [hexadecimal](hexadeciaml.md) and [octal](octal.md) because 1 hexadecimal (octal) digit always maps to exactly 4 (3) binary digits. E.g. the hexadeciaml number F0 is 11110000 in binary. + +We can work with the binary representation the same way as with decimal, i.e. we can e.g. write negative numbers such as -110101 or [rational numbers](rational_number.md) such as 1011.001101. However in a computer memory there are no other symbols than 1 and 0, so we can't use extra symbols such as *-* or *.* to represent such values. So if we want to represent more numbers than non-negative integers, we literally have to only use 1s and 0s and choose a specific **representation**, or **format** of numbers -- there are several formats for representing e.g. [signed](signed.md) (potentially negative) or rational numbers, each with pros and cons. The following are the most common number representations: + +- **[two's complement](twos_complement.md)**: Allows storing integers, both positive, negative and zero. It is **probably the most common representation** of integers because of its great advantages: basic operations (+, -, *) are performed exactly the same as with "normal" binary numbers, and there is no negative zero (which would be an inconvenience and waste of memory). Inverting a number (from negative to positive and vice versa) is done simply by inverting all the bits and adding 1. The leftmost bit signifies the number's sign (0 = +, 1 = -). +- **[sign-magnitude](sign_magnitude.md)**: Allows storing integers, both positive, negative and zero. It's pretty straightforward: the leftmost bit in a number serves as a sign, 0 = +, 1 = -, and the rest of the number is the distance from zero in "normal" representation. So e.g. 0011 is 3 while 1011 is -3. The disadvantage is there are two values for zero (positive, 0000 and [negative](negative_zero.md), 1000) which wastes a value and presents a computational inconvenience, and operations with these numbers are more complicated and slower (checking the sign requires extra code). +- **[one's complement](ones_complement.md)**: Allows storing integers, both positive, negative and zero. The leftmost bit signifies a sign, in the same way as with sign-magnitude, but numbers are inverted differently: a positive number is turned into negative (and vice versa) by inverting all bits. So e.g. 0011 is 3 while 1100 is -3. The disadvantage is there are two values for zero (positive, 0000 and [negative](negative_zero.md), 1111) which wastes a value and presents a computational inconvenience, and some operations with these numbers may be more complex. +- **[fixed point](fixed_point.md)**: Allows storing [rational numbers](rational_number.md) (fractions), i.e. numbers with a radix point (such as 1101.011), which can also be positive, negative or zero. It works by supposing a radix point at some fixed position in the binary representation, e.g. if we have an 8 bit number, we may consider 5 leftmost bits to represent the whole part and 3 rightmost bits to be the fractional part (so e.g the number 11010110 represents 11010.110). The advantage here is extreme simplicity (we can use normal integer numbers as fixed point simply by imagining a radix point). The disadvantage may be low precision and small range of representable values. +- **[floating point](float.md)**: Allows storing [rational numbers](rational_number.md) in great ranges, both positive, negative and zero, plus some additional values such as [infinity](infinity.md) and *[not a number](nan.md)*. It allows the radix point to be shifted which gives a potential for storing extremely big and extremely small numbers at the same time. The disadvantage is that float is extremely complex, [bloated](bloat.md), wastes some values and for fast execution requires a special hardware unit (which most "normal" computers nowadays have, but are missing e.g. in some [embedded systems](embedded.md)). + +As anything can be represented with numbers, binary can be used to store any kind of information such as text, images, sounds and videos. See [data structures](data_structure.md) and [file formats](file_format.md). + +## See Also + +- [bit](bit.md) +- [hexadecimal](hexadeciaml.md) +- [data structure](data_structure.md) +- [data type](data_type.md) \ No newline at end of file diff --git a/blender.md b/blender.md new file mode 100644 index 0000000..4f232ad --- /dev/null +++ b/blender.md @@ -0,0 +1,5 @@ +# Blender + +Blender is an "[open-source](open_source.md)" 3D modeling and [rendering](rendering.md) [software](software.md) -- one of the most powerful and "feature-rich" ones, even compared to [proprietary](proprietary.md) competition -- used not only by the [FOSS](foss.md) community, but also the industry (commercial [games](game.md), movies etc.), which is an impressive achievement in itself, however Blender is also a [capitalist](capitalist.md) software suffering from many not-so-nice features such as [bloat](bloat.md). + +After version 2.76 Blender started REQUIRING [OpenGL](opengl.md) 2.1 due to its "[modern](modern.md)" [EEVEE](eevee.md) renderer, deprecating old machines and giving a huge fuck you to all users with incompatible hardware (for example the users of [RYF](ryf.md) software). This new version also stopped working with the [free](free_software.md) [Nouveau](nouvea.md) driver, forcing the users to use NVidia's proprietary drivers. Blender of course doesn't at all care about this. { I've been forced to use the extremely low FPS [software](sw_rendering.md) GL version of Blender after 2.8. ~drummyfish } \ No newline at end of file diff --git a/bloat.md b/bloat.md new file mode 100644 index 0000000..003ee87 --- /dev/null +++ b/bloat.md @@ -0,0 +1,20 @@ +# Bloat + +Bloat is a very wide term that in the context of software and technology means extreme growth in terms of source code size, complexity, number of [dependencies](dependency.md), useless features and resource usage, all of which lead to inefficient, badly designed technology with bugs and [security](security.md) vulnerabilities, as well as **loss of [freedom](free_software.md)**, waste of human effort and great obscurity and ugliness. Bloat is extremely bad and one of the greatest technological issues of today. Creating bloat is bad engineering at it worst and unfortunately it is what's absolutely taking over all technology nowadays, mostly due to [capitalism](capitalism.md), commercialization, consumerism and incompetent people trying to take on jobs they are in no way qualified to do. + +[LRS](lrs.md), [suckless](suckless.md) and some others small groups are trying to address the issue and write software that is good, minimal, safe, efficient and well functioning. Nevertheless our numbers are very small and in this endeavor we are basically standing against the whole world and the most powerful tech corporations. + +One of a very frequent questions you may hear a noob ask is **"How can bloat limit software freedom if such software has a [free](free_software.md) license?"** Bloat de-facto limits some of the four essential freedoms (to use, study, modify and share) required for a software to be free. A free license grants these freedoms legally, but if some of those freedoms are subsequently limited by other circumstances, the software becomes effectively less free. It is important to realize that **complexity itself goes against freedom** because a more complex system will inevitably reduce the number of people being able to execute freedoms such as modifying the software (the number of programmers being able to understand and modify a trivial program is much greater than the number of programmers being able to understand and modify a highly complex million [LOC](loc.md) program). As the number of people being able to execute the basic freedom drops, we're approaching the scenario in which the software is de-facto controlled by a small number of people who can (e.g. due to the cost) effectively study, modify and maintain the program -- and a program that is controlled by a small group of people (e.g. a corporation) is by definition [proprietary](proprietary.md). If there is a web browser that has a free license but you, a lone programmer, can't afford to study it, modify it significantly and maintain it, and your friends aren't able to do that either, when the only one who can practically do this is the developer of the browser himself and perhaps a few other rich corporations that can pay dozens of full time programmers, then such browser cannot be considered free as it won't be shaped to benefit you, the user, but rather the developer, a corporation. + +## Example of Bloat + +The following is a list of software usually considered a good example of bloat. However keep in mind that bloat is a relative term, for example [vim](vim.md) can be seen as a minimalist suckless editor when compared to mainstream software ([IDEs](ide.md)), but at the same time it's pretty bloated when compared to strictly [suckless](suckless.md) programs. + +- [Web](web.md) since the onset of "web 2.0" has been steadily becoming more and more bloated with things such as Adobe Flash and [JavaScript](javascript.md). By today the situation about web bloat is reaching almost unbearable levels, especially in [modern](modern.md) sites such as [YouTube](youtube.md). For a great read see [The Website Obesity Crisis](https://idlewords.com/talks/website_obesity.htm). +- Ads, [spyware](spyware.md), [DRM](drm.md), anti-cheats, anti-viruses, anti-repair and other anti-user "features" are bloat. +- Desktop environments such as [KDE](kde.md) and [GNOME](gnome.md). The concept of a [desktop environment](de.md) itself is often considered bloat. +- [Windows](windows.md): one of the best examples of how software should NOT be done +- [Blender](blender.md): quite useful [FOSS](foss.md) 3D editor which however integrates things like a whole video editor, game engine, several renderers, scripting language with text editor and so on +- [CMake](cmake.md): gigantic build system that stands above other build systems (lol) +- [Electron](electron.md): [GUI](gui.md) [framework](framework.md) infamous for its huge resource consumption +- [glibc](glibc.md): TODO \ No newline at end of file diff --git a/bloat_monopoly.md b/bloat_monopoly.md new file mode 100644 index 0000000..d319822 --- /dev/null +++ b/bloat_monopoly.md @@ -0,0 +1,7 @@ +# Bloat Monopoly + +Bloat monopoly is an exclusive control over or de-facto ownership of [software](software.md) not by legal means but by means of [bloat](bloat.md). I.e. even if given sofware is [FOSS](foss.md) (that is its source code is public and everyone has basic rights to it), it can still be made **practically** controlled exclusively by the developer because the developer is the only one with enough resources and/or know-how to be able to execute the basic rights such as meaningful modifications of the software. + +Bloat monopoly is [capitalism](capitalism.md)'s bypass of [free](free.md) licenses and accommodation to their popularity. With bloat monopoly capitalists can stick an [FOSS](foss.md) license to their software, get an automatic approval of most "open-source" fans as well as their free work time, while really staying in control almost to the same degree as with [proprietary](proprietary.md) software. + +Examples of bloat monopoly include web browsers, [Android](android.md) etc. This software is characteristic by its difficulty to be even compiled, yet alone understood and meaningfully modified, by its astronomical [maintenance](maintenance.md) cost that is hard to pay for volunteers, and by aggressive [update culture](update_culture.md). \ No newline at end of file diff --git a/brain_software.md b/brain_software.md new file mode 100644 index 0000000..d50cea9 --- /dev/null +++ b/brain_software.md @@ -0,0 +1,9 @@ +# Brain Software + +Brain [software](software.md) is kind of a fun idea of software that runs on the human brain as opposed to a [computer](computer.md). This removes the [dependency](dependency.md) on computers and highly increases freedom. Of course, this also comes with a huge drop of computational power :) However, aside from being a fun idea to explore, this kind of software and "architectures" may become interesting from the perspective of [freedom](free_software.md) and [primitivism](primitivism.md) (especially when the technological [collapse](collapse.md) seems like a real danger). + +Primitive tools helping the brain compute, such as pen and paper or printed out mathematical tables, may be allowed. + +Example of brain software can be the [game](game.html) of [chess](chess.md). Chess masters can easily play the game without a physical chess board, only in their head, and they can play games with each other by just saying the moves out loud. They may even just play games with themselves, which makes chess a deep, entertaining game that can be 100% contained in one's brain. Such game can never be taken away from the person, it can't be altered by corporations, it can't become unplayable on new [hardware](hardware.md) etc., making it free to the greatest extent. + +One may think of a pen and paper computer with its own simple instruction set that allows general purpose programming. This instruction set may be designed to be well interpretable by human and it may be accompanied by tables printed out on paper for quick lookup of operation results -- e.g. a 4 bit computer might provide a 16x16 table with precomputed multiplication results which would help the person execute the multiplication instruction within mere seconds. \ No newline at end of file diff --git a/brainfuck.md b/brainfuck.md new file mode 100644 index 0000000..4bba6ba --- /dev/null +++ b/brainfuck.md @@ -0,0 +1,92 @@ +# Brainfuck + +Brainfuck is an extremely simple, untyped [esoteric programming language](esoland.md); simple by its specification (consisting only of 8 commands) but intentionally very hard to program in. It works similarly to a pure [Turing machine](turing_machine.md). In a way it is kind of [beautiful](beauty.md) by its [simplicity](minimalism.md). It is very easy to write your own brainfuck [interpreter](interpreter.md). + +There exist [self-hosted](self_hosting.md) brainfuck interpreters which is pretty fucked up. + +The language is based on a 1964 language P´´ which was published in a mathematical paper; it is very similar to brainfuck except for having no [I/O](io.md). + +Brainfuck has seen tremendous success in the [esolang](esolang.md) community as the **lowest common denominator language**: just as mathematicians use [Turing machines](turing_machine.md) in proofs, esolang programmers use brainfuck in similar ways -- many esolangs just compile to brainfuck or use brainfuck in proofs of [Turing completeness](turing_complete.md) etc. This is thanks to brainfuck being an actual, implemented and working language reflecting real computers, not just a highly abstract mathematical model with many different variants. For example if one wants to encode a program as an integer number, we can simply take the binary representation of the program's brainfuck implementation. + +In [LRS](lrs.md) programs brainfuck may be seriously used as a super simple [scripting language](script.md). + +## Specification + +The "vanilla" brainfuck operates as follows: + +We have a linear memory of **cells** and a **data pointer** which initially points to the 0th cell. The size and count of the cells is implementation-defined, but usually a cell is 8 bits wide and there is at least 30000 cells. + +A program consists of these possible commands: + +- `+`: increment the data cell under data pointer +- `-`: decrement the data cell under data pointer +- `>`: move the data pointer to the right +- `<`: move the data pointer to the left +- `[`: jump after corresponding `]` if value under data pointer is zero +- `]`: jump after corresponding `[` if value under data pointer is not zero +- `.`: output value under data pointer as an ASCII character +- `,`: read value and store it to the cell under data pointer + +## Implementation + +This is a very simple [C](c.md) implementation of brainfuck: + +``` +#include + +#define CELLS 30000 + +const char program[] = ",[.-]"; // your program here + +int main(void) +{ + char tape[CELLS]; + unsigned int cell = 0; + const char *i = program; + int bDir, bCount; + + while (*i != 0) + { + switch (*i) + { + case '>': cell++; break; + case '<': cell--; break; + case '+': tape[cell]++; break; + case '-': tape[cell]--; break; + case '.': putchar(tape[cell]); fflush(stdout); break; + case ',': scanf("%c",tape + cell); break; + case '[': + case ']': + if ((tape[cell] == 0) == (*i == ']')) + break; + + bDir = (*i == '[') ? 1 : -1; + bCount = 0; + + while (1) + { + if (*i == '[') + bCount += bDir; + else if (*i == ']') + bCount -= bDir; + + if (bCount == 0) + break; + + i += bDir; + } + + break; + + default: break; + } + + i++; + } +} + +``` + +## Variants + +TODO \ No newline at end of file diff --git a/bs.md b/bs.md new file mode 100644 index 0000000..bc4f70d --- /dev/null +++ b/bs.md @@ -0,0 +1,3 @@ +# BS + +[Bullshit](bullshit.md). \ No newline at end of file diff --git a/bullshit.md b/bullshit.md new file mode 100644 index 0000000..103b7e0 --- /dev/null +++ b/bullshit.md @@ -0,0 +1 @@ +# Bullshit \ No newline at end of file diff --git a/bytebeat.md b/bytebeat.md new file mode 100644 index 0000000..c7b65a2 --- /dev/null +++ b/bytebeat.md @@ -0,0 +1,68 @@ +# Bytebeat + +Bytebeat is a procedural [chiptune](chiptune.md)/8bit style music generated by a short expression in a programming language; it was discovered/highlighted in 2011 by [Viznut](viznut.md) (author of [countercomplex](countercomplex.md) blog) and others, and the technique capable of producing quite impressive music by single-line code has since caught the attention of many programmers, especially in [demoscene](demoscene.md). There has even been a [paper](https://arxiv.org/abs/1112.1368) written about bytebeat. + +This is a [beautiful](beauty.md) [hack](hacking.md) for [LRS](lrs.md)/[suckless](suckless.md) programmers because it takes quite a tiny amount of code, space and effort to produce nice music, e.g. for [games](game.md) (done e.g. by [Anarch](anarch.md)). + +8bit samples corresponding to `unsigned char` are typically used with bytebeat. The formulas take advantage of [overflows](overflow.md) that create rhythmical patterns with potential other operations such as multiplication, division, addition, squaring, bitwise/logical operators and conditions adding more interesting effects. + +Bytebeat also looks kind of cool when rendered as an image (outputting pixels instead of musical samples). + +## How To + +Quick experiments with bytebeat can be performed with online tools that are easy to find on the [web](www.md), these usually use [JavaScript](javascript.md). + +Nevertheless, traditionally we use [C](c.md) for bytebeat. We simply create a loop with a *time* variable (`i`) and inside the loop body we create our bytebeat expression with the variable to compute a char that we output. + +A simple "workflow" for bytebeat "development" can be set up as follows. Firstly write a C program: + +``` +#include + +int main(void) +{ + for (int i = 0; i < 10000; ++i) + putchar( + i / 3 // < bytebeat formula here + ); + + return 0; +} +``` + +Now compile the program and play its output e.g. like this: + +``` +gcc program.c && ./a.out | aplay +``` + +Now we can just start experimenting and invent new music by fiddling with the formula indicated by the comment. + +General tips/tricks and observations are these: + +- Outputting the variable `i` creates a periodical saw-shaped beat, **multiplication/division decreases/increases the speed, addition/subtraction shifts the phase backward/forward**. +- Squaring (and other powers) create a **wah-wah effect**. +- Crazier patterns can be achieved by **using the variable in places of numerical constants**, e.g. `i << ((i / 512) % 8)` (shifting by a value that depends on the variable). +- Modulo (`%`) increases the frequency and **decreases volume** (limits the wave peak). +- So called **Sierpinski harmonies** are often used melodic expressions of the form `i*N & i >> M`. +- Bitwise and (`&`) can add distortion (create steps in the wave). +- A **macro structure** of the song (silent/louds parts, verse/chorus, ...) can be achieved by combining multiple patterns with some low-frequency pattern, e.g. this alternates a slower and faster beat: `int cond = (i & 0x8000) == 0;`, `cond * (i / 16) + !cond * (i / 32)` +- **Extra variables** can add more complexity (e.g. precompute some variable `a` which will subsequently be used multiple times in the final formula). + +## Copyright + +It is not exactly clear whether, how and to what extent [copyright](copyright) can apply to bytebeat: on one hand we have a short formula that's uncopyrightable (just like mathematical formulas), on the other hand we have music, an artistic expression. Many authors of bytebeat "release" their creations under [free](free_culture.md) [licenses](license.md) such as [CC-BY-SA](cc-by-sa.md), but such licenses are of course not applicable if copyright can't even arise. + +We believe copyright doesn't and SHOULDN'T apply to bytebeat. To ensure this, it is good to stick [CC0](cc0.md) to any released bytebeat. + +## Examples + +A super-simple example can be just a simple: + +- `i / 16` + +The following more complex examples come from the [LRS](lrs.md) game [Anarch](anarch.md) (these are legally safe even in case copyright can apply to bytebeat as Anarch is released under [CC0](cc0.md)): + +- distortion guitar rhythmical beat: `~((((i >> ((i >> 2) % 32)) | (i >> ((i >> 5) % 32))) & 0x12) << 1) | (i >> 11)` +- electronic/techno: `((0x47 >> ((i >> 9) % 32)) & (i >> (i % 32))) | (0x57 >> ((i >> 7) % 32)) | (0x06 >> ((i >> ((((i * 11) >> 14) & 0x0e) % 32)) % 32))` +- main theme, uses an extra variable: `(((i) & 65536) ? (a & (((i * 2) >> 16) & 0x09)) : ~a)`, where `uint32_t a = ((i >> 7) | (i >> 9) | (~i << 1) | i)` diff --git a/c.md b/c.md new file mode 100644 index 0000000..7d6042f --- /dev/null +++ b/c.md @@ -0,0 +1,162 @@ +# C + +{ We have a [C tutorial](c_tutorial.md)! ~drummyfish } + +C is a [low level](low_level.md), [statically typed](static_typing.md) [imperative](imperative.md) compiled [programming language](programming_language.md), the go-to language of most [less retarded software](lrs.md). It is the absolutely preferred language of the [suckless](suckless.md) community as well as of most true experts, for example the [Linux](linux.md) and [OpenBSD](openbsd.md) developers, because of its good minimal design, level of control, uncontested performance and a greatly established and tested status. + +C is usually not considered an easy language to learn because of its low level nature: it requires good understanding of how a computer actually works and doesn't prevent the programmer from shooting himself in the foot. Programmer is given full control (and therefore responsibility). There are things considered "tricky" which one must be aware of, such as undefined behavior of certain operators and raw pointers. This is what can discourage a lot of modern "coding monkeys" from choosing C, but it's also what inevitably allows such great performance -- undefined behavior allows the compiler to choose the most efficient implementation. + +## History and Context + +C was developed in 1972 at [Bell Labs](bell_labs.md) alongside the [Unix](unix.md) operating system by [Dennis Ritchie](dennis_ritchie.md) and [Brian Kerninghan](brian_kerninghan.md), as a successor to the [B](b.md) language ([portable](portability.md) language with [recursion](recursion.md)) written by Denis Ritchie and [Ken Thompson](ken_thompson.md), which was in turn inspired by the the [ALGOL](algol.md) language (code blocks, lexical [scope](scope.md), ...). + +In 1973 Unix was rewritten in C. In 1978 Keninghan and Ritchie published a book called *The C Programming Language*, known as *K&R*, which became something akin the C specification. In 1989, the [ANSI C](ansi_c.md) standard, also known as C89, was released by the American ANSI. The same standard was also adopted a year later by the international ISO, so C90 refers to the same language. In 1999 ISO issues a new standard that's known as C99. + +TODO + +## Standards + +C is not a single language, there have been a few standards over the years since its inception in 1970s. The notable standards and versions are: + +- **K&R C**: C as described by its inventors in the book *The C Programming Language*, before official standardization. This is kind of too ancient nowadays. +- **C89/C90 (ANSI/ISO C)**: First fully standardized version, usable even today. +- **C95**: A minor update of the previous standard, adds wide character support. +- **C99**: Updated standard from the year 1999 striking a great balance between "modern" and "good old". This is a good version to use in LRS programs, but will be a little less supported than C89. +- **C11**: Updated standard from the year 2011. This one is too [bloated](bloat.md) and isn't worth using. +- **C17/C18**: Yet another update, yet more bloated and not worth using. + +LRS should use C99 or C89 as the newer versions are considered [bloat](bloat.md) and don't have such great support in compilers, making them less portable and therefore less free. + +The standards of C99 and older are considered pretty [future-proof](future_proof.md) and using them will help your program be future-proof as well. This is to a high degree due to C having been established and tested better than any other language; it is one of the oldest languages and a majority of the most essential software is written in C, C compiler is one of the very first things a new hardware platform needs to implement, so C compilers will always be around, at least for historical reasons. C has also been very well designed in a relatively minimal fashion, before the advent of modern feature-creep and and bullshit such as [OOP](oop.md) which cripples almost all "modern" languages. + +## Compilers + +- [gcc](gcc.md) +- [clang](clang.md) +- [tcc](tcc.md) +- scc + +## Standard Library + +So the standard library (libc) is a subject of live debate because while its interface and behavior are given by the C standard, its implementation is a matter of each compiler; since the standard library is so commonly used, we should take great care in assuring it's extremely well written. As you probably guessed, the popular implementations ([glibc](glibc.md) et al) are [bloat](bloat.md). Better alternatives thankfully exist, such as: + +- [musl](musl.md) +- [uclibc](uclibc.md) +- [not using](dependency.md) the standard library :) + +## Bad Things About C + +C isn't perfect, it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better version of C. So, let's go: + +- **C specification (the ISO standard) is [proprietary](proprietary.md)** :( The language itself probably can't be copyrighted, nevertheless this may change in the future, and a proprietary specs lowers C's accessibility and moddability (you can't make derivative versions of the spec). +- **The specification is also long as fuck**. A good, free language should have a simple definition. It could be simplified a lot by simplifying the language itself as well as dropping some truly legacy considerations (like [BCD](bcd.md) systems?) and removing a lot of undefined behavior. +- **Some behavior is weird and has exceptions**, for example a function can return anything, including a `struct`, except for an array. This makes it awkward to e.g. implement vectors which would best be made as arrays but you want functions to return them, so you may do hacks like wrapping them instide a struct just for this. +- **Some things could be made simpler**, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness. +- Some things like [enums](enum.md) could be dropped entirely, they can easily be replaced with macros. +- **The preprocessor isn't exactly elegant**, it has completely different syntax and rules from the main language, not very suckless. +- **The syntax isn't perfect**, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character, e.g. `#` which would end either with a newline or another `#`. +- **Some basic things that are part of the standard library or extensions**, like fixed with types and binary literals, could be part of the language itself. +- TODO: moar + +## Basics + +This is a quick overview, for a more in depth tutorial see [C tutorial](c_tutorial.md). + +A simple program in C that writes "welcome to C" looks like this: + +``` +#include // standard I/O library + +int main(void) +{ + // this is the main program + + puts("welcome to C"); + + return 0; // end with success +} +``` + +You can simply paste this code into a file which you name e.g. `program.c`, then you can compile the program from command line like this: + +`gcc -o program program.c` + +Then if you run the program from command line (`./program` on Unix like systems) you should see the message. + +## 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 +} + +``` + +## See Also + +- [C tutorial](c_tutorial.md) +- [C pitfalls](c_pitfalls.md) +- [C programming style](programming_style.md) +- [IOCCC](ioccc.md) \ No newline at end of file diff --git a/c_pitfalls.md b/c_pitfalls.md new file mode 100644 index 0000000..cb78879 --- /dev/null +++ b/c_pitfalls.md @@ -0,0 +1,51 @@ +# C Pitfalls + +[C](c.md) is a powerful language that offers almost absolute control and maximum performance which necessarily comes with responsibility and danger of shooting oneself in the foot. Without knowledge of the pitfalls you may well find yourself fallen into one of them. + +Unless specified otherwise, this article supposes the C99 standard of the C language. + +## Undefined/Unspecified Behavior + +Undefined, unspecified and implementation-defined behaviors are kinds of unpredictable and sometimes non-intuitive behavior of certain operations that may differ between compilers, platforms or runs because they are not defined by the language specification; this is mostly done on purpose as to allow some implementation freedom which allows implementing the language in a way that is most efficient on given platform. This behavior may be completely random (unpredictable) or implementation-specified (consistent within each implementation but potentially different between implementations). In any case, one has to be very careful about letting such behavior influence computations. Note that tools such as [cppcheck](cppcheck.md) can help find undefined behavior in code. Description of some of these behaviors follow. + +**Data type sizes including int and char may not be the same on each platform**. Even though we almost take it for granted than char is 8 bits wide, in theory it can be wider. The int (and unsigned int) type width should reflect the architectures native integer type, so nowadays mostly it's mostly 32 or 64 bits. To deal with this we can use the standard library `limits.h` and `stdint.h` headers. + +**No specific [endianness](endian.md) is enforced**. Nowadays little endian is what you'll encounter on most platforms, but e.g. [PowerPC](ppc.md) uses big endian. + +**Order of evaluation of operands and function arguments is not specified**. I.e. in an expression or function call it is not defined which operands or arguments will be evaluated first, the order may be completely random and the order may differ even when evaluating the same expression at another time. This is demonstrated by the following code: + +``` +#include + +int x = 0; + +int a(void) +{ + x += 1; + return x; +} + +int main(void) +{ + printf("%d %d\n",x,a()); // may print 0 1 or 1 1 + return 0; +} +``` + +**Char data type signedness is not defined**. The signedness can be explicitly "forced" by specifying `signed char` or `unsigned char`. + +**Bit shifts by type width or more are undefined.** Also bit shifts by negative values are undefined. So e.g. `x >> 8` is undefined if width of the data type of `x` is 8 bits. + +**Overflow behavior of signed addition is not guaranteed.** Sometimes we suppose that addition of two signed integers that are past the data type's limit will produce two's complement overflow, but in fact this operation's behavior is undefined. + +## Memory Unsafety + +Besides being extra careful about writing memory safe code, one needs to also know that **some functions of the standard library are memory unsafe**. This is regarding mainly string functions such as `strcpy` or `strlen` which do not check the string boundaries (i.e. they rely on not being passed a string that's not zero terminated and so can potentially touch memory anywhere beyond); safer alternatives are available, they have an `n` added in the name (`strncpy`, `strnlen`, ...) and allow specifying a length limit. + +## Different Behavior Between C And C++ + +C is **not** a subset of C++, i.e. not every C program is a C++ program (for simple example imagine a C program in which we use the word `class` as an identifier). Furthermore a C program that is at the same time also a C++ program may behave differently when compiled as C vs C++. Of course, all of this may also apply between different standards of C, not just between C and C++. + +For portability sake it is good to try to write C code that will also compile as C++ (and behave the same). For this we should know some basic differences in behavior between C and C++. + +TODO: specific examples \ No newline at end of file diff --git a/c_tutorial.md b/c_tutorial.md new file mode 100644 index 0000000..b85f8ec --- /dev/null +++ b/c_tutorial.md @@ -0,0 +1,1685 @@ +# C Tutorial + +{ Still a work in progress. ~drummyfish } + +This is a relatively quick [C](c.md) tutorial. + +You should probably know at least the completely basic ideas of programming before reading this (what's a [programming language](programming_language.md), [source code](source_code.md), [command line](cli.md) etc.). If you're as far as already knowing another language, this should be pretty easy to understand. + +## About C And Programming + +[C](c.md) is + +- A **[programming language](programming_language.md)**, i.e. a language that lets you express [algorithms](algorithm.md). +- [Compiled](compiled.md) language (as opposed to [interpreted](interpreted.md)), i.e. you have to compile the code you write (with [compiler](compiler.md)) in order to obtain a [native](native.md) executable program (a binary file that you can run directly). +- Extremely **fast and efficient**. +- Very **widely supported and portable** to almost anything. +- **[Low level](low_level.md)**, i.e. there is relatively little [abstraction](abstraction.md) and not many comfortable built-in functionality such as [garbage collection](garbage_collection.md), you have to write many things yourself, you will deal with [pointers](pointer.md), [endianness](endianness.md) etc. +- [Imperative](imperative.md) (based on sequences of commands), without [object oriented programming](oop.md). +- Considered **hard**, but in certain ways it's simple, it lacks [bloat](bloat.md) and [bullshit](bullshit.md) of "[modern](modern.md)" languages which is an essential thing. It will take long to learn (don't worry, not nearly as long as learning a foreign language) but it's the most basic thing you should know if you want to create good software. You won't regret. +- **Not holding your hand**, i.e. you may very easily "shoot yourself in your foot" and crash your program. This is the price for the language's power. +- Very old, well established and tested by time. +- Recommended by us for serious programs. + +If you come from a language like [Python](python.md) or [JavaScript](javascript.md), you may be shocked that C doesn't come with its own [package manager](package_manager.md), [debugger](debugger.md) or [build system](build_system.md), it doesn't have [modules](module.md), [generics](generics.md), [garabage collection](garbage_collection.d), [OOP](oop.md), [hashmaps](hashmap.md), dynamic [lists](list.md), [type inference](type_inference.md) and similar "[modern](modern.md)" featured. When you truly get into C, you'll find it's a good thing. + +Programming in C works like this: + +1. You write a C source code into a file. +2. You compile the file with a C [compiler](compiler.md) such as [gcc](gcc.md) (which is just a program that turns source code into a runnable program). This gives you the executable program. +3. You run the program, test it, see how it works and potentially get back to modifying the source code (step 1). + +So, for writing the source code you'll need a [text editor](text_editor.md); any [plain text](plain_text.md) editor will do but you should use some that can highlight C [syntax](syntax.md) -- this helps very much when programming and is practically a necessity. Ideal editor is [vim](vim.md) but it's a bit difficult to learn so you can use something as simple as [Gedit](gedit.md) or [Geany](geany.md). We do NOT recommend using huge programming [IDEs](ide.md) such as "VS Code" and whatnot. You definitely can NOT use an advanced document editor that works with [rich text](rich_text.md) such as [LibreOffice](libreoffice.md) or that [shit](shit.md) from Micro$oft, this won't work because it's not plain text. + +Next you'll need a C [compiler](compiler.md), the program that will turn your source code into a runnable program. We'll use the most commonly used one called [gcc](gcc.md) (you can try different ones such as [clang](clang.md) or [tcc](tcc.md) if you want). If you're on a [Unix](unix.md)-like system such as [GNU](gnu.md)/[Linux](linux.md) (which you probably should), gcc is probably already installed. Open up a terminal and write `gcc` to see if it's installed -- if not, then install it (e.g. with `sudo apt install build-essential` if you're on a Debian-based system). + +If you're extremely lazy, there are online web C compilers that work in a web browser (find them with a search engine). You can use these for quick experiments but note there are some limitations (e.g. not being able to work with files), and you should definitely know how to compile programs yourself. + +Last thing: there are multiple standards of C. Here we will be covering [C99](c99.md), but this likely doesn't have to bother you at this point. + +## First Program + +Let's quickly try to compile a tiny program to test everything and see how everything works in practice. + +Open your text editor and paste this code: + +``` +/* simple C program! */ + +#include // include IO library + +int main(void) +{ + puts("It works."); + + return 0; +} +``` + +Save this file and name it `program.c`. Then open a terminal emulator (or an equivalent command line interface), locate yourself into the directory where you saved the file (e.g. `cd somedirectory`) and compile the program with the following command: + +``` +gcc -o program program.c +``` + +The program should compile and the executable `program` should appear in the directory. You can run it with + +``` +./program +``` + +And you should see + +``` +It works. +``` + +written in the command line. + +Now let's see what the source code means: + +- `/* simple C program! */` is so called *block comment*, it does nothing, it's here only for the humans that will read the source code. Such comments can be almost anywhere in the code. The comment starts at `/*` and ends with `*/`. +- `// include IO library` is another comment, but this is a *line comment*, it starts with `//` and ends with the end of line. +- `#include ` tells the compiler we want to include a library named *stdio* (the weird [syntax](syntax.md) will be explained in the future). This is a standard library with input output functions, we need it to be able to use the function `puts` later on. We can include more libraries if we want to. These includes are almost always at the very top of the source code. +- `int main(void)` is the start of the main program. What exactly this means will be explained later, for now just remember there has to be this function named `main` in basically every program -- inside it there are commands that will be executed when the program is run. Note that the curly brackets that follow (`{` and `}`) denote the block of code that belongs to this function, so we need to write our commands between these brackets. +- `puts("It works.");` is a "command" for printing text strings to the command line (it's a command from the `stdio` library included above). Why exactly this is written like this will be explained later, but for now notice the following. The command starts with its name (`puts`, for *put string*), then there are left and right brackets (`(` and `)`) between which there are arguments to the command, in our case there is one, the text string `"It works."`. Text strings have to be put between quotes (`"`), otherwise the compiler would think the words are other commands (the quotes are not part of the string itself, they won't be printed out). The command is terminated by `;` -- all "normal" commands in C have to end with a semicolon. +- `return 0;` is another "command", it basically tells the operating system that everything was terminated successfully (`0` is a code for success). This command is an exception in that it doesn't have to have brackets (`(` and `)`). This doesn't have to bother us too much now, let's just remember this will always be the last command in our program. + +Also notice how the source code is formatted, e.g. the indentation of code withing the `{` and `}` brackets. White characters (spaces, new lines, tabs) are ignored by the compiler so we can theoretically write our program on a single line, but that would be unreadable. We use indentation, spaces and empty lines to format the code to be well readable. + +To sum up let's see a general structure of a typical C program. You can just copy paste this for any new program and then just start writing commands in the `main` function. + +``` +#include // include the I/O library +// more libraries can be included here + +int main(void) +{ + // write commands here + + return 0; // always the last command +} +``` + +## Variables, Arithmetic, Data Types + +Programming is a lot like mathematics, we compute equations and transform numerical values into other values. You probably know in mathematics we use *variables* such as *x* or *y* to denote numerical values that can change (hence variables). In programming we also use variables -- here **[variable](variable.md) is a place in memory which has a name**. + +We can create variables named `x`, `y`, `myVariable` or `score` and then store specific values (for now let's only consider numbers) into them. We can read from and write to these variables at any time. These variables physically reside in [RAM](ram.md), but we don't really care where exactly (at which address) they are located -- this is e.g. similar to houses, in common talk we normally say things like *John's house* or *the pet store* instead of *house with address 3225*. + +Variable names can't start with a digit (and they can't be any of the [keywords](keyword.md) reserved by C). By convention they also shouldn't be all uppercase or start with uppercase (these are normally used for other things). Normally we name variables like this: `myVariable` or `my_variable` (pick one style, don't mix them). + +In C as in other languages each variable has a certain **[data type](data_type.md)**; that is each variable has associated an information of what kind of data is stored in it. This can be e.g. a *whole number*, *fraction*, a *text character*, *text string* etc. Data types are a more complex topic that will be discussed later, for now we'll start with the most basic one, the **integer type**, in C called `int`. An `int` variable can store whole numbers in the range of at least -32768 to 32767 (but usually much more). + +Let's see an example. + +``` +#include + +int main(void) +{ + int myVariable; + + myVariable = 5; + + printf("%d\n",myVariable); + + myVariable = 8; + + printf("%d\n",myVariable); +} +``` + +- `int myVariable;` is so called **variable declaration**, it tells the compiler we are creating a new variable with the name `myVariable` and data type `int`. Variables can be created almost anywhere in the code (even outside the `main` function) but that's a topic for later. +- `myVariable = 5;` is so called **variable assignment**, it stores a value 5 into variable named `myVariable`. IMPORTANT NOTE: the `=` does NOT signify mathematical equality but an assignment (equality in C is written as `==`); when compiler encounters `=`, it simply takes the value on the right of it and writes it to the variable on the left side of it. Sometimes people confuse assignment with an equation that the compiler solves -- this is NOT the case, assignment is much more simple, it simply writes a value into variable. So `x = x + 1;` is a valid command even though mathematically it would be an equation without a solution. +- `printf("%d\n",myVariable);` prints out the value currently stored in `myVariable`. Don't get scared by this complicated command, it will be explained later (once we learn about [pointers](pointer.md)). For now only know this prints the variable content. +- `myVariable = 8;` assigns a new value to `myVariable`, overwriting the old. +- `printf("%d\n",myVariable);` again prints the value in `myVariable`. + +After compiling and running of the program you should see: + +``` +5 +8 +``` + +Last thing to learn is **arithmetic operators**. They're just normal math operators such as +, - and /. You can use these along with brackets (`(` and `)`) to create **[expressions](expression.md)**. Expressions can contain variables and can themselves be used in many places where variables can be used (but not everywhere, e.g. on the left side of variable assignment, that would make no sense). E.g.: + +``` +#include + +int main(void) +{ + int heightCm = 175; + int weightKg = 75; + int bmi = (weightKg * 10000) / (heightCm * heightCm); + + printf("%d\n",bmi); +} +``` + +calculates and prints your BMI (body mass index). + +Let's quickly mention how you can read and write values in C so that you can begin to experiment with your own small programs. You don't have to understand the following [syntax](syntax.md) as of yet, it will be explained later, now simply copy-paste the commands: + +- `puts("hello");`: Prints a text string with newline. +- `printf("hello");`: Same as above but without newline. +- `printf("%d\n",x);`: Prints the value of variable `x` with newline. +- `printf("%d ");`: Same as above but without a newline. +- `scanf("%d",&x);`: Read a number from input to the variable `x`. Note there has to be `&` in front of `x`. + +## Branches And Loops (If, While, For) + +When creating [algorithms](algorithm.md), it's not enough to just write linear sequences of commands. Two things (called [control structures](control_structure.md)) are very important to have in addition: + +- **[branches](branch.md)**: Conditionally executing or skipping certain commands (e.g. if a user enters password we want to either log him in if the password was correct or write error if the password was incorrect). This is informally known as **"if-then-else"**. +- **[loops](loop.md)** (also called **iteration**): Repeating certain commands given number of times or as long as some condition holds (e.g. when searching a text we repeatedly compare words one by one to the searched word until a match is found or end of text is reached). + +Let's start with **branches**. In C the command for a branch is `if`. E.g.: + +``` +if (x > 10) + puts("X is greater than 10."); +``` + +The [syntax](syntax.md) is given, we start with `if`, then brackets (`(` and `)`) follow inside which there is a condition, then a command or a block of multiple commands (inside `{` and `}`) follow. If the condition in brackets holds, the command (or block of commands) gets executed, otherwise it is skipped. + +Optionally there may be an *else* branch which is gets executed only if the condition does NOT hold. It is denoted with the `else` keyword which is again followed by a command or a block of multiple commands. Branching may also be nested, i.e. branches may be inside other branches. For example: + +``` +if (x > 10) + puts("X is greater than 10."); +else +{ + puts("X is not greater than 10."); + + if (x < 5) + puts("And it is also smaller than 5."); +} +``` + +So if `x` is equal e.g. 3, the output will be: + +``` +X is not greater than 10. +And it is also smaller than 5. +``` + +About **conditions** in C: a condition is just an expression (variables/functions along with arithmetic operators). The expression is evaluated (computed) and the number that is obtained is interpreted as *true* or *false* like this: **in C 0 means false, anything else means true**. Even comparison operators like `<` and `>` are technically arithmetic, they compare numbers and yield either 1 or 0. Some operators commonly used in conditions are: + +- `==` (equals): yields 1 if the operands are equal, otherwise 0. +- `!=` (not equal): yields 1 if the operands are NOT equal, otherwise 0. +- `<` (less than): yields 1 if the first operand is smaller than the second, otherwise 0. +- `<=`: yields 1 if the first operand is smaller or equal to the second, otherwise 0. +- `&&` (logical [AND](and.md)): yields 1 if both operands are non-0, otherwise 0. +- `||` (logical [OR](or.md)): yields 1 if at least one operand is non-0, otherwise 0. +- `!` (logical [NOT](not.md)): yields 1 if the operand is 0, otherwise 0. + +E.g. an if statement starting as `if (x == 5 || x == 10)` will be true if `x` is either 5 or 10. + +Next we have **loops**. There are multiple kinds of loops even though in theory it is enough to only have one kind of loop (there are multiple types out of convenience). The loops in C are: + +- **while**: Loop with condition at the beginning. +- **do while**: Loop with condition at the end, not used so often so we'll ignore this one. +- **for**: Loop executed a fixed number of times. This is a very common case, that's why there is a special loop for it. + +The **while** loop is used when we want to repeat something without knowing in advance how many times we'll repeat it (e.g. searching a word in text). It starts with the `while` keyword, is followed by brackets with a condition inside (same as with branches) and finally a command or a block of commands to be looped. For instance: + +``` +while (x > y) // as long as x is greater than y +{ + printf("%d %d\n",x,y); // prints x and y + + x = x - 1; // decrease x by 1 + y = y * 2; // double y +} + +puts("The loop ended."); +``` + +If `x` and `y` were to be equal 100 and 20 (respectively) before the loop is encountered, the output would be: + +``` +100 20 +99 40 +98 60 +97 80 +The loop ended. +``` + +The **for** loop is executed a fixed number of time, i.e. we use it when we know in advance how many time we want to repeat our commands. The [syntax](syntax.md) is a bit more complicated: it starts with the keywords `for`, then brackets (`(` and `)`) follow and then the command or a block of commands to be looped. The inside of the brackets consists of an initialization, condition and action separated by semicolon (`;`) -- don't worry, it is enough to just remember the structure. A for loop may look like this: + +``` +puts("Counting until 5..."); + +for (int i = 0; i < 5; ++i) + printf("%d\n",i); // prints i +``` + +`int i = 0` creates a new temporary variable named `i` (name normally used by convention) which is used as a **counter**, i.e. this variable starts at 0 and increases with each iteration (cycle), and it can be used inside the loop body (the repeated commands). `i < 5` says the loop continues to repeat as long as `i` is smaller than 5 and `++i` says that `i` is to be increased by 1 after each iteration (`++i` is basically just a shorthand for `i = i + 1`). The above code outputs: + +``` +Counting until 5... +0 +1 +2 +3 +4 +``` + +IMPORTANT NOTE: in programming we **count from 0**, not from 1 (this is convenient e.g. in regards to [pointers](pointer.md)). So if we count to 5, we get 0, 1, 2, 3, 4. This is why `i` starts with value 0 and the end condition is `i < 10` (not `i <= 10`). + +Generally if we want to repeat the `for` loop *N* times, the format is `for (int i = 0; i < N; ++i)`. + +Any loop can be exited at any time with a special command called `break`. This is often used with so called infinite loop, a *while* loop that has `1` as a condition; recall that 1 means true, i.e. the loop condition always holds and the loop never ends. `break` allows us to place conditions in the middle of the loop and into multiple places. E.g.: + +``` +while (1) // infinite loop +{ + x = x - 1; + + if (x == 0) + break; // this exits the loop! + + y = y / x; +} +``` + +The code above places a condition in the middle of an infinite loop to prevent division by zero in `y = y / x`. + +Again, loops can be nested (we may have loops inside loops) and also loops can contain branches and vice versa. + +## Simple Game: Guess A Number + +With what we've learned so far we can already make a simple [game](game.md): guess a number. The computer thinks a random number in range 0 to 9 and the user has to guess it. The source code is following. + +``` +#include +#include +#include + +int main(void) +{ + srand(clock()); // random seed + + while (1) // infinite loop + { + int randomNumber = rand() % 10; + + puts("I think a number. What is it?"); + + int guess; + + scanf("%d",&guess); // read the guess + + getchar(); + + if (guess == randomNumber) + puts("You guessed it!"); + else + printf("Wrong. The number was %d.\n",randomNumber); + + puts("Play on? [y/n]"); + + char answer; + + scanf("%c",&answer); // read the answer + + if (answer == 'n') + break; + } + + puts("Bye."); + + return 0; // return success, always here +} +``` + +- `#include `, `#include `: we're including additional libraries because we need some specific functions from them (`rand`, `srand`, `clock`). +- `srand(clock());`: don't mind this line too much, its purpose is to [seed](seed.md) a pseudorandom number generator. Without doing this the game would always generate the same sequence of random numbers when run again. +- `while (1)` is an infinite game loop -- it runs over and over, in each cycle we perform one game round. The loop can be exited with the `break` statement later on (if the user answers he doesn't want to continue playing). +- `int randomNumber = rand() % 10;`: this line declares a variable named `randomNumber` and immediately assigns a value to it. The value is a random number from 0 to 9. This is achieved with a function `rand` (from the above included `stdlib` library) which returns a random number, and with the modulo (remainder after division) arithmetic operator (`%`) which ensures the number is in the correct range (less than 10). +- `int guess;` creates another variable in which we'll store the user's guessed number. +- `scanf("%d",&guess);` reads a number from the input to the variable named `guess`. Again, don't be bothered by the complicated structure of this command, for now just accept that this is how it's done. +- `getchar();`: don't mind this line, it just discards a newline character read from the input. +- `if (guess == randomNumber) ...`: this is a branch which checks if the user guess is equal to the generated random number. If so, a success message is printed out. If not, a fail message is printed out along with the secret number. Note we use the `puts` function for the first message as it only prints a text sting, while for the latter message we have to use `printf`, a more complex function, because that requires inserting a number into the printed string. More on these functions later. +- `char answer;` declares a variable to store user's answer to a question of whether to play on. It is of `char` data type which can store a single text character. +- `scanf("%c",&answer);` reads a single character from input to the `answer` variable. +- `if (answer == 'n') break;` is a branch that exits the infinite loop with `break` statement if the answer entered was `n` (*no*). + +## Functions (Subprograms) + +Functions are extremely important, no program besides the most primitive ones can be made without them. + +**[Function](function.md) is a subprogram** (in other languages functions are also called procedures or subroutines), i.e. it is code that solves some smaller subproblem that you can repeatedly invoke, for instance you may have a function for computing a [square root](sqrt.md), for encrypting data or for playing a sound from speakers. We have already met functions such as `puts`, `printf` or `rand`. + +Functions are similar to but **NOT the same as mathematical functions**. Mathematical function (simply put) takes a number as input and outputs another number computed from the input number, and this output number depends only on the input number and nothing else. C functions can do this too but they can also do additional things such as modify variables in other parts of the program or make the computer do something (such as play a sound or display something on the screen) -- these are called **[side effects](side_effect.md)**; things done besides computing and output number from an input number. For distinction mathematical functions are called *pure* functions and functions with side effects are called non-pure. + +**Why are function so important?** Firstly they help us divide a big problem into small subproblems and make the code better organized and readable, but mainly they help us respect the [DRY](dry.md) (*Don't Repeat Yourself*) principle -- this is extremely important in programming. Imagine you need to solve a [quadratic equation](quadratic_equation.md) in several parts of your program; you do NOT want to solve it in each place separately, you want to make a function that solves a quadratic equation and then only invoke (call) that function anywhere you need to solve your quadratic equation. This firstly saves space (source code will be shorter and compiled program will be smaller), but it also makes your program manageable and eliminates bugs -- imagine you find a better (e.g. faster) way to solving quadratic equations; without functions you'd have to go through the whole code and change the algorithm in each place separately which is impractical and increases the chance of making errors. With functions you only change the code in one place (in the function) and in any place where your code invokes (calls) this function the new better and updated version of the function will be used. + +Besides writing programs that can be directly executed programmers write **[libraries](library.md)** -- collections of functions that can be used in other projects. We have already seen libraries such as *stdio*, *standard input/output library*, a standard (official, bundled with every C compiler) library for input/output (reading and printing values); *stdio* contains functions such as `puts` which is used to printing out text strings. Examples of other libraries are the standard *math* library containing function for e.g. computing [sine](sine.md), or [SDL](sdl.md), a 3rd party multimedia library for such things as drawing to screen, playing sounds and handling keyboard and mouse input. + +Let's see a simple example of a function that writes out a temperature in degrees of Celsius as well as in Kelvin: + +``` +#include + +void writeTemperature(int celsius) +{ + int kelvin = celsius + 273; + printf("%d C (%d K)\n",celsius,kelvin); +} + +int main(void) +{ + writeTemperature(-50); + writeTemperature(0); + writeTemperature(100); + + return 0; +} +``` + +The output is + +``` +-50 C (223 K) +0 C (273 K) +100 C (373 K) +``` + +Now imagine we decide we also want our temperatures in Fahrenheit. We can simply edit the code in `writeTemperature` function and the program will automatically be writing temperatures in the new way. + +Let's see how to create and invoke functions. Creating a function in code is done between inclusion of libraries and the `main function`, and we formally call this **defining a function**. The function definition format is following: + +``` +RETURN_TYPE FUNCTION_NAME(FUNCTION_PARAMETERS) +{ + FUNCTION_BODY +} +``` + +- `RETURN_TYPE` is the [data type](data_type.md) the function returns. A function may or may not return a certain value, just as the pure mathematical function do. This may for example be `int`, if the function returns an integer number. If the function doesn't return anything, this type is `void`. +- `FUNCTION_NAME` is the name of the function, it follows the same rules as the names for variables. +- `FUNCTION_PARAMETERS` specifies the input values of the function. The function can take any number of parameters (e.g. a function `playBeep` may take 0 arguments, `sine` function takes 1, `logarithm` may take two etc.). This list is comma-separated and each item consists of the parameter data type and name. If there are 0 parameters, there should be the word `void` inside the brackets, but compilers tolerate just having empty brackets. +- `FUNCTION_BODY` are the commands executed by the function, just as we know them from the *main* function. + +Let's see another function: + +``` +#include + +int power(int x, int n) +{ + int result = 1; + + for (int i = 0; i < n; ++i) // repeat n times + result = result * x; + + return result; +} + +int main(void) +{ + for (int i = 0; i < 5; ++i) + { + int powerOfTwo = power(2,i); + printf("%d\n",powerOfTwo); + } + + return 0; +} +``` + +The output is: + +``` +2 +4 +8 +16 +``` + +The function power takes two parameters: `x` and `n`, and returns `x` raised to the `n`s power. Note that unlike the first function we saw here the return type is `int` because this function does return a value. **Notice the command `return`** -- it is a special command that causes the function to terminate and return a specific value. In function that return a value (their return type is not `void`) there has to be a `return` command. In function that return nothing there may or may not be one, and if there is, it has no value after it (`return;`); + +Let's focus on how we invoke the function -- in programming we say we **call the function**. The function call in our code is `power(2,i)`. If a function returns a value (return type is not `void`), it function call can be used in any expression, i.e. almost anywhere where we can use a variable or a numerical value -- just imagine the function computes a return value and this value is **substituted to the place where we call the function**. For example we can imagine the expression `power(3,1) + power(3,0)` as simply `3 + 1`. + +If a function return nothing (return type is `void`), it can't be used in expressions, it is used "by itself"; e.g. `playBeep();`. (Function that do return a value can also be used like this -- their return value is in this case simply ignored.) + +We call a function by writing its name (`power`), then adding brackets (`(` and `)`) and inside them we put **arguments** -- specific values that will substitute the corresponding parameters inside the function (here `x` will take the value `2` and `n` will take the current value of `i`). If the function takes no parameters (the function list is `void`), we simply put nothing inside the brackets (e.g. `playBeep();`); + +Here comes the nice thing: **we can nest function calls**. For example we can write `x = power(3,power(2,1));` which will result in assigning the variable `x` the value of 9. **Functions can also call other functions** (even themselves, see [recursion](recursion.md)), but only those that have been defined before them in the source code (this can be fixed with so called [forward declarations](forward_decl.md)). + +Notice that the `main` function we always have in our programs is also a function definition. The definition of this function is required for runnable programs, its name has to be `main` and it has to return `int` (an error code where 0 means no error). It can also take parameters but more on that later. + +These is the most basic knowledge to have about C functions. Let's see one more example with some pecularities that aren't so important now, but will be later. + +``` +#include + +void writeFactors(int x) // writes divisord of x +{ + printf("factors of %d:\n",x); + + while (x > 1) // keep dividing x by its factors + { + for (int i = 2; i <= x; ++i) // search for a factor + if (x % i == 0) // i divides x without remainder? + { + printf(" %d\n",i); // i is a factor, write it + x = x / i; // divide x by i + break; // exit the for loop + } + } +} + +int readNumber(void) +{ + int number; + + puts("Please enter a number to factor (0 to quit)."); + scanf("%d",&number); + + return number; +} + +int main(void) +{ + while (1) // infinite loop + { + int number = readNumber(); // <- function call + + if (number == 0) // 0 means quit + break; + + writeFactors(number); // <- function call + } + + return 0; +} +``` + +We have defined two functions: `writeFactors` and `readNumber`. `writeFactors` return no values but it has side effects (print text to the command line). `readNumber` takes no parameters but return a value; it prompts the user to enter a value and returns the read value. + +Notice that inside `writeFactors` we modify its parameter `x` inside the function body -- this is okay, it won't affect the argument that was passed to this function (the `number` variable inside the `main` function won't change after this function call). `x` can be seen as a **[local variable](local_variable.md)** of the function, i.e. a variable that's created inside this function and can only be used inside it -- when `writeFactors` is called inside `main`, a new local variable `x` is created inside `writeFactors` and the value of `number` is copied to it. + +Another local variable is `number` -- it is a local variable both in `main` and in `readNumber`. Even though the names are the same, these are two different variables, each one is local to its respective function (modifying `number` inside `readNumber` won't affect `number` inside `main` and vice versa). + +And a last thing: keep in mind that not every command you write in C program is a function call. E.g. control structures (`if`, `while`, ...) and special commands (`return`, `break`, ...) are not function calls. + +## More Details (Globals, Switch, Float, Forward Decls, ...) + +We've skipped a lot of details and small tricks for simplicity. Let's go over some of them. Many of the following things are so called [syntactic sugar](sugar.md): convenient syntax shorthands for common operations. + +Multiple variables can be defined and assigned like this: + +``` +int x = 1, y = 2, z; +``` + +The meaning should be clear, but let's mention that `z` doesn't generally have a defined value here -- it will have a value but you don't know what it is (this may differ between different computers and platforms). See [undefined behavior](undefined_behavior.md). + +The following is a shorthand for using operators: + +``` +x += 1; // same as: x = x + 1; +x -= 10; // same as: x = x - 1; +x *= x + 1; // same as: x = x * (x + 1); +x++; // same as: x = x + 1; +x--; // same as: x = x - 1; +// etc. +``` + +The last two constructs are called **[incrementing](increment.md)** and **[decrementing](decrement.md)**. This just means adding/subtracting 1. + +In C there is a pretty unique operator called the **[ternary operator](ternary_operator.md)** (ternary for having three [operands](operand.md)). It can be used in expressions just as any other operators such as `+` or `-`. Its format is: + +``` +CONDITION ? VALUE1 : VALUE2 +``` + +It evaluates the `CONDITION` and if it's true (non-0), this whole expression will have the value of `VALUE1`, otherwise its value will be `VALUE2`. It allows for not using so many `if`s. For example instead of + +``` +if (x >= 10) + x -= 10; +else + x = 10; +``` + +we can write + +``` +x = x >= 10 ? x - 10 : 10; +``` + +**[Global variables](global_variable.md)**: we can create variables even outside function bodies. Recall than variables inside functions are called *local*; variables outside functions are called *global* -- they can basically be accessed from anywhere and can sometimes be useful. For example: + +``` +#include +#include // for rand() + +int money = 0; // total money, global variable + +void printMoney(void) +{ + printf("I currently have $%d.\n",money); +} + +void playLottery(void) +{ + puts("I'm playing lottery."); + + money -= 10; // price of lottery ticket + + if (rand() % 5) // 1 in 5 chance + { + money += 100; + puts("I've won!"); + } + else + puts("I've lost!"); + + printMoney(); +} + +void work(void) +{ + puts("I'm going to work :("); + + money += 200; // salary + + printMoney(); +} + +int main() +{ + work(); + playLottery(); + work(); + playLottery(); + + return 0; +} +``` + +In C programs you may encounter a **switch** statement -- it is a control structure similar to a branch `if` which can have more than two branches. It looks like this: + +``` + switch (x) + { + case 0: puts("X is zero. Don't divide by it."); break; + case 69: puts("X is 69, haha."); break; + case 42: puts("X is 42, the answer to everything."); break; + default: printf("I don't know anything about X."); break; + } +``` + +Switch can only compare exact values, it can't e.g. check if a value is greater than something. Each branch starts with the keyword `case`, then the match value follows, then there is a colon (`:`) and the branch commands follow. IMPORTANT: there has to be the `break;` statement at the end of each case branch (we won't go into details). A special branch is the one starting with the word `default` that is executed if no case label was matched. + +Let's also mention some additional data types we can use in programs: + +- `char`: A single text character such as *'a'*, *'G'* or *'_'*. We can assign characters as `char c = 'a';` (single characters are enclosed in apostrophes similarly to how text strings are inside quotes). We can read a character as `c = getchar();` and print it as `putchar(c);`. Special characters that can be used are `\n` (newline) or `\t` (tab). Characters are in fact small numbers (usually with 256 possible values) and can be used basically anywhere a number can be used (for example we can compare characters, e.g. `if (c < 'b') ...`). Later we'll see characters are basic building blocks of text strings. +- `unsigned int`: Integer that can only take positive values or 0 (i.e. no negative values). It can store higher positive values than normal `int` (which is called a *signed int*). +- `long`: Big integer, takes more memory but can store number in the range of at least a few billion. +- `float` and `double`: [Floating point](float.md) number (`double` is bigger and more precise than `float`) -- an approximation of [real numbers](real_number.md), i.e. numbers with a fractional part such as 2.5 or 0.0001. You can print these numbers as `printf("%lf\n",x);` and read them as `scanf("%f",&x);`. + +Here is a short example with the new data types: + +``` +#include + +int main(void) +{ + char c; + float f; + + puts("Enter character."); + c = getchar(); // read character + + puts("Enter float."); + scanf("%f",&f); + + printf("Your character is :%c.\n",c); + printf("Your float is %lf\n",f); + + float fSquared = f * f; + int wholePart = f; // this can be done + + printf("It's square is %lf.\n",fSquared); + printf("It's whole part is %d.\n",wholePart); + + return 0; +} +``` + +Notice mainly how we can assign a `float` value into the variable of `int` type (`int wholePart = f;`). This can be done even the other way around and with many other types. C can do automatic **type conversions** (*[casting](cast.md)*), but of course, some information may be lost in this process (e.g. the fractional part). + +In the section about functions we said a function can only call a function that has been defined before it in the source code -- this is because the compiler read the file from start to finish and if you call a function that hasn't been defined yet, it simply doesn't know what to call. But sometimes we need to call a function that will be defined later, e.g. in cases where two functions call each other (function *A* calls function *B* in its code but function *B* also calls function *A*). For this there exist so called **[forward declaractions](forward_decl.md)** -- a forward declaration is informing that a function of certain name (and with certain parameters etc.) will be defined later in the code. Forward declaration look the same as a function definition, but it doesn't have a body (the part between `{` and `}`), instead it is terminated with a semicolon (`;`). Here is an example: + +``` +#include + +void printDecorated2(int x, int fancy); // forward declaration + +void printDecorated1(int x, int fancy) +{ + putchar('~'); + + if (fancy) + printDecorated2(x,0); // would be error without f. decl. + else + printf("%d",x); + + putchar('~'); +} + +void printDecorated2(int x, int fancy) +{ + putchar('>'); + + if (fancy) + printDecorated1(x,0); + else + printf("%d",x); + + putchar('<'); +} + +int main() +{ + printDecorated1(10,1); + putchar('\n'); // newline + printDecorated2(20,1); +} +``` + +which prints + +``` +~>10<~ +>~20~< +``` + +The functions `printDecorated1` and `printDecorated2` call each other, so this is the case when we have to use a forward declaration of `printDecorated2`. Also note the condition `if (fancy)` which is the same thing as `if (fancy != 0)` (imagine `fancy` being 1 and 0 and about what the condition evaluates to in each case). + +## Header Files, Libraries, Compilation/Building + +So far we've only been writing programs into a single source code file (such as `program.c`). More complicated programs consist of multiple files and libraries -- we'll take a look at this now. + +In C we normally deal with two types of source code files: + +- *.c files*: These files contain so called **[implementation](implementation.md)** of algorithms, i.e. code that translates into actual program instructions. These files are what's handed to the compiler. +- *.h files*, or **[header files](header_file.md)**: These files typically contain **declarations** such as constants and function headers (but not their bodies, i.e. implementations). + +When we have multiple source code files, we typically have pairs of *.c* and *.h* files. E.g. if there is a library called *mathfunctions*, it will consist of files *mathfunctions.c* and *mathfunctions.h*. The *.h* file will contain the function headers (in the same manner as with forward declarations) and constants such as [pi](pi.md). The *.c* file will then contain the implementations of all the functions declared in the *.h* file. But why do we do this? + +Firstly *.h* files may serve as a nice documentation of the library for programmers: you can simply open the *.h* file and see all the functions the library offers without having to skim over thousands of lines of code. Secondly this is for how multiple source code files are compiled into a single executable program. + +Suppose now we're compiling a single file named *program.c* as we've been doing until now. The compilation consists of several steps: + +1. The compiler reads the file *program.c* and makes sense of it. +2. It then creates an intermediate file called *program.o*. This is called an [object file](object_file.md) and is a binary compiled file which however cannot yet be run because it is not *linked* -- in this code all memory addresses are relative and it doesn't yet contain the code from external libraries (e.g. the code of `printf`). +3. The compiler then runs a **[linker](linker.md)** which takes the file *program.o* and the object files of libraries (such as the *stdio* library) and it puts them all together into the final executable file called *program*. This is called **linking**; the code from the libraries is copied to complete the code of our program and the memory addresses are settled to some specific values. + +So realize that when the compiler is compiling our program (*program.c*), which contains function such as `printf` from a separate library, it doesn't have the code of these functions available -- this code is not in our file. Recall that if we want to call a function, it must have been defined before and so in order for us to be able to call `printf`, the compiler must know about it. This is why we include the *stdio* library at the top of our source code with `#include ` -- this basically copy-pastes the content of the header file of the *stdio* library to the top of our source code file. In this header there are forward declarations of functions such as `printf`, so the compiler now knows about them (it knows their name, what they return and what parameters they take) and we can call them. + +Let's see a small example. We'll have the following files (all in the same directory). + +*library.h* (the header file): + +``` +// Returns the square of n. +int square(int n); +``` + +*library.c* (the implementation file): + +``` +int square(int x) +{ + // function implementation + return x * x; +} +``` + +*program.c* (main program): + +``` +#include +#include "library.h" + +int main(void) +{ + int n = square(5); + + printf("%d\n",n); + + return 0; +} +``` + +Now we will manually compile the library and the final program. First let's compile the library, in command line run: + +``` +gcc -c -o library.o library.c +``` + +The `-c` flag tells the compiler to only compile the file, i.e. only generate the object (*.o*) file without trying to link it. After this command a file *library.o* should appear. Next we compile the main program in the same way: + +``` +gcc -c -o program.o program.c +``` + +This will generate the file *program.o*. Note that during this process the compiler is working only with the *program.c* file, it doesn't know the code of the function `square`, but it knows this function exists, what it returns and what parameter it has thanks to us including the library header *library.h* with `#include "library.h"` (quotes are used instead of `<` and `>` to tell the compiler to look for the files in the current directory). + +Now we have the file *program.o* in which the compiled `main` function resides and file *library.o* in which the compiled function `square` resides. We need to link them together. This is done like this: + +``` +gcc -o program program.o library.o +``` + +For linking we don't need to use any special flag, the compiler knows that if we give it several *.o* files, it is supposed to link them. The file *program* should appear that we can already run and it should print + +``` +25 +``` + +This is the principle of compiling multiple C files (and it also allows for combining C with other languages). This process is normally automated, but you should know how it works. The systems that automate this action are called **[build systems](build_system.md)**, they are for example [Make](make.md) and [Cmake](cmake.md). When using e.g. the Make system, the whole codebase can be built with a single command `make` in the command line. + +Some programmers simplify this whole process further so that they don't even need a build system, e.g. with so called [header-only libraries](header_only.md), but this is outside the scope of this tutorial. + +As a bonus, let's see a few useful compiler flags: + +- `-O1`, `-O2`, `-O3`: Optimize for speed (higher number means better optimization). Adding `-O3` normally instantly speeds up your program. This is recommended. +- `-Os`: Optimize for size, the same as above but the compiler will try to make as small executable as possible. +- `-Wall -Wextra -pedantic`: The compiler will write more warnings and will be more strict. This can help spot many bugs. +- `-c`: Compile only (generate object files, do not link). +- `-g`: Include debug symbols, this will be important for [debugging](debugging.md). + +## Advanced Data Types And Variables (Structs, Arrays, Strings) + +Until now we've encountered simple data types such as `int`, `char` or `float`. These identify values which can take single atomic values (e.g. numbers or text characters). Such data types are called **[primitive types](primitive_type.md)**. + +Above these there exist **[compound data types](compound_type.md)** (also *complex* or *structured*) which are composed of multiple primitive types. They are necessary any advanced program. + +The first compound type is a structure, or **[struct](struct.md)**. It is a collection of several values of potentially different data types (primitive or compound). The following code shows how a struc can be created and used. + +``` +#include + +typedef struct +{ + char initial; // initial of name + int weightKg; + int heightCm; +} Human; + +int bmi(Human human) +{ + return (human.weightKg * 10000) / (human.heightCm * human.heightCm); +} + +int main(void) +{ + Human carl; + + carl.initial = 'C'; + carl.weightKg = 100; + carl.heightCm = 180; + + if (bmi(carl) > 25) + puts("Carl is fat."); + + return 0; +} +``` + +The part of the code starting with `typedef struct` creates a new data type that we call `Human` (one convention for data type names is to start them with an uppercase character). This data type is a structure consisting of three members, one of type `char` and two of type `int`. Inside the `main` function we create a variable `carl` which is of `Human` data type. Then we set the specific values -- we see that each member of the struct can be accessed using the dot character (`.`), e.g. `carl.weightKg`; this can be used just as any other variable. Then we see the type `Human` being used in the parameter list of the function `bmi`, just as any other type would be used. + +What is this good for? Why don't we just create global variables such as `carl_initial`, `carl_weightKg` and `carl_heightCm`? In this simple case it might work just as well, but in a more complex code this would be burdening -- imagine we wanted to create 10 variables of type `Human` (`john`, `becky`, `arnold`, ...). We would have to painstakingly create 30 variables (3 for each person), the function `bmi` would have to take two parameters (`height` and `weight`) instead of one (`human`) and if we wanted to e.g. add more information about every human (such as `hairLength`), we would have to manually create another 10 variables and add one parameter to the function `bmi`, while with a struct we only add one member to the struct definition and create more variables of type `Human`. + +**Structs can be nested**. So you may see things such as `myHouse.groundFloor.livingRoom.ceilingHeight` in C code. + +Another extremely important compound type is **[array](array.md)** -- a sequence of items, all of which are of the same data type. Each array is specified with its length (number of items) and the data type of the items. We can have, for instance, an array of 10 `int`s, or an array of 235 `Human`s. The important thing is that we can **index** the array, i.e. we access the individual items of the array by their position, and this position can be specified with a variable. This allows for **looping over array items** and performing certain operations on each item. Demonstration code follows: + +``` +#include +#include // for sqrt() + +int main(void) +{ + float vector[5]; + + vector[0] = 1; + vector[1] = 2.5; + vector[2] = 0; + vector[3] = 1.1; + vector[4] = -405.054; + + puts("The vector is:"); + + for (int i = 0; i < 5; ++i) + printf("%lf ",vector[i]); + + putchar('\n'); // newline + + /* compute vector length with + pythagoren theorem: */ + + float sum = 0; + + for (int i = 0; i < 5; ++i) + sum += vector[i] * vector[i]; + + printf("Vector length is: %lf\n",sqrt(sum)); + + return 0; +} +``` + +We've included a new library called `math.h` so that we can use a function for square root (`sqrt`). (If you have trouble compiling the code, add `-lm` flag to the compile command.) + +`float vector[5];` is a declaration of an array of length 5 whose items are of type `float`. When compiler sees this, it creates a continuous area in memory long enough to store 5 numbers of `float` type, the numbers will reside here one after another. + +After doing this, we can **index** the array with square brackets (`[` and `]`) like this: `ARRAY_NAME[INDEX]` where `ARRAY_NAME` is the name of the array (here `vector`) and `INDEX` is an expression that evaluates to integer, **starting with 0** and going up to the vector length minus one (remember that **programmers count from zero**). So the first item of the array is at index 0, the second at index 1 etc. The index can be a numeric constant like `3`, but also a variable or a whole expression such as `x + 3 * myFunction()`. Indexed array can be used just like any other variable, you can assign to it, you can use it in expressions etc. This is seen in the example. Trying to access an item beyond the array's bounds (e.g. `vector[100]`) will likely crash your program. + +Especially important are the parts of code staring with `for (int i = 0; i < 5; ++i)`: this is an iteration over the array. It's a very common pattern that we use whenever we need to perform some action with every item of the array. + +Arrays can also be multidimensional, but we won't bothered with that right now. + +Why are arrays so important? They allow us to work with great number of data, not just a handful of numeric variables. We can create an array of million structs and easily work with all of them thanks to indexing and loops, this would be practically impossible without arrays. Imagine e.g. a game of [chess](chess.md); it would be very silly to have 64 plain variables for each square of the board (`squareA1`, `squareA2`, ..., `squareH8`), it would be extremely difficult to work with such code. With an array we can represent the square as a single array, we can iterate over all the squares easily etc. + +One more thing to mention about arrays is how they can be passed to functions. A function can have as a parameter an array of fixed or unknown length. There is also one exception with arrays as opposed to other types: **if a function has an array as parameter and the function modifies this array, the array passed to the function (the argument) will be modified as well** (we say that arrays are *passed by reference* while other types are *passed by value*). We know this wasn't the case with other parameters such as `int` -- for these the function makes a local copy that doesn't affect the argument passed to the function. The following example shows what's been said: + +``` +#include + +// prints an int array of lengt 10 +void printArray10(int array[10]) +{ + for (int i = 0; i < 10; ++i) + printf("%d ",array[i]); +} + +// prints an int array of arbitrary lengt +void printArrayN(int array[], int n) +{ + for (int i = 0; i < n; ++i) + printf("%d ",array[i]); +} + +// fills an array with numbers 0, 1, 2, ... +void fillArrayN(int array[], int n) +{ + for (int i = 0; i < n; ++i) + array[i] = i; +} + +int main(void) +{ + int array10[10]; + int array20[20]; + + fillArrayN(array10,10); + fillArrayN(array20,20); + + printArray10(array10); + putchar('\n'); + printArrayN(array20,20); + + return 0; +} +``` + +The function `printArray10` has a fixed length array as a parameter (`int array[10]`) while `printArrayN` takes as a parameter an array of unknown length (`int array[]`) plus one additional parameter to specify this length (so that the function knows how many items of the array it should print). The function `printArray10` is important because it shows how a function can modify an array: when we call `fillArrayN(array10,10);` in the `main` function, the array `array10` will be actually modified after when the function finishes (it will be filled with numbers 0, 1, 2, ...). This can't be done with other data types (though there is a trick involving [pointers](pointer.md) which we will learn later). + +Now let's finally talk about **text [strings](string.md)**. We've already seen strings (such as `"hello"`), we know we can print them, but what are they really? A string is a data type, and from C's point of view strings are nothing but **arrays of `char`s** (text characters), i.e. sequences of `char`s in memory. **In C every string has to end with a 0 `char`** -- this is NOT `'0'` (whose [ASCII](ascii.md) value is 48) but the direct value 0 (remember that `char`s are really just numbers). The 0 `char` cannot be printed out, it is just a helper value to terminate strings. So to store a string `"hello"` in memory we need an array of length at least 6 -- one for each character plus one for the terminating 0. These types of string are called **zero terminated strings** (or *C strings*). + +When we write a string such as `"hello"` in our source, the C compiler creates an array in memory for us and fills it with characters `'h'`, `'e'`, `'l'`, `'l'`, `'o'`, 0. In memory this may look like a sequence of numbers 104, 101, 108, 108 111, 0. + +Why do we terminate strings with 0? Because functions that work with strings (such as `puts` or `printf`) don't know what length the string is. We can call `puts("abc");` or `puts("abcdefghijk");` -- the string passed to `puts` has different length in each case, and the function doesn't know this length. But thanks to these strings ending with 0, the function can compute the length, simply by counting characters from the beginning until it finds 0 (or more efficiently it simply prints characters until it finds 0). + +The [syntax](syntax.md) that allows us to create strings with double quotes (`"`) is just a helper (*syntactic sugar*); we can create strings just as any other array, and we can work with them the same. Let's see an example: + +``` +#include + +int main(void) +{ + char alphabet[27]; // 26 places for letters + 1 for temrinating 0 + + for (int i = 0; i < 26; ++i) + alphabet[i] = 'A' + i; + + alphabet[26] = 0; // terminate the string + + puts(alphabet); + + return 0; +} +``` + +`alphabet` is an array of `char`s, i.e. a string. Its length is 27 because we need 26 places for letters and one extra space for the terminating 0. Here it's important to remind ourselves that we count from 0, so the alphabet can be indexed from 0 to 26, i.e. 26 is the last index we can use, doing `alphabet[27]` would be an error! Next we fill the array with letters (see how we can treat `char`s as numbers and do `'A' + i`). We iterate while `i < 26`, i.e. we will fill all the places in the array up to the index 25 (including) and leave the last place (with index 26) empty for the terminating 0. That we subsequently assign. And finally we print the string with `puts(alphabet)` -- here note that there are no double quotes around `alphabet` because its a variable name. Doing `puts("alphabet")` would cause the program to literally print out `alphabet`. Now the program outputs: + +``` +ABCDEFGHIJKLMNOPQRSTUVWXYZ +``` + +In C there is a standard library for working with strings called *string* (`#include `), it contains such function as `strlen` for computing string length or `strcmp` for comparing strings. + +One final example -- a creature generator -- will show all the three new data types in action: + +``` +#include +#include // for rand() + +typedef struct +{ + char name[4]; // 3 letter name + 1 place for 0 + int weightKg; + int legCount; +} Creature; // some weird creature + +Creature creatures[100]; // global array of Creatures + +void printCreature(Creature c) +{ + printf("Creature named %s ",c.name); // %s prints a string + printf("(%d kg, ",c.weightKg); + printf("%d legs)\n",c.legCount); +} + +int main(void) +{ + // generate random creatures: + + for (int i = 0; i < 100; ++i) + { + Creature c; + + c.name[0] = 'A' + (rand() % 26); + c.name[1] = 'a' + (rand() % 26); + c.name[2] = 'a' + (rand() % 26); + c.name[3] = 0; // terminate the string + + c.weightKg = 1 + (rand() % 1000); + c.legCount = 1 + (rand() % 10); // 1 to 10 legs + + creatures[i] = c; + } + + // print the creatures: + + for (int i = 0; i < 100; ++i) + printCreature(creatures[i]); + + return 0; +} +``` + +When run you will see a list of 100 randomly generated creatures which may start e.g. as: + +``` +Creature named Nwl (916 kg, 4 legs) +Creature named Bmq (650 kg, 2 legs) +Creature named Cda (60 kg, 4 legs) +Creature named Owk (173 kg, 7 legs) +Creature named Hid (430 kg, 3 legs) +... +``` + +## Macros/Preprocessor + +The C language comes with a feature called *preprocessor* which is necessary for some advanced things. It allows automatized modification of the source code before it is compiled. + +Remember how we said that compiler compiles C programs in several steps such as generating object files and linking? There is one more step we didn't mention: **[preprocessing](preprocessing.md)**. It is the very first step -- the source code you give to the compiler first goes to the preprocessor which modifies it according to special commands in the source code called **preprocessor directives**. The result of preprocessing is a pure C code without any more preprocessing directives, and this is handed over to the actual compilation. + +The preprocessor is like a **mini language on top of the C language**, it has its own commands and rules, but it's much more simple than C itself, for example it has no data types or loops. + +Each directive begins with `#`, is followed by the directive name and continues until the end of the line (`\` can be used to extend the directive to the next line). + +We have already encountered one preprocessor directive: the `#include` directive when we included library header files. This directive pastes a text of the file whose name it is handed to the place of the directive. + +Another directive is `#define` which creates so called [macro](macro.md) -- in its basic form a macro is nothing else than an alias, a nickname for some text. This is used to create constants. Consider the following code: + +``` +#include + +#define ARRAY_SIZE 10 + +int array[ARRAY_SIZE]; + +void fillArray(void) +{ + for (int i = 0; i < ARRAY_SIZE; ++i) + array[i] = i; +} + +void printArray(void) +{ + for (int i = 0; i < ARRAY_SIZE; ++i) + printf("%d ",array[i]); +} + +int main() +{ + fillArray(); + printArray(); + return 0; +} +``` + +`#define ARRAY_SIZE 10` creates a macro that can be seen as a constant named `ARRAY_SIZE` which stands for `10`. From this line on any occurence of `ARRAY_SIZE` that the preprocessor encounters in the code will be replaced with `10`. The reason for doing this is obvious -- we respect the [DRY](dry.md) (don't repeat yourself) principle, if we didn't use a constant for the array size and used the direct numeric value `10` in different parts of the code, it would be difficult to change them all later, especially in a very long code, there's a danger we'd miss some. With a constant it is enough to change one line in the code (e.g. `#define ARRAY_SIZE 10` to `#define ARRAY_SIZE 20`). + +The macro substitution is literally a copy-paste text replacement, there is nothing very complex going on. This means you can create a nickname for almost anything (for example you could do `#define when if` and then also use `when` in place of `if` -- but it's probably not a very good idea). By convention macro names are to be `ALL_UPPER_CASE` (so that whenever you see an all upper case word in the source code, you know it's a macro). + +Macros can optionally take parameters similarly to functions. There are no data types, just parameter names. The usage is demonstrated by the following code: + +``` +#include + +#define MEAN3(a,b,c) (((a) + (b) + (c)) / 3) + +int main() +{ + int n = MEAN3(10,20,25); + + printf("%d\n",n); + + return 0; +} +``` + +`MEAN3` computes the mean of 3 values. Again, it's just text replacement, so the line `int n = MEAN3(10,20,25);` becomes `int n = (((10) + (20) + (25)) / 3);` before code compilation. Why are there so many brackets in the macro? It's always good to put brackets over a macro and all its parameters because the parameters are again a simple text replacement; consider e.g. a macro `#define HALF(x) x / 2` -- if it was invoked as `HALF(5 + 1)`, the substitution would result in the final text `5 + 1 / 2`, which gives 5 (instead of the intended value 3). + +You may be asking why would we use a macro when we can use a function for computing the mean? Firstly macros don't just have to work with numbers, they can be used to generate parts of the source code in ways that functions can't. Secondly using a macro may sometimes be simpler, it's shorter and will be faster to execute because the is no function call (which has a slight overhead) and because the macro expansion may lead to the compiler precomputing expressions at compile time. But beware: macros are usually worse than functions and should only be used in very justified cases. For example macros don't know about data types and cannot check them, and they also result in a bigger compiled executable (function code is in the executable only once whereas the macro is expanded in each place where it is used and so the code it generates multiplies). + +Another very useful directive is `#if` for conditional inclusion or exclusion of parts of the source code. It is similar to the C `if` command. The following example shows its use: + +``` +#include + +#define RUDE 0 + +void printNumber(int x) +{ + puts( +#if RUDE + "You idiot, the number is:" +#else + "The number is:" +#endif + ); + + printf("%d\n",x); +} + +int main() +{ + printNumber(3); + printNumber(100); + +#if RUDE + puts("Bye bitch."); +#endif + + return 0; +} +``` + +When run, we get the output: + +``` +The number is: +3 +The number is: +100 +``` + +And if we change `#define RUDE 0` to `#define RUDE 1`, we get: + +``` +You idiot, the number is: +3 +You idiot, the number is: +100 +Bye bitch. +``` + +We see the `#if` directive has to have a corresponding `#endif` directive that terminates it, and there can be an optional `#else` directive for an *else* branch. The condition after `#if` can use similar operators as those in C itself (`+`, `==`, `&&`, `||` etc.). There also exists an `#ifdef` directive which is used the same and checks if a macro of given name has been defined. + +`#if` directives are very useful for conditional compilation, they allow for creation of various "settings" and parameters that can fine-tune a program -- you may turn specific features on and off with this directive. It is also helpful for [portability](portability.md); compilers may automatically define specific macros depending on the platform (e.g. `_WIN64`, `__APPLE__`, ...) based on which you can trigger different code. E.g.: + +``` +#ifdef _WIN64 + puts("Your OS sucks."); +#endif +``` + +Let us talk about one more thing that doesn't fall under the preprocessor language but is related to constants: **enumerations**. Enumeration is a data type that can have values that we specify individually, for example: + +``` +typedef enum +{ + APPLE, + PEAR, + TOMATO +} Fruit; +``` + +This creates a new data type `Fruit`. Variables of this type may have values `APPLE`, `PEAR` or `TOMATO`, so we may for example do `Fruit myFruit = APPLE;`. These values are in fact integers and the names we give them are just nicknames, so here `APPLE` is equal to 0, `PEAR` to 1 and `TOMATO` to 2. + +## Pointers + +Pointers are an advanced topic that many people fear -- many complain they're hard to learn, others complain about memory unsafety and potential dangers of using pointers. These people are stupid, pointers are great. + +But beware, there may be too much new information in the first read. Don't get scared, give it some time. + +Pointers allow us to do certain advanced things such as allocate dynamic memory, return multiple values from functions, inspect content of memory or use functions in similar ways in which we use variables. + +A **[pointer](pointer.md)** is nothing complicated: it is a **data type that can hold a memory address** (plus the information of what data type should be stored at that address). An address is simply a number. Why can't we simply use an `int` for an address? Because the size of `int` and a pointer may differ, the size of pointer depends on each platform's address width. It is also good when the compiler knows a certain variable is supposed to point to a memory (and to which type) -- this can prevent bugs. + +It's important to remember that a pointer is not a pure address but it also knows about the data type it is pointing to, so there are many kinds of pointers: a pointer to `int`, a pointer to `char`, a pointer to a specific struct type etc. + +A variable of pointer type is created similarly to a normal variable, we just add `*` after the data type, for example `int *x;` creates a variable named `x` that is a pointer to `int` (some people would write this as `int* x;`). + +But how do we assign a value to the pointer? To do this, we need an address of something, e.g. of some variable. To get an address of a variable we use the `&` character, i.e. `&a` is the address of a variable `a`. + +The last basic thing we need to know is how to **[dereference](dereference.md)** a pointer. Dereferencing means accessing the value at the address that's stored in the pointer, i.e. working with the pointed to value. This is again done (maybe a bit confusingly) with `*` character in front of a pointer, e.g. if `x` is a pointer to `int`, `*x` is the `int` value to which the pointer is pointing. An example can perhaps make it clearer. + +``` +#include + +int main(void) +{ + int normalVariable = 10; + int *pointer; + + pointer = &normalVariable; + + printf("address in pointer: %p\n",pointer); + printf("value at this address: %d\n",*pointer); + + *pointer = *pointer + 10; + + printf("normalVariable: %d\n",normalVariable); + + return 0; +} +``` + +This may print e.g.: + +``` +address in pointer: 0x7fff226fe2ec +value at this address: 10 +normalVariable: 20 +``` + +`int *pointer;` creates a pointer to `int` with name `pointer`. Next we make the pointer point to the variable `normalVariable`, i.e. we get the address of the variable with `&normalVariable` and assign it normally to `pointer`. Next we print firstly the address in the pointer (accessed with `pointer`) and the value at this address, for which we use dereference as `*pointer`. At the next line we see that we can also use dereference for writing to the pointed address, i.e. doing `*pointer = *pointer + 10;` here is the same as doing `normalVariable = normalVariable + 10;`. The last line shows that the value in `normalVariable` has indeed changed. + +IMPORTANT NOTE: **You generally cannot read and write from/to random addresses**! This will crash your program. To be able to write to a certain address it must be *[allocated](allocation.md)*, i.e. reserved for use. Addresses of variables are allocated by the compiler and can be safely operated with. + +There's a special value called `NULL` (a macro defined in the standard library) that is meant to be assigned to pointer that points to "nothing". So when we have a pointer `p` that's currently not supposed to point to anything, we do `p = NULL;`. In a safe code we should always check (with `if`) whether a pointer is not `NULL` before dereferencing it, and if it is, then NOT dereference it. This isn't required but is considered a "good practice" in safe code, storing `NULL` in pointers that point nowhere prevents dereferencing random or unallocated addresses which would crash the program. + +But what can pointers be good for? Many things, for example we can kind of "store variables in variables", i.e. a pointer is a variable which says which variable we are now using, and we can switch between variable any time. E.g.: + +``` +#include + +int backAccountMonica = 1000; +int backAccountBob = -550; +int backAccountJose = 700; + +int *payingAccount; // pointer to who's currently paying + +void payBills(void) +{ + *payingAccount -= 200; +} + +void buyFood(void) +{ + *payingAccount -= 50; +} + +void buyGas(void) +{ + *payingAccount -= 20; +} + +int main(void) +{ + // let Jose pay first + + payingAccount = &backAccountJose; + + payBills(); + buyFood(); + buyGas(); + + // that's enough, now let Monica pay + + payingAccount = &backAccountMonica; + + buyFood(); + buyGas(); + buyFood(); + buyFood(); + + // now it's Bob's turn + + payingAccount = &backAccountBob; + + payBills(); + buyFood(); + buyFood(); + buyGas(); + + printf("Monika has $%d left.\n",backAccountMonica); + printf("Jose has $%d left.\n",backAccountJose); + printf("backAccountBob has $%d left.\n",backAccountBob); + + return 0; +} +``` + +Well, this could be similarly achieved with arrays, but pointers have more uses. For example they allow us to **return multiple values by a function**. Again, remember that we said that (with the exception of arrays) a function cannot modify a variable passed to it because it always makes its own local copy of it? We can bypass this by, instead of giving the function the value of the variable, giving it the address of the variable. The function can read the value of that variable (with dereference) but it can also CHANGE the value, it simply writes a new value to that address (again, using dereference). This example shows it: + +``` +#include +#include + +#define PI 3.141592 + +// returns 2D coordinates of a point on a unit circle +void getUnitCirclePoint(float angle, float *x, float *y) +{ + *x = sin(angle); + *y = cos(angle); +} + +int main(void) +{ + for (int i = 0; i < 8; ++i) + { + float pointX, pointY; + + getUnitCirclePoint(i * 0.125 * 2 * PI,&pointX,&pointY); + + printf("%lf %lf\n",pointX,pointY); + } + + return 0; +} +``` + +Function `getUnitCirclePoint` doesn't return any value in the strict sense, but thank to pointers it effectively returns two `float` values via its parameters `x` and `y`. These parameters are of the data type pointer to `int` (as there's `*` in front of them). When we call the function with `getUnitCirclePoint(i * 0.125 * 2 * PI,&pointX,&pointY);`, we hand over the addresses of the variables `pointX` and `pointY` (which belong to the `main` function and couldn't normally be accessed in `getUnitCirclePoint`). The function can then compute values and write them to these addresses (with dereference, `*x` and `*y`), changing the values in `pointX` and `pointY`, effectively returning two values. + +Now let's take a look at pointers to structs. Everything basically works the same here, but there's one thing to know about, a [syntactic sugar](sugar.md) known as an arrow (`->`). Example: + +``` +#include + +typedef struct +{ + int a; + int b; +} SomeStruct; + +SomeStruct s; +SomeStruct *sPointer; + +int main(void) +{ + sPointer = &s; + + (*sPointer).a = 10; // without arrow + sPointer->b = 20; // same as (*sPointer).b = 20 + + printf("%d\n",s.a); + printf("%d\n",s.b); + + return 0; +} +``` + +Here we are trying to write values to a struct through pointers. Without using the arrow we can simply dereference the pointer with `*`, put brackets around and access the member of the struct normally. This shows the line `(*sPointer).a = 10;`. Using an arrow achieves the same thing but is perhaps a bit more readable, as seen in the line `sPointer->b = 20;`. The arrow is simply a special shorthand and doesn't need any brackets. + +Now let's talk about arrays -- these are a bit special. The important thing is that **an array is itself basically a pointer**. What does this mean? If we create an array, let's say `int myArray[10];`, then `myArray` is basically a pointer to `int` in which the address of the first array item is stored. When we index the array, e.g. like `myArray[3] = 1;`, behind the scenes there is basically a dereference because the index 3 means: 3 places after the address pointed to by `myArray`. So when we index an array, the compiler takes the address stored in `myArray` (the address of the array start) and adds 3 to it (well, kind of) by which it gets the address of the item we want to access, and then dereferences this address. + +Arrays and pointer are kind of a duality -- we can also use array indexing with pointers. For example if we have a pointer declared as `int *x;`, we can access the value `x` points to with a dereference (`*x`), but ALSO with indexing like this: `x[0]`. Accessing index 0 simply means: take the value stored in the variable and add 0 to it, then dereference it. So it achieves the same thing. We can also use higher indices (e.g. `x[10]`), BUT ONLY if `x` actually points to a memory that has at least 11 allocated places. + +This leads to a concept called **[pointer arithmetic](pointer_arithmetic.md)**. Pointer arithmetic simply means we can add or subtract numbers to pointer values. If we continue with the same pointer as above (`int *x;`), we can actually add numbers to it like `*(x + 1) = 10;`. What does this mean?! It means exactly the same thing as `x[1]`. Adding a number to a pointer shifts that pointer given number of *places* forward. We use the word *places* because each data type takes a different space in memory, for example `char` takes one byte of memory while `int` takes usually 4 (but not always), so shifting a pointer by *N* places means adding *N* times the size of the pointed to data type to the address stored in the pointer. + +This may be a lot information to digest. Let's provide an example to show all this in practice: + +``` +#include + +// our own string print function +void printString(char *s) +{ + int position = 0; + + while (s[position] != 0) + { + putchar(s[position]); + position += 1; + } +} + +// returns the length of string s +int stringLength(char *s) +{ + int length = 0; + + while (*s != 0) // count until terminating 0 + { + length += 1; + s += 1; // shift the pointer one character to right + } + + return length; +} + +int main(void) +{ + char testString[] = "catdog"; + + printString("The string '"); + printString(testString); + printString("' has length "); + + int l = stringLength(testString); + + printf("%d.",l); + + return 0; +} +``` + +The output is: + +``` +The string 'catdog' has length 6. +``` + +We've created a function for printing strings (`printString`) similar to `puts` and a function for computing the length of a string (`stringLength`). They both take as an argument a pointer to `char`, i.e. a string. In `printString` we use indexing (`[` and `]`) just as if `s` was an array, and indeed we see it works! In `stringLength` we similarly iterate over all characters in the string but we use dereference (`*s`) and pointer arithmetic (`s += 1;`). It doesn't matter which of the two styles we choose -- here we've shown both, for educational purposes. Finally notice that the string we actually work with is created in `main` as an array with `char testString[] = "catdog";` -- here we don't need to specify the array size between `[` and `]` because we immediately assign a string literal to it (`"catdog"`) and in such a case the compiler knows how big the array needs to be and automatically fills in the correct size. + +Now that know about pointers, we can finally completely explain the functions from `stdio` we've been using: + +- `int puts(char *s)`: A simple and fast function for printing a string (adds the newline character `\n` at the end). +- `int printf(char *format, ...)`: A little bit more complex function that can print not only strings but also other data types. It takes a variable number of parameters. The first one is always a string that specifies the print format -- this string can contain special sequences that will be replaced by textual representations of values we additionally provide as extra parameters after `format`. E.g. the sequence "%d" is replaced with a number obtained from the value of a corresponding `int` parameter. Similarly `%c` is for `char`, `%s` for strings, `%p` for pointers. Example: `printf("MyInt = %d, myChar = %c, MyStr = %s\n",myInt,myChar,myStr);`. +- `int getchar(void)`: Reads a single text character from the input and returns it. Why does the function return `int` and not `char`? Because the function can return additional special values such as `EOF` (end of file) which couldn't be stored in plain `char`. +- `int scanf(char *format, ...)`: Function for reading various data types from the input. Like `printf` it takes a variable number of parameters. The first one is a string that specifies which data type(s) to read -- this is a bit complicated but "%d" reads an `int`, "%f" `float`, "%c" `char` and "%s" string. The following arguments are **pointers** to expected data types, so e.g. if we've provided the format string "%d", a pointer to `int` has to follow. Through this parameter the value that's been read will be returned (in the same way we've seen in one example above). + +## Files + +Now we'll take a look at how we can read and write from/to files on the computer disk which enables us to store information permanently or potentially process data such as images or audio. Files aren't so difficult. + +We work with files through functions provided in the *stdio* library (so it has to be included). We distinguish two types of files: + +- **text files**: Contain text, are human readable. +- **binary files**: Contain binary data, aren't human readable, are more efficient but also more prone to corruption. + +From programmer's point of view there's actually not a huge difference between the two, they're both just sequences of characters or bytes (which are kind of almost the same). Text files are a little more abstract, they handle potentially different format of newlines etc. The main thing for us is that we'll use slightly different functions for each type. + +There is a special data type for file called `FILE` (we'll be using a pointer to it). Whatever file we work with, we need to firstly open it with the function `fopen` and when we're done with it, we need to close it with a function `fclose`. + +First we'll write something to a text file: + +``` +#include + +int main(void) +{ + FILE *textFile = fopen("test.txt","w"); // "w" for write + + if (textFile != NULL) // if opened successfully + fprintf(textFile,"Hello file."); + else + puts("ERROR: Couldn't open file."); + + fclose(textFile); + + return 0; +} +``` + +When run, the program should create a new file named *test.txt* in the same directory we're in and in it you should find the text `Hello file.`. `FILE *textFile` creates a new variable `textFile` which is a pointer to the `FILE` data type. We are using a pointer simply because the standard library is designed this way, its functions work with pointers (it can be more efficient). `fopen("test.txt","w");` attempts to open the file *test.txt* in text mode for writing -- it returns a pointer that represents the opened file. The mode, i.e. text/binary, read/write etc., is specified by the second argument: `"w"`; *w* simply specifies *write* and the text mode is implicit (it doesn't have to be specified). `if (textFile != NULL)` checks if the file has been successfully opened; the function `fopen` returns `NULL` (the value of "point to nothing" pointers) if there was an error with opening the file (such as that the file doesn't exist). On success we write text to the file with a function `fprintf` -- it's basically the same as `printf` but works on files, so it's first parameter is always a pointer to a file to which it should write. You can of course also print numbers and anything that `printf` can with this function. Finally we mustn't forget to close the file at the end with `fclose`! + +Now let's write another program that reads the file we've just created and writes its content out in the command line: + +``` +#include + +int main(void) +{ + FILE *textFile = fopen("test.txt","r"); // "r" for read + + if (textFile != NULL) // if opened successfully + { + char c; + + while (fscanf(textFile,"%c",&c) != EOF) // while not end of file + putchar(c); + } + else + puts("ERROR: Couldn't open file."); + + fclose(textFile); + + return 0; +} +``` + +Notice that in `fopen` we now specify `"w"` (write) as a mode. Again, we check if the file has been opened successfully (`if (textFile != NULL)`). If so, we use a `while` loop to read and print all characters from the file until we encounter the end of file. The reading of file characters is done with the `fscanf` function inside the loop's condition -- there's nothing preventing us from doing this. `fscanf` again works the same as `scanf` (so it can read other types than only `char`s), just on files (its first argument is the file to read from). On encountering end of file `fscanf` returns a special value `EOF` (which is macro constant defined in the standard library). Again, we must close the file at the end with `fclose`. + +We will now write to a binary file: + +``` +#include + +int main(void) +{ + unsigned char image[] = // image in ppm format + { + 80, 54, 32, 53, 32, 53, 32, 50, 53, 53, 32, + 255,255,255, 255,255,255, 255,255,255, 255,255,255, 255,255,255, + 255,255,255, 0, 0, 0, 255,255,255, 0, 0, 0, 255,255,255, + 255,255,255, 255,255,255, 255,255,255, 255,255,255, 255,255,255, + 0, 0, 0, 255,255,255, 255,255,255, 255,255,255, 0, 0, 0, + 255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,255,255 + }; + + FILE *binFile = fopen("image.ppm","wb"); + + if (binFile != NULL) // if opened successfully + fwrite(image,1,sizeof(image),binFile); + else + puts("ERROR: Couldn't open file."); + + fclose(binFile); + + return 0; +} +``` + +Okay, don't get scared, this example looks complex because it is trying to do a cool thing: it creates an image file! When run, it should produce a file named *image.ppm* which is a tiny 5x5 smiley face image in [ppm](ppm.md) format. You should be able to open the image in any good viewer (I wouldn't bet on [Windows](windows.md) programs though). The image data was made manually and are stored in the `image` array. We don't need to understand the data, we just know we have some data we want to write to a file. Notice how we can manually initialize the array with values using `{` and `}` brackets. We open the file for writing and in binary mode, i.e. with a mode `"wb"`, we check the success of the action and then write the whole array into the file with one function call. The function is name `fwrite` and is used for writing to binary files (as opposed to `fprintf` for text files). `fwrite` takes these parameters: pointer to the data to be written to the file, size of one data element (in bytes), number of data elements and a pointer to the file to write to. Our data is the `image` array and since "arrays are basically pointers", we provide it as the first argument. Next argument is 1 (`unsigned char` always takes 1 byte), then length of our array (`sizeof` is a special operator that substitutes the size of a variable in bytes -- since each item in our array takes 1 byte, `sizeof(image)` provides the number of items in the array), and the file pointer. At the end we close the file. + +And finally we'll finish with reading this binary file back: + +``` +#include + +int main(void) +{ + FILE *binFile = fopen("image.ppm","rb"); + + if (binFile != NULL) // if opened successfully + { + unsigned char byte; + + while (fread(&byte,1,1,binFile)) + printf("%d ",byte); + + putchar('\n'); + } + else + puts("ERROR: Couldn't open file."); + + fclose(binFile); + + return 0; +} +``` + +The file mode is now `"rb"` (read binary). For reading from binary files we use the `fread` function, similarly to how we used `fscanf` for reading from a text file. `fread` has these parameters: pointer where to store the read data (the memory must have sufficient space allocated!), size of one data item, number of items to read and the pointer to the file which to read from. As the first argument we pass `&byte`, i.e. the address of the variable `byte`, next 1 (we want to read a single byte whose size in bytes is 1), 1 (we want to read one byte) and the file pointer. `fread` returns the number of items read, so the `while` condition holds as long as `fread` reads bytes; once we reach end of file, `fread` can no longer read anything and returns 0 (which in C is interpreted as a false value) and the loop ends. Again, we must close the file at the end. + +## More On Functions (Recursion, Function Pointers) + +There's more to be known about functions. + +An important concept in programming is [recursion](recursion.md) -- the situation in which a function calls itself. Yes, it is possible, but some rules have to be followed. + +When a function calls itself, we have to ensure that we won't end up in infinite recursion (i.e. the function calls itself which subsequently calls itself and so on until infinity). This crashes our program. There always has to be a **terminating condition** in a recursive function, i.e. an `if` branch that will eventually stop the function from calling itself again. + +But what is this even good for? Recursion is actually very common in math and programming, many problems are recursive in nature. Many things are beautifully described with recursion (e.g. [fractals](fractal.md)). But remember: anything a recursion can achieve can also be achieved by iteration (loop) and vice versa. It's just that sometimes one is more elegant or more computationally efficient. + +Let's see this on a typical example of the mathematical function called [factorial](factorial.md). Factorial of *N* is defined as *N* x *(N - 1)* x *(N - 2)* x ... x 1. It can also be defined recursively as: factorial of *N* is 1 if *N* is 0, otherwise *N* x *N - 1*. Here is some code: + +``` +#include + +unsigned int factorialRecursive(unsigned int x) +{ + if (x == 0) // terminating condition + return 1; + else + return x * factorialRecursive(x - 1); +} + +unsigned int factorialIterative(unsigned int x) +{ + unsigned int result = 1; + + while (x > 1) + { + result *= x; + x--; + } + + return result; +} + +int main(void) +{ + printf("%d %d\n",factorialRecursive(5),factorialIterative(5)); + return 0; +} +``` + +`factorialIterative` computes the factorial by iteration. `factorialRecursive` uses recursion -- it calls itself. The important thing is the recursion is guaranteed to end because every time the function calls itself, it passes a decremented argument so at one point the function will receive 0 in which case the terminating condition (`if (x == 0)`) will be triggered which will avoid the further recursive call. + +It should be mentioned that performance-wise recursion is almost always worse than iteration (function calls have certain overhead), so in practice it is used sparingly. But in some cases it is very well justified (e.g. when it makes code much simpler while creating unnoticeable performance loss). + +Another thing to mention is that we can have **pointers to functions**; this is an advanced topic so we'll stay at it just briefly. Function pointers are pretty powerful, they allow us to create so called *[callbacks](callback.md)*: imagine we are using some [GUI](gui.md) framework and we want to tell it what should happen when a user clicks on a specific button -- this is usually done by giving the framework a pointer to our custom function that it will be called by the framework whenever the button is clicked. + +## Dynamic Allocation (Malloc) + +Dynamic memory allocation means the possibility of reserving additional memory for our program at run time, whenever we need it. This is opposed to static memory allocation, i.e. reserving memory for use at compile time (when compiling, before the program runs). We've already been doing static allocation whenever we created a variable -- compiler automatically reserves as much memory for our variables as is needed. But what if we're writing a program but don't yet know how much memory it will need? Maybe the program will be reading a file but we don't know how big that file is going to be -- how much memory should we reserve? Dynamic allocation allows us to reserve this memory with functions when the program is actually runing and already knows how much of it should be reserved. + +It must be known that dynamic allocation comes with a new kind of bug known as a **[memory leak](memory_leak.md)**. It happens when we reserve a memory and forget to free it after we no longer need it. If this happens e.g. in a loop, the program will continue to "grow", eat more and more RAM until operating system has no more to give. For this reason, as well as others such as simplicity, it may sometimes be better to go with only static allocation. + +Anyway, let's see how we can allocate memory if we need to. We use mostly just two functions that are provided by the *stdlib* library. One is `malloc` which takes as an argument size of the memory we want to allocate (reserve) in bytes and returns a pointer to this allocated memory if successful or `NULL` if the memory couldn't be allocated (which in serious programs we should always check). The other function is `free` which frees the memory when we no longer need it (every allocated memory should be freed at some point) -- it takes as the only parameter a pointer to the memory we've previously allocated. There is also another function called `realloc` which serves to change the size of an already allocated memory: it takes a pointer the the allocated memory and the new size in byte, and returns the pointer to the resized memory. + +Here is an example: + +``` +#include +#include + +#define ALLOCATION_CHUNK 32 // by how many bytes to resize + +int main(void) +{ + int charsRead = 0; + int resized = 0; // how many times we called realloc + char *inputChars = malloc(ALLOCATION_CHUNK * sizeof(char)); + + while (1) // read input characters + { + char c = getchar(); + + charsRead++; + + if (c == '\n') + break; + + if ((charsRead % ALLOCATION_CHUNK) == 0) + { + inputChars = // we need more space, resize the array + realloc(inputChars,(charsRead / ALLOCATION_CHUNK + 1) * ALLOCATION_CHUNK * sizeof(char)); + + resized++; + } + + inputChars[charsRead] = c; + } + + puts("The string you entered backwards:"); + + while (charsRead > 0) + { + putchar(inputChars[charsRead - 1]); + charsRead--; + } + + free(inputChars); // important! + + putchar('\n'); + printf("I had to resize the input buffer %d times.",resized); + + return 0; +} +``` + +This code reads characters from the input and stores them in an array (`inputChars`) -- the array is dynamically resized if more characters are needed. (We restraing from calling the array `inputChars` a string because we never terminate it with 0, we couldn't print it with standard functions like `puts`.) At the end the entered characters are printed backwards (to prove we really stored all of them), and we print out how many times we needed to resize the array. + +We define a constant (macro) `ALLOCATION_CHUNK` that says by how many characters we'll be resizing our character buffer. I.e. at the beginning we create a character buffer of size `ALLOCATION_CHUNK` and start reading input character into it. Once it fills up we resize the buffer by another `ALLOCATION_CHUNK` characters and so on. We could be resizing the buffer by single characters but that's usually inefficient (the function `malloc` may be quite complex and take some time to execute). + +The line starting with `char *inputChars = malloc(...` creates a pointer to `char` -- our character buffer -- to which we assign a chunk of memory allocated with `malloc`. Its size is `ALLOCATION_CHUNK * sizeof(char)`. Note that for simplicity we don't check if `inputChars` is not `NULL`, i.e. whether the allocation succeeded -- but in your program you should do it :) Then we enter the character reading loop inside which we check if the buffer has filled up (`if ((charsRead % ALLOCATION_CHUNK) == 0)`). If so, we used the `realloc` function to increase the size of the character buffer. The important thing is that once we exit the loop and print the characters stored in the buffer, we free the memory with `free(inputChars);` as we no longer need it. + +## Debugging, Optimization + +[Debugging](debugging.md) means localizing and fixing [bugs](bug.md) (errors) in your program. In practice there are always bugs, even in very short programs (you've probably already figured that out yourself), some small and insignificant and some pretty bad ones that make your program unusable or vulnerable. + +There are two kinds of bugs: **[syntactic](syntax.md) errors** and **[semantic](semantics.md) errors**. A syntactic error is when you write something not obeying the C grammar, it's like a typo or grammatical error in a normal language -- these errors are very easy to detect and fix, a compiler won't be able to understand your program and will point you to the exact place where the error occurs. A semantic error can be much worse -- it's a logical error in the program; the program will compile and run but the program will behave differently than intended. The program may crash, leak memory, give wrong results, run slowly, corrupt files etc. These errors may be hard to spot and fix, especially when they happen in rare situations. We'll be only considering semantic errors from now on. + +If we spot a bug, how do we fix it? The first thing is to find a way to **replicate** it, i.e. find the exact steps we need to make with the program to make the bug appear (e.g. "in the menu press keys A and B simultaneously", ...). Next we need to trace and locate which exact line or piece of code is causing the bug. This can either be done with the help of specialized [debuggers](debugger.md) such as [gdb](gdb.md) or [valgrind](valgrind.md), but there's usually a much easier way of using printing functions such as `printf`. (Still do check out the above mentioned debuggers, they're very helpful.) + +Let's say your program crashes and you don't know at which line. You simply put prints such as `printf("A\n");` and `printf("B\n);` at the beginning and end of a code you suspect might be causing the crash. Then you run the program: if `A` is printed but `B` isn't, you know the crash happened somewhere between the two prints, so you shift the `B` print a little bit up and so on until you find exactly after which line `B` stops printing -- this is the line that crashes the program. IMPORTANT NOTE: the prints have to have newline (`\n`) at the end, otherwise this method may not work because of output buffering. + +Of course, you may use the prints in other ways, for example to detect at which place a value of variable changes to a wrong value. ([Asserts](assert.md) are also good for keeping an eye on correct values of variables.) + +What if the program isn't exactly crashing but is giving wrong results? Then you need to trace the program step by step (not exactly line by line, but maybe function by function) and check which step has a problem in it. If for example your game AI is behaving stupid, you firstly check (with prints) if it correctly detects its circumstances, then you check whether it makes the correct decision based on the circumstances, then you check whether the pathfinding algorithm finds the correct path etc. At each step you need to know what the correct behavior should be and you try to find where the behavior is broken. + +Knowing how to fix a bug isn't everything, we also need to find the bugs in the first place. **[Testing](testing.md)** is the process of trying to find bugs by simply running and using the program. Remember, testing can't prove there are no bugs in the program, it can only prove bugs exits. You can do testing manually or automate the tests. Automated tests are very important for preventing so called **[regressions](regression.md)** (so the tests are called regression tests). Regression happens when during further development you break some of its already working features (it is very common, don't think it won't be happening to you). Regression test (which can simply be just a normal C program) simply automatically checks whether the already implemented functions still give the same results as before (e.g. if *sin(0) = 0* etc.). These tests should be run and pass before releasing any new version of the program (or even before any commit of new code). + +[Optimization](optimization.md) is also a process of improving an already working program, but here we try to make the program more efficient -- the most common goal is to make the program faster, smaller or consume less [RAM](ram.md). This can be a very complex task, so we'll only mention it briefly. + +The very basic thing we can do is to turn on automatic optimization with a compiler flag: `-O3` for speed, `-Os` for program size (`-O2` and `-O1` are less aggressive speed optimizations). Yes, it's that simple, you simply add `-O3` and your program gets magically faster. Remember that **optimizations against different resources are often antagonistic**, i.e. speeding up your program typically makes it consume more memory and vice versa. You need to choose. Optimizing manually is a great art. Let's suppose you are optimizing for speed -- the first, most important thing is to locate the part of code that's slowing down you program the most, so called **[bottleneck](bottleneck.md)**. That is the code you want to make faster. Trying to optimize non-bottlenecks doesn't speed up your program as a whole much; imagine you optimize a part of the code that takes 1% of total execution time by 200% -- your program will only get 0.5% faster. Bottlenecks can be found using [profiling](profiling.md) -- measuring the execution time of different parts of the program (e.g. each function). This can be done manually or with tools such a [gprof](gprof.md). Once you know where to optimize, you try to apply different techniques: using algorithms with better [time complexity](time_complexity.md), using [look up tables](lut.md), optimizing [cache](cache.md) behavior and so on. This is beyond the scope of this tutorial. + +## Final Program + +TODO + +## Where To Go Next + +We haven't covered the whole of C, not even close, but you should have pretty solid basics now. Now you just have to go and write a lot of C programs, that's the only way to truly master C. WARNING: Do not start with an ambitious project such as a 3D game. You won't make it and you'll get demotivated. Start very simple (a Tetris clone perhaps?). + +You should definitely learn about common [data structures](data_strucutre.md) ([linked lists](linked_list.md), [binary trees](binary_tree.md), [hash tables](hash.md), ...) and [algorithms](algorithm.md) ([sorting](sorting.md), [searching](search.md), ...). Also take a look at basic [licensing](license.md). Another thing to learn is some [version control system](vcs.md), preferably [git](git.md), because this is how we manage bigger programs and how we collaborate on them. To start making graphical programs you should get familiar with some library such as [SDL](sdl.md). + +A great amount of experience can be gained by contributing to some existing project, collaboration really boosts your skill and knowledge of the language. This should only be done when you're at least intermediate. Firstly look up a nice project on some git hosting site, then take a look at the bug tracker and pick a bug or feature that's easy to fix or implement (low hanging fruit). diff --git a/cancer.md b/cancer.md new file mode 100644 index 0000000..de7d25c --- /dev/null +++ b/cancer.md @@ -0,0 +1,7 @@ +# Cancer + +Cancer is similar to [shit](shit.md) but is even worse because it spreads itself and infects anything else it touches (it is a subset of shit). + +## See Also + +- [shit](shit.md) \ No newline at end of file diff --git a/capitalism.md b/capitalism.md new file mode 100644 index 0000000..fa7bce9 --- /dev/null +++ b/capitalism.md @@ -0,0 +1,68 @@ +# Capitalism + +*"Capitalism is the astonishing belief that the most evil among men will for the nastiest motives work for the benefit of all."* + +Capitalism is the worst economic system we've yet seen in the history,^[source](logic.md) literally based on pure greed and artificially sustained conflict between people (so called [competition](competition.md)), abandoning all morals and putting money and profit (so called [capital](capital.md)) above everything else including preservation of life itself, capitalism fuels the worst in people and forces them to compete and suffer for basic resources, even in a world where abundance of resources is already possible to achieve. Capitalism goes against progress (see e.g. [antivirus paradox](antivirus_paradox.md)), [good technology](lrs.md), freedom, it supports immense waste of resources, wars, abuse of people, destruction of environment, decline of morals, invention of [bullshit](bullshit.md) (bullshit jobs, bullshit laws, ...), [torture](marketing.md) of people and animals and much more. Nevertheless, it's been truthfully stated that "it is now easier to imagine the end of all life than any substantial change in capitalism." + +Capitalism produces the [worst imaginable technology](capitalist_software.md) and rewards people for [being cruel to each other](entrepreneur.md). It points the direction of society towards a [collapse](collapse.md) and may very likely be the [great filter](great_filter.md) of civilizations; in capitalism people de-facto own nothing and become wholly dependent on corporations which exploit this fact to abuse them as much as possible. This is achieved by [slowly boiling the frog](slowly_boiling_the_frog.md). No one owns anything, products become [services](saas.md) (your car won't drive without Internet connection and permission from its manufacturer), all independency and decentralization is lost in favor of a highly fragile and interdependent economy and infrastructure of services. Then only a slight break in the chain is enough to bring the whole civilization down. + +**The underlying issue of capitalism is [competition](competition.md)** -- competition is the root of all evil in any social system, however capitalism is the glorification of competition, amplification of this evil to maximum. It is implemented by setting and supporting a very stupid idea that **everyone's primary and only goal is to be self-benefit**, i.e. maximization of capital. This is combined with the fact that the environment of [free market](free_market.md) is a system with **Darwinian evolution** which through natural selection extremely effectively and quickly optimizes the organisms (corporations) for achieving this given goal, i.e. generating maximum profit, on the detriment of all other values such as wellbeing of people, sustainability or morality. In other words capitalism has never promised a good society, it literally only states that everyone should try to benefit oneself as much as possible, i.e. defines the [fitness function](fitness_function.md) purely as the ability to seize as many resources as possible, and then selects and rewards those who best implement this function, i.e. those we would call sociopaths or "dicks", and to those is given the power in society. In other words we simply get what we set to achieve: find entities that are best at making profit at any cost. The inevitable decline of society can not possibly be prevented by laws, any effort of trying to stop evolution by inventing artificial rules on the go is a battle against nature itself and is extremely naive, the immense power of the evolutionary system that's constantly at work to find ways to bypass or cancel laws in the way of profit and abuse of others will prevails just as life will always find its way to survive and thrive even in the worst conditions on Earth. Trying to stop corporations with laws is like trying to stop a train by throwing sticks in its path. The problem is not that "people are dicks", it is that we choose to put in place a system that rewards the dicks, a system that fuels the worst in people and smothers the best in them. + +From a certain point of view capitalism is not really a traditional socioeconomic system, it is **the failure to establish one** -- capitalism is the failure to prevent the establishment of capitalism, and it is also the punishment for this failure. It is the continuation of the jungle to the age when technology for mass production, mass surveillance etc. has sufficiently evolved -- capitalism will arise with technological progress unless we prevent it, just as cancer will grow unless we treat it in very early stages. This is what people mean when they say that capitalism [simply works](just_werks.md) or that it's *natural* -- it's the least effort option, one that simply lets people behave like animals, except that these animals are now equipped with weapons of mass destruction, tools for implementing slavery etc. It is natural in the same way in which wars, murders, bullying and deadly diseases are. It is the most primitive system imaginable, it is uncontrolled, leads to suffering and self-destruction. + +## Attributes Of Capitalism + +The following is a list of just SOME attributes of capitalism -- note that not all of them are present in initial stages but capitalism will always converge towards them. + +- **[slavery](slavery.md), oppression, loss of freedom**: In capitalism people are slaves firstly as workers -- in work time, so called [wage slavery](wage_slavery.md) -- and secondly as consumers -- in "free" time. Banks create inflation to devalue money people save so that they have to work constantly for their whole lives as products are getting progressively more expensive. More and more essentially unnecessary spending purchases are forced on people -- new smartphone every year, mortgages, gas and maintenance to cars, new clothes according to fashion, insurances etc. Practically no one has a truly free time nowadays. +- **extreme waste**: Bullshit products, [bullshit jobs](bullshit_job.md) and the need for constant dynamics on the market force to waste energy, material and human work just on keeping everything in motion, even if purely arbitrarily. Corporations keep reinventing and reselling slightly modified version of already existing products, one group of people is creating something while another group is destroying it, just to keep everyone occupied. Byproduct physical waste such as plastics and chemicals are dumped in the environment and pollute it for decades, even centuries to come. +- **[antivirus paradox](antivirus_paradox.md)**: Sustaining and artificially creating negative phenomena so as to build a business in [fighting](fight.md) it, to keep and create jobs ("firefighters starting fires"). + - **[artificial scarcity](artificial_scarcity.md)**: In order to be able to sell something, that something has to be scarce, an abundant resource such as air cannot be sold. Once technology emerges to make some resource abundant, it threatens those who have a business in selling that resource. This creates the huge interest in keeping resources scarce, sometimes by force. Corporations are known to routinely destroy food that can still be eaten, and other goods as well. Corporations indirectly conspire on keeping resources scarce by artificial obsolescence, outlawing old products as "unsafe", using [copyright](copyright.md) to prevent people from recycling old intellectual works etc. + - **[artificial obsolescence](artificial_obsolescence.md)**: To keep businesses running companies have an interest in making people consume even things that could otherwise last them even whole lives, so we see phenomena like people being forced to buy new phones every every year. There used to be the famous light bulb cartel ([Phoebus cartel](phoebus_cartel.md)) that fined any bulb manufacturer that made long lasting light bulbs, bulbs were forcefully made to last for a short time. [Apple](apple.md) has remotely decreased the performance of older [iPhones](iphone.md) when new ones came out. There are countless examples. + - **artificial crippling of technology**: It is nowadays the norm to create a high tier product, such as a CPU or a car, and then artificially cripple some of the manufactured units (limit car engine power by software, burn parts of the CPU, ...) so as to sell them as a lower tier of that product. It is cheaper than to separately invent several tiers of the product. So it costs the same (actually less) to create a high end CPU as the low end one -- we could all be using high end CPUs, but the poorer of us are forced to use the forcefully crippled versions, because "capitalism". + - **purposeful incompatibility in technology**: In market competition products of one company will often be incompatible with products of the competition on purpose, so as to discourage consumers from buying it. Technology corporations create their own "ecosystems" for consumers into which they are trying to lock them. + - **[bullshit jobs](bullshit_job.md), invention of bullshit products/needs**: As automatization takes people's jobs, people try to keep jobs by creating artificial bullshit, e.g. "lack of women in tech" leads to creation of "diversity departments", politicians try to *create more jobs* by increasing bureaucracy etc. This is of course in direct conflict with the base goal of civilization itself of eliminating the need for human work. One online company even successfully sold literal excrement (which had no actual use, it was just marketed as "funny and cool"). + - **preventing progress, sustaining status quo**: Capitalism is extremely hostile towards social progress (more leisure time, more social security, ...), i.e. the main kind of progress. It is also, contrary to popular belief, against technological progress -- the established corporations want to perpetuate their established businesses and will attack and destroy new ideas that endanger it (i.e. electric cars vs fuel powered cars, ...). +- **[fascism](fascism.md)**: Capitalism is based on fascism, i.e. extreme hierarchy and "tribes" of which each fights to death for its own self interest. This fight happens between companies themselves, between state and companies, different departments inside companies, between workers and employers, between brands on the market etc. +- **no long term planning, irresponsibility**: Companies need to make immediate profit, it's extremely rare to plan longer than 5 years ahead. Managers hired to new positions are expected to immediately increase profits and they won't stay for long, so they simply do whatever it takes to create immediate profit without considering any long term consequence such as pollution etc. +- **extreme lowering of quality of products, deterioration of [art](art.md)**: Despite capitalist propaganda, capitalism doesn't lead to increased quality of products -- on the contrary it seeks to find the MINIMUM quality that will be accepted by the consumer. In seeking to minimize manufacturing cost of a single unit, companies save money wherever they can and rather invest in marketing etc. -- for example instead of paying several experts to produce a good, well fact-checked documentary, only one man will be paid to create the documentary with the focus on it being "fun and engaging" rather than factually correct. Art is hasted, scheduled, produced on short deadlines, littered with product placement etc. +- **[plutocracy](plutocracy.md), i.e. loss of (true) [democracy](democracy.md)**: In capitalism only illusion of democracy is sustained, there is no rule of the people, there is rule of the rich THROUGH people, as the rich are who make the laws and actually take the ruling positions and who have a tremendous power to manipulate masses via private media. State is becoming more and more the tool of corporations rather than a protection against them. +- **[monopolies](monopoly.md) with unlimited power, degeneration of competition**: The naive ideas of capitalists that markets will magically regulate themselves quickly falls apart, basically no one believes it. In a competitive market monopolies arise in a short time who will prevent any competition from even arising. Can a tiny starting company compete with an established corporations with billions of dollars at their hand? No. The corporation can defeat them by gigantic marketing, unfair practices (unfair prices etc.) despite fines, by buying them, legal trolling, negative internet reviews etc. Once a monopoly without competition exists, the few advantages of competition disappear completely. A corporation doesn't respond to demand, it creates the demand. It can do whatever it likes, it can set arbitrarily high prices, create arbitrarily shitty products and so on, no competition is pressuring it to do otherwise, people have no choice than to to subvert. +- **[poverty](poverty.md)**: Despite capitalist propaganda, not everyone can be successful in capitalism (if everyone could retire at 20, why doesn't everyone just do it?), and it is a fact that because [money makes money](money_makes_money.md), the gap between the poor and the rich is becoming wider and wider (as of 2020, 8 richest people owned as much wealth as the whole poorer half of the population). Poor people are pushed into loans, getting into debts, working multiple jobs, while their health deteriorates increasing their depth on medical bills, decreasing their ability to work more etc. +- **torture and killing of people**: The poorest, mostly in third world countries, including children, are forced to hard labor that destroys their lives. Whole cities live off of processing waste coming from first world countries, e.g. disintegrating used ships with primitive tools, no work safety, breathing cancerous fumes etc. +- **money and profit above everything**: By definition capitalism advises ONLY to maximize one's profit, any other values such as human well being, peace, preservation of life environment or progress are subverted to the goal of profit. As other values are often in conflict with profit, profit wins and people suffer. +- **[fight culture](fight_culture.md), extreme hostility between people, disappearance of morality**: The very basis of capitalism -- competition -- nurtures people towards self interest, self centeredness and hostility towards others while suppressing good attributes such as sharing, love for others and [altruism](altruism.md). With this morals decline. Furthermore the system of overcomplicated laws are starting to replace morals, people as "is it legal?" rather than "is it a good thing to do?". This creates a society of dicks and psychopaths who are additionally rewarded for their immoral behavior by becoming "successful" and wealthy. In long term this serves as a natural selection of Darwinian evolution, immorally behaving people are actually more likely to survive and reproduce, which leads to genes of psychopathic behavior becoming more and more common in society -- under capitalism good people quite literally become extinct in the long run. +- **[fear culture](fear_culture.md)**: To keep people consuming and constantly engaged a tension has to be kept, comfortable people are undesirable in capitalism. So there is constantly a propaganda of some threat, be it viruses, terrorism, pedophiles on the internet, computer viruses, killing bees etc. +- **[consumerism](consumerism.md)**: To keep businesses running people need to consume everything, even things that shouldn't be consumed and that could last for very long such as computers and cars. This leads to creation of hasted low quality products (even art such as TV series) that are meant to be used and thrown away, repairing is no longer considered. +- **commerce infects absolutely everything**: In advanced capitalism there is no such thing as a commerce free zone, everything is privatized eventually and serves selfish interests. Nowadays even such areas as health care, wellfare or education of children is permeated by money, ads and corporate propaganda. Even nonprofits have to make money. Educational videos in schools are preceded with ads (as they are played on [YouTube](youtube.md)), propagandists even legally go to school and brainwash little children (they call it "education in financial literacy" and teach children that they should e.g. create bank accounts in the propagandist's specific bank). +- **destruction of environment**: This is nowadays already pretty clear, [global warming](global_warming.md) is attributed mainly to capitalism. Lack of long term planning, consumerism and extreme waste (of energy, creating physical waste such as plastics etc.) lead to the destruction of nature itself. +- **loss of ethical behavior**: Ethical behavior is a disadvantage in a competitive environment of the market, it is a limitation. Those trying to behave ethically (e.g. fair prices, ...) will simply lose to the unethically behaving ones and be eliminated from the market. Eventually there only remain unethically behaving entities, just as for example vegetarian people would not survive in a jungle. +- **anti-people design**: By definition in capitalism technology is not to serve people, it is to serve companies to make profit and abuse people, so technology spies on its users, refuses to work ([DRM](drm.md), ...) shows [ads](ad.md), forces children into purchases (predatory [games](game.md)), breaks on purpose so as to enforce a paid repair etc. +- **[censorship](censorship.md)**: So called [intellectual property](intellectual_property.md) allows for extreme censorship. Privately owned media lawfully censor and manipulate information so as to manipulate people in whichever way they see will bring them most profit. +- **[surveillance](surveillance.md)**: Companies want to analyze behavior of people, manipulate them, target ads, spam, train neural networks on their data etc., so there is an interest in applying surveillance. Indeed, this is exactly what we see in practice. +- **extreme [brainwashing](brainwashing.md) and propaganda**: [Marketing](marketing.md) becomes extreme in capitalism, utilizing advanced psychological tricks and repetition to the point of becoming a torture, with the goal of teaching people brand loyalty, consumerist behavior etc. Application of this brainwashing even on children has already been normalized. Entrepreneurs create cults of personalities. There is now even a "legit" job called an [influencer](influencer.md) whose sole purpose is in spreading corporate propaganda on the Internet. +- **criminality**: This is a direct consequence of poverty and diminishing morality. +- **instability**: Lack of long term planning, fragility of the market, increasing wealth gap, pushing workers to poverty, creating extreme interdependencies, eliminating self sufficiency and other phenomena pose great dangers of market collapses, violent strikes, disasters and even societal [collapse](collapse.md). +- **need for extremely complex market control and laws, burdening society**: As corporations are absolutely unethical and pursue evil goals such as enslaving workers and abuse of consumers, there have to be an extremely complex set of constantly evolving laws and bureaucracy just to somehow "make corporations behave". However laws are imperfect and corporations work 24/7 on bypassing them as well as on attacking and eliminating the laws themselves via lobbyist etc. This creates a constant, extremely expensive legal war (which eventually corporations will likely win). +- **uncontrolled growth**: Capitalism is likened to [cancer](cancer.md) as it requires a constant uncontrolled growth which on a planet of limited resources inevitably leads to a catastrophic scenario. +- **hyperspecialization, loss of self sufficiency**: Entities (people, cities, companies, states, ...) lose self sufficiency as they hyperspecialize in some task and in everything else rely on someone else. This complete dependence creates slavery and danger -- in an event of a blackout for example people cannot survive as they cannot make their own food. +- **loss of humanity**: In capitalism humans are just consumers and resources -- corporations now routinely use these terms (*human resources department* etc.). People are brainwashed to no longer even take offense in being called such terms. People's worth is only in how much they can work or consume. +- **abuse of animals**: In capitalism animals are just products and resources, they are kept in very bad conditions just to be killed for meat or other purpose. They are slaughtered by millions just so we can overeat to morbid obesity. Maximizing profit dictates no money should be spent on animal comfort. +- **[productivity cult](productivity_cult.md)**: People are brainwashed and forced into becoming robots whose sole purpose is to produce. Working overtimes, skipping lunch, minimizing sleep etc. has already become part of the work culture for example in USA and Japan. +- **endangering existence of all life**: The mentioned lack of long term planning, irresponsibility and instability along with creating a dangerous overdependence on technology and interconnections of self insufficient states and cities is just waiting for a disaster such as [CME](cme.md) that immediately collapses the civilization and consequently endangers all life on Earth e.g. by meltdowns in nuclear plants or possible nuclear wars as a consequence of panic. The absolute preference of immediate profit is hostile towards investments in future and precautions. + +## How It Works + +Capitalism newly instated in a society kind of **works for a short time**, but it never lasts. Initially when more or less everyone is at the same start line, when there are no highly evolved corporations with their advanced methods of oppression, small businesses grow and take their small shares of the market, there appears true innovation, businesses compete by true quality of products, people are relatively free and it all feels natural because it is, it's the system of the jungle, i.e. as has been said, capitalism is the failure to establish a controlled socioeconomic system rather than a presence of a purposefully designed one. Its benefits for the people are at this point only a side effect, people see it as good and continue to support it. However the system has other goals of its own, and that is the development and constant growth that's meant to create a higher organism just like smaller living cells formed us, multi cell organisms. The system will start being less and less beneficial to the people who will only become cells in a higher organism to which they'll become slaves. A cell isn't supposed to be happy, it is supposed to sacrifice its life for the good of the higher organism. + +{ This initial prosperous stage appeared e.g. in Czechoslovakia, where I lived, in the 90s, after the fall of the totalitarian regime. Everything was beautiful, sadly it didn't last longer than 10-20 years at most. ~drummyfish } + +Slowly medium sized businesses will grow and become [corporations](corporation.md). These are the first higher order entities that have an intelligence of their own, they are composed of humans and technology who together work solely for the corporation's further growth. A corporation has a super human intelligence but has no human emotion or conscience, it is basically the rogue [AI](ai.md) we read about in sci-fi horror movies. Corporation selects only the worst of humans for the management positions and has further mechanisms to eliminate any effects of human conscience and tendency for ethical behavior; for example it works on the principle of ["I'm just doing my job"](just_doing_my_job.md): everyone is just doing a small part of what the whole company is doing so that no one feels responsible for the whole or sometimes doesn't even know what he's part of. If anyone protests, he's replaced with a new hire. + +Corporations make calculated decisions to eliminate any competition, they devour or kill smaller businesses with unfair practices, more marketing and by other means, both legal and illegal. They develop advanced psychological methods and extort extreme pressure such as brainwashing by ads to the population to create an immensely powerful propaganda that bends any natural human thinking. With this corporations no longer need to satisfy the demand, they **create the demand** arbitrarily. They create artificial scarcity, manipulate the market, manipulate the people, manipulate laws. At this point they've broken the system, competition no longer works as idealized by theoretical capitalists, corporations can now do practically anything they want. + +This is a system with [Darwinian evolution](evolution.md) in which the fitness function is simply the [capital](capital.md). Entities involved in the market are simply chosen by natural selection to be the ones that best make profit, i.e. who are best at circumventing laws, brainwashing, hiding illegal activities etc. Ethical behavior is a disadvantage that leads to elimination; if a business decides to behave ethically, it is outrun by the one who doesn't have this weakness. + +The unfair, unethical behavior of corporations is still supposed to be controlled by the [state](state.md), however corporations become stronger and bigger than states, they can manipulate laws by lobbying, financially supporting preferred candidates, brainwashing people via private media and so on. States are the only force left supposed to protect people from this pure evil, but they are too weak; a single organization of relatively few people who are, quite importantly, often corporation managers, won't compete against a plethora of the best warriors selected by the extremely efficient system of free market. States slowly turn to serving corporations, becoming their tools and then slowly dissolve (see how small role the US government already plays). This leads to "[anarcho capitalism](ancap.md)", the worst stage of capitalism where there is no state, no entity supposed to protect the people, there is only one rule and that is the unlimited rule of the strongest. + +Here the strongest corporation takes over the world and starts becoming the higher order organism of the whole Earth. It doesn't have to pretend anything at this point, it can simply hire an army, it can use physical force, chemical weapons, torture, unlimited surveillance, anything to achieve further seize of remaining bits of power and resources. We can only guess what will happen here, a [collapse](collapse.md) due to instability or total destruction of environment is possible, which would at least save the civilization from the horrendous fate of being eternally tortured. If the system survives, humans will be probably genetically engineered to be more submissive, killing any hope of a possible revolt, surveillance chips will be implanted to everyone, reproduction will be controlled precisely and finally perhaps the system will be able, thanks to an advanced [AI](ai.md), to exist and work more efficiently without humans completely, so they will be eliminated. This is how the mankind ends. diff --git a/capitalist_singularity.md b/capitalist_singularity.md new file mode 100644 index 0000000..dfd4456 --- /dev/null +++ b/capitalist_singularity.md @@ -0,0 +1,5 @@ +# Capitalist Singularity + +Capitalist singularity is a point in time at which capitalism becomes irreversible and the cancerous growth of society unstoppable due to corporations taking absolute control over society. It is when people lose any power to revolt against corporations as corporations become stronger than states and any other collective effort towards their control. + +This is similar to the famous [technological singularity](tech_singularity.md), the difference being that society isn't conquered by a digital [AI](ai.md) but rather a superintelligent entity in a form of corporation. While many people see the danger of superintelligent AIs, surprisingly not many have noticed that we've already seen rise of such AIs -- corporations. A corporation is an entity much more intelligent than any single individual, with the single preprogrammed goal of profit. A corporation doesn't have any sense of morals as morals are an obstacle towards making profit. A corporation runs on humans but humans don't control them; there are mechanisms in place to discourage moral behavior of people inside corporations and anyone exhibiting such behavior is simply replaced. \ No newline at end of file diff --git a/capitalist_software.md b/capitalist_software.md new file mode 100644 index 0000000..0489674 --- /dev/null +++ b/capitalist_software.md @@ -0,0 +1,24 @@ +# Capitalist Software + +Capitalist software is [software](software.md) that late stage [capitalism](capitalism.md) produces and is practically 100% [shitty](shit.md) [modern](modern.md) [bloat](bloat.md) and [malware](malware.md) hostile to its users, made with the sole goal of benefiting its creator (often a [corporation](corporation.md)). Capitalist software is not just [proprietary](proprietary.md) corporate software, but a lot of times "[open source](open_source.md)", [indie](indie.md) software and even [free software](free_software.md) that's just infected by the toxic capitalist environment -- this infection may come deep even into the basic design principles, even such things as [UI](ui.md) design, priorities and development practices and subtle software behavior which have simply all been shaped by the capitalist pressure on abusing the user. + +Basically everyone will agree that corporate software such as [Windows](windows.md) is to a high degree abusive to its users, be it by its spying, unjustified hardware demands, forced non customizability, price etc. A mistake a lot of people make is to think that sticking a free [license](license.md) to similar software will simply make it magically friendly to the user and that therefore most [FOSS](foss.md) programs are ethical and respect its users. This is sadly not the case, a license if only the first necessary step towards [freedom](freedom.md), but not a sufficient one -- other important steps have to follow. + +A ridiculous example of capitalist software is the most consumerist type: [games](game.md). AAA games are pure evil that no longer even try to be good, they just try to be addictive like drugs. Games on release aren't even supposed to work correctly, tons of bugs are the standard, something that's expected by default, customers aren't even meant to receive a finished product for their money. They aren't even meant to own the product or have any control over it (lend it to someone, install it on another computer, play it offline or play it when it gets retired). These games spy on people (via so called [anti-cheat](anti_cheat.md) systems), are shamelessly meant to be consumed and thrown away, purposefully incompatible ("exclusives"), [bloated](bloat.md), discriminative against low-end computers and even targeting attacks on children ("lootboxes"). Game corporations attack and take down fan modification and remakes and show all imaginable kinds of unethical behavior such as trying to steal rights for maps/mods created with the game's editor (Warcraft: Reforged). + +But how can possibly a [FOSS](foss.md) program be abusive? Let's mention a few examples: + +- Being a **[bloat monopoly](bloat_monopoly.md)**. +- **Allowing [maintenance](maintenance.md) cost to be high** and prioritizing e.g. [features](feature_creep.md) leads to program being expensive to maintain which discriminizes against developers unable to pay this maintenance cost. If a rich corporation intentionally makes their program bloated and expensive to just maintain, it ensures no one poor will be able to fork the software and maintain it, which effectively removes the possibility of an ethical competition being made our of their "open source" program. +- **[Bloat](bloat.md), intentional [obscurity](obscurity.md) and [update_culture](update_culture.md) may lead to de-facto (as opposed to de-jure) limitations of basic [freedom conditions](free_software.md), despite a free license**. Specifically freedom 1 (to study the software, which may be unnecessarily difficult and **expensive**) and 2 (to modify the software, which requires its understanding, unnecessarily high cost of dealing with bad code and the ability to compile it which may be non-trivial). Therefore a company may, on paper, provide the rights to study and modify their program, but keep the actual know-how of the program's working and modification private, de-facto becoming the program's owner and sole controlling entity. +- **Allowing [proprietary](proprietary.md) [dependencies](dependency.md)**, especiall in [open source](open_source.md). While free software usually avoids this, open source if happy with e.g. Windows-only programs which of course requires the users to run abusive code in order for the program to function. +- **Unnecessarily high [hardware](hardware.md) demands and dropping support for old hardware** which drives [consumerism](consumerism.md) and discriminates against poor people and people who just don't want to "consoom" hardware. A group can make "open source" software that intentionally requires the latest hardware that they just happen to sell (e.g. [gaymes](game.md) with "AAA graphics"), even if the software might in theory run on older hardware. Possible "fixes" of this by third parties can be prevented by the above mentioned techniques. +- **Allowing [bloat](bloat.md) to increase the risk of security vulnerabilities and bugs** (which may in some ares be fatal and lead to literal deaths). +- **Obscurity may be used to successfully hide malicious features even withing publicly accessible code**. {TODO: examples. ~drummyfish} +- **Introducing dangerous dependencies**: for example a fully free software may be unnecessarily designed as [cloud](cloud.md) software which increases the risk of its non functionality e.g. in cases of Internet blackouts (or just any loss of connection). +- **Licenses can by bypassed**, e.g. [copyleft](copyleft.md) was legally eliminated by [Google](google.md)'s [Android](android.md) which is based on copylefted [Linux](linux.md): their proprietary Play Store is a 3rd party program to which the copyleft doesn't apply but which is essential for Android and serves to control Android (which should have been prevented by the copyleft).This is an example of a FOSS "protection mechanism" failing under capitalist pressure. +- Setting up a **discriminatory, fascist and toxic development environment**, e.g. in the form of [codes of conduct](coc.md). This allows to bully and "cancel" developers who are, for whatever reason, unwelcome. + +The essential issue of capitalist software is in its goal: profit. This doesn't have to mean making money directly, profit can also mean e.g. gaining popularity and political power. This goal goes before and eventually against goals such as helping and respecting the users. A free license is a mere obstacle on the way towards this goal, an obstacle that may for a while slow down corporation from abusing the users, but which will eventually be overcome just by the sheer power of the market environment which works on the principles of Darwinian evolution: those who make most profit, by any way, survive and thrive. + +Therefore "fixing" capitalist software is only possible via redefinition of the basic goal to just developing selfless software that's good for the people (as opposed to making software for profit). This approach requires eliminating or just greatly limiting capitalism itself, at least from the area of technology. We need to find other ways than profit to motivate development of software and yes, other ways do exist (morality, social status, fun etc.). \ No newline at end of file diff --git a/cathedral.md b/cathedral.md new file mode 100644 index 0000000..7147fc9 --- /dev/null +++ b/cathedral.md @@ -0,0 +1,19 @@ +# Cathedral + +Welcome to the cathedral. Here we mourn the death of [technology](technology.md) by the hand of [capitalism](capitalism.md). + +{ Sometimes we are very depressed from what's going on in this world, how technology is raped and used by living beings against each other. Seeing on a daily basis the atrocities done to the art we love and the atrocities done by it -- it is like watching a living being die. Sometimes it can help to just know you are not alone. ~drummyfish } + +``` + R. I. P. + ~~~~~~~~~~~~~ + + TECHNOLOGY + + long time ago - now + + Here lies technology who was +helping people tremendously until +its last breath. It was killed by + capitalism. +``` \ No newline at end of file diff --git a/cc0.md b/cc0.md new file mode 100644 index 0000000..eb498a1 --- /dev/null +++ b/cc0.md @@ -0,0 +1,25 @@ +# CC0 + +CC0 is a [waiver](waiver.md) (similar to a [license](license.md)) of [copyright](copyright.md), created by [Creative Commons](creative_commons.md), that can be used to dedicate one's work to the [public domain](public_domain.md) (kind of). + +Unlike a license, a waiver such as this *removes* (at least effectively) the author's copyright; by using CC0 the author willingly gives up his own copyright so that the work will no longer be owned by anyone (while a license preserves the author's copyright while granting some rights to other people). It's therefore the most [free](free_software.md) and [permissive](permissive.md) option for releasing intellectual works. CC0 is designed in a pretty sophisticated way, it also waives "neighboring rights" ([moral rights](moral_rights.md)), and also contains a fallback license in case waiving copyright isn't possible in a certain country. For this CC0 is one of the best ways, if not the best, of truly and completely dedicating works to public domain world-wide (well, at least in terms of copyright). In this world of extremely fucked up [intellectual property](intellectual_property.md) laws it is not enough to state "my work is public domain" -- you need to use something like CC0 to achieve legally valid public domain status. + +CC0 is recommended by [LRS](lrs.md) for both programs and other art -- however for programs additional waivers of [patents](patent.md) should be added as CC0 doesn't deal with patents. CC0 is endorsed by the [FSF](fsf.md) but not [OSI](osi.md) (who rejected it because it explicitly states that trademarks and patents are NOT waived). + +## Things Under CC0 + +Here are some things and places with CC0 materials that you can use in your projects so that you can release them under CC0 as well. **BEWARE**: if you find something under CC0, do verify it's actually valid, normies often don't know what CC0 means and happily post derivative works of proprietary stuff under CC0. + +TODO + +- software: + - much of [LRS](lrs.md) sofware: [Anarch](anarch.md), [small3dlib](small3dlib.md), [raycastlib](raycastlib.md), [SAF](saf.md), ... +- other assets: + - many things on [Wikimedia Commons](wikimedia_commons.md) + - many things on opengameart + - many things on BlendSwap + - all of [drummyfish's](drummyfish.md) stuff including fonts, textures, 3D models etc. + - [librivox](librivox.md) creates CC0 audiobooks from old books +- text: + - [Esolang Wiki](esolang.md) + - OSdev Wiki [since 2011](https://wiki.osdev.org/OSDev_Wiki:Copyrights) \ No newline at end of file diff --git a/chaos.md b/chaos.md new file mode 100644 index 0000000..43b0212 --- /dev/null +++ b/chaos.md @@ -0,0 +1,19 @@ +# Chaos + +In [mathematics](math.md) chaos is a phenomenon that makes it extremely difficult to predict, even approximately, the result of some process even if we completely know how the process works and what state it starts in. In more technical terms chaos is a property of a [nonlinear](nonlinear.md) [deterministic](determinism.md) [system](system.md) in which even a very small change in input creates a great change in the output, i.e. the system is very sensitive to [initial conditions](initial_condition.md). Chaos is a topic studied by the field called **chaos theory** and is important in all [science](science.md). In [computer science](compsci.md) it is important for example for the generation of [pseudorandom](pseudorandom.md) numbers or in [cryptography](cryptography.md). Every programmer should be familiar with the existence of chaotic behavior because in mathematics (programming) it emerges very often, it may pose a problem but, of course, it may be taken advantage of as well. + +Perhaps the most important point is that a chaotic system is difficult to predict NOT because of [randomness](randomness.md), lack of information about it or even its incomprehensible complexity (many chaotic systems are defined extremely simply), but because of its inherent structure that greatly amplifies any slight nudge to the system and gives any such nudge a great significance. This may be caused by things such as [feedback loops](feedback_loop.md) and [domino effects](domino_effect.md). Generally we describe this behavior as so called **[butterfly effect](butterfly_effect.md)** -- we liken this to the fact that a butterfly flapping its wings somewhere in a forest can trigger a sequence of events that may lead to causing a tornado in a distant city a few days later. + +Examples of chaotic systems are the double pendulum, weather (which is why it is so difficult to predict it), dice roll, [rule 30](rule_30.md) cellular automaton, [logistic map](logistic_map.md), gravitational interaction of [N bodies](n_body.md) or [Lorenz differential equations](lorenz_system.md). [Langton's ant](langtons_ant.md) sometimes behaves chaotically. Another example may be e.g. a billiard table with multiple balls: if we hit one of the balls with enough strength, it'll shoot and bounce off of walls and other balls, setting them into motion and so on until all balls come to stop in a specific position. If we hit the ball with exactly the same strength but from an angle differing just by 1 degree, the final position would probably end up being completely different. Despite the system being deterministic (governed by exact and predictable laws of motion, neglecting things like quantum physics) a slight difference in input causes a great different in output. + +A simple example of a chaotic equation is also the function *sin(1/x)* for *x* near 0 where it oscillates so quickly that just a tiny shift along the *x* axis drastically changes the result. See how unpredictable results a variant of the function can give: + +| *x* | *1000 * sin(10^9 / x)* | +|-------|------------------------| +| 4.001 | 455,... | +| 4.002 | 818,... | +| 4.003 | -511,... | +| 4.004 | -974,... | +| 4.005 | -335,... | + + diff --git a/chess.md b/chess.md new file mode 100644 index 0000000..2ba6228 --- /dev/null +++ b/chess.md @@ -0,0 +1,85 @@ +# Chess + +Chess is an old two-player board [game](game.md), perhaps most famous and popular among all board games in history. It is a complete information game that simulates a battle of two armies on a 64x64 board with different battle pieces. Chess has a world-wide competitive community and is considered an intellectual sport but is also a topic of active research (chess is unlikely to be ever solved due to its non-trivial rules combined with enormous state space, Shannon estimated the number of possible games at 10^120) and programming (many chess engines, [AI](ai.md)s and frontends are being actively developed). + +{ There is a nice black and white indie movie called *Computer Chess* about chess programmers of the 1980s, it's pretty good, very oldschool, starring real programmers and chess players, check it out. ~drummyfish } + +[Drummyfish](drummyfish.md) has created a suckless/[LRS](lrs.md) chess library [smallchesslib](smallchesslib.md) which includes a simple engine called *smolchess*. + +**At [LRS](lrs.md) we consider chess to be one of the best games**, if not the very best one, for the following reasons: + +- It is just a greatly interesting and deep game in which luck plays minimal role. +- **It is [suckless](suckless.md)**, the rules are very simple, it can be implemented on simple 8bit computers. The game doesn't even require a computer to play and chess masters don't even need a physical board to play (they can completely visualize it in memory). In the end one can in theory just play against himself in his head, achieving ultimate freedom: the only dependency of the game is one's brain, i.e. it becomes a [brain software](brain_software.md). Chess is extremely inexpensive, doesn't discriminate against poor people and will survive even the most extreme technological [collapse](collapse.md). +- **No one owns chess**, the game is hundreds of years old and many books about it are also already in the [public domain](public_domain.md). It is extremely free. +- It is a basis for other derived games, for example many different chess variants or chess puzzles which can be considered a "singleplayer chess game". +- It is a source of many interesting [mathematical](math.md) and programming challenges. + +## Chess in General + +Chess evolved from ancient board games in India in about 6th century. Nowadays the game is internationally governed by **FIDE** which has taken the on role of an authority that defines the official rules: FIDE rules are considered to be the standard chess rules. FIDE also organizes tournaments, promotes the game and keeps a list of registered players whose performance it rates with so called Elo system –⁠ based on the performance it also grants titles such as **Grandmaster** (GM, strongest), **Internation Master** (IM, second strongest) or **Candidate Master** (CM). + +**[Elo](elo.md) rating** is a mathematical system of numerically rating the performance of players (it is used in many sports, not just chess). Given two players with Elo rating it is possible to compute the probability of the game's outcome (e.g. white has 70% chance of winning etc.). The FIDE set the parameters so that the rating is roughly this: < 1000: beginner, 1000-2000: intermediate, 2000-3000: master. More advanced systems have also been created, namely the Glicko system. + +The rules of chess are quite simple ([easy to learn, hard to master](easy_to_learn_hard_to_master.md)) and can be found anywhere on the Internet. In short, the game is played on a 64x64 board by two players: one with **white** pieces, one with **black**. Each piece has a way of moving and capturing (eliminating) enemy pieces, for example bishops move diagonally while pawns move one square forward and take diagonally. The goal is to **checkmate** the opponent's king, i.e. make the king attacked by a piece while giving him no way to escape this attack. There are also lesser known rules that noobs often miss and ignore, e.g. so called en-passant or the 50 move rule that declares a draw if there has been no significant move for 50 moves. + +At the competitive level **clock** (so called *time control*) is used to give each player a limited time for making moves: with unlimited move time games would be painfully long and more a test of patience than skill. Clock can also nicely help balance unequal opponent by giving the stronger player less time to move. Based on the amount of time to move there exist several formats, most notably **correspondence** (slowest, days for a move), **classical** (slow, hours per game), **rapid** (faster, tens of minutes per game), **blitz** (fast, a few seconds per move) and **bullet** (fastest, units of seconds per move). + +Currently the best player in the world is pretty clearly Magnus Carlsen from Norway with Elo rating 2800+. + +During [covid](covid.md) chess has experienced a small boom among normies and [YouTube](youtube.md) chess channels have gained considerable popularity. This gave rise to [memes](meme.md) such as the bong cloud opening popularized by a top player and streamer Hikaru Nakamura; the bong cloud is an intentionally shitty opening that's supposed to taunt the opponent (it's been even played in serious tournaments lol). + +## Chess and Computers + +{[This](https://www.youtube.com/watch?v=DpXy041BIlA) is an absolutely amazing video about weird chess algorithms :) ~drummyfish} + +Chess are a big topic in computer science and programming, computers not only help people play chess, train their skills, analyze positions and perform research of games, but they also allow mathematical analysis of chess and provide a platform for things such as [artificial intelligence](ai.md). + +There is a great online Wiki focused on programming chess engines: https://www.chessprogramming.org. + +Chess software is usually separated to **libraries**, **chess engines** and **frontends** (or boards). Chess engine is typically a [CLI](cli.md) program capable of playing chess but also doing other things such as evaluating arbitrary position, hinting best moves, saving and loading games etc. Frontends on the other hand are [GUI](gui.md) programs that help people interact with the underlying engine. + +For communication between different engines and frontends there exist standards such as XBoard (engine [protocol](protocol.md)), UCI (another engine protocol), FEN (way of encoding a position as a string), PGN (way of encoding games as strings) etc. + +Computers have already surpassed the best humans in their playing strength (we can't exactly compute an engine's Elo as it depends on hardware used, but generally the strongest would rate high above 3000 FIDE). As of 2021 the strongest chess engine is considered to be the [FOSS](foss.md) engine [Stockfish](stockfish.md), with other strong engines being e.g. Leela Chess Zero (also FOSS) or AlphaZero ([proprietary](proprietary.md), by [Google](google.md)). [GNU Chess](gnu_chess.md) is a pretty strong [free software](free_software.md) engine by [GNU](gnu.md). There are world championships for chess engines such as the *Top Chess Engine Championship* or *World Computer Chess Championship*. [CCRL](https://ccrl.chessdom.com/ccrl/4040/) is a list of chess engines along with their Elo ratings. Despite the immense strength of modern engines, there are still very specific situation in which humans beat the computer (shown e.g. in [this](https://www.youtube.com/watch?v=R9IZWgArWUE) video). + +The first chess computer that beat the world champion (at the time Gary Kasparov) was famously [Deep Blue](deep_blue.md) in 1997. [Alan Turing](turing.md) himself has written a chess playing algorithm but at his time there were no computers to run it, so he executed it by hand -- nowadays the algorithm has been implemented on computers (there are bots playing this algorithm e.g. on lichess). + +For online chess there exist many servers such as https://chess.com or https://chess24.com, but for us the most important is https://lichess.org which is gratis and uses [FOSS](foss.md) (it also allows users to run bots under special accounts which is an amazing way of testing engines against people and other engines). These servers rate players with Elo/Glicko, allow them to play with each other or against computer, solve puzzles, analyze games, play chess variants, explore opening databases etc. + +Playing strength is not the only possible measure of chess engine quality, of course -- for example there are people who try to make the **smallest chess programs** (see [countercomplex](countercomplex.md) and [golfing](golf.md)). As of 2022 the leading programmer of smallest chess programs seems to be Óscar Toledo G. (https://nanochess.org/chess.html). Unfortunately his programs are [proprietary](proprietary.md), even though their source code is public. The programs include Toledo Atomchess (392 [x86](x86.md) instructions), Toledo Nanochess (world's smallest [C](c.md) chess program, 1257 non-blank C characters) and Toledo Javascript chess (world's smallest [Javascript](javascript.md) chess program). He won the [IOCCC](ioccc.md). Another small chess program is micro-Max by H. G. Muller (https://home.hccnet.nl/h.g.muller/max-src2.html, 1433 C characters, Toledo claims it is weaker than his program). + +{ Nanochess is actually pretty strong, in my testing it easily beat [smallchesslib](smallchesslib.md) Q_Q ~drummyfish } + +## Variants + +Besides similar games such as [shogi](shogi.md) there are many variants of chess, i.e. slight modifications of rules, foremost worth mentioning is for example chess 960. The following is a list of some variants: + +- **antichess**: The goal is to lose all pieces or get stalemated, rules are a bit changed, e.g. castling and checks are removed and taking is forced. +- **chess 960** aka **Fisher's random**: Starting position is randomly modified by shuffling the non-pawn rows (with these rules: king must be between rooks, bishops on opposite colors and black/white's positions are mirrored). The rules are the same with a slight modification to castling. This was invented by Bobby Fisher to emphasize pure chess skill as opposed to memorizing the best opening moves, he saw the opening theory as harmful to chess. Chess 960 is nowadays even advocated by some to become the "main" version of chess. +- **[chess boxing](chess_boxing.md)**: Chess combined with box, players switch between the two games, one wins either by checkmate or knockout. +- **different pieces**: Some variants use different pieces, e.g. empress (moves like rook and knight) or amazon (queen/knight). +- **fog of war**: Makes chess an incomplete-information game by allowing players to only see squares they can immediately move to (this is similarly to some strategy video games). +- **horde chess**: Asymmetric starting position: large number of black pawns vs a white army of traditional pieces. Rules are slightly modified, e.g. black can only be defeated by having all pawns captured (there is no black king). +- **infinite chess**: Infinite chessboard. +- **minichess**: Smaller chessboard, e.g. 4x4, 4x8 etc. Some are already solved (e.g. 3x3). +- **more players**: E.g. 3 man chess or 4 player chess allow more than two players to play, some use different boards. +- **old chess**: The rules of chess itself have been changing over time (e.g. adding the 50 move rule etc.). The older rule sets can be seen as variants as well. +- **puzzle**: For single player, chess positions are presented and the player has to find the best move or sequence of moves. +- **racing kings**: The starting position has both players on the same side, the goal is to get one's king to the other side first. +- **3D chess**: [3D](3d.md) generalization of chess. + +## Programming Chess + +Programming chess is a [fun](fun.md) and enriching experience and is therefore recommended as a good exercise. There is nothing more satisfying than writing a custom chess engine and then watching it play on its own. + +The core of chess programming is writing the [AI](ai.md), everything else, i.e. implementing the rules, communication protocols etc., is pretty straightforward (but still a good programming exercise). Nevertheless one has to pay a great attention to eliminating as many bugs as possible; really, the importance of writing automatic tests can't be stressed enough as debugging the AI will be hard enough and can become unmanageable with small bugs creeping in. + +The AI itself works in almost all cases on the same principle: firstly we implement so called static **evaluation function** -- a function that takes a chess position and outputs its evaluation number which say how good the position is for white vs black (positive number favoring white, negative black). This function considers a number of factors such as total material of both players, pawn structure, king safety, piece mobility and so on (in new engines this function is often a learned [neural network](neural_network.md), but it may very well be written by hand). Secondly we implement a **search** algorithm -- typically some modification of [minimax](minimax.md) algorithm -- that recursively searches the game tree and looks for a move that will lead to the best result, i.e. to position for which the evaluation function gives the best value. This basic principle, especially the search part, gets very complex as there are many possible weaknesses and optimizations. + +Exhaustively searching the tree to great depths is not possible due to astronomical numbers of possible move combinations, so the engine has to limit the depth quite greatly. Normally it will search all moves to a small depth (e.g. 2 or 3 half moves or *plys*) and then extend the search for interesting moves such as exchanges or checks. Maybe the greatest danger of searching algorithms is so called **horizon effect** which has to be addressed somehow (e.g. by detecting quiet positions, so called *quiescence*). If not addressed, the horizon effect will make an engine misevaluate certain moves by stopping the evaluation at certain depth even if the played out situation would continue and lead to a vastly different result (imagine e.g. a queen taking a pawn which is guarded by another pawn; if the engine stops evaluating after the pawn take, it will think it's a won pawn, when in fact it's a lost queen). There are also many techniques for reducing the number of searched tree nodes and speeding up the search, for example pruning methods such as **alpha-beta** (which subsequently works best with correctly ordering moves to search), or **transposition tables** (remembering already evaluated position so that they don't have to be evaluated again when encountered by a different path in the tree). + +Many other aspects come into the AI design such as opening books (databases of best opening moves), endgame tablebases (databases of winning moves in simple endgames), heuristics in search, clock management, pondering (thinking on opponent's move), learning from played games etc. For details see the above linked chess programming wiki. + +## Rules + +TODO \ No newline at end of file diff --git a/coc.md b/coc.md new file mode 100644 index 0000000..8fc4d3f --- /dev/null +++ b/coc.md @@ -0,0 +1,7 @@ +# Code of Conduct + +Code of conduct (COC) is a shitty invention of [SJW](sjw.md) fascists that dictates how development of specific software should be conducted, generally pushing toxic woke concepts such as forced inclusivity or use of politically correct language. COC is typically placed in the software repository as a `CODE_OF_CONDUCT` file. In practice COCs are used to kick people out of development because of their political opinions expressed anywhere, inside or outside the project, and to push political opinions through software projects. + +**[LRS](lrs.md) must never include any COC**, with possible exceptions of anti-COC (such as NO COC) or parody style COCs, not because we dislike genuine inclusivity, but because we believe COCs are bullshit and mostly harmful as they support bullying, censorship and exclusion of people. + +Anyway it's best to avoid any kind of COC file in the repository, it just takes up space and doesn't serve anything. We may simply ignore this shitty concept completely. You may argue why we don't ignore e.g. [copyright](copyright.md) in the same way and just not use any [licenses](license.md)? The situation with copyright is different: it exists by default, without a license file the code is proprietary and our neighbors don't have the legal safety to execute basic freedoms, they may be bullied by the state -- for this we are forced to include a license file to get rid of copyright. With COC there simply isn't any such implicit issues to be solved (because COCs are simply inventing their own issues), so we just don't try to solve non-issues. \ No newline at end of file diff --git a/coding.md b/coding.md new file mode 100644 index 0000000..84b123e --- /dev/null +++ b/coding.md @@ -0,0 +1,6 @@ +# Coding + +Coding nowadays means low quality attempt at [programming](programming.md), usually practiced by [soydevs](soydev.md) and barely qualified coding monkeys. + +Traditionally it means encoding and decoding of information as in e.g. video coding -- this is the only non-gay meaning of the word + diff --git a/collapse.md b/collapse.md new file mode 100644 index 0000000..457d393 --- /dev/null +++ b/collapse.md @@ -0,0 +1,17 @@ +# Collapse + +Collapse of our civilization is a concerning scenario in which basic structures of society relatively rapidly fall apart and cause world-wide horrors such as chaos, [wars](war.md), famine and loss of advanced technology. It is something that's very likely coming very soon: we are especially focusing on a very probable **technological collapse** (caused by badly designed technology as well as its wrong application and extreme overuse causing a dangerous dependence) but of course clues point to it coming from many directions (ecological, economical, political, natural disasters such as a coronal mass ejection etc.). Recently there has even appeared a specific term *collapsology* referring to the study of the potential collapse. + +There is a [reddit](reddit.md) community for discussing the collapse at https://reddit.net/r/collapse. [WikiWikiWeb](wikiwikiweb.md) has a related discussion under *ExtinctionOfHumanity*. + +In technological world a lot of people are concerned with the collapse, notable the [collapse OS](collapse_os.md), an operating system meant to run on simple [hardware](hw.md) after the technological supply chain collapses and renders development of modern computers impossible. They believe the collapse will happen before 2030. The chip shortage and energy crisis of 2020s are one of the first warnings and shows how fragile the systems really is. + +[Ted Kaczynski](ted_kaczynski.md), a famous primitivist murderer, has seen the collapse as a possible option. People like [Luke Smith](luke_smith.md) advocate (and practice) simple, independent off-grid living, besides other reasons in order to be prepared for such an eventuality as a collapse. Even [proprietary](proprietary.md) normies such as [Jonathan Blow](jonathan_blow.md) warn of a coming disaster (in his talk *Preventing the Collapse of Civilization*). [Viznut](viznut.md) is another programmer warning about the collapse. + +The details of the collapse cannot of course be predicted exactly -- it may come is an quick, violent form (e.g. in case of a disaster causing a blackout) or as a more agonizing slow death. CollapseOS site talks about two stages of the slow collapse: the first one after the collapse of the supply chain. i.e. when the production of modern computers halts, and the second (decades after) when the last modern computer stops working. + +{ I've read a book called Blackout by Marc Elsberg whose story revolves around a large collapse of power supply in Europe. It goes into details on what the consequences would likely be. It's a nice read on the topic. ~drummyfish } + +## See Also + +- [capitalist singularity](capitalist_singularity.md) \ No newline at end of file diff --git a/collision.md b/collision.md new file mode 100644 index 0000000..445c2cf --- /dev/null +++ b/collision.md @@ -0,0 +1,7 @@ +# Collision + +Collision happens when two or more things want to occupy the same spot. This situation usually needs to be addressed somehow; then we talk about **collision resolution**. In [programming](programming.md) there are different types of collisions, for example: + +- **[hash](hash.md) collision**: When two items produce the same hash, they will map to the same index in a [hash table](hash_table.md). Typical solution is to have a [list](list.md) at each table index so that multiple items can fit there. +- **collision of bodies in a [physics engine](physics_engine.md)**: See [collision_detection](collision_detection.md). These collision are resolved by separating the bodies and updating their velocities so that they "bounce off" as in [real life](irl.md). +- **request collision**: General situation in which multiple clients request access to something that can be used only by one client at a time, e.g. a communication [bus](bus.md). Resolution is usually done by some kind of [arbiter](arbiter.md) who decides, by whatever algorithm, who to grant the access to. \ No newline at end of file diff --git a/collision_detection.md b/collision_detection.md new file mode 100644 index 0000000..e7b0dd9 --- /dev/null +++ b/collision_detection.md @@ -0,0 +1,21 @@ +# Collision Detection + +Collision detection is an essential problem e.g. of simulating physics of mechanical bodies in [physics engines](physics_engine.md) (but also elsewhere), it tries to detect whether (and also how) geometric shapes overlap. Here we'll be talking about the collision detection in physics engine, but the problem appear in other contexts too (e.g. [frustum culling](frustum_culling.md) in [computer graphics](graphics.md)). Collision detection potentially leads to so called *collision resolution*, a different stage that tries to deal with the detected collision (separate the bodies, update their velocities, make them "bounce off"). Physics engines are mostly divided into 2D and 3D ones so we also normally either talk about 2D or 3D collision detection (3D being, of course, a bit more complex). + +There are two main types of collision detection: + +- **[discrete](discrete.md)**: Detecting collisions only at discrete points in time (each engine tick or "frame") -- this is easier but can result in detecting the collisions in wrong ways or missing them completely (imagine a fast flying object that in one moment is wholly in front of a wall and at the next instant wholly behind it). Nevertheless this is completely usable, one just has to be careful enough about the extreme cases. +- **[continuous](continuous.md)**: Detecting collisions considering the continuous motion of the bodies (still done at discrete ticks but [analytically](analytical.md) considering the whole motion since the last tick) -- this is more difficult to program and more costly to compute, but also correctly detects collisions even in extreme cases. Sometimes engines perform discrete detection by default and use continuous detection in special cases (e.g. when speeds become very high or in other error-prone situations). Continuous detection can be imagined as a collision detection of a higher dimensional bodies where the added dimension is time -- e.g. detecting collisions of 2D spheres becomes detecting collisions of "tubes" in 3D space. If you don't want to go all the way to implementing continuous collisions, you may consider an in-between solution by detecting collisions in smaller steps (which may also be done only sometimes, e.g. only for high speed bodies or only when an actual discrete collision is detected). + +Collision detection is non-trivial because we need to detect not only the presence of the collision but also its parameters which are typically the exact **point of collision, collision depth and collision [normal](normal.md)** -- these are needed for subsequently resolving the collision (typically the bodies will be shifted along the normal by the collision depth to become separated and [impulses](impulse.md) will be applied at the collision point to update their velocities). We also need to detect **general cases**, i.e. collisions of whole volumes (imagine e.g. a tiny cuboid inside an arbitrarily rotated bigger cone). This is very hard and/or expensive for some complex shapes such as general 3D triangle meshes (which is why we approximate them with simpler shapes). We also want the detection algorithm to be at least reasonably **fast** -- for this reason collision detection mostly happens in two phases: + +- **broad phase**: Quickly estimates which bodies MAY collide, usually with [bounding volumes](bounding_volume.md) (such as spheres or [axis aligned bounding boxes](aabb.md)) or space indexing and algorithms such as *[sweep and prune](sweep_and_prune.md)*. This phase quickly opts-out of checking collision of objects that definitely CANNOT collide because they're e.g. too far away. +- **narrow phase**: Applying the precise, expensive collision detection on the potentially colliding pairs of bodies determined in the broad phase. This yields the real collisions. + +In many cases it is also important to correctly detect the **order of collisions** -- it may well happen a body collides not with one but with multiple bodies at the time of collision detection and the computed behavior may vary widely depending on the order in which we consider them. Imagine that body *A* is colliding with body *B* and body *C* at the same time; in [real life](real_life.md) *A* may have first collided with *B* and be deflected so that it never hits *C*, or the other way around, or it might have collided with both. In continuous collision detection we know the order as we also have exact time coordinate of each collision (even though the detection itself is still computed at discrete time steps), i.e. we know which one happened first. With discrete collisions we may use [heuristics](heuristic.md) such as the direction in which the bodies are moving, but this may fail in certain cases (considering e.g. rotations). + +**On shapes**: general rule is that **mathematically simpler shapes are better for collision detection**. Spheres (or circles in 2D) are the best, they are stupidly simple -- a collision of two spheres is simply decided by their [distance](distance.md) (i.e. whether the distance of their center points is less that the sum of the radia of the spheres), which also determines the collision depth, and the collision normal is always aligned with the vector pointing from one sphere center to the other. So **if you can, use spheres** -- it is even worth using multiple spheres to approximate more complex shapes if possible. [Capsules](capsule.md) ("extruded spheres"), infinite planes, half-planes, infinite cylinders (distance from a line) and axis-aligned boxes are also pretty simple. Cylinders and cuboids with arbitrary rotation are bit harder. Triangle meshes (the shape most commonly used for real-time 3D models) are very difficult but may be [approximated](approximation.md) e.g. by a [convex hull](convex_hull.md) which is manageable (a convex hull is an intersection of a number of half-spaces) -- if we really want to precisely collide full 3D meshes, we may split each one into several convex hulls (but we need to write the non-trivial splitting algorithm of course). Also note that you need to write a detection algorithm for any possible pair of shape types you want to support, so for *N* supported shapes you'll need *N * (N + 1) / 2* detection algorithms. + +{ In theory we may in some cases also think about using iterative/numerical methods to find collisions, i.e. starting at some point between the bodies and somehow stepping towards their intersection until we're close enough. Another ideas I had was to use [signed distance functions](sdf.md) for representing static environments, it could have some nice advantages. But I'm really not sure how well or whether it would really work. ~drummyfish } + +TODO: some actual algorithms \ No newline at end of file diff --git a/comment.md b/comment.md new file mode 100644 index 0000000..eb7f95b --- /dev/null +++ b/comment.md @@ -0,0 +1,17 @@ +# Comment + +Comment is part of computer code that doesn't affect how the code is interpreted by the computer and is intended to hold information for humans (even though comments can sometimes contain additional information for computers such as metadata and autodocumentation information). There are comments in basically all [programming languages](programming_language.md), they usually start with `//`, `#`, `/*` and similar symbols. + +**You should comment you source code.** General tips on commenting: + +- ALWAYS put a **global file comment** at the top of a file to make it [self-contained](self_contained.md). It should include: + - **Description of what the file actually does.** This is extremely important for [readability](readability.md), documentation and quick orientation. If a new programmer comes looking for a specific part of the code, he may waste hours on searching the wrong files just because the idiotic author couldn't be bothered to include fucking three sentences at the start of the file. [Modern](modern.md) program just don't fucking do this anymore, this is just [shit](shit.md). + - [License](license.md)/[waiver](waiver.md), either full text or link. Even if your repo contains a global license (which it should), it's good for the file to carry the license because the file may just be copy pasted on its own into some other project and then it will appear as having no license. + - **Name/nick of the author(s)** and roughly the date of creation (year is enough). This firstly helps legally assess [copyright](copyright.md) (who and for how long holds the copyright) and secondly helps others contact the author in case of encountering something weird in the code. +- Comment specific blocks of code with **keywords** -- this will help searching the code with tools like [grep](grep.md). E.g. in game's code add comment `// player: shoot, fire` to the part of code that handles player's shooting so that someone searching for any one of these two words will be directed here. +- All functions (maybe with exceptions of trivial one-liners) should come with a comment documenting: + - **Behavior** of the function, what it does and also how it does that (Is the function slow? Is it safe? Does it perform checks of arguments? Does it have [side effects](side_effect.md)? ...). + - **Meaning of all arguments** and if needed their possible values. + - **Return value meaning**. +- You may decide to use comment format of some [autodoc](autodoc.md) system such as [doxygen](doxygen.md) -- it costs nothing and helps firstly unify the style of your comments and secondly, obviously, generate automatic documentation of your code, as well as possibly automatically process it in other ways. +- TODO: moar \ No newline at end of file diff --git a/compsci.md b/compsci.md new file mode 100644 index 0000000..7619b60 --- /dev/null +++ b/compsci.md @@ -0,0 +1,22 @@ +# Computer Science + +Computer science, abbreviated as "compsci", is (surprise-surprise) a [science](science.md) studying [computers](computer.md). The term is pretty wide, a lot of it covers very formal and theoretical areas that neighbor and overlap with [mathematics](marh.md), such as [formal languages](formal_language.md), [cryptography](cryptography.md) and [machine learning](machine_learning.md), but also more practical/applied and "softer" disciplines such as [software_engineering](software_engineering.md), [programming](programming.md) [hardware](hardware.md), computer networks or even [user interface](ui.md) design. This science deals with such things as [algorithms](algorithm.md), [data structures](data_structure.md), [artificial intelligence](ai.md) and [information](information.md) theory. The field has become quite popular and rapidly growing after the coming of the 21st century computer/[Internet](internet.md) revolution and it has also become quite spoiled and abused by its sudden lucrativity. + +## Overview + +Notable fields of computer science include: + +- [artificial intelligence](ai.md) +- [computer graphics](graphics.md) +- [databases](database.md) +- [hardware](hardware.md) design +- [networking](network.md) +- [security](security.md) and [cryptography](cryptography.md) +- [software engineering](software_engineering.md) +- theoretical computer science +- [user interface](ui.md) +- smaller field or subfields such as [operating systems](os.md), [compiler](compiler.md) design, formal verification, speech recognition etc. + +Computer science also figures in interdisciplinary endeavors such as [bioinformatics](bioinformatics.md) and [robotics](robotics.md). + +In the industry there have arisen fields of [art](art.md) and study that probably shouldn't be included in computer science itself, but are very close to it. These may include e.g. [web design](webdesign.md) (well, let's include it for the sake of completeness), [game](game.md) design, [system administration](sysadmin.md) etc. \ No newline at end of file diff --git a/computer.md b/computer.md new file mode 100644 index 0000000..52c6b86 --- /dev/null +++ b/computer.md @@ -0,0 +1,32 @@ +# Computer + +The word *computer* can be defined in many ways and can also take many different meanings; a somewhat common definition may be this: computer is a machine that automatically performs mathematical computations. We can also see it as a machine for processing information or, very generally, as any tool that helps computation, in which case one's fingers or even a [mathematical](math.md) formula itself can be considered a computer. Here we are of course mostly concerned with electronic [digital](digital.md) computers. + +We can divide computers based on many attributes, e.g.: + +- by **representation of data**: [digital](digital.md) vs [analog](analog.md) +- by **[hardware](hw.md) technology**: [electronic](electronics.md), [mechanical](mechanical.md), [quantum](quantum.md), biological etc. +- by **purpose**: special purpose vs general purpose, [personal](pc.md), [embedded](embedded.md), [supercomputers](supercomputer.md) etc. +- by **[programmability](programming.md)**: non-programmable, partially or fully programmable +- by **other criteria**: conventional vs [quantum computers](quantum.md), gaming computers etc. + +Computers are studied by [computer science](compsci.md). The kind of computer we normally talk about consists of two main parts: + +- **[hardware](hw.md)**: physical parts +- **[software](sw.md)**: [programs](program.md), made by [programmers](programmer.md) + +The power of computers is limited, [Alan Turing](turing.md) mathematically proved that there exist problems that can never be completely solved by any [algorithm](algorithm.md), i.e. there are problems a computer (including our [brain](brain.md)) will never be able to solve (even if solution exists). He also invented the theoretical model of a computer called the [Turing machine](turing_machine.md). Besides the mentioned theoretical limitation, many solvable problems may take too long to compute, at least with computers we currently know (see [computational complexity](computational_complexity.md) and [P vs NP](p_vs_np.md)). + +## Typical Computer + +Computers we normally talk about are [electronic](electronics.md) [digital](digital.md) mostly personal computers such as [desktops](desktop.md) and [laptops](laptop.md), possibly also [cell phones](phone.md), [tablets](tablet.md) etc. + +Such a computer consists of some kind of [case](case.md) (chassis), internal [hardware](hardware.md) plus [peripheral devices](peripheral.md) that serve for [input and output](io.md) -- these are for example a [keyboard](keyboard.md) and [mouse](mouse.md) (input devices), a [monitor](monitor.md) (output device) or [harddisk](hdd.md) (input/output device). The internals of the computer normally include: + +- **[motherboard](motherboard.md)**: The main electronic circuit of the computer into which other components are plugged and which creates the network and interfaces that interconnect them (a [chipset](chipset.md)). It contains slots for expansion cards as well as connectors for external devices, e.g. [USB](usb.md). In a small memory on the board there is the most basic software ([firmaware](firmware.md)), such as [BIOS](bios.md), to e.g. enable installation of other software. The board also carries the [clock](clock.md) generator for synchronization of all hardware, heat sensors etc. +- **[CPU](cpu.md)** (central processing unit): Core of the computer, the chip plugged into motherboard that performs general calculations and which runs [programs](program.md), i.e. [software](sw.md). +- **[RAM](ram.md)/working memory**: Lower capacity volatile (temporary, erased when powered off) working memory of the computer, plugged into motherboard. It is used as a "pen and paper" by the CPU when performing calculations. +- **[disk](disk.md)**: [Non-volatile](volatile.md) (persisting when powered off) large capacity memory for storing [files](file.md) and other [data](data.md), connected to the motherboard via some kind of [bus](bus.md). Different types of disks exist, most commonly [hard disks](hdd.md) and [SSDs](ssd.md). +- **expansion cards ([GPU](gpu.md), sound card, network card, ...)**: Additional hardware cards plugged into motherboard for either enabling or accelerating specific functionality (e.g. GPU for graphics etc.). +- **[PSU](psu.md)** (power supply unit): Converts the input electrical power from the plug to the electrical power needed by the computer. +- other things like fans for [cooling](cooling.md), batteries in laptops etc. \ No newline at end of file diff --git a/copyleft.md b/copyleft.md new file mode 100644 index 0000000..db0bcc7 --- /dev/null +++ b/copyleft.md @@ -0,0 +1,18 @@ +# Copyleft + +Copyleft (also share-alike) is a concept of sharing something on the condition that others will share it under the same terms; this is practically always used by a subset of [free (as in freedom) software](free_software.md) to legally ensure this software and its modifications will always remain free. This kind of [hacks](hack.md) [copyright](copyright.md) to de-facto remove copyright by its own power. + +Copyleft has been by its mechanisms likened to a virus because once it is applied to certain software, it "infects" it and will force its conditions on any descendants of that software, i.e. it will spread itself (in this case the word virus does not bear a negative connotation, at least to some, they see it as a good virus). + +For free/open-source software the alternative to copyleft is so called **permissive** licensing which (same as with copyleft) grants all the necessary freedom rights, but does NOT require modified versions to grant these rights as well. This allows free software being forked and developed into [proprietary](proprietary.md) software and is what copyleft proponents criticize. + +In the [FOSS](foss.md) world there is a huge battle between the copyleft camp and permissive camp ([LRS](lrs.md) advocates permissive licenses with a preference for 100% [public domain](public_domain.md)). + +## Issues With Copyleft + +In the great debate of copyleft vs permissive free-licenses we, as technological anarchists, stand on the permissive side. Here are some reasons for why we reject copyleft: + +- By adopting copyleft one is **embracing and supporting the copyright laws** ("marrying the lawyers") because copyleft relies on and uses copyright laws. Copyleft chooses to play along with the capitalist bullshit [intellectual property](intellectual_property.md) game and threatens to use force and bullying in order to enforce *correct* usage of information. +- In a way it is **[bloat](bloat.md)**. Copyleft introduces **legal complexity**, [friction](friction.md) and takes programmers' [head space](head_space.md), especially when copyleft is probably mostly ineffective as **detecting its violation and actual legal enforcement is difficult, expensive and without a guaranteed positive outcome** ([FSF](fsf.md) encourages programmers to hand over their copyright to them so they can defend their programs which just confirms existence and relevance of this issue). Sure, corporations can probably "abuse" permissive (non-copyleft) software easier, but we argue that this is a problem whose roots lie in the broken basic principles of our society ([capitalism](capitalism.md)) and so the issue should be addressed by improving our socioeconomic system rather than by bullshit legal techniques that just imperfectly cure the symptoms. +- **The scope of copyleft is highly debatable** (which is why we have different kind of copyleft such as *strong*, *weak*, *network* etc.). I.e. it can't be objectively said what exactly should classify as violation of copyleft AND increasing copyleft scope leads to copylefted software being practically unusable. Consider this **example**: [Linux](linux.md) is copylefted which means we can't create a proprietary version of Linux, nevertheless we can create a proprietary operating system of which Linux is part (e.g. [Android](android.md) in which its proprietary app store makes it de-facto owned by [Google](google.md)), and so Linux is effectively used as a part of proprietary software -- the copyleft is bypassed. One might try to increase the copyleft scope here by saying *"everything Linux ever touches has to be free software"* which would however render Linux unusable on practically any computer as most computers contain at least some small proprietary software and hardware. The restriction would be too great. +- In practice, **copyleft licenses have to be complex and ugly** because they have to strictly describe the copyleft scope and include lots of legal [boilerplate](boilerplate.md) in order to make them well defendable in court -- and as we know, complexity comes with bugs, vulnerabilities and other burden. Indeed, we see this in practice: the only practically used copyleft licenses are the various versions of GPL of which all are ugly and have historically shown many faults (which is again evident from e.g. looking at GPL v1 vs v2 vs v3). Permissive licenses on the other hand are simple, clear and well understandable. diff --git a/copyright.md b/copyright.md new file mode 100644 index 0000000..f708855 --- /dev/null +++ b/copyright.md @@ -0,0 +1,38 @@ +# Copyright + +Copyright (better called copyrestriction) is one of many types of so called [intellectual property](intellectual_property.md) (IP), i.e. a legal concept that allows ownership (restriction) of certain kind of information. Copyright specifically allows to own (i.e. restrict other people's rights to) [art](art.md) creations such as images, songs or texts, which include source code of computer programs. Copyright is not to be confused with [trademark](trademark.md) or [patent](patent.md). Copyright is symbolized by C in a circle or in brackets: (C). + +When someone creates something that can even remotely be considered artistic expression (even such things as e.g. a mere collection of already existing things), they automatically gain copyright on it, without having to register it anywhere or let it be known anywhere. They then have practically full control over the work and can successfully sue anyone who basically just touches it in any way. Therefore **any code without a [free](free_software.md) license attached is implicitly fully owned by its creator** (so called "all rights reserved") and can't be used by anyone without permission. It is said that copyright can't apply to ideas, only to expressions of ideas, however that's [bullshit](bs.md), the line isn't clear and is arbitrarily drawn by judges; for example regarding stories in books it's been established that the story itself can be copyrighted, not just its expression (you can't rewrite the Harry Potter story in different words and start selling it). + +This current form of copyright (as well as other types of IP such as software patents) has been highly criticized by many people, even those whom it's supposed to "protect" (e.g. small game creators). Strong copyright laws basically benefit corporations and "trolls" on the detriment of everyone else. It smothers creativity and efficiency by prohibiting people to reuse, remix and improve already existing works. Most people are probably for *some* form of copyright but still oppose the current extreme form which is pretty crazy: copyright applies to everything without any registration or notice and last usually 70 years (!!!) **after** the author has died (!!!). This is 100 years in some countries. In some countries it is not even possible to waive copyright to own creations. Some people are against the very idea of copyright (those may either use waivers such as [CC0](cc0.md) or [unlicense](unlicense.md) or protest by not using any licenses and simply ignoring copyright which however will actually discourage other people from reusing their works). + +Prominent critics include [Lawrence Lessig](lessig.md) (who established [free culture](free_culture.md) and [Creative Commons](creative_commons.md)) as a response), [Nina Paley](nina_paley.md) and [Richard Stallman](rms.md). + +The book *Free Culture* by Lessig talks, besides others, about how copyright has started and how it's been shaped by corporations to becoming their tool for monopolizing art. The concept of copyright has appeared after the invention of [printing press](printing_press.md). The so called *Statute of Anne* of 1710 allowed the authors of books to control their copying for **14 years** and only after **registartion**. The term could be prolonged by anothert 14 years if the author survived. The laws started to get more and more strict as control of information became more valued and eventually the term grew to **life of authour plus 70 years**, without any need for registration or deposit of the copy of the work. Furthermore with new technologies, the scope of copyright has also extended: if copyright originally only limited *copying* of books, in the Internet age it started to cover basically any use, as any manipulation with digital data in the computer age requires making local copies. Addidionally the copyright laws were passing despite being unconstitutional as the US constitution says that copyright term has to be finite -- the corporations have found a way around this and simply regularly increased the copyright's term, trying to make it de-facto infinite. Their reason, of course, was to firstly forever keep ovenership of their own art but also, maybe more importantly, to **kill the [public domain](public_domain.md)**, i.e. prevent old works from entering the public domain where they would become a completely free, unrestricted work for all people, competing with their proprietary art. Nowadays, with coprporations such as [YouTube](youtube.md) and [Facebook](facebook.md) de-facto controlling most of infromation sharing among common people, the situation worsens further: they can simply make their own laws that don't need to be passed by the government but simply implemented on the platform they control. This way they are already killing e.g. the right to [fair use](fair_use.md), they can simply remove any content on the basis of "copyright violation", even if such content would normally NOT violate copyright because it would fall under fair use. This would normally have to be devided by court, but a corporation here itself takes the role of the court itself. So in terms of copyright, corporations have now a greater say than governments, and of course they'll use this power against the people (e.g. to implement censorship and surveillance). + +Copyright rules differ greatly by country, most notably the US measures copyright length from the publication of the work rather than from when the author died. It is possible for a work to be copyrighted in one country and not copyrighted in another. It is sometimes also very difficult to say whether a work is copyrighted because the rules have been greatly changing (e.g. a notice used to be required for some time), sometimes even retroactively copyrighting public domain works, and there also exists no official database of copyrighted works (you can't safely look up whether your creation is too similar to someone else's). All in all, copyright is a huge mess, which is why we choose [free licenses](free_software.md) and even [public domain](public_domain.md) waivers. + +[Copyleft](copyleft.md) (also share-alike) is a concept standing against copyright, a kind of anti-copyright, invented by [Richard Stallman](rms.md) in the context of [free software](free_software.md). It's a license that grants people the rights to the author's work on the condition that they share its further modification under the same terms, which basically hacks copyright to effectively spread free works like a "virus". + +Copyright does **not** apply to facts (including mathematical formulas) (even though the formulation of them may be copyrighted), ideas (though these may be covered by [patents](patent.md)) and single words or short phrases (these may however still be [trademarked](trademark.md)). As such copyright can't e.g. be applied to game mechanics of a computer [game](game.md) (it's an idea). It is also basically proven that copyright doesn't cover [computer languages](programming_language.md) (Oracle vs Google). Depending on time and location there also exist various peculiar exceptions such as the freedom of panorama for photographs or uncopyrightable utilitarian design (e.g. no one can own the shape of a generic car). But it's never good to rely on these peculiarities as they are specific to time/location, they are often highly subjective, fuzzy and debatable and may even be retroactively changed by law. This constitutes a huge legal [bloat](bloat.md) and many time legal unsafety. Do not stay in the gray area, try to stay safely far away from the fuzzy copyright line. + +A work which is not covered by copyright (and any other IP) -- which is nowadays pretty rare due to the extent and duration of copyright -- is in the **[public domain](public_domain.md)**. + +[Free software](free_software.md) (and free art etc.) is **not** automatically public domain, it is mostly still copyrighted, i.e. "owned" by someone, but the owner has given some key rights to everyone with a free software license and by doing so minimized or even eliminated the negative effects of full copyright. The owner may still keep the rights e.g. to being properly credited in all copies of the software, which he may enforce in court. Similarly software that is in public domain is **not** automatically free software -- this holds only if source code for this software is available (so that the rights to studying and modifying can be executed). + +## See Also + +- [copyleft](copyleft.md) +- [fair use](fair_use.md) +- [creative commons](cc.md) +- [license](license.md) +- [patent](patent.md) +- [trademark](trademark.md) +- [public domain](pd.md) +- [intellectual property](intellectual_property.md) + + + + + + diff --git a/cpp.md b/cpp.md new file mode 100644 index 0000000..5d143b3 --- /dev/null +++ b/cpp.md @@ -0,0 +1,3 @@ +# C++ + +C++ is an [object-obsessed](oop.md) [joke](jokes.md) language based on [C](c.md) to which it adds only [capitalist](capitalist_software.md) features and [bloat](bloat.md). Most good programmers agree that C++ is hilariously messy and also tragic in that it actually succeeded to become mainstream. As someone once said, "C++ is not an increment, it is excrement". \ No newline at end of file diff --git a/cracker.md b/cracker.md new file mode 100644 index 0000000..15f512d --- /dev/null +++ b/cracker.md @@ -0,0 +1,5 @@ +# Cracker + +Crackers are the good people who in computer systems, with use of [hacking](hacking.md), remove artificial barriers to obtaining and sharing of [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. + +Cracker is also food. \ No newline at end of file diff --git a/crow_funding.md b/crow_funding.md new file mode 100644 index 0000000..e37fb66 --- /dev/null +++ b/crow_funding.md @@ -0,0 +1,5 @@ +# Crow Funding + +Crow funding is when a crow pays for your program. + +You probably misspelled [crowd funding](crowd_funding.md). \ No newline at end of file diff --git a/crypto.md b/crypto.md new file mode 100644 index 0000000..920f01f --- /dev/null +++ b/crypto.md @@ -0,0 +1,34 @@ +# Cryptocurrency + +Cryptocurrency, or just *crypto*, is a digital, virtual (non-physical) currency used on the [Internet](internet.md) which uses [cryptographic](cryptography.md) methods (electronic signatures etc.) to implement a [decentralized](decentralized.md) system in which there is no authority to control the currency (unlike e.g. with traditional currencies that are controlled by the state or systems of digital payments controlled by the banks that run these systems). Cryptocurrencies use so called **[blockchain](blockchain.md)** as an underlying technology and are practically always implemented as [free and open-source software](foss.md). Example of cryptocurrencies are [Bitcoin](bitcoin.md), [Monero](monero.md) or [Dogecoin](dogecoin.md). + +The word *crypto* in *crpytocurrency* **doesn't imply that the currency provides or protects privacy** -- it rather refers to the cryptographic algorithms used to make the currency work -- even though thanks to the decentralization, anonymity and openness cryptocurrencies actually are mostly privacy friendly (up to the points of being considered the currency of criminals). + +[LRS](lrs.md) sees cryptocurrencies more or less as **unethical** because in our view money itself is unethical, plus the currencies based on proof of work waste not only human effort but also enormous amount of electricity and computing power that could be spent in a better way. Crypto is just an immensely expensive game in which people try to fuck each other over money that have been stolen from the people. + +# History + +TODO + +# How It Works + +Cryptocurrency is build on top of so called [blockchain](blockchain.md) -- a kind structure that holds records of transactions (exchanges of money or "coins", as called in the crypto world). Blockchain is a [data structure](data-structure.md) serving as a [database](database.md) of the system. As its name suggests, it consists of **blocks**. Each block contains various data, most important of which are performed transactions (e.g. "A sent 1 coin to B"), and each block points to a previous one (forming a [linked list](linked_list.md)). As new transactions are made, new blocks are created and appended at the end of the blockchain. + +But where is the blockchain stored? It is not on a single computer; many computers participating in the system have their own copy of the blockchain and they share it together (similarly to how people share files via [torrents](torrent.md)). + +But how do we know which one is the "official" blockchain? Can't just people start forging information in the blockchain and then distribute the fake blockchains? Isn't there a chaos if there are so many copies? Well yes, it would be messy -- that's why we need a **consensus** of the participants on which blockchain is the *real* one. And there are a few algorithms to ensure the consensus. Basically people can't just spam add new blocks, a new block to be added needs to be validated via some process (which depends on the specific algorithm) in order to be accepted by others. Two main algorithms for this are: + +- [proof of work](proof_of_work.md): For a block to be confirmed it has to have a specific cryptographic puzzle solved, e.g. it may need to have appended some string that makes the block's hash some predetermined value. Participants try to solve this puzzle: finding the string is difficult and has to be done by [brute force](brute_force.md) (which wastes electricity and makes this method controversial). Once someone finds a solution, the block is confirmed and the solver gets a reward in coin -- this is therefore called **mining**. +- [proof of stake](proof_of_stake.md): This methods tries to waste less energy by not solving cryptographics puzzles but rather having some chosen participants validate/confirm the blocks. Basically participans can give some of their money at stake which then gives them a chance (proportional to the amount of money put at stake) to be chosen as validators. A validator is then chosen at random who will check the transactions and sign the block. For this they will get a small reward in coins. If they try to confirm fraudulent transactions (e.g. money sent from people without any money), the network will punish them by taking away the money they put at stake (so there is a financial motivation to not "cheat"). + +Can't people just forge transactions, e.g. by sending out a record that says someone else sent them money? This can be easily prevented by [digitally signing](digital_signature.md) the transactions, i.e. if there is e.g. a transaction "A sends 1 coint to B", it has to be signed by A to confirm that A really intended to send the money. But can't someone just copy-paste someone else's already signed transactions and try to perform them multiple times? This can also be prevented by e.g. numbering the transactions, i.e. recording something like "A sent 1 coin to B as his 1st transaction". + +But where are the coins of a person actually stored? They're not explicitly stored anywhere; the amount of coins any participant has is deduced from the list of transactions, i.e. if it is known someone joined the network with 0 coins and there is a record of someone else sending him 1 coin, it is clear he now has 1 coin. For end users there are so called **wallets** which to them appear to store their coins, but a wallet is in fact just the set of cryptographic keys needed to perform transactions. + +But why is blockchain even needed? Can't we just have a list of signed transactions without any blocks? Well, blockchain is designed to ensure coherency and the above mentioned consensus. + + + + + + diff --git a/data_hoarding.md b/data_hoarding.md new file mode 100644 index 0000000..dd88742 --- /dev/null +++ b/data_hoarding.md @@ -0,0 +1,3 @@ +# Data Hoarding + +TODO \ No newline at end of file diff --git a/data_structure.md b/data_structure.md new file mode 100644 index 0000000..49c7840 --- /dev/null +++ b/data_structure.md @@ -0,0 +1,32 @@ +# Data Structure + +Data structure refers to a any specific way in which [data](data.md) is organized in computer memory. A specific data structure describes such things as order, relationships (interconnection, hierarchy, ...), formats and [types](data_type.md) of parts of the data. [Programming](programming.md) is sometimes seen as consisting mainly of two things: design of [algorithms](algorithm.md) and data structures these algorithm work with. + +As a programmer dealing with a specific problem you oftentimes have a choice of multiple data structures -- choosing the right one is essential for performance and efficiency of your program. As with everything, each data structure has advantages and also its downsides; some are faster, some take less memory etc. For example for a searchable database of text string we can be choosing between a [binary tree](binary_tree.md) and a [hash table](hash_table.md); hash table offers theoretically much faster search, but binary trees may be more memory efficient and offer many other efficient operations like range search and sorting (which hash tables can do but very inefficiently). + +## Specific Data Structures + +These are just some common ones: + +- [array](array.md) +- [binary_tree](binary_tree.md) +- [bitfield](bitfield.md) +- [blockchain](blockchain.md) +- [B+ tree](bplus_tree.md) +- [circular buffer](circular_bugger.md) +- [directed acyclic graph](dac.md) +- [graph](graph.md) +- [hash table](hash_table.md) +- [heap](heap.md) +- [linked list](linked_list.md) +- [N-ary tree](nary_tree.md) +- [record](record.md) +- [stack](stack.md) +- [string](string.md) +- [tree](tree.md) +- [queue](queue.md) + +## See Also + +- [data](data.md) +- [data type](data_type.md) \ No newline at end of file diff --git a/de_facto.md b/de_facto.md new file mode 100644 index 0000000..d599c7d --- /dev/null +++ b/de_facto.md @@ -0,0 +1,9 @@ +# De Facto + +De facto is [Latin](latin.md) for "in fact" or "by facts", it means that something holds in practice; it is contrasted with [de jure](de_jure.md) ("by law"). We use the term to say whether something is actually true in reality as opposed to "just on paper". + +For example in [technology](tech.md) a so called [de facto standard](de_facto_standard.md) is something that, without it being officially formalized or forced by law in prior, most developers naturally come to adopt so as to keep [compatibility](compatibility.md); for example the [Markdown](md.md) format has become the de facto standard for [READMEs](readme.md) in [FOSS](foss.md) development. Of course it happens often that de facto standards are later made into official standards. On the other hand there may be standards that are created by official standardizing authorities, such as the state, which however fail to gain wide adoption in practice -- these are official standards but not de facto one. TODO: example? :) + +Regarding politics and society, we often talk about **de facto [freedom](freedom.md)** vs **de jure freedom**. For example in the context of [free (as in freedom) software](free_software.md) it is stressed that software ought to bear a free [license](license.md) -- this is to ensure de jure freedom, i.e. legal rights to being able to use, study, modify and share such software. However in these talks the **de facto freedom of software is often forgotten**; the legal (de jure) freedom is worth nothing if it doesn't imply real and practical (de facto) freedom to exercise the rights given by the license; for example if a piece of "free" (having a free license) software is extremely [bloated](bloat.md), our practical ability to study and modify it gets limited because doing so gets considerably expensive and therefore limits the number of people who can truly exercise those rights in practice. This issue of diminishing de facto freedom of free software is addressed e.g. by the [suckless](suckless.md) movement, and of course our [LRS](lrs.md) movement. + +There is also a similar situation regarding [free speech](free_speech.md): if speech is free only de jure, i.e. we can "in theory" legally speek relatively freely, BUT if then in reality we also CANNOT speek freely because e.g. of fear of being [cancelled](cancel_culture.md), **our speech is de facto not free**. \ No newline at end of file diff --git a/deferred_shading.md b/deferred_shading.md new file mode 100644 index 0000000..c9edbee --- /dev/null +++ b/deferred_shading.md @@ -0,0 +1,12 @@ +# Deferred Shading + +In computer [graphics](graphics.md) programming deferred shading is a technique for speeding up the rendering of (mainly) [shaded](shading.md) 3D graphics (i.e. graphics with textures, materials, [normal maps](normal_mapping.md) etc.). It is nowadays used in many advanced 3D engines. In principle of course the idea may also be used in 2D graphics and outside graphics. + +The principle is following: in normal forward shading (non-deferred) the shading computation is applied immediately to any rendered pixel (fragment) as they are rendered. However, as objects can overlap, many of these expensively computed pixels may be overwritten by pixels of other objects, so many pixels end up being expensively computed but invisible. This is of course wasted computation. Deferred shading only computes shading of the pixels that will end up actually being visible -- this is achieved by **two rendering passes**: + +1. At first geometry is rendered without shading, only with information that is needed for shading (for example [normals](normal.md), material IDs, texture IDs etc.). The rendered image is stored in so called G-buffer which is basically an image in which every pixel stores the above mentioned shading information. +2. The second pass applies the shading effects by applying the pixel/fragment [shader](shader.md) on each pixel of the G-buffer. + +This is especially effective when we're using very expensive/complex pixel/fragment shaders AND we have many overlapping objects. **Sometimes deferred shading may be replaced by simply ordering the rendered models**, i.e. rendering front-to-back, which may achieve practically the same speed up. In simple cases deferred shading may not even be worth it -- in [LRS](lrs.md) programs we may use it only rarely. + +Deferred shading also comes with complications, for example **rasterization [anti aliasing](anti_aliasing.md) can't be used** because, of course, anti-aliasing in G-buffer doesn't really make sense. This is usually solved by some [screen-space](screen_space.md) antialiasing technique such as [FXAA](fxaa.md), but of course that may be a bit inferior. **Transparency also poses an issue**. \ No newline at end of file diff --git a/demoscene.md b/demoscene.md new file mode 100644 index 0000000..06e80cb --- /dev/null +++ b/demoscene.md @@ -0,0 +1,19 @@ +# Demoscene + +Demoscene is a [hacker](hacking.md) [art](art.md) subculture revolving around making so called [demos](demo.md), programs that produce rich and interesting audiovisual effects and which are sometimes limited by strict size constraints (so called [intros](intro.md)). The scene originated in northern [Europe](europe.md) sometime in 1980s (even though things like screen hacks existed long before) among groups of [crackers](cracker.md) who were adding small signature effect screens into their cracked software (like "digital graffiti"); programming of these cool effects later became an art of its own and started to have their own competitions (sometimes with high financial prizes), so called *[compos](compo.md)*, at dedicated real life events called *[demoparties](demoparty.md)* (which themselves evolved from *[copyparties](copyparty.md)*, real life events focused on [piracy](piracy.md)). The community is still centered mostly in the Europe (primarily Finland), it is underground, out of the mainstream; [Wikipedia](wikipedia.md) says that by 2010 its size was estimated to 10000 people (such people are called *demosceners*). + +Demoscene is a bittersweet topic: on one side it's awesome, full of beautiful hacking, great ideas and minimalism, on the other side there are secretive people who don't share their source code (most demos are [proprietary](proprietary.md)) and ugly unportable programs that exploit quirks of specific platforms -- common ones are [DOS](dos.md), [Commodore 64](c64.md), [Amiga](amiga.md) or [Windows](windows.md). These guys simply try to make the coolest visuals and smallest programs, with all good and bad that comes with it. Try to take only the good of it. + +Besides "digital graffiti" the scene is also perhaps a bit similar to the culture of street rap, except that there's less improvisation (obviously, making a program takes long) and competition happens between groups rather than individuals. Nevertheless the focus is on competition, originality, style etc. But demos should show off technological skills as the highest priority -- trying to "win by content" rather than programming skills is sometimes frowned upon. Individuals within a demogroup have roles such as a [programmer](programmer.md), visual artist, music artist, director, even [PR](pr.md) etc. + +A demo isn't a video, it is a non-[interactive](interactive.md) [real time](real_time.md) executable that produces the same output on every run (even though categories outside of this may also appear). [Viznut](viznut.md) has noted that this "static nature" of demos may be due to the established culture in which demos are made for a single show to the audience. Demos themselves aren't really limited by resource constraints (well, sometimes a limit such as 4 MB is imposed), it's where the programmers can show off all they have. However compos are often organized for **intros**, demos whose executable size is limited (i.e. NOT the size of the source code, like in [code golfing](golf.md), but the size of the compiled binary). The main categories are 4Kib intros and 64Kib intros, rarely also 256Kib intros (all sizes are in [kibibytes](memory_units.md)). Apparently even such categories as 256 [byte](byte.md) intro appear. Sometimes also platform may be specified (e.g. [Commodore 64](c64.md), [PC](pc.md) etc.). The winner of a compo is decided by voting. + +Some of the biggest demoparties are or were Assembly (Finland), The Party (Denmark), The Gathering (Norway), Kindergarden (Norway) and Revision (Germany). A guy on https://mlab.taik.fi/~eye/demos/ says that he has never seen a demo [female](female.md) programmer and that females often have free entry to demoparties while men have to pay because there are almost no women anyway xD Some famous demogroups include Farbrausch (Germany, also created a tiny 3D shooter game [.kkrieger](kkrieger.md)), Future Crew (Finland), Pulse (international), Haujobb (international), Conspiracy (Hungary) and [Razor 1911](razor_1911.md) (Norway). { Personally I liked best the name of a group that called themselves *Byterapers*. ~drummyfish } There is an online community of demosceners at at https://www.pouet.net. + +**On technological side of demos**: great amount of hacking, exploitation of bugs and errors and usage of techniques going against "good programming practices" are made use of in making of demos. They're usually made in [C](c.md), [C++](cpp.md) or [assembly](assembly.md) (though some retards even make demos in [Java](java.md) [lmao](lmao.md)). In intros it is extremely important to save space wherever possible, so things such as [procedural generation](procgen.md) and [compression](compression.md) are heavily used. Manual [assembly](assembly.md) optimization for size can take place. [Tracker music](tracker_music.md), [chiptune](chiptune.md), [fractals](fractal.md) and [ASCII art](ascii_art.md) are very popular. New techniques are still being discovered, e.g. [bytebeat](bytebeat.md). [GLSL](glsl.md) shader source code that's to be embedded in the executable has to be minified or compressed. Compiler flags are chosen so as to minimize size, e.g. small size optimization (`-Os`), turning off buffer security checks or turning on fast [float](float.md) operations. The final executable is also additionally compressed with [specialized executable compression](executable_compression.md). + +## See Also + +- [code golf](golf.md) +- [kkrieger](kkrieger.md) +- [LAN party](lan_party.md) \ No newline at end of file diff --git a/dependency.md b/dependency.md new file mode 100644 index 0000000..8d52e44 --- /dev/null +++ b/dependency.md @@ -0,0 +1,40 @@ +# Dependency + +Dependency is something your program depends on -- dependencies are [bad](shit.md)! Unfortunately they are also unavoidable. We at least try to minimize dependencies as much as possible while keeping our program functioning as intended, and those we can't avoid we try to abstract in order to be able to quickly drop-in replace them with alternatives. + +Having many dependencies is a sign of [bloat](bloat.md) and bad design. Unfortunately this is the reality of mainstream programming. For example at the time of writing this [Chromium](chromium.md) in [Debian](debian.md) requires (recursively) 395 packages LMAO xD And these are just runtime dependencies... + +In [software](software.md) development context we usually talk about software dependencies, typically [libraries](library.md) and other software [packages](package.md). However, there are many other types of dependencies we need to consider when striving for the best programs. Let us list just some of the possible types: + +- [software](software.md) + - [libraries](library.md) + - [compiler](compiler.md) supporting specific language standard + - [build system](build_system.md) + - [GUI](gui.md) capability + - [operating system](operating_system.md) and its services such as presence of a [window manager](file_system.md), [desktop environment](desktop_environment.md), presence of a [file system](file_system.md) etc. + - [Internet](internet.md) connection +- [hardware](hardware.md) + - [computing resources](computing_resources.md) (sufficient RAM, CPU speed, ...) + - [graphics card](gpu.md) + - [floating point unit](fpu.md) and other [coprocessors](coprocessor.md) + - CPU features such as special instructions + - [mouse](mouse.md), [speakers](monitor.md) and other I/O devices +- other: + - know-how/education: Your program may require specific knowledge, e.g. knowledge of advanced math to be able to meaningfully modify the program, or nonnegligiable amount of time spent studying your codebase. + - running cost: e.g. electricity, Internet connection cost + - culture: Your program may require the culture to allow what it is presenting or dealing with. + +Good program will take into account all kinds of these dependencies and try to minimize them to offer freedom, stability and safety while keeping its functionality or reducing it only very little. + +Why are dependencies so bad? Some of the reasons are: + +- **less secure** (more [attack surface](attack_surface.md), i.e. potential for vulnerabilities which may arise in the dependencies) +- **more buggy** (more [fuck up surface](fuck_up_surface.md)) +- **more expensive to [maintain](maintenance.md)** (requires someone's constant attention to just keep the dependencies up to date and keeping up with their changing API) +- **less [future proof](future_proof.md)** and more **fragile** (your program dies as soon as one of its dependencies, or any dependency of these dependencies) +- **less under your control** (in practice it's extremely difficult to modify and maintain a library you use even if it's [free](free_software.md), so you're typically doomed to just accept whatever it does) +- **more dangerous [legally](law.md)** (reusing work of other people requires dealing with several to many different licenses with possibly wild conditions and there's always a chance of someone starting to make trouble such as threatening to withdraw a license) + +## How to Avoid Them + +TODO \ No newline at end of file diff --git a/determinism.md b/determinism.md new file mode 100644 index 0000000..6004095 --- /dev/null +++ b/determinism.md @@ -0,0 +1,17 @@ +# Determinism + +*"God doesn't play dice."* --[some German dude](einstein.md) + +Deterministic system is one which over time evolves without any involvement of [randomness](randomness.md) and probability; i.e. its current state along with the rules according to which it behaves unambiguously and precisely determine its following state. This means that a deterministic [algorithm](algorithm.md) will always give the same result if run multiple times with the same input values. Determinism is an extremely important concept in [computer science](compsci.md) and [programming](programming.md) (and in many other fields of science and philosophy). + +[Computers](computer.md) are mostly deterministic by nature and design, they operate by strict rules and engineers normally try to eliminate any random behavior as that is mostly undesirable (with certain exceptions mentioned below) -- randomness leads to hard to detect and hard to fix [bugs](bug.md), unpredictability etc. Determinism has furthermore many advantages, for example if we want to record a behavior of a deterministic system, it is enough if we record only the inputs to the system without the need to record its state which saves a great amount of space -- if we later want to replay the system's behavior we simply rerun the system with the recorded inputs and its behavior will be the same as before (this is exploited e.g. in recording gameplay demos in video [games](game.md) such as [Doom](doom.md)). + +Determinism can however also pose a problem, notable e.g. in cryptography where we DO want true randomness e.g. when generating [seeds](seed.md). Determinism in this case implies an attacker knowing the conditions under which we generated the seed can exactly replicate the process and arrive at the seed value that's supposed to be random and secret. For this reason some [CPUs](cpu.md) come with special hardware for generating truly random numbers. + +Despite the natural determinism of computers as such, **computer programs aren't automatically deterministic** -- if you're writing a computer program, you have to make some effort to make it deterministic. This is because there are things such as [undefined behavior](undefined_behavior.md). For example the behavior of your program may depend on timing ([critical sections](critical_section.md), ...), performance of the computer (a game running on slower computer will render fewer [frames per second](fps.md), ...), [byte sex](endianness.md) (big vs little endian), accessing uninitialized memory (which many times contains undefined values) and many more things. All this means that your program run with the same input data will produce different results on different computers or under slightly different circumstances, i.e. it would be non-deterministic. + +Even if we're creating a program that somehow works with probability, we usually want to make it deterministic. This means we don't use actual random numbers but rather [pseudorandom](pseudorandomness.md) number generators that output [chaotic](chaos.md) values which simulate randomness, but which will nevertheless be exactly the same when ran multiple times with the same initial seed. This is again important e.g. for [debugging](debugging.md) the system in which replicating the bug is key to fixing it. + +In theoretical computer science non-determinism means that a model of computation, such as a [Turing machine](turing_machine.md), may at certain points decide to make one of several possible actions which is somehow most convenient, e.g. which will lead to finding a solution in shortest time. Or in other words it means that the model makes many computations, each in different path, and at the end we conveniently pick the "best" one, e.g. the fastest one. Then we may talk e.g. about how the computational strength or speed of computation differ between a deterministic and non-deterministic Turing machine etc. + +Determinism is also a philosophical theory that says our Universe is deterministic, i.e. that everything is already predetermined by the state of the universe and the laws of physics, i.e. that we don't have "free will" (whatever it means) etc. Many believe [quantum physics](quantum.md) disproves determinism which is however not the case, there may e.g. exist hidden variables that still make quantum physics deterministic. Anyway, this is already beyond the scope of technological determinism. \ No newline at end of file diff --git a/digital.md b/digital.md new file mode 100644 index 0000000..7af0669 --- /dev/null +++ b/digital.md @@ -0,0 +1,7 @@ +# Digital + +Digital [technology](tech.md) is that which works with whole numbers, i.e. discrete values, as opposed to [analog](analog.md) technology which works with real numbers, i.e. continuous values. The name *digital* is related to the word *digit* as digital computers store data by digits, e.g. in 1s and 0s if they work in [binary](binary.md). + +Normies confuse digital with [electronic](electronic.md) or think that digital computers can only be electronic, that digital computers can only work in [binary](binary.md) or have other weird assumptions whatsoever. **This is indeed false!** An [abacus](abacus.md) is digital device. Fucking normies. + +The advantage of digital technology is its resilience to noise which prevents degradation of data and accumulation of error -- if a digital picture is copied a billion times, it will very likely remain unchanged, whereas performing the same operation with analog picture would probably erase most of the information it bears due to loss of quality in each copy. Digital technology also makes it easy and practically possible to create fully programmable general purpose [computers](computer.md) if great complexity. diff --git a/digital_signature.md b/digital_signature.md new file mode 100644 index 0000000..d87dd17 --- /dev/null +++ b/digital_signature.md @@ -0,0 +1,9 @@ +# Digital Signature + +Digital signature is a method of mathematically (with [cryptographical](cryptography.md) algorithms) proving that, with a high probability, a digital message or document has been produced by a specific sender, i.e. it is something aka traditional signature which gives a "proof" that something has been written by a specific person. + +It works on the basis of [asymmetric cryptography](asymmetric_cryptography.md): the signature of a message is a pair of a public key and a number (the signature) which can only have been produced by the owner of the private key associated with the public key. This signature is dependent on the message data itself, i.e. if the message is modified, the signature will no longer be valid, preventing anyone who doesn't posses the private key from modifying the message. The signature number can for example be a [hash](hash.md) of the message decoded with the private key -- anyone can check that the signature encoded with the public key gives the document hash, proving that whoever computed the signature number must have possessed the private key. + +Signatures can be computed e.g. with the [RSA](rsa.md) algorithm. + +The nice thing here is that **[anonymity](anonymity.md) can be kept with digital signatures**; no private information such as the signer's real name is required to be revealed, only his public key. Someone may ask why we then even sign documents if we don't know by whom it is signed lol? But of course the answer is obvious: many times we don't need to know the identity of the signer, we just need to know that different messages have all been written by the same person, and this is what a digital signature can ensure. And of course, if we want, a public key can have a real identity assigned if desirable, it's just that it's not required. \ No newline at end of file diff --git a/dinosaur.md b/dinosaur.md new file mode 100644 index 0000000..4234095 --- /dev/null +++ b/dinosaur.md @@ -0,0 +1,5 @@ +# Dinosaur + +In the [hacker](hacker.md) jargon *dinosaur* is a type of a big, very old, mostly non-interactive ([batch](batch.md)), possibly partly mechanical computer, usually an IBM [mainframe](mainframe.md) from 1940s and 1950s (so called Stone Age). They resided in *dinosaur pens* (mainframe rooms). + +{ This is how I understood it from the [Jargon File](jargon_file.md). ~drummyfish } \ No newline at end of file diff --git a/dodleston.md b/dodleston.md new file mode 100644 index 0000000..16557b1 --- /dev/null +++ b/dodleston.md @@ -0,0 +1,7 @@ +# Dodleston Mystery + +The Dodleston mystery regards a teacher Ken Webster who in 1984 supposedly started exchanging messages with people from the past and future, most notably people from the 16th and 22nd century, via files on a [BBC micro](bbc_micro.md) computer. While probably a [hoax](hoax.md) and [creepypasta](creepypasta.md), there are some interesting unexplained details... and it's a fun story. + +The guy has written a [proprietary](proprietary.md) book about it, called *The Vertical Plane*. + +{ If the story is made up and maybe even if it isn't it may be a copyright violation to reproduce the story with all the details here so I don't know if I should, but reporting on a few facts probably can't hurt. Yes, this is how bad the copyrestriction laws have gotten. ~drummyfish } \ No newline at end of file diff --git a/dog.md b/dog.md new file mode 100644 index 0000000..e0d13d5 --- /dev/null +++ b/dog.md @@ -0,0 +1,19 @@ +# Dog + +Here is our dog. He doesn't judge you, he loves unconditionally. No matter who you are or what you did, this doggo will always be your best friend <3 We should all learn from this little buddy. + +Send this to anyone who's feeling down :) + +``` + __ + _ / \ + (( / 0 0) + \\___\/ _o) + ( | WOOOOOOOF + | /___| |( + |_)_) |_)_) +``` + +## See Also + +- [watchdog](watchdog.md) \ No newline at end of file diff --git a/doom.md b/doom.md new file mode 100644 index 0000000..571dcb9 --- /dev/null +++ b/doom.md @@ -0,0 +1,11 @@ +# Doom + +Doom is a legendary video [game](game.md) released in 1993, perhaps the most famous game of all time, the game that popularized the [first person shooter](first_person_shooter.md) genre and shocked by its at the time extremely advanced [3Dish](pseudo_3D.md) graphics. It was made by [Id Software](id_software.md), most notably by [John Carmack](john_carmack.md) (graphics + engine programmer) and [John Romero](john_romero.md) (tool programmer + level designer). Doom is sadly [proprietary](proprietary.md), however its engine was later (1999) released as [free (as in freedom) software](free_software.md) under [GPL](gpl.md) which gave rise to many source ports. The assets remain non-free but a completely free alternative is offered by the [Freedoom](freedoom.md) project that has created [free as in freedom](free_culture.md) asset replacements for the game. [Anarch](anarch.md) is an official [LRS](lrs.md) game inspired by Doom, completely in the [public domain](public_domain.md). + +{ Great books about Doom I can recommend: *Masters of Doom* (about the development) and *Game Engine Black Book: Doom* (details about the engine internals). ~drummyfish } + +Partially thanks to the free release of the engine and its relatively [suckless](suckless.md) design ([C](c.md) language, [software rendering](sw_rendering.md), ...), Doom has been [ported](port.md), both officially and unofficially, to a great number of platforms (e.g. [Gameboy Advance](gba.md), [PS1](playstation.md), even [SNES](snes.md)) and has become a kind of **de facto standard [benchmark](benchmark.md)** for computer platforms -- you will often hear the phrase: **"but does it run Doom?"** Porting a Doom to any platform has become kind of a [meme](meme.md), someone allegedly even ported it to a pregnancy test (though it didn't actually run on the test, it was really just a display). { Still [Anarch](anarch.md) may be even more portable than Doom :) ~drummyfish } + +The Doom engine was revolutionary and advanced (not only) video game graphics by a great leap, considering its predecessor [Wolf3D](wolf3D.md) was really primitive in comparison. Doom used a technique called **[BSP rendering](bsp.md)** that was able to render [realtime](realtime.md) 3D views of textured environments with distance fog and enemies and items represented by 2D [billboards](billboard.md) ("sprites"). No [GPU](gpu.md) acceleration was used, graphics was rendered purely with [CPU](cpu.md) (so called [software rendering](sw_rendering.md)). This had its limitations, for example the camera could not tilt up and down and the levels could not have rooms above other rooms. For this reason some call Doom "[pseudo 3D](pseudo3d.md)" or 2.5D rather than "true 3D". Nevertheless, though with limitations, Doom did present 3D views and internally it did work with 3D coordinates (for example the player or projectiles have 2D position plus height coordinate), despite some dumb YouTube videos saying otherwise. For this reason we prefer to call Doom a **primitive 3D** engine, but 3D nonetheless. + +LOL someone created a Doom system monitor for [Unix](unix.md) systems called [psDooM](psdoom.md) where the monsters in game are the operating system [processes](process.md) and killing the monsters kills the processes. \ No newline at end of file diff --git a/double_buffering.md b/double_buffering.md new file mode 100644 index 0000000..02a446a --- /dev/null +++ b/double_buffering.md @@ -0,0 +1,15 @@ +# Double Buffering + +In [computer graphics](graphics.md) double buffering is a technique of rendering in which we do not draw directly to [video RAM](vram.md), but instead to a second "back buffer", and only copy the rendered frame from back buffer to the video RAM ("front buffer") once the rendering has been completed; this prevents flickering and displaying of incompletely rendered frames on the display. Double buffering requires a significant amount of extra memory for the back buffer, however it is also necessary for how graphics is rendered today. + +In most libraries and frameworks today you don't have to care about double buffering, it's done automatically. For this reason in many frameworks you often need to indicate the end of rendering with some special command such as `flip`, `endFrame` etc. If you're going lower level, you may need to implement double buffering yourself. + +Though we encounter the term mostly in computer graphics, the principle of using a second buffer in order to ensure the result is presented only when it's ready can be applied also elsewhere. + +Let's take a small example: say we're rendering a frame in a 3D game. First we render the environment, then on top of it we render the enemies, then effects such as explosions and then at the top of all this we render the [GUI](gui.md). Without double buffering we'd simply be rendering all these pixel into the front buffer, i.e. the memory that is immediately shown on the display. This would lead to the user literally seeing how first the environment appears, then enemies are drawn over it, then effects and then the GUI. Even if all this redrawing takes an extremely short time, it is also the case that the final frame will be shown for a very short time before another one will start appearing, so in the result the user will see huge flickering: the environment may look kind of normal but the enemies, effects and GUI may appear transparent because they are only visible for a fraction of the frame. The user also might be able to see e.g. enemies that are supposed to be hidden behind some object if that object is rendered after the enemies. With double buffering this won't happen as we perform the rendering into the back buffer, a memory which doesn't show on the display. Only when we have completed the frame in the back buffer, we copy it to the front buffer, pixel by pixel. Here the user may see the display changing from the old frame to the new one from top to the bottom, but he will never see anything temporary, and since the old and new frames are usually very similar, this top-to-bottom update may not even be distracting (it is addressed by [vertical synchronization](vsync.md) if we really want to get rid of it). + +There also exists [triple buffering](triple_buffering.md) which uses yet another additional buffer to increase [FPS](fps.md). With double buffering we can't start rendering a new frame into back buffer until the back buffer has been copied to the front buffer which may further be delayed by [vertical synchronization](vsync.md), i.e. we have to wait and waste some time. With triple buffering we can start rendering into the other back buffer while the other one is being copied to the front buffer. Of course this consumes significantly more memory. Also note that triple buffering can only be considered if the hardware supports parallel rendering and copying of data, and if the FPS is actually limited by this... mostly you'll find your FPS bottleneck is elsewhere in which case it makes no sense to try to implement triple buffering. On small devices like embedded you probably shouldn't even think about this. + +Double buffering can be made more efficient by so called page flipping, i.e. allowing to switch the back and front buffer without having to physically copy the data, i.e. by simply changing the [pointer](pointer.md) of a display buffer. This has to be somehow supported by hardware. + +**When do we actually need double buffering?** Not always, we can avoid it or suppress its memory requirements if we need to, e.g. with so called **[frameless rendering](frameless.md)** -- we may want to do this e.g. in [embedded](embedded.md) programming where we want to save every byte of RAM. The mainstream computers nowadays simply always run on a very fast FPS and keep redrawing the screen even if the image doesn't change, but if you write a program that only occasionally changes what's on the screen (e.g. an e-book reader), you may simply leave out double buffering and actually render to the front buffer once the screen needs to change, the user probably won't notice any flicker during a single quick frame redraw. You also don't need double buffering if you're able to compute the final pixel color right away, for example with [ray tracing](ray_tracing.md) you don't need any double buffering, unless of course you're doing some complex [postprocessing](postprocessing.md). Double buffering is only needed if we compute a pixel color but that color may still change before the frame is finished. You may also only use a partial double buffer if that is possible (which may not be always): you can e.g. split the screen into 16 regions and render region by region, using only a 1/16th size double buffer. Using a [palette](palette.md) can also make the back buffer smaller: if we use e.g. a 256 color palette, we only need 1 byte for every pixel of the back buffer instead of some 3 bytes for full [RGB](rgb.md). The same goes for using a smaller resolution that is the actual native resolution of the screen. \ No newline at end of file diff --git a/drummyfish.md b/drummyfish.md new file mode 100644 index 0000000..ca3330b --- /dev/null +++ b/drummyfish.md @@ -0,0 +1,17 @@ +# Drummyfish + +Drummyfish (also tastyfish, drumy etc.) is a programmer, [anarchopacifist](anpac.md) and proponent of [free software/culture](free_software.md), who started [this wiki](lrs_wiki.md) and invented the kind of software it focuses on: [less retarded software](lrs.md) (LRS). Besides others he has written [Anarch](anarch.md), [small3dlib](small3dlib.md), [raycastlib](raycastlib.md) and [SAF](saf.md). He has also been creating free culture art. + +Drummyfish has a personal website at https://www.tastyfish.cz. + +Aside from creating [LRS](lrs.md) drummyfish has contributed to a few [FOSS](foss.md) projects such as [OpenMW](openm.md). He's been contributing with [public domain](pd.md) art of all kind (2D, 3D, music, ...) and writings to [Wikipedia](wikipedia.md), [Wikimedia Commons](wm_commons.md), [opengameart](oga.md), [libregamewiki](lgw.md), freesound and others. + +Drummyfish's real name is Miloslav Číž, he was born on 24.08.1990 and lives in Moravia, Czech Republic. He started programming at high school in [Pascal](pascal.md), then he went on to study [compsci](compsci.md) (later focused on [computer graphics](graphics.md)) in a Brno University of Technology and got a master's degree, however he subsequently refused to find a job in the industry, partly because of his views (manifested by [LRS](lrs.md)) and partly because of mental health issues (depressions/anxiety/avoidant personality disorder). He rather chose to do less harmful slavery such as cleaning and physical [spam](spam.md) distribution, and continues [hacking](hacking.md) on his programming (and other) projects in his spare time in order to be able to do it with absolute freedom. + +In 2019 drummyfish has written a "manifesto" of his ideas called **Non-Competitive Society** that describes the political ideas of an ideal society. It is in the [public domain](public_domain.md) under [CC0](cc0.md) and available for download online. + +{ Why doxx myself? Following the [LRS](lrs.md) philosophy, I believe information should be free. [Censorship](censorship.md) -- even in the name of [privacy](privacy.md) -- goes against information freedom. We should live in a society in which people are moral and don't abuse others by any means, including via availability of their private information. And in order to achieve ideal society we have to actually live it, i.e. slowly start to behave as if it was already in place. Of course, I can't tell you literally everything (such as my passwords etc.), but the more I can tell you, the closer we are to the ideal society. ~drummyfish } + +He likes many things such as animals, peace, freedom, programming, [math](math.md) and [games](game.md) (e.g. [Xonotic](xonotic.md)). + +Drummyfish is pretty retarded when it comes to leading projects or otherwise dealing with people or practical life. \ No newline at end of file diff --git a/dynamic_programming.md b/dynamic_programming.md new file mode 100644 index 0000000..b43a494 --- /dev/null +++ b/dynamic_programming.md @@ -0,0 +1,45 @@ +# Dynamic Programming + +Dynamic programming is a programming technique that can be used to make many algorithms more efficient (faster). It works on the principle of repeatedly breaking given problem down into smaller subproblems and then solving one by one from the simplest and remembering already calculated results that can be reused later. + +It is usually contrasted to the *[divide and conquer](divide_and_conquer.md)* (DAC) technique which at the first sight looks similar but is in fact quite different. DAC also subdivides the main problem into subproblems, but then solves them [recursively](recursive.md), i.e. it is a top-down method. DAC also doesn't remember already solved subproblem and may end up solving the same problem multiple times, wasting computational time. Dynamic programming on the other hand starts solving the subproblems from the simplest ones -- i.e. it is a **bottom-up** method -- and remembers solutions to already solved subproblems in some kind of a [table](lut.md) which makes it possible to quickly reuse the results if such subproblem is encountered again. The order of solving the subproblems should be made such as to maximize the efficiency of the algorithm. + +It's not the case that dynamic programming is always better than DAC, it depends on the situation. Dynamic programming is effective **when the subproblems overlap** and so the same subproblems WILL be encountered multiple times. But if this is not the case, DAC can easily be used and memory for the look up tables will be saved. + +## Example + +Let's firstly take a look at the case when divide and conquer is preferable. This is for instance the case with many [sorting](sorting.md) algorithms such as [quicksort](quicksort.md). Quicksort recursively divides parts of the array into halves and sorts each of those parts: sorting each of these parts is a different subproblem as these parts (at least mostly) differ in size, elements and their order. The subproblems therefore don't overlap and applying dynamic programming makes little sense. + +But if we tackle a problem such as computing *N*th [Fibonacci number](fibonacci_number.md), the situation changes. Considering the definition of *N*th Fibonacci number as a *"sum of N-1th and N-2th Fibonacci numbers"*, we might naively try to apply the divide and conquer method: + +``` +int fib(int n) +{ + return (n == 0 || n == 1) ? + n : // start the sequence with 0, 1 + fib(n - 1) + fib(n - 2); // else add two previous +} +``` + +But we can see this is painfully slow as calling `fib(n - 2)` computes all values already computed by calling `fib(n - 1)` all over again, and this inefficiency additionally appears inside these functions recursively. Applying dynamic programming we get a better code: + +``` +int fib(int n) +{ + if (n < 2) + return n; + + int current = 1, prev = 0; + + for (int i = 2; i <= n; ++i) + { + int tmp = current; + current += prev; + prev = tmp; + } + + return current; +} +``` + +We can see the code is longer, but it is faster. In this case we only need to remember the previously computed Fibonacci number (in practice we may need much more memory for remembering the partial results). \ No newline at end of file diff --git a/earth.md b/earth.md new file mode 100644 index 0000000..f887e83 --- /dev/null +++ b/earth.md @@ -0,0 +1,41 @@ +# Earth + +Well, Earth is the [planet](planet.md) we live on. It is the third planet from the [Sun](sun.md) of our Solar system which itself is part of the [Milky Way](milky_way.md) [galaxy](galaxy.md). So far it is the only known place to have [life](life.md). + +Now behold the grand rendering of the Earth map in [ASCII](ascii_art.md) ([equirectangular](equirectangular.md) projection): + +``` +X v v v v v v v v v v v v v v v X + .-,./"">===-_.----..----.. : -==- + -=""-,><__-;;;<""._ / : -===- + ___ .=---""""\/ \/ ><."-, "\ /" : .--._ ____ __.-""""------""""---.....-----.. +> -=_ """""---"" _.-" \_/ | .-" /"\ : _.'' ".."" """ < +"" _.'ALASKA {_ ,".__ "" '"' _ : ( _/| _ _.. + "-._.--"""-._ CANADA "--" "\ / \: ""./ / _--"","/ + "" \ _/_ ",_/:_./\_.' ASIA "--. \/ +> } /_\/ \:EUROPE __ __ /\| < + \ ""=- __.-" /"":_-. -._ _, /__\ \ ( .-" ) >- + \__ USA _/ """:___" " ", "" ,-. \ __// + |\ __ / /"": ""._..../ \ "" \_/ +> \\_ ." \| ATLANTIC / : \\ <'\ | < + \ \_/| -=- OCEAN ) :AFRICA \\_.-" """\ .' + PACIFIC "--._\ \___: "/ \ .""\_ <^,..-" __ + OCEAN \"""-""-.._ :""\ / " | _) \_\INDONESIA +>.............................|..........",.............:...\......./................_\\_....__/\..,__..........< + | SOUTH \ : / | "-._\_ \__/ \ ""-_ + \ AMERICA / : ( } """""===- """""_ + \_ | : \ \ __.-""._,"", +> \ / : / / |\ ," AUSTRALIA \ < + | | : \ / \/ INDIAN "; __ ) + | / : \___/ OCEAN """ ""-._ / + / / : "" |\ +> | / : {) // < + | | : "" + \_ \ : + """ : +> ., : < + __....___ _/"" \ : _____ ___.......___......-------...__ +--....-----""""----"""" "" "-..__ __......--""""""" """ .;_..... + """" : ANTARCTICA +X ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ X +``` \ No newline at end of file diff --git a/easier_done_than_said.md b/easier_done_than_said.md new file mode 100644 index 0000000..10865cb --- /dev/null +++ b/easier_done_than_said.md @@ -0,0 +1,5 @@ +# Easier Done Than Said + +Easier done than said is the opposite of [easier said than done](easier_said_than_done.md). + +Example: exhaling, as saying the word "exhaling" requires exhaling plus doing some extra work such as correctly shaping your mouth. \ No newline at end of file diff --git a/easy_to_learn_hard_to_master.md b/easy_to_learn_hard_to_master.md new file mode 100644 index 0000000..3b50fcd --- /dev/null +++ b/easy_to_learn_hard_to_master.md @@ -0,0 +1,18 @@ +# Easy To Learn, Hard To Master + +"Easy to learn, hard to master" (ETLHTM) is a type of design of a [game](game.md) (and by extension a potential property of any [art](art.md) or [skill](skill.md)) which makes it relatively easy to learn to play while mastering the play (playing in near optimal way) remains very difficult. + +Examples of this are games such as [tetris](tetris.md), [minesweeper](minesweeper.md) or [Trackmania](trackmania.md). + +[LRS](lrs.md) sees the ETLHTM design as extremely useful and desirable as it allows for creation of [suckless](suckless.md), simple games that offer many hours of [fun](fun.md). With this philosophy we get a great amount of value for relatively little effort. + +This is related to a fun coming from **self imposed goals**, another very important and useful concept in games. Self imposed goals in games are goals the player sets for himself, for example completing the game without killing anyone (so called "pacifist" gameplay) or completing it very quickly ([speedrunning](speedrun.md)). Here the game serves only as a platform, a playground at which different games can be played and invented -- inventing games is fun in itself. Again, a game supporting self imposed goals can be relatively simple and offer years of fun, which is extremely cool. + +The simplicity of learning a game comes from simple rules while the difficulty of its mastering arises from the complex emergent behavior these simple rules create. Mastering of the game is many times encouraged by [competition](competition.md) among different people but also competition against oneself (trying to beat own score). In many simple games such as [minesweeper](minesweeper.md) there exists a competitive scene (based either on direct matches or some measurement of skill such as [speedrunning](speedrun.md) or achieving high score) that drives people to search for strategies and techniques that optimize the play, and to training skillful execution of such play. + +The opposite is [hard to learn, easy to master](hard_to_learn_easy_to_master.md). + +## See Also + +- [easier done than said](easier_done_than_said.md) +- [speedrun](speedrun.md) \ No newline at end of file diff --git a/english.md b/english.md new file mode 100644 index 0000000..4e3e011 --- /dev/null +++ b/english.md @@ -0,0 +1,7 @@ +# English + +*"English Motherfucker, do you speak it?"* + +English is a natural human language spoken mainly in the [USA](usa.md), UK and Australia as well as in dozens of other countries and in all parts of the world. It is the default language of the world. It is a pretty simple and [suckless](suckless.md) language (even though not as suckless as [Esperanto](esperanto.md)), even a braindead person can learn it { Knowing Czech and learning Spanish, which is considered one of the easier languages, I can say English is orders of magnitude simpler. ~drummyfish }. It is the lingua franca of the tech world and many other worldwide communities. Thanks to its simplicity (lack of declension, fixed word order etc.) it is pretty suitable for computer analysis and as a basis for [programming languages](programming_language.md). + +If you haven't noticed, this wiki is written in English. \ No newline at end of file diff --git a/entrepreneur.md b/entrepreneur.md new file mode 100644 index 0000000..66ae24f --- /dev/null +++ b/entrepreneur.md @@ -0,0 +1,3 @@ +# Entrepreneur + +Entrepreneur is a person practicing slavery and committing legal theft under [capitalism](capitalism.md); capitalists describe those actions by euphemisms such as "doing [business](business.md)". Successful entrepreneurs can also be seen as murderers as they consciously firstly hoard resources that poor people lack (including basic resources needed for living) and secondly cause and perpetuate situations such as the third world slavery where people die on a daily basis performing extremely difficult, dangerous and low paid work, so that the entrepreneur can buy his ass yet another private jet. \ No newline at end of file diff --git a/esolang.md b/esolang.md new file mode 100644 index 0000000..2aabd4e --- /dev/null +++ b/esolang.md @@ -0,0 +1,63 @@ +# Esoteric Programming Language + +So called esoteric programming languages (esolangs) are highly experimental and [fun](fun.md) [programming languages](programming_language.md) that employ bizarre ideas. Popular languages of this kind include [Brainfuck](brainfuck.md), [Chef](chef.md) or [Omgrofl](omgrofl.md). + +There is a wiki for esolangs, the [Esolang Wiki](https://esolangs.org). If you want to behold esolangs in all their beauty, see [hello world in different languages](https://esolangs.org/wiki/Hello_world_program_in_esoteric_languages_(nonalphabetic_and_A-M%29). The Wiki is published under [CC0](cc0.md)! + +Some notable ideas employed by esolangs are: + +- Using images instead of text as [source code](source_code.md) (e.g. *Piet*). +- Doing nothing (e.g. *Nothing*). +- Being two or more dimensional (e.g. *Befunge* or *Hexagony*). +- Source code resembling cooking recipes (e.g. *Chef*). +- Trying to be as hard to use as possible (e.g. *Brainfuck*). +- Trying to be as hard to compile as possible (e.g. *Befunge*). +- Adding randomness to program execution (e.g. *Entropy*). +- Having no [input/output](io.md) (e.g. *Compute*). +- Obligation to beg the compiler to do its job (e.g. *INTERCAL*). +- Using only white characters in source code (e.g. *Whitespace*). +- Using only a single letter in source code (e.g. *Unary*). +- Using git repository structure as source code (e.g. *legit*). +- Source code resembling dramatic plays (e.g. *Shakespeare*, actual [real-life](real_life.md) plays were performed). +- Solely focus on [golfing](golf.md), i.e. writing the shortest possible programs (e.g. *GoldScript*) +- Using [unicode](unicode.md) characters (e.g. *UniCode*). +- Being infinitely many languages (e.g. *MetaGolfScript*, each one solves a specific program in 0 bytes). + +Esolangs are great because: + +- **They are [fun](fun.md)**. +- **They are actually useful research in language design**, even if most of the ideas aren't useful directly, esolangs really teach us about the borders and definitions of what languages are. And sometimes, by mistake, actual discoveries are made. +- **They are great exercise in [programming](programming.md)** and design. Simple languages that are allowed to not be useful are potentially good for education as they let the programmer fully focus on a specific idea and its implementation. +- **They blend technology with [art](art.md)**, train creativity and thinking "outside the box". +- **They are a breath of fresh air** in the sometimes too serious area of technology. Hobbyist and non-commercial programming communities are always great to have. + +## History + +INTERCAL, made in 1972 by Donald Woods and James Lyon, is considered the first esolang in history: its goal was specifically intended to be different from traditional languages and so for example a level of politeness was introduced -- if there weren't enough PLEASE labels in the source code, the compiler wouldn't compile the program. + +In 2005 esolang wiki was started. + +## Specific Languages + +The following is a list of some notable esoteric languages. + +- **`!@$%^&*()+`**: Source code looks like gibberish. +- **[Brainfuck](brainfuck.md)**: Extremely simple but hard to program in, arguably the most famous esolang with many forks. +- **[Brainfork](brainfork.md)**: Brainfuck with added [multithreading](multithreading.md). +- **[Befunge](befunge.md)**: Two dimensional language that's extremely hard to compile. +- **[Chef](chef.md)**: Source codes look like cooking recipes. +- **Entropy**: Adds randomness to programs, data in variables decay. +- **FALSE**: Aims for as small compiler as possible, inspired creation of Brainfuck and other esolangs. +- **Gravity**: Executing programs involves solving [differential equations](differential_equation.md) related to gravity, which is [uncomputable](computability.md). +- **[INTERCAL](intercal.md)**: Maybe the first esolang, includes such statements as `PLEASE DO` which have to be present in order for the compilation to be successful. +- **Nothing**: Does nothing, guarantees zero bugs. +- **[Compute](compute.md)**: Can compute any existing problem in arbitrarily short time, but has no output so the result cannot be printed. +- **[Omgrofl](omgrofl.md)**: Source code is composed of internet acronyms such as *lol*, *wtf*, *lmao* etc. +- **Pi**: Source code looks like the number [pi](pi.md), errors encode the program. +- **[Piet](piet.md)**: Source codes are images. +- **Text**: Language that always prints its source code (it is not Turing complete). All [ASCII](ascii.md) files are programs in Text. +- **Polynomial**: Programs are [polynomials](polynomial.md) whose zeros determine the commands. +- **[Unary](unary.md)**: Source code uses only 1 character: `0`. Each program is just a sequence of zeros of different length. +- **[Velato](velato.md)**: Source codes are [MIDI](midi.md) files. +- **[Whitespace](whitespace.md)**: Source code uses only white characters (spaces, tabs and newlines) so it looks seemingly empty. +- **XENBLN**: [Golfing](golf.md) language, hello world is just `š`. diff --git a/evil.md b/evil.md new file mode 100644 index 0000000..4851741 --- /dev/null +++ b/evil.md @@ -0,0 +1,3 @@ +# Evil + +*Evil always wins in the end.* \ No newline at end of file diff --git a/exercises.md b/exercises.md new file mode 100644 index 0000000..3f73123 --- /dev/null +++ b/exercises.md @@ -0,0 +1,50 @@ +# Exercises + +Here let be listed exercises for the readers of this wiki. You can allow yourself to as many helpers and resources as you find challenging: with each problem you should either find out you know the solution or learn something new while solving it. + +1. What's the difference between [free software](free_software.md) and [open source](open_source.md)? +2. 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 (pseudocode): `for i := 0 to N: for j := 0 to N: if numbers[i] == numbers[j]: add(S,pair(i,j))`. How can we optimize the algorithm in terms of its execution speed (i.e. make it perform fewer operations while keeping its results the same)? How did the asymptotic time complexity ("big O") class change? +3. In computer graphics, what is the difference between ray casting, ray tracing and path tracing? +4. Why are manhole lids round and not square? +5. Give one real-life example of each of the following binary [relation](relation.md) types: [transitive](transitivity.md) but not equivalence, non-transitive, [antisymmetric](antisymmetric.md) and symmetric at the same time, [asymmetric](asymmetry.md), non-trivial [equivalence](equivalence.md). + +## Solutions + +A solution to each problem should be listed here -- keep in mind there may exist other solutions that those listed here. + +**solution 1**: + +Both movements share very similar rules of licensing and technically free software and open-source are largely the same. However, free software is fundamentally aiming for the creation of ethical software -- that which respects its user's freedom -- while open source is a later movement that tries to adapt free software for the business and abandons the pursuit of ethics, i.e. it becomes corrupted by capitalism and no longer minds e.g. proprietary dependencies. + +**solution 2**: + +In the given algorithm we compare all numbers twice. This can be avoided by not comparing a number to previous numbers in the array (because these have already been compared). Additionally we don't have to compare the same number to itself, a number will always be equal to itself: + +``` +for i := 0 to N: + add(S,i,i) // no need to compare + +for i := 0 to N: + for j := i + 1 to N: + if numbers[i] == numbers[j]: + add(S,pair(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)). + +**solution 3**: + +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. + +**solution 4**: + +Round lid can't fall into the hole. + +**solution 5**: + +- transitive, not equivalence: *A* is a descendant from *B*. +- non-transitive: *A* is a friend of *B*. +- symmetric: *A* had sex with *B*. +- antisymmetric and symmetric: *A* is *B*. +- asymmetric: *A* is a mother of *B*. +- non-trivial equivalence: *A* is of same age as *B*. \ No newline at end of file diff --git a/facebook.md b/facebook.md new file mode 100644 index 0000000..179a1a3 --- /dev/null +++ b/facebook.md @@ -0,0 +1,5 @@ +# Facebook + +"*Facebook has no users, it only has useds.*" --[rms](rms.md) + +TODO \ No newline at end of file diff --git a/faggot.md b/faggot.md new file mode 100644 index 0000000..f46bfd7 --- /dev/null +++ b/faggot.md @@ -0,0 +1,3 @@ +# Faggot + +Faggot is a synonym to [gay](gay.md). \ No newline at end of file diff --git a/fail_ab.md b/fail_ab.md new file mode 100644 index 0000000..a75fbc3 --- /dev/null +++ b/fail_ab.md @@ -0,0 +1,10 @@ +# Type A/B Fail + +Type A and type B fails are two very common cases of failing to adhere to the [LRS](lrs.md) politics/philosophy by only a small margin. Most people don't come even close to LRS politically or by their life philosophy -- these are simply general failures. Then there a few who ALMOST adhere to LRS politics and philosophy but fail in an important point, either by being/supporting [pseudoleft](pseudoleft.md) (type A fail) or being/supporting [right](left_right.md) (type B fail). The typical cases are following (specific cases may not fully fit these, of course): + +- **type A fail**: Is anticapitalist, anticonsumerist, may incline towards minimalism, supports [free software](free_software.md) and [free culture](free_culture.md), may even be a vegan, [anarchist](anarchism.md), [C](c.md) programmer etc., however falls into the trap of supporting [pseudoleft](pseudoleft.md), e.g. [LGBT](lgbt.md) or [feminism](feminism.md) and things such as censorship ("[moderation](moderation.md)", [COCs](coc.md)), "just violence and bullying" (violence against fascists, e.g. [antifa](antifa.md)), falls for memes such as "[Rust](rust.md) is the new [C](c.md)". +- **type B fail**: Is against [pseudoleft](pseudoleft.md) bullshit and propaganda such as political correctness, is a [racial realist](racial_realism.md), highly supports [suckless](suckless.md) software, hacking and minimalism to achieve high freedom, usually also opposes [corporations](corporation.md) and state, however falls into the trap of being a [fascist](fascism.md), easily accepts violence, believes in "natural selection/wild west as a basis of society", supports and engages in [cryptocurrencies](crypto.md), believes in some form of [capitalism](capitalism.md) and that the current form of it can be "fixed" (["anarcho" capitalism](ancap.md) etc.) + +Type A/B fails are the "great filter" of the rare kind of people who show a great potential for adhering to LRS. It may be due to the modern western culture that forces a [right](right.md)-[pseudoleft](pseudoleft.md) false dichotomy that even those showing a high degree of non-conformance eventually slip into the trap of being caught by one of the two poles. These two fails seem to be a manifestation of an individual's true motives of [self interest](self_interest.md) which is culturally fueled with great force -- those individuals then try to not conform and support non-mainstream concepts like free culture or sucklessness, but eventually only with the goal of self interest. It seems to be extremely difficult to abandon this goal, much more than simply non-conforming. Maybe it's also the subconscious knowledge that adhering completely to LRS means an extreme loneliness; being type A/B fail means being a part of a minority, but still a having a supportive community, not being completely alone. + +However these kinds of people may also pose a hope: if we could educate them and "fix their failure", the LRS community could grow rapidly. If realized, this step could even be seen as the main contribution of LRS -- uniting the misguided rightists and pseudoleftists by pointing out errors in their philosophies (errors that may largely be intentionally forced by the system anyway exactly to create the hostility between the non-conforming, as a means of protecting the system). \ No newline at end of file diff --git a/fantasy_console.md b/fantasy_console.md new file mode 100644 index 0000000..1a4d64f --- /dev/null +++ b/fantasy_console.md @@ -0,0 +1,29 @@ +# Fantasy Console + +Fantasy console, also fantasy computer, is a software platform intended mainly for creating and playing simple [games](game.md), which imitates parameters, simplicity and [look and feel](look_and_feel.md) of classic retro consoles such as [GameBoy](gameboy.md). These consoles are called *fantasy* because they are not [emulators](emulator.md) of already existing hardware consoles but rather "dreamed up" platforms, [virtual machines](vm.md) made purely in software with artificially added restrictions that a real hardware console might have. These restrictions limit for example the resolution and color depth of the display, number of buttons and sometimes also computational resources. + +The motivation behind creating fantasy consoles is normally twofold: firstly the enjoyment of [retro](retro.md) games and retro programming, and secondly the immense advantages of [simplicity](minimalism.md). It is much faster and easier to create a simple game than a full fledged PC game, this attracts many programmers, simple programming is also more enjoyable (fewer bugs and headaches) and simple games have many nice properties such as small size (playability over [web](web.md)), easy embedding or enabling emulator-like features. + +Fantasy consoles usually include some kind of simple [IDE](ide.md); a typical mainstream fantasy console both runs and is programmed in a [web browser](browser.md) so as to be accessible to normies. They also use some kind of easy scripting language for game programming, e.g. [Lua](lua.md). Even though the games are simple, the code of such a mainstream console is normally [bloat](bloat.md), i.e. we are talking about **[pseudominimalism](pseudominimalism.md)**. Nevertheless some consoles, such as [SAF](saf.md), are truly [suckless](suckless.md), free and highly portable (it's not a coincidence that SAF is an official [LRS](lrs.md) project). + +## Notable Fantasy Consoles + +The following are a few notable fantasy consoles. + +| name | license | game lang. |parameters | comment | +|--------------------|------------------------|-------------------|-----------|------------------------| +|[CToy](ctoy.md) |[zlib](zlib.md) |[C](c.md) |128x128 |[suckless](suckless.md) | +|[LIKO-12](liko12.md)|[MIT](mit.md) |[Lua](lua.md) |192x128 | | +|[PICO-8](pico8.md) |[propr.](proprietary.md)|[Lua](lua.md) |128x128 4b |likely most famous | +|PixelVision8 |[MS-PL](ms_pl.md) (FOSS)|[Lua](lua.md) |256x240 |written in C# | +|Pyxel |[MIT](mit.md) |[Python](python.md)|256x256 4b | | +|[SAF](saf.md) |[CC0](cc0.md) |[C](c.md) |64x64 8b |[LRS](lrs.md), suckless | +|[TIC-80](tic80.md) |[MIT](mit.md) |Lua, JS, ... |240x136 4b |paid "pro" version | + +## See Also + +- [open console](open_console.md) +- [handheld](handheld.md) +- [virtual machine](vm.md) +- [IBNIZ](ibniz.md) +- [SAF](saf.md) \ No newline at end of file diff --git a/faq.md b/faq.md new file mode 100644 index 0000000..aff8b98 --- /dev/null +++ b/faq.md @@ -0,0 +1,120 @@ +# Frequently Asked Questions + +*Not to be confused with [fuck](fuck.md) or [frequently questioned answers](fqa.md).* + +{ answers by ~drummyfish } + + +### Is this a joke? Are you trolling? + +No. + +### What the fuck? + +See [WTF](wtf.md). + +### How does LRS differ from [suckless](suckless.md), [KISS](kiss.md) and similar types of software? + +Technically these sets largely overlap and LRS is sometimes just a slightly different angle of looking at the same things. I have invented LRS as my own take on suckless software -- as I cannot speak on behalf of the whole suckless community, I have created my own "fork" and simply set my own definitions without worrying about misinterpreting and misquoting someone else. However, LRS does have its specific ideas and areas of focus. The main point is that **LRS is derived from an unconditional love of all life** rather than some shallow idea such as "[productivity](productivity_cult.md)". In practice this leads to such things as a high stress put on [public domain](public_domain.md) and legal safety, altruism, anti-capitalism, accepting software such as games as desirable type of software, NOT subscribing to the [productivity cult](productivity_cult.md), seeing [privacy](privacy.md) as ultimately undesirable etc. + +### Why this obsession with extreme simplicity? Is it because you're too stupid to understand complex stuff? + +I used to be the mainstream, complexity embracing programmer. I am in no way saying I'm a genius but I've put a lot of energy into studying computer science full time for many years so I believe I can say I have some understanding of the "complex" stuff. I speak from own experience and also on behalf of others who shared their experience with me that the appreciation of simplicity and realization of its necessity comes after many years of dealing with the complex and deep insight into the field and into the complex connections of that field to society. + +You may ask: well then but why it's just you and a few weirdos who see this, why don't most good programmers share your opinions? Because they need to make living or because they simply WANT to make a lot of money and so they do what the system wants them to do. Education in technology (and generally just being exposed to corporate propaganda since birth) is kind of a trap: it teaches you to embrace complexity and when you realize it's not a good thing, it is too late, you already need to pay your student loan, your rent, your mortgage, and the only thing they want you to do is to keep this complexity cult rolling. So people just do what they need to do and many of them just psychologically make themselves believe something they subconsciously know isn't right because that makes their everyday life easier to live. "Everyone does it so it can't be bad, better not even bother thinking about it too much". It's difficult doing something every day that you think is wrong, so you make yourself believe it's right. + +It's not that we can't understand the complex. It is that the simpler things we deal with, the more powerful things we can create out of them as the overhead of the accumulated complexity isn't burdening us so much. + +Simplicity is crucial not only for the quality of technology, i.e. for example its safety and efficiency, but also for its freedom. The more complex technology becomes, the fewer people can control it. If technology is to serve all people, it has to be simple enough so that as many people as possible can understand it, maintain it, fix it, customize it, improve it. It's not just about being able to understand a complex program, it's also about how much time and energy it takes because time is a price not everyone can afford, even if they have the knowledge of programming. Even if you yourself cannot program, if you are using a simple program and it breaks, you can easily find someone with a basic knowledge of programming who can fix it, unlike with a very complex program whose fix will require a corporation. + +Going for the simple technology doesn't necessarily have to mean we have to give up the "nice things" such as computer games or 3D graphics. Many things, such as responsiveness and customizability of programs, would improve. Even if the results won't be so shiny, we can recreate much of what we are used to in a much simpler way. You may now ask: why don't companies do things simply if they can? Because complexity benefits them in creating de facto monopolies, as mentioned above, by reducing the number of people who can tinker with their creations. And also because capitalism pushes towards making things quickly rather than well -- and yes, even non commercial "FOSS" programs are pushed towards this, they still compete and imitate the commercial programs. Already now you can see how technology and society are intertwined in complex ways that all need to be understood before one comes to realize the necessity of simplicity. + +### Who writes this wiki? Can I contribute. + +At the moment it's just me, [drummyfish](drummyfish.md). This started as a collaborative wiki name *based wiki* but after some disagreements I forked it (everything was practically written by me at that point) and made it my own wiki where I don't have to make any compromises or respect anyone else's opinions. I'm not opposed to the idea of collaboration but I bet we disagree on something in which case I probably don't want to let you edit this. I also resist allowing contributions because with multiple authors the chance of legal complications grows, even if the work is under a free license or waiver (refer to e.g. the situation where some Linux developers were threatening to withdraw their code contribution license). But you can totally fork this wiki, it's [public domain](cc0.md). + +If you want to contribute to the cause, just create your own website, spread the ideas you liked here -- you may or may not refer to LRS, everything's up to you. Start creating software with LRS philosophy if you can -- together we can help evolve and spread our ideas in a decentralized way, without me or anyone else being an authority, a potential censor. That's the best way forward I think. + +### Since it is public domain, can I take this wiki and do anything with it? Even something you don't like, like sell it or rewrite it in a different way? + +Yes, you can do anything... well, anything that's not otherwise illegal like falsely claiming authorship (copyright) of the original text. This is not because I care about being credited, I don't (you DON'T have to give me any credit), but because I care about this wiki not being owned by anyone. You can however claim copyright to anything you add to the wiki if you fork it, as that's your original creation. + +### Why not keep politics out of this Wiki and make it purely about technology? + +Firstly for us technological progress is secondary to the primary type of progress in society: the social progress. The goal of our civilization is to provide good conditions for life -- this is social progress and mankind's main goal. Technological progress only serves to achieve this, so technological progress follows from the goals of social progress. So, to define technology we have to first know what it should help achieve in society. And for that we need to talk politics. + +Secondly examining any existing subject in depth requires also understanding its context anyway. Politics and technology nowadays are very much intertwined and the politics of a society ultimately significantly affects what its technology looks like ([capitalist SW](capitalist_software.md), [censorship](censorship.md), [bloat](bloat.md), [spyware](spyware.md), [DRM](drm.md), ...), what goals it serves (consumerism, [productivity](productivity_cult.md), control, war, peace, ...) and how it is developed ([COCs](cos.md), [free software](free_software.md), ...), so studying technology ultimately requires understanding politics around it. I hate arguing about politics, sometimes it literally make me suicidal, but it is inevitable, we have to specify real-life goals clearly if we're to create good technology. Political goals guide us in making important design decisions about features, [tradeoffs](tradeoff.md) and other attributes of technology. + +Of course you can fork this wiki and try to remove politics from it, but I think it won't be possible to just keep the technology part alone so that it would still make sense, most things will be left without justification and explanation. + +### What is the political direction of LRS then? + +In three words: [anarcho pacifist](anpac.md) [communism](communism.md). For more details see the article about [LRS](lrs.md) itself. + +### Why do you blame everything on capitalism when most of the issues you talk about, like propaganda, surveillance, exploitation of the poor and general abuse of power, appeared also under practically any other systems we've seen in history? + +This is a good point, we talk about capitalism simply because it is the system of today's world and an immediate threat that needs to be addressed, however we always try to stress that the root issue lies deeper: it is **competition** that we see as causing all major evil. Competition between people is what always caused the main issues of a society, no matter whether the system at the time was called capitalism, feudalism or pseudosocialism. While historically competition and conflict between people was mostly forced by the nature, nowadays we've conquered technology to a degree at which we could practically eliminate competition, however we choose to artificially preserve it via capitalism, the glorification of competition, and we see this as an extremely wrong direction, hence we put stress on opposing capitalism, i.e. artificial prolonging of competition. + +### WTF I am offended, is this a nazi site? Are you racist/Xphobic? Do you love Hitler?!?! + +We're not fascists, we're in fact the exact opposite: our aim is to create technology that benefits everyone equally without any discrimination. I (drummyfish) am personally a pacifist anarchist, I love all living beings and believe in absolute social equality of all life forms. We invite and welcome everyone here, be it gays, communists, rightists, trannies, pedophiles or murderers, we love everyone equally, even you and Hitler. + +What we do NOT engage in is political correctness, censorship, offended culture, identity politics and pseudoleftism. We do NOT support fascist groups such as feminists and LGBT and we will NOT practice bullying and [codes of conducts](coc.md). We do not pretend there aren't any differences between people and we will make jokes that make you feel offended. + +### Why do you use the word Nigger so much? + +To counter its censorship. The more they censor something, the more I am going to uncensor it. They have to learn that the only way to make me not say that word so often is to stop censoring it, so to their action of censorship I produce a reaction they dislike. That's basically how you train a dog. (Please don't ask who "they" are.). + +It also has the nice side effect of making this less likely to be used by corporations and SJWs. + +### How can you say you love all living beings and use offensive language at the same time? + +The culture of being offended is [bullshit](bullshit.md), it is a [pseudoleftist](pseudoleft.md) (fascist) invention that serves as a weapon to justify censorship, canceling and bullying of people. Since I love all people, I don't support any weapons against anyone (not even against people I dislike or disagree with). People are offended by language because they're taught to be offended by it by the propaganda, I am helping them unlearn it. + +### But how can you so pretentiously preach "absolute love" and then say you hate capitalists, fascists, bloat etc.? + +OK, firstly we do NOT love *everything*, we do NOT advocate against hate itself, only against hate of living beings (note we say we love *everyone*, not *everything*). Hating other things than living beings, such as some bad ideas or malicious objects, is totally acceptable, there's no problem with it. We in fact think hate of some concepts is necessary for finding better ways. + +Now when it comes to *"hating"* people, there's an important distinction to be stressed: we never hate a living being as such, we may only hate their properties. So when we say we *hate* someone, it's merely a matter of language convenience -- saying we *hate* someone never means we hate a person as such, but only some thing about that person, for example his opinions, his work, actions, behavior or even appearance. I can hear you ask: what's the difference? The difference is we'll never try to eliminate a living being or cause it suffering because we love it, we may only try to change, in non-violent ways, their attributes we find wrong (which we *hate*): for example we may try to educate the person, point out errors in his arguments, give him advice, and if that doesn't work we may simply choose to avoid his presence. But we will never target hate against him. + +And yeah, of course sometimes we make jokes and sarcastic comments, it is relied on your ability to recognize those yourself. + +### So you really "love" everyone, even dicks like Trump, school shooters, instagram influencers etc.? + +Yes, but it may need an elaboration. There are many different kinds of love: love of a sexual partner, love of a parent, love of a pet, love of a hobby, love of nature etc. Obviously we can't love everyone with the same kind of love we have e.g. for our life partner, that's impossible if we've actually never even seen most people who live on this planet. The love we are talking about -- our universal love of everyone -- is an unconditional love of life itself. Being alive is a miracle, it's beautiful, and as living beings we feel a sense of connection with all other living beings in this universe who were for some reason chosen to experience this rare miracle as well -- we know what it feels like to live and we know other living beings experience this special, mysterious privilege too, though for a limited time. This is the most basic kind of love, an empathy, the happiness of seeing someone else live. It is sacred, there's nothing more pure in this universe than feeling this empathy, it works without language, without science, without explanation. While not all living beings are capable of this love (a virus probably won't feel any empathy), we believe all humans have this love in them, even if it's being suppressed by their environment that often forces them compete, hate, even kill. Our goal is to awaken this love in everyone as we believe it's the only way to achieve a truly happy coexistence of us, living beings. + +### I dislike this wiki, our teacher taught us that global variables are bad and that OOP is good. + +This is not a question you dummy. Have you even read the title of this page? Anyway, your teacher is stupid, he is, very likely unknowingly, just spreading the capitalist propaganda. He probably believes what he's saying but he's wrong. + +### Lol you've got this fact wrong and you misunderstand this and this topic, you've got bugs in code, your writing sucks etc. How dare you write about things you have no clue about? + +I want a public domain encyclopedia that includes topics of new technology. Since this supposedly modern society failed to produce even a single one and since every idiot on this planet wants to keep his copyright on everything he writes, I am forced to write the encyclopedia myself, even for the price of making mistakes. No, US public domain doesn't count as world wide public domain. Blame this society for not allowing even a tiny bit of information to slip into public domain. Writing my own encyclopedia is literally the best I can do in the situation I am in. Nothing is perfect, I still believe this can be helpful to someone. You shouldn't take facts from a random website for granted. If you wanna help me correct errors, email me. + +### How can you use [CC0](cc0.md) if you, as anarchists, reject laws and intellectual property? + +We use it to **remove** law from our project. Using a [license](license.md) such as [GFDL](gfdl.md) would mean we're keeping our copyright and are willing to execute enforcement of intellectual property laws, however using a CC0 [waiver](waiver.md) means we GIVE UP all lawful exclusive rights that have been forced on us. This has no negative effects: if law applies, then we use it to remove itself, and if it doesn't, then nothing happens. To those that acknowledge the reality of the fact that adapting proprietary information can lead to being bullied by the state we give a guarantee this won't happen, and others simply don't have to care. + +### What software does this wiki use? + +[Git](git.md), the articles are written in [markdown](md.md) and converted to [HTML](html.md) with a simple script. + +### I don't want my name associated with this, can you remove a reference to myself or my software from your wiki? + +No. + +### Are you the only one in the world who is not affected by the propaganda? + +It definitely seems so. + +### How does it feel to be the only one on this planet to see the undistorted truth of reality? + +Pretty lonely and depressing. + +### Are you a crank? + +Depending on exact definition the answer is either "no" or "yes and it's a good thing". + +### Are you retarded? + +:( Maybe, but even a stupid person can sometimes have smart ideas. \ No newline at end of file diff --git a/fascism.md b/fascism.md new file mode 100644 index 0000000..d0d79ea --- /dev/null +++ b/fascism.md @@ -0,0 +1,7 @@ +# Fascism + +Fascist groups are subgroups of society that strongly pursue [self interest](self_interest.md) on the detriment of others (those who are not part of said group). Fascism is a [rightist](left_right.md), [competitive](competition.md) tendency; fascists aim to make themselves as strong, as powerful and as rich as possible, i.e. to weaken and possibly eliminate competing groups, to have power over them, enslave them and to seize their resources. The means of their operation are almost exclusively [evil](evil.md), including [violence](violence.md), [bullying](bully.md), [wars](war.md), [propaganda](propaganda.md), [eye for an eye](revenge.md), [slavery](slavery.md) etc. + +A few examples of fascist groups are [corporations](corporation.md), [nations](nationalism.md), NSDAP ([Nazis](nazi.md)), [LGBT](lgbt.md), [feminists](feminism.md), [Antifa](antifa.md), [KKK](kkk.md), [Marxists](marxism.md) and, of course, the infamous Italian fascist party of Benito Mussolini. + +Fascism is always bad and we have to aim towards eliminating it. However here comes a great warning: **in eliminating fascism be extremely careful to not become a fascist yourself**. We purposefully do NOT advice to *[fight](fight_culture.md)* fascism as fight implies violence, the tool of fascism. **Elimination of fascism has to be done in a [non-violent](nonviolence.md) way**. Sadly, generation after generation keeps repeating the same mistake over and over: they keep opposing fascism by fascist means, eventually taking the oppressors place and becoming the new oppressor, only to again be dethroned by the new generation. This has happened e.g. with [feminism](feminism.md) and other [pseudoleftist](pseudoleft.md) movements. This is an endless cycle of stupidity but, more importantly, endless suffering of people. This cycle needs to be ended. We must choose not the easy way of violence, but the difficult way of non-violent rejection which includes loving the enemy as we [love](love.md) ourselves. Fascism is all about loving one's own group while hating the enemy groups -- if we can achieve loving all groups of people, even fascists themselves, fascism will have been by definition eliminated. \ No newline at end of file diff --git a/fascist.md b/fascist.md new file mode 100644 index 0000000..7e79d4d --- /dev/null +++ b/fascist.md @@ -0,0 +1,3 @@ +# Fascist + +See [fascism](fascism.md). \ No newline at end of file diff --git a/feminism.md b/feminism.md new file mode 100644 index 0000000..fb4cfc8 --- /dev/null +++ b/feminism.md @@ -0,0 +1,5 @@ +# Feminism + +Feminism is a [fascist](fascism.md) [terrorist](terrorism.md) [pseudoleftist](pseudoleft.md) movement aiming for establishing female as the superior gender and for social revenge on men. Similarly to [LGBT](lgbt.md), feminism is hugely violent, [toxic](toxic.md) and harmful, based on [brainwashing](brainwashing.md), [bullying](bullying.md) (e.g. the [metoo](metoo.md) campaign) and [propaganda](propaganda.md). + +If anything's clear, then that feminism doesn't care about gender equality. Firstly it is not called *gender equality movement* but *feminism*, i.e. for-female, and as we know, [name plays a huge role](name_is_important.md). Indeed, women have historically been oppressed and needed support, but once that support reaches equality -- which has basically already happened a long time ago now -- feminist movement will, if only by [social inertia](social_inertia.md), keep pursuing more advantages for women (what else should a movement called *feminism* do?), i.e. at this point the new goal has already become female superiority. Another proof is that feminists care about things such as wage gap but of course absolutely don't give a damn about opposite direction inequality, such as men dying on average much younger than women etc. And of course, when men establish "men rights" movements to address this, suddenly feminists see those as "fascist", "toxic" and "violent" and try to destroy such movements. \ No newline at end of file diff --git a/femoid.md b/femoid.md new file mode 100644 index 0000000..d2fb775 --- /dev/null +++ b/femoid.md @@ -0,0 +1,3 @@ +# Femoid + +See [woman](woman.md). \ No newline at end of file diff --git a/fight_culture.md b/fight_culture.md new file mode 100644 index 0000000..4021fec --- /dev/null +++ b/fight_culture.md @@ -0,0 +1,5 @@ +# Fight Culture + +Fight culture is the [modern](modern.md) western mindset of seeing any endeavor as a fight against something. Even such causes as aiming for establishment of [peace](peace.md) is seen as fighting people who are against peace, which is [funny](fun.md) but also sad. Fight culture keeps, just by the constant repetition of the word *fight*, a subconscious validation of violence as justified and necessary means for achieving any goal. Fight culture is to a great degree the culture of [capitalist](capitalism.md) society (of course not exclusively), the environment of extreme competition and hostility. + +[We](lrs.md), of course, see fight culture as inherently undesirable for a good society as that needs to be based on peace, love and [collaboration](collaboration.md), not [competition](competition.md). For this reasons we never say we "fight" anything, we rather aim for goals, look for solutions, educate and sometimes reject, refuse and oppose bad concepts (e.g. fight culture itself). \ No newline at end of file diff --git a/firmware.md b/firmware.md new file mode 100644 index 0000000..fcd3a26 --- /dev/null +++ b/firmware.md @@ -0,0 +1,3 @@ +# Firmware + +Firmware is a type of very basic [software](software.md) that's usually preinstalled on a device from factory and serves to provide the most essential functionality of the device. On simple devices, like mp3 players or remote controls, firmware may be all that's ever needed for the device's functioning, while on more complex ones, such as [personal computers](pc.md), firmware (e.g. [BIOS](bios.md) or [UEFI](uefi.md)) allows basic configuration and installation of more complex software (such as an [operating system](os.md)) and possibly provides functions that the installed software can use. Firmware is normally not meant to be rewritten by the user and is installed in some kind of memory that's not very easy to rewrite, it may even be hard-wired in which case it becomes something on the very boundary of software and [hardware](hardware.md). diff --git a/fixed_point.md b/fixed_point.md new file mode 100644 index 0000000..2971afd --- /dev/null +++ b/fixed_point.md @@ -0,0 +1,148 @@ +# Fixed Point + +Fixed point arithmetic is a simple and often [good enough](good_enough.md) method of computer representation of [fractional](rational_number.md) numbers (i.e. numbers with higher precision than [integers](integer.md), e.g. 4.03), as opposed to [floating point](float.md) which is a more complicated way of doing this which in most cases we consider a worse, [bloated](bloat.md) alternative. Probably in 99% cases when you think you need floating point, fixed point will do just fine. + +Fixed point has at least these advantages over floating point: + +- **It doesn't require a special hardware coprocessor** for efficient execution and so doesn't introduce a [dependency](dependency.md). Programs using floating point will run extremely slowly on systems without float hardware support as they have to emulate the complex hardware in software, while fixed point will run just as fast as integer arithmetic. For this reason fixed point is very often used in [embedded](embedded.md) computers. +- It is **easier to understand and better predictable**, less tricky, [KISS](kiss.md), [suckless](sukless.md). (Float's IEEE 754 standard is 58 pages long, the paper *What Every Computer Scientist Should Know About Floating-Point Arithmetic* has 48 pages.) +- Is easier to implement and so **supported in many more systems**. Any language or format supporting integers also supports fixed point. +- Isn't ugly and **doesn't waste values** (unlike IEEE 754 with positive and negative zero, denormalized numbers, many [NaNs](nan.md) etc.). + +## How It Works + +Fixed point uses a fixed (hence the name) number of digits (bits in binary) for the integer part and the rest for the fractional part (whereas floating point's fractional part varies in size). I.e. we split the binary representation of the number into two parts (integer and fractional) by IMAGINING a radix point at some place in the binary representation. That's basically it. Fixed point therefore spaces numbers [uniformly](uniformity.md), as opposed to floating point whose spacing of numbers is non-uniform. + +So, **we can just use an integer data type as a fixed point data type**, there is no need for libraries or special hardware support. We can also perform operations such as addition the same way as with integers. For example if we have a binary integer number represented as `00001001`, 9 in decimal, we may say we'll be considering a radix point after let's say the sixth place, i.e. we get `000010.01` which we interpret as 2.25 (2^2 + 2^(-2)). The binary value we store in a variable is the same (as the radix point is only imagined), we only INTERPRET it differently. + +We may look at it this way: we still use integers but we use them to count smaller fractions than 1. For example in a 3D game where our basic spatial unit is 1 meter our variables may rather contain the number of centimeters (however in practice we should use powers of two, so rather 1/128ths of a meter). In the example in previous paragraph we count 1/4ths (we say our **scaling factor** is 1/4), so actually the number represented as `00000100` is what in floating point we'd write as `1.0` (`00000100` is 4 and 4 * 1/4 = 1), while `00000001` means `0.25`. + +This has just one consequence: **we have to [normalize](normalize.md) results of multiplication and division** (addition and subtraction work just as with integers, we can normally use the `+` and `-` operators). I.e. when multiplying, we have to divide the result by the inverse of the fractions we're counting, i.e. by 4 in our case (1/(1/4) = 4). Similarly when dividing, we need to MULTIPLY the result by this number. This is because we are using fractions as our units and when we multiply two numbers in those units, the units multiply as well, i.e. in our case multiplying two numbers that count 1/4ths give a result that counts 1/16ths, we need to divide this by 4 to get the number of 1/4ths back again (this works the same as e.g. units in physics, multiplying number of meters by number of meters gives meters squared.) For example the following integer multiplication: + +`00001000` * `00000010` = `00010000` (8 * 2 = 16) + +in our system has to be normalized like this: + +(`000010.00` * `000000.10`) / 4 = `000001.00` (2.0 * 0.5 = 1.0) + +With this normalization we also have to **think about how to bracket expressions** to prevent rounding errors and [overflows](overflow.md), for example instead of `(x / y) * 4` we may want to write `(x * 4) / y`; imagine e.g. *x* being `00000010` (0.5) and *y* being `00000100` (1.0), the former would result in 0 (incorrect, rounding error) while the latter correctly results in 0.5. The bracketing depends on what values you expect to be in the variables so it can't really be done automatically by a compiler or library (well, it might probably be somehow handled at [runtime](runtime.md), but of course, that will be slower). + +The normalization is basically the only thing you have to think about, apart from this everything works as with integers. Remember that **this all also works with negative number in [two's complement](twos_complement.md)**, so you can use a signed integer type without any extra trouble. + +Remember to **always use a power of two scaling factor** -- this is crucial for performance. I.e. you want to count 1/2th, 1/4th, 1/8ths etc., but NOT 1/10ths, as might be tempting. Why are power of two good here? Because computers work in binary and so the normalization operations with powers of two (division and multiplication by the scaling factor) can easily be optimized by the compiler to a mere [bit shift](bit_shift.md), an operation much faster than multiplication or division. + +## Code Example + +For start let's compare basic arithmetic operations in [C](c.md) written with floating point and the same code written with fixed point. Consider the floating point code first: + +``` +float + a = 21, + b = 3.0 / 4.0, + c = -10.0 / 3.0; + +a = a * b; // multiplication +a += c; // addition +a /= b; // division +a -= 10; // subtraction +a /= 3; // division + +printf("%f\n",a); +``` + +Equivalent code with fixed point may look as follows: + +``` +#define UNIT 1024 // our "1.0" value + +int + a = 21 * UNIT, + b = (3 * UNIT) / 4, // note the brackets, (3 / 4) * UNIT would give 0 + c = (-10 * UNIT) / 3; + +a = (a * b) / UNIT; // multiplication, we have to normalize +a += c; // addition, no normalization needed +a = (a * UNIT) / b; // division, normalization needed, note the brackets +a -= 10 * UNIT; // subtraction +a /= 3; // division by a number NOT in UNITs, no normalization needed + +printf("%d.%d%d%d\n", // writing a nice printing function is left as an exercise :) + a / UNIT, + ((a * 10) / UNIT) % 10, + ((a * 100) / UNIT) % 10, + ((a * 1000) / UNIT) % 10); +``` + +These examples output `2.185185` and `2.184`, respectively. + +Now consider another example: a simple [C](c.md) program using fixed point with 10 fractional bits, computing [square roots](sqrt.md) of numbers from 0 to 10. + +``` +#include + +typedef int Fixed; + +#define UNIT_FRACTIONS 1024 // 10 fractional bits, 2^10 = 1024 + +#define INT_TO_FIXED(x) ((x) * UNIT_FRACTIONS) + +Fixed fixedSqrt(Fixed x) +{ + // stupid brute force square root + + int previousError = -1; + + for (int test = 0; test <= x; ++test) + { + int error = x - (test * test) / UNIT_FRACTIONS; + + if (error == 0) + return test; + else if (error < 0) + error *= -1; + + if (previousError > 0 && error > previousError) + return test - 1; + + previousError = error; + } + + return 0; +} + +void fixedPrint(Fixed x) +{ + printf("%d.%03d",x / UNIT_FRACTIONS, + ((x % UNIT_FRACTIONS) * 1000) / UNIT_FRACTIONS); +} + +int main(void) +{ + for (int i = 0; i <= 10; ++i) + { + printf("%d: ",i); + + fixedPrint(fixedSqrt(INT_TO_FIXED(i))); + + putchar('\n'); + } + + return 0; +} +``` + +The output is: + +``` +0: 0.000 +1: 1.000 +2: 1.414 +3: 1.732 +4: 2.000 +5: 2.236 +6: 2.449 +7: 2.645 +8: 2.828 +9: 3.000 +10: 3.162 +``` \ No newline at end of file diff --git a/float.md b/float.md new file mode 100644 index 0000000..52ddde4 --- /dev/null +++ b/float.md @@ -0,0 +1,54 @@ +# Floating Point + +Floating point arithmetic (normally just *float*) is a method of computer representation of [fractional](rational_number.md) numbers, i.e. numbers with higher than [integer](integer.md) precision (such as 5.13), which is more complex than e.g. [fixed point](fixed_point.md). The core idea of it is to use a radix point that's not fixed but can move around so as to allow representation of both very small and very big values. Nowadays floating point is the standard way of [approximating](approximation.md) [real numbers](real_number.md) in computers, basically all of the popular [programming languages](programming_language.md) have a floating point [data type](data_type.md) that adheres to the IEEE 754 standard, all personal computers also have the floating point hardware unit (FPU) and so it is widely used in all [modern](modern.md) programs. However most of the time a simpler representation of fractional numbers, such as the mentioned [fixed point](fixed_point.md), suffices, and weaker computers (e.g. [embedded](embedded.md)) may lack the hardware support so floating point operations are emulated in software and therefore slow -- for these reasons we consider floating point [bloat](bloat.md) and recommend the preference of fixed point. + +Is floating point literal evil? Well, of course not, but it is extremely overused. You may need it for precise scientific simulations, e.g. [numerical integration](numerical_integration.md), but as our [small3dlib](small3dlib.md) shows, you can comfortably do even [3D rendering](3d_rendering.md) without it. So always consider whether you REALLY need float. + +## How It Works + +Floats represent numbers by representing two main parts: the *base* -- actual encoded digits, called **mantissa** (or significand etc.) -- and the position of the radix point. The position of radix point is called the **exponent** because mathematically the floating point works similarly to the scientific notation of extreme numbers that use exponentiation. For example instead of writing 0.0000123 scientists write 123 * 10^-7 -- here 123 would be the mantissa and -7 the exponent. + +Though various numeric bases can be used, in [computers](computer.md) we normally use [base 2](binary.md), so let's consider it from now on. So our numbers will be of format: + +*mantissa * 2^exponent* + +Note that besides mantissa and exponent there may also be other parts, typically there is also a sign bit that says whether the number is positive or negative. + +Let's now consider an extremely simple floating point format based on the above. Keep in mind this is an EXTREMELY NAIVE inefficient format that wastes values. We won't consider negative numbers. We will use 6 bits for our numbers: + +- 3 leftmost bits for mantissa: This allows us to represent 2^3 = 8 base values: 0 to 7 (including both). +- 3 rightmost bits for exponent: We will encode exponent in [two's complement](twos_complement.md) so that it can represent values from -4 to 3 (including both). + +So for example the binary representation `110011` stores mantissa `110` (6) and exponent `011` (3), so the number it represents is 6 * 2^3 = 48. Similarly `001101` represents 1 * 2^-3 = 1/8 = 0.125. + +Note a few things: firstly our format is [shit](shit.md) because some numbers have multiple representations, e.g. 0 can be represented as `000000`, `000001`, `000010`, `000011` etc., in fact we have 8 zeros! That's unforgivable and formats used in practice address this (usually by prepending an implicit 1 to mantissa). + +Secondly notice the non-uniform distribution of our numbers: while we have a nice resolution close to 0 (we can represent 1/16, 2/16, 3/16, ...) but low resolution in higher numbers (the highest number we can represent is 56 but the second highest is 48, we can NOT represent e.g. 50 exactly). Realize that obviously with 6 bits we can still represent only 64 numbers at most! So float is NOT a magical way to get more numbers, with integers on 6 bits we can represent numbers from 0 to 63 spaced exactly by 1 and with our floating point we can represent numbers spaced as close as 1/16th but only in the region near 0, we pay the price of having big gaps in higher numbers. + +Also notice that thing like simple addition of numbers become more difficult and time consuming, you have to include conversions and [rounding](rounding.md) -- while with fixed point addition is a single machine instruction, same as integer addition, here with software implementation we might end up with dozens of instructions (specialized hardware can perform addition fast but still, not all computer have that hardware). + +Rounding errors will appear and accumulate during computations: imagine the operation 48 + 1/8. Both numbers can be represented in our system but not the result (48.125). We have to round the result and end up with 48 again. Imagine you perform 64 such additions in succession (e.g. in a loop): mathematically the result should be 48 + 64 * 1/8 = 56, which is a result we can represent in our system, but we will nevertheless get the wrong result (48) due to rounding errors in each addition. So the behavior of float can be **non intuitive** and dangerous, at least for those who don't know how it works. + +## Standard Float Format: IEEE 754 + +IEEE 754 is THE standard that basically all computers use for floating point nowadays -- it specifies the exact representation of floating point numbers as well as rounding rules, required operations applications should implement etc. However note that the standard is **kind of [shitty](shit.md)** -- even if we want to use floating point numbers there exist better ways such as **[posits](posit.md)** that outperform this standard. Nevertheless IEEE 754 has been established in the industry to the point that it's unlikely to go anytime soon. So it's good to know how it works. + +Numbers in this standard are signed, have positive and negative zero (oops), can represent plus and minus [infinity](infinity.md) and different [NaNs](nan.md) (not a number). In fact there are thousands to billions of different NaNs which are basically wasted values. These inefficiencies are addressed by the mentioned [posits](posit.md). + +Briefly the representation is following (hold on to your chair): leftmost bit is the sign bit, then exponent follows (the number of bits depends on the specific format), the rest of bits is mantissa. In mantissa implicit `1.` is considered (except when exponent is all 0s), i.e. we "imagine" `1.` in front of the mantissa bits but this 1 is not physically stored. Exponent is in so called biased format, i.e. we have to subtract half (rounded down) of the maximum possible value to get the real value (e.g. if we have 8 bits for exponent and the directly stored value is 120, we have to subtract 255 / 2 = 127 to get the real exponent value, in this case we get -7). However two values of exponent have special meaning; all 0s signify so called denormalized (also subnormal) number in which we consider exponent to be that which is otherwise lowest possible (e.g. -126 in case of 8 bit exponent) but we do NOT consider the implicit 1 in front of mantissa (we instead consider `0.`), i.e. this allows storing [zero](zero.md) (positive and negative) and very small numbers. All 1s in exponent signify either [infinity](infinity.md) (positive and negative) in case mantissa is all 0s, or a [NaN](nan.md) otherwise -- considering here we have the whole mantissa plus sign bit unused, we actually have many different NaNs ([WTF](wtf.mf)), but usually we only distinguish two kinds of NaNs: quiet (qNaN) and signaling (sNaN, throws and [exception](exception.md)) that are distinguished by the leftmost bit in mantissa (1 for qNaN, 0 for sNaN). + +The standard specifies many formats that are either binary or decimal and use various numbers of bits. The most relevant ones are the following: + +| name |M bits|E bits| smallest and biggest number | precision <= 1 up to | +| --------------------------------- | ---- | ---- | --------------------------------------- | -------------------- | +|binary16 (half precision) | 10 | 5 |2^(-24), 65504 | 2048 | +|binary32 (single precision, float) | 23 | 8 |2^(-149), 2127 * (2 - 2^-23) ~= 3 * 10^38| 16777216 | +|binary64 (double precision, double)| 52 | 11 |2^(-1074), ~10^308 | 9007199254740992 | +|binary128 (quadruple precision) | 112 | 15 |2^(-16494), ~10^4932 | ~10^34 | + +**Example?** Let's say we have float (binary34) value `11000000111100000000000000000000`: first bit (sign) is 1 so the number is negative. Then we have 8 bits of exponent: `10000001` (129) which converted from the biased format (subtracting 127) gives exponent value of 2. Then mantissa bits follow: `11100000000000000000000`. As we're dealing with a normal number (exponent bits are neither all 1s nor all 0s), we have to imagine the implicit `1.` in front of mantissa, i.e. our actual mantissa is `1.11100000000000000000000` = 1.875. The final number is therefore -1 * 1.875 * 2^2 = -7.5. + +## See Also + +- [posit](posit.md) +- [fixed point](fixed_point.md) \ No newline at end of file diff --git a/floss.md b/floss.md new file mode 100644 index 0000000..f9191b7 --- /dev/null +++ b/floss.md @@ -0,0 +1,3 @@ +# FLOSS + +FLOSS ([free](free_software.md) [libre](libre.md) and [open source](open_source.md)) is basically [FOSS](foss.md). \ No newline at end of file diff --git a/fork.md b/fork.md new file mode 100644 index 0000000..d399e74 --- /dev/null +++ b/fork.md @@ -0,0 +1,13 @@ +# Fork + +Fork is a branch that splits from the main branch of a project and continues to develop in a different direction as a separate version of that project, possibly becoming a completely new one. This may happen with any "intellectual work" or idea such as [software](software.md), movement, theory, literary universe or, for example, [database](database.md). Forks may later be *merged* back into the original project or continue and diverge far away, forks of different projects may also combine into a single project as well. + +For example the [Android](android.md) [operating system](os.md) and [Linux-libre](linux_libre.md) [kernel](kernel.md) have both been forked from [Linux](linux.md). [Linux distributions](distro.md) highly utilize forking, e.g. [Devuan](devuan.md) or [Ubuntu](ubuntu.md) and [Mint](mint.md) are forked from [Debian](debian.md). [Free software movement](free_software.md) was forked into [open source](open_source.md), [free culture](free_culture.md) and [suckless](suckless.md), and suckless was more or less forked into [LRS](lrs.md). [Wikipedia](wikipedia.md) also has forks such as [Metapedia](metapedia.md). [Memes](meme.md) evolve a lot on the basis of forking. + +Forking takes advantage of the ability to freely duplicate [information](information.md), i.e. if someone sees how to improve an intellectual work or use it in a novel way, he may simply copy it and start developing it in a new diverging direction while the original continues to exist and going its own way. That is **unless copying and modification of information is artificially prevented**, e.g. by [intellectual property](intellectual_property.md) laws or purposeful obscurity standing in the way of remixing. For this reason forking is very popular in [free culture](free_culture.md) and [free software](free_software.md) where it is allowed both legally and practically -- in fact it plays a very important role there. + +In software development temporary forking is used for implementing individual features which, when completed, are merged back into the main branch. This is called **[branching](branch.md)** and is supported by [version control systems](vcs.md) such as [git](git.md). + +**Is forking good?** Yes, to create anything new it is basically necessary to build on top of someone else's work, stand on someone else's shoulders. Some people criticize too much forking; for example some cry about [Linux](linux.md) [distro](distro.md) fragmentation, they say there are too many of them and that people should rather focus their energy on creating a single or at least fewer good operating system. [LRS](lrs.md) supports any kind of wild forking and experimentation, we believe the exploration of many directions to be necessary in order to find the right one. + +In fact we think forking should be incorporated on a much more basic level, in the way that the [suckless](suckless.md) community popularized. In suckless **everyone's copy of software is a personal fork**, i.e. software is distributed in source form and is so extremely easy to compile and modify that every user is supposed to do this as part of the installation process (even if he isn't a programmer). Before compilation user applies his own selected patches, custom changes and specific configuration (which is done in the source code itself) that are unique to that user and which form source code that is the user's personal fork. Some of these personal forks may even become popular and copied by other users, leading to further development of these forks and possible natural rise of very different software. This should lead to natural selection, survival and development of the good and useful forks. \ No newline at end of file diff --git a/formal_language.md b/formal_language.md new file mode 100644 index 0000000..9a6b122 --- /dev/null +++ b/formal_language.md @@ -0,0 +1,23 @@ +# Formal Language + +The field of formal languages tries to [mathematically](math.md) and rigorously describe and examine anything that can be viewed as a language, which probably includes most structures we can think of, from human languages and computer languages to visual patterns and other highly abstract structures. Formal languages are at the root of theoretical computer science and are important e.g. for [computability](computability.md)/decidability, computational complexity, [security](security.md) and [compilers](compiler.md), but they also find use in linguistics and other fields of [science](science.md). + +A **formal language** is defined as a (potentially infinite) set of strings over some alphabet (which is finite). I.e. a language is a subset of E* where E is a finite alphabet (a set of *letters*). (* is a *Kleene Star* and signifies a set of all possible strings over E). The string belonging to a language may be referred to as a *word* or perhaps even *sentence*, but this word/sentence is actually a whole kind of *text* written in the language, if we think of it in terms of our natural languages. + +**For example**, given an alphabet [a,b,c], a possible formal language over it is [a,ab,bc,c]. Another, different possible language over this alphabet is an infinite language [b,ab,aab,aaab,aaaab,...] which we can also write with a [regular expression](regex.md) as a*b. We can also see e.g. English as being a formal language equivalent to a set of all texts over the English alphabet (along with symbols like space, dot, comma etc.) that we would consider to be in English as we speak it. + +**What is this all good for?** This mathematical formalization allows us to classify languages and understand their structure, which is necessary e.g. for creating efficient compilers, but also to understand computers as such, their power and limits, as computers can be viewed as machines for processing formal languages. With these tools researches are able to come up with [proofs](proof.md) of different properties of languages, which we can exploit. For example, within formal languages, it has been proven that certain languages are uncomputable, i.e. there are some problems which a computer cannot ever solve (typical example is the [halting problem](halting_problem.md)) and so we don't have to waste time on trying to create such algorithms as we will never find any. The knowledge of formal languages can also guide us in designing computer languages: e.g. we know that regular languages are extremely simple to implement and so, if we can, we should prefer our languages to be regular. + +## Classification + +We usually classify formal languages according to the **[Chomsky](chomsky.md) hierarchy**, by their computational "difficulty". Each level of the hierarchy has associated models of computation ([grammars](grammar.md), [automatons](automaton.md), ...) that are able to compute **all** languages of that level (remember that a level of the hierarchy is a superset of the levels below it and so also includes all the "simpler" languages). The hierarchy is more or less as follows: + +- **all languages**: This includes all possible languages, even those that computers cannot analyze (e.g. the language representing the [halting problem](halting_problem.md)). These languages can only be computed by theoretical computers that cannot physically exist in our universe. +- **type 0**, **recursively enumerable languages**: Most "difficult"/general languages that computers in our universe can analyze. These languages can be computed e.g. by a **[Turing machine](turing_machine.md)**, [lambda calculus](lambda_calculus.md) or a general unrestricted [grammar](grammar.md). Example language: all strings encoding a [Game of Life](game_of_life.md) run which ends in finite time. { At least I think :) ~drummyfish } +- **type 1**, **context sensitive languages**: Computed e.g. by a linearly bounded non-deterministic Turing machine or a context sensitive grammars. Example language: a^(n)b^(n)c^(n), n >= 0 (strings of *n* *a*s, followed by *n* *b*s, followed by *n* *c*s). +- **type 2**, **context free languages**: Computed by e.g. non-deterministic pushdown automata or context free grammars. (Deterministic pushdown automata compute a class of languages that is between type 2 and type 3). +- **type 3**, **regular languages**: The *easiest*, *weakest* kind of languages, computed e.g. by [finite state automata](finite_state_automaton.md)s or [regular expressions](regexp.md). This class includes also all finite languages. + +Note that here we are basically always examining **infinite languages** as finite languages are trivial. If a language is finite (i.e. the set of all strings of the language is finite), it can automatically be computed by any type 3 computational model. In [real life](irl.md) computers are actually always equivalent to a finite state automaton, i.e. the *weakest* computational type (because a computer memory is always finite and so there is always a finite number of states a computer can be in). However this doesn't mean there is no point in studying infinite languages, of course, as we're still interested in the structure, computational methods and approximating the infinite models of computation. + +**NOTE**: When trying to classify a [programming language](programming_language.md), we have to be careful about what we classify: one things is what a program written in given language can compute, and another thing is the language's [syntax](syntax.md). To the former all strict general-purpose programming languages such as [C](c.md) or [JavaScript](javascript.md) are type 0 ([Turing complete](turing_complete.md)). From the syntax point of view it's a bit more complicated and we need to further define what exactly a syntax is (where is the line between syntax and semantic errors): it may be (and often is) that syntactically the class will be lower. There is actually a famous [meme](meme.md) about [Perl](perl.md) syntax being undecidable. \ No newline at end of file diff --git a/forth.md b/forth.md new file mode 100644 index 0000000..1308a5e --- /dev/null +++ b/forth.md @@ -0,0 +1,96 @@ +# Forth + +Forth is a based [minimalist](minimalism.md) stack-based untyped programming language with [postfix](notation.md) (reverse Polish) notation. + +{ It's kinda like usable [brainfuck](brainfuck.md). ~drummyfish } + +It is usually presented as [interpreted](interpreter.md) language but may as well be [compiled](compiler.md), in fact it maps pretty nicely to [assembly](assembly.md). + +There are several Forth standard, most notably ANSI Forth from 1994. + +A free interpreter is e.g. GNU Forth ([gforth](gforth.md)). + +## Language + +The language is case-insensitive. + +The language operates on an evaluation **stack**: e.g. the operation + takes the two values at the top of the stack, adds them together and pushed the result back to the stack. Besides this there are also some "advanced" features like variables living outside the stack, if you want to use them. + +The stack is composed of **cells**: the size and internal representation of the cell is implementation defined. There are no data types, or rather everything is just of type signed int. + +Basic abstraction of Forth is so called **word**: a word is simply a string without spaces like `abc` or `1mm#3`. A word represents some operation on stack (and possible other effect such as printing to the console), for example the word `1` adds the number 1 on top of the stack, the word `+` performs the addition on top of the stack etc. The programmer can define his own words which can be seen as "functions" or rather procedures or macros (words don't return anything or take any arguments, they all just invoke some operations on the stack). A word is defined like this: + +``` +: myword operation1 operation2 ... ; +``` + +For example a word that computes and average of the two values on top of the stack can be defined as: + +``` +: average + 2 / ; +``` + +Built-in words include: + +``` +GENERAL: + ++ add a b -> (a + b) +- subtract a b -> (b - a) +* multiply a b -> (a * b) +/ divide a b -> (b / a) += equals a b -> (-1 if a = b else 0) +< less than a b -> (-1 if a < b else 0) +> greater than a b -> (-1 if a > b else 0) +mod modulo a b -> (b % a) +dup duplicate a -> a a +drop pop stack top a -> +swap swap items a b -> b a +rot rotate 3 a b c -> b c a +. print top & pop +key read char on top +.s print stack +emit print char & pop +cr print newline +cells times cell width a -> (a * cell width in bytes) +depth pop all & get d. a ... -> (previous stack size) +bye quit + +VARIABLES/CONSTS: + +variable X creates var named X (X is a word that pushed its addr) +N X ! stores value N to variable X +N X +! adds value N to variable X +X @ pushes value of variable X to stack +N constant C creates constant C with value N +C pushes the value of constant C + +SPECIAL: + +( ) comment (inline) +\ comment (until newline) +." S " print string S +X if C then if X, execute C // only in word def. +X if C1 else C2 then if X, execute C1 else C2 // only in word def. +do C loop loops from stack top value to stack second from, + top, special word "i" will hold the iteration val. +begin C until like do/loop but keeps looping as long as top = 0 +begin C while like begin/until but loops as long as top != 0 +allot allocates memory, can be used for arrays + +``` + +example programs: + +``` +100 1 2 + 7 * / . \ computes and prints 100 / ((1 + 2) * 7) +``` + +``` +cr ." hey bitch " cr \ prints: hey bitch +``` + +``` +: myloop 5 0 do i . loop ; myloop \ prints 0 1 2 3 4 +``` + diff --git a/foss.md b/foss.md new file mode 100644 index 0000000..c6c72bf --- /dev/null +++ b/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. \ No newline at end of file diff --git a/fqa.md b/fqa.md new file mode 100644 index 0000000..7250723 --- /dev/null +++ b/fqa.md @@ -0,0 +1,3 @@ +# Frequently Questioned Answers + +TODO: figure out what to write here \ No newline at end of file diff --git a/fractal.md b/fractal.md new file mode 100644 index 0000000..32af3fe --- /dev/null +++ b/fractal.md @@ -0,0 +1,59 @@ +# Fractal + +Informally speaking fractal is a shape that's geometrically "infinitely complex" while being described in an extremely simple way, e.g. with a very simple formula. Shapes found in the nature, such as trees, mountains or clouds, are often fractals. Fractals show self-similarity, i.e. when "zooming" into an ideal fractal we keep seeing it is composed, down to an infinitely small scale, of shapes that are similar to the shape of the whole fractal; e.g. the branches of a tree look like smaller versions of the whole tree etc. + +Fractals are the beauty of mathematics, they can impress even complete non-mathematicians and so are probably good as a motivational example in [math](math.md) education. + +Fractal is formed by [iteratively](iteration.md) or [recursively](recursion.md) (repeatedly) applying its defining rule -- once we repeat the rule infinitely many times, we've got a perfect fractal. [In the real world](irl.md), of course, both in nature and in computing, the rule is just repeat many times as we can't repeat literally infinitely. The following is an example of how iteration of a rule creates a simple tree fractal; the rule being: *from each branch grow two smaller branches*. + +``` + V V V V + \ / \ / V \ / \ / V + | | _| | | |_ >_| | | |_< + '-.| |.-' '-.| |.-' '-.| |.-' + \ / \ / \ / \ / + \ / \ / \ / \ / + | | | | + | | | | + | | | | + +iteration 0 iteration 1 iteration 2 iteration 3 +``` + +Mathematically fractal is a shape whose [Hausdorff dimension](hausdorff_dimension.md) (the "scaling factor of the shape's mass") is non-integer. For example the [Sierpinski triangle](sierpinski_triangle.md) can normally be seen as a 1D or 2D shape, but its Hausdorff dimension is approx. 1.585 as if we scale it down twice, it decreases its "weight" three times (it becomes one of the three parts it is composed of); Hausdorff dimension is then calculated as log(3)/log(2) ~= 1.585. + +[L-systems](l_system.md) are one possible way of creating fractals. They describe rules in form of a [formal grammar](grammar.md) which is used to generate a string of symbols that are subsequently interpreted as drawing commands (e.g. with [turtle graphics](turtle_graphics.md)) that render the fractal. The above shown tree can be described by an L-system. Among similar famous fractals are the [Koch snowflake](koch_snowflake.md) and [Sierpinski Triangle](sierpinski_triangle.md). + + +``` + /\ + /\/\ + /\ /\ + /\/\/\/\ + /\ /\ + /\/\ /\/\ + /\ /\ /\ /\ + /\/\/\/\/\/\/\/\ + + Sierpinski Triangle +``` + +Fractals don't have to be [deterministic](determinism.md), sometimes there can be [randomness](random.md) in the rules which will make the shape be not perfectly self-similar (e.g. in the above shown tree fractal we might modify the rule to *from each branch grow 2 or 3 new branches*). + +Another way of describing fractals is by iterative mathematical formulas that work with points in [space](space.md). One of the most famous fractals formed this way is the **[Mandelbrot set](mandelbrot.md)**. It is the set of [complex numbers](complex_number.md) *c* such that the series *z\_next = (z\_previous)^2 + c*, *z0 = 0* does not [diverge](divergence.md) to [infinity](infinity.md). Mendelbrot set can nicely be rendered by assigning each iteration's result a different color; this produces a nice colorful fractal. [Julia sets](julia_set.md) are very similar and there is infinitely many of them (each Julia set is formed like the Mandelbrot set but *c* is fixed for the specific set and *z0* is the tested point in the complex plain). + +Fractals can of course also exist in 3 and more dimensions so we can have also have animated 3D fractals etc. + +## Fractals In Tech + +[Computers](computer.md) are good for exploring and rendering fractals as they can repeat given rule millions of times in a very short time. Programming fractals is quite easy thanks to their simple rules, yet this can highly impress noobs. + +3D fractals can be rendered with [ray marching](ray_marching.md) and so called *distance estimation*. This works similarly to classic [ray tracing](ray_tracing.md) but the rays are traced iteratively: we step along the ray and at each step use an estimate of the current point to the surface of the fractal; once we are "close enough" (below some specified threshold), we declare a hit and proceed as in normal ray tracing (we can render shadows, apply materials etc.). The distance estimate is done by some clever math. + +[Mandelbulber](mandelbulber.md) is a [free](free_software.md), advanced software for exploring and rendering 3D fractals using the mentioned method. + +[Marble Racer](marble_racer.md) is a [FOSS](foss.md) [game](game.md) in which the player races a glass ball through levels that are animated 3D fractals. It also uses the distance estimation method implemented as a [GPU](gpu.md) [shader](shader.md) and runs in real-time. + +Fractals are also immensely useful in [procedural generation](procgen.md), they can help generate complex art much faster than human artists, and such art can only take a very small amount of storage. + +There also exist such things as fractal antennas and fractal transistors. \ No newline at end of file diff --git a/frameless.md b/frameless.md new file mode 100644 index 0000000..8f05874 --- /dev/null +++ b/frameless.md @@ -0,0 +1,11 @@ +# Frameless Rendering + +Frameless rendering is a technique of [rendering](rendering.md) animation by continuously updating an image on the screen by updating single "randomly" selected pixels rather than by showing a quick sequence of discrete frames. This is an alternative to the mainstream [double buffered](double_buffering.md) frame-based rendering traditionally used nowadays. + +Typically this is done with [image order](image_order.md) rendering methods, i.e. methods that can immediately and independently compute the final color of any pixel on the screen -- for example with [raytracing](raytracing.md). + +The main advantage of frameless rendering is of course saving a huge amount of memory usually needed for double buffering, and usually also increased performance (fewer pixels are processed per second). The animation may also seem more smooth and responsive -- reaction to input is seen faster. Another advantage, and possibly a disadvantage as well, is a **[motion blur](motion_blur.md)** effect that arises as a side effect of updating by individual pixels spread over the screen: some pixels show the scene at a newer time than others, so the previous images kind of blend with the newer ones. This may add realism and also prevent temporal [aliasing](aliasing.md), but blur may sometimes be undesirable, and also the kind of blur we get is "pixelated" and noisy. + +Selecting the pixels to update can be done in many ways, usually with some [pseudorandom](pseudorandom.md) selection ([jittered sampling](jittered_sampling.md), [Halton sequence](halton_sequence.md), Poisson Disk sampling, ...), but regular patterns may also be used. There have been papers that implemented adaptive frameless rendering that detected where it is best to update pixels to achieve low noise. + +Historically similar (though different) techniques were used on computers that didn't have enough memory for a double buffer or redrawing the whole screen each frame was too intensive on the CPU; programmers had to identify which pixels had to be redrawn and only update those. This resulted in techniques like *adaptive tile refresh* used in scrolling games such as [Commander Keen](commander_keen.md). \ No newline at end of file diff --git a/framework.md b/framework.md new file mode 100644 index 0000000..6a69e04 --- /dev/null +++ b/framework.md @@ -0,0 +1,3 @@ +# Framework + +Software framework is a collection of tools such as [environments](environment.md), [libraries](library.md), [compilers](compiler.md) and [editors](editor.md), that together allow fast and comfortable implementation of other software by plugging in relatively small pieces of code. While a simple [library](library.md) is something that's plugged as a helper into programmer's code, framework is a bigger system into which programmer plugs his code. Frameworks are generally [bloated](bloat.md) and harmful, [LRS](lrs.md) doesn't recommend relying on them. \ No newline at end of file diff --git a/free.md b/free.md new file mode 100644 index 0000000..c5b99b1 --- /dev/null +++ b/free.md @@ -0,0 +1,3 @@ +# Free + +In our community, as well as in the wider tech and some non-tech communities, the word free is normally used in the sense of [free as in freedom](free_software.md), i.e. implying freedom, not price. The word for "free of cost" is [gratis](gratis.md) (also *free as in beer*). To prevent this confusion the word *[libre](libre.md)* is sometimes used in place of *free*, or we say *free as in freedom*, *free as in speech* etc. \ No newline at end of file diff --git a/free_culture.md b/free_culture.md new file mode 100644 index 0000000..fdf29ee --- /dev/null +++ b/free_culture.md @@ -0,0 +1,30 @@ +# Free Culture + +*Information wants to be free.* + +Free (as in freedom) culture is a movement aiming for the relaxation of [intellectual property](intellectual_property.md) restrictions, mainly that of [copyright](copyright.md), to allow free usage, reusing and sharing of [artworks](art.md) and other kind of [information](information.md). Free culture argues that our society has gone too far in forcefully restricting the natural freedom of information by very strict laws (e.g. by authors holding copyright even 100 years after their death) and that we're hurting art, creativity, education and progress by continuing to strengthen restrictions on using, modifying ([remixing](remix.md)) and sharing things like [books](book.md), [music](music.md) and scientific papers. The word "free" in free culture refers to freedom, not just price -- free cultural works have to be more than just available gratis, they must also give its users some specific legal rights. Nevertheless free culture itself isn't against commercialization of art, it just argues for rather doing so by other means than selling legal rights to it. The opposite of free culture is [permission culture](permission_culture.md) (culture requiring permission for reuse of intellectual works). + +The promoters of free culture want to relax intellectual property laws ([copyright](copyright.md), [patents](patent.md), [trademarks](tm.md) etc.) but also promote an ethic of sharing and remixing being good (as opposed to the demonizing anti-"[piracy](piracy.md)" propaganda of today), they sometimes mark their works with words **"some rights reserved"** or even "no rights reserved", as opposed to the traditional "all rights reserved". + +Free culture is kind of a younger sister movement to the **[free software](free_software.md)** movement, in fact it has been inspired by it (we could call it its [fork](fork.md)). While free software movement, established in 1983, was only concerned with freedoms relating to computer program source code, free culture later (around 2000) took its ideas and extended them to all information including e.g. artworks and scientific data. There are **clearly defined criteria** for a work to be considered free (as in freedom) work, i.e. part of the body of free cultural works. The criteria are very similar to those of free software (the definition is at https://freedomdefined.org/Definition) and can be summed up as follows: + +A free cultural work must allow anyone to (legally and practically): + +1. **Use it** in any way and for any purpose, even commercially. +2. **Study it**. +3. **Share it**, i.e. redistribute copies, even commercially. +4. **Modify it** and redistribute the modified copies, even commercially. + +Some of these conditions may e.g. further require a source code of the work to be made available (e.g. sheet music, to allow studying and modification). Some conditions may however still be imposed, as long as they don't violate the above -- e.g. if a work allows all the above but requires crediting the author, it is still considered free (as in freedom). [Copyleft](copyleft.md) (also share-alike, requirement of keeping the license for derivative works) is another condition that may be required. This means that many (probably most) free culture promoters actually rely and even support the concept of e.g. copyright, they just want to make it much less strict. + +It was in 2001 when **[Lawrence Lessig](lessig.md)**, an American lawyer who can be seen as the movement's founder, created the **[Creative Commons](creative_commons.md)**, a non-profit organization which stands among the foundations of the movement and is very much connected to it. By this time he was already educating people about the twisted intellectual property laws and had a few followers. Creative Commons would create and publish a set of [licenses](license.md) that anyone could use to release their works under much less restrictive conditions than those that lawfully arise by default. For example if someone creates a song and releases it under the [CC-BY](cc_by.md) license, he allows anyone to freely use, modify and share the song as long as proper attribution is given to him. It has to be noted that **NOT all Creative Commons licenses are free culture** (those with NC and ND conditions break the above given rules)! It is also possible to use other, non Creative Commons licenses in free culture, as long as the above given criteria are respected. + +In 2004 Lessig published his **book** called Free Culture that summarized the topic as well as proposed solutions -- the book itself is shared under a Creative Commons license and can be downloaded for free (however the license is among the non-free CC licenses so the book itself is not part of free culture [lmao](lmao.md), big fail by Lessig). + +{ I'd recommend reading the Free Culture book to anyone whose interests lie close to free culture/software, it's definitely one of the essential works. ~drummyfish } + +In the book Lessig gives an overview of the history of copyright -- it has been around since about the time of invention of [printing press](printing_press.md) to give some publishers exclusive rights (an artificial [monopoly](monopoly.md)) for printing and publishing certain books. The laws evolved but at first were not so restrictive, they only applied to very specific uses (printing) and for limited time, plus the copyright had to be registered. Over time corporations pressured to make it more and more restrictive -- nowadays copyright applies to basically everything and lasts for 70 years AFTER the death of the author (!!!). This is combined with the fact that in the age of computers any use of information requires making a copy (to read something you need to download it), i.e. copyright basically applies to ANY use now. I.e. both scope and term of copyright have been extended to the extreme, and this was done even AGAINST the US constitution -- Lessig himself tried to fight against it in court but lost. This form of copyright now restricts culture and basically only serves corporations who want to e.g. **kill the [public domain](public_domain.md)** (works that run out of copyright and are now "free for everyone") by repeatedly prolonging the copyright term so that people don't have any pool of free works that would compete (and often win simply by being gratis) with the corporate created "content". In the books Lessig also mentions many hard punishments for breaking copyright laws and a lot of other examples of corruption of the system. He then goes on to propose solutions, mainly his Creative Commons licenses. + +Free culture has become a relative success, the free Creative Commons licenses are now widely used -- e.g. **[Wikipedia](wikipedia.md) is part of free** culture under the [CC-BY-SA](cc_by_sa.md) license and its sister project [Wikimedia Commons](wm_commons.md) hosts over 80 million free cultural works! There are famous promoters of free culture such as [Nina Paley](nina_paley.md), webcomics, books, songs etc. In development of libre [games](game.md) free cultural licenses are used (alongside free software licenses) to liberate the game assets -- e.g. the [Freedoom](freedoom.md) project creates free culture content replacement for the game [Doom](doom.md). There are whole communities such as [opengameart](oga.md) or Blendswap for sharing free art, even sites with completely public domain stock photos, vector images, music and many other things. Many scientists release their data to public domain under [CC0](cc0.md). And of course, [LRS](lrs.md) highly advocated free culture, specifically [public domain](public_domain.md) under [CC0](cc0.md). + +**BEWARE of fake free culture**: there are many resources that look like or even call themselves "free culture" despite not adhering to its rules. This may be by intention or not, some people just don't know too much about the topic -- a common mistake is to think that all Creative Commons licenses are free culture -- again, this is NOT the case (the NC and ND ones are not). Some think that "free" just means "gratis" -- this is not the case (free means freedom, i.e. respecting the above mentioned criteria of free cultural works). Many people don't know the rules of copyright and think that they can e.g. create a remix of some non-free pop song and license it under CC-BY-SA -- they CANNOT, they are making a derivative work of a non-free work and so cannot license it. Some people use licenses without knowing what they mean, e.g. many use CC0 and then ask for their work to not be used commercially -- this can't be done, CC0 specifically allows any commercial use. Some try to make their own "licenses" by e.g. stating "do whatever you want with my work" instead of using a proper waiver like CC0 -- this is with high probability legally unsafe and invalid, it is unfortunately not so easy to waive one's copyright -- DO use the existing licenses. Educate yourself and if you're unsure, ask away in the community, people are glad to give advice. \ No newline at end of file diff --git a/free_software.md b/free_software.md new file mode 100644 index 0000000..7ad30a3 --- /dev/null +++ b/free_software.md @@ -0,0 +1,33 @@ +# Free Software + +Free (as in freedom) software is a type of [software](software.md) that's respecting its users' freedom, generally by availability of its source code and by a [license](license.md) that allows anyone to use, study, modify and share the software. It stands opposed to the [proprietary software](proprietary_software.md). Free software is not to be confused with [freeware](freeware.md) ("gratis", software available for free); although free software is always available for free thanks to its definition, zero price is not its goal. The goal is freedom. + +Free software is also known as *free as in freedom* or *free as in speech* software. It is sometimes equated with [open source](open_source.md), even though open source is fundamentally different, or neutrally labelled FOSS (free and open-source software). Software that is gratis is sometimes called *free as in beer*. + +[Richard Stallman](rms.md), the inventor of the concept and the term "free software", says free software is about ensuring the freedom of computer users, i.e. people truly owning their tools -- he points out that unless people have complete control over their tools, they don't truly own them and will instead become controlled and abused by the makers (true owners) of those tools, which in [capitalism](capitalism.md) are [corporations](corporation.md). Richard Stallman stressed that **there is no such thing as partially free software** -- it takes only a single line of code to take away the user's freedom and therefore if software is to be free, it has to be free as a whole. This is in direct contrast with [open source](open_source.md) which happily tolerates for example [Windows](windows.md) only programs and accepts them as "open source", even though such a program cannot be run without the underlying proprietary code of the platform. + +**Is free software [communism](communism.md)?** This is a question often debated by [Americans](usa.md) who have a panic phobia of anything resembling ideas of sharing and giving away for free. The answer is: yes and no. No as in it's not [Marxism](marxism.md), the kind of [evil](evil.md) pseudocommunism that plagued Europe not a long time long ago -- that was a hugely complex, twisted violent ideology encompassing whole society which furthermore betrayed many basic ideas of equality and so on. Compared to this free software is just a simple idea of not applying intellectual property to software, and this idea may well function under some form of early capitalism. But on the other hand yes, free software is communism in its general form that simply states that sharing is good, it is communism as much e.g. charity or teaching a kid to share toys with its siblings. + +# Definition + +Free software was originally defined by [Richard Stallman](rms.md) for his [GNU](gnu.md) project. The definition was subsequently adopted and adjusted by other groups such as [Debian](debian.md) and so nowadays there isn't just one definition, even though the GNU definition is usually implicitly supposed. However, all of these definition are very similar and are basically variations and subsets of the original one. The GNU definition of free software is paraphrased as follows: + +Software is considered free if all its users have the rights to: + +0. Use the software for any purpose. +1. Study the software. For this source code of the program has to be available. +2. Share the software with anyone. +3. Modify the software. This modified version can also be shared with anyone. + +Note that as free software cares about real freedom, the word "right" here is seen as meaning a [de facto](de_facto.md) right, i.e. NOT just a legal right -- legal rights (a free [license](license.md)) are required but if there appears a non-legal obstacle to those freedoms, free software communities will address them. Again, open source differs here by just focusing on legality. + +The developers of Debian operating system have created their own guidelines (Debian Free Software Guidelines) which respect these points but are worded in more complex terms and further require e.g. non-functional data to be available under free terms as well ([source](https://people.debian.org/~bap/dfsg-faq.html#not_just_code)) which GNU doesn't ([source](https://www.gnu.org/distros/free-system-distribution-guidelines.en.html#non-functional-data)). The definition of open source is yet more complex even though in practice legally free software is eventually also open source and vice versa. + +# History + +Free software was invented by the great [Richard Stallman](rms.md) in the 1980s. His free software movement inspired later movements such as the [free culture](free_culture.md) movement and the evil [open-source](open_source.md) movement. + +# See Also + +- [open source](open_source.md) +- [free culture](free_culture.md) diff --git a/free_speech.md b/free_speech.md new file mode 100644 index 0000000..a7e72de --- /dev/null +++ b/free_speech.md @@ -0,0 +1,5 @@ +# Free Speech + +Freedom of speech means there are no arbitrary punishments, imposed by government or anyone else, solely for talking about anything, making any public statement or publication of any information. Freedom of speech is an essential attribute of a mature society, sadly it hasn't been fully implemented yet and the latest trend in society seems to be towards less free speech rather than more. + +Some idiots (like that [xkcd](xkcd.md) #1357) say that free speech is only about legality, i.e. about what's merely allowed to be said by the law. **This is wrong**, true free speech mustn't be limited by anything -- if you're not allowed to say something, it doesn't matter too much what it is that's preventing you, your speech is not free. If for example it is theoretically legal to be politically incorrect and criticize the LGBT gospel but you [de-facto](de_facto.md) can't do it because the LGBT fascist [SJWs](sjw.md) would [cancel](cancel_culture.md) you and maybe even physically lynch you, your speech is not free. \ No newline at end of file diff --git a/fsf.md b/fsf.md new file mode 100644 index 0000000..98bd98c --- /dev/null +++ b/fsf.md @@ -0,0 +1,11 @@ +# FSF + +FSF stands for Free Software Foundation, a non-profit organization established by [Richard Stallman](rms.md) with the goal of promoting and supporting [free as in freedom software](free_software.md), software that respects its users' freedom. + +## History + +TODO + +In September 2019 Richard Stallman, the founder and president of the FSF, was cyberbullied and [cancelled](cancel_culture.md) by SJW fascists for simply stating a rational but unpopular opinion on child sexuality and was forced to resign as a president. This might have been the last nail in the coffin for the FSF. The new president would come to be [Geoffrey Knauth](geoffrey_knauth.md), an idiot who spent his life writing [proprietary](proprietary.md) software in such shit as [C#](c_sharp.md) and helped built military software for killing people (just read his cv online). What's next, a porn actor becoming the next Pope? Would be less surprising. + +After this the FSF definitely died. \ No newline at end of file diff --git a/fun.md b/fun.md new file mode 100644 index 0000000..85e008c --- /dev/null +++ b/fun.md @@ -0,0 +1,19 @@ +# Fun + +*See also [lmao](lmao.md).* + +Fun is a rewarding lighthearted satisfying feeling you get as a result of doing or witnessing something playful. + +## Things That Are Fun + +- [programming](programming.md) +- [games](game.md) such as [chess](chess.md) +- [jokes](jokes.md) +- [open consoles](open_console.md) +- [obfuscating C](ioccc.md) +- [marble racing](marble_race.md) +- [Netstalking](netstalking.md) +- hanging around with friends on the [Island](island.md) +- laughing at normies dealing with [bloat](bloat.md) +- randomly stumbling upon sites on [wiby](https://www.wiby.me/) +- old [Nokia](nokia.md) phones were fun diff --git a/function.md b/function.md new file mode 100644 index 0000000..4559e4b --- /dev/null +++ b/function.md @@ -0,0 +1,101 @@ +# Function + +Function is a very basic term in [mathematics](math.md) and [programming](programming.md) with a slightly different meanings in each: mathematical function maps numbers to other numbers, a function in programming is a subprograms to which we divide a bigger program. Well, that's pretty simplified but those are the basic ideas. A more detailed explanation will follow. + +## Mathematical Functions + +In mathematics functions can be defined and viewed from different angles but a function is basically anything that assigns each member of some set *A* (so called *domain*) exactly one member of a potentially different set *B* (so called *codomain*). A typical example of a function is an equation that from one "input number" computes another number, for example: + +*f(x) = x / 2* + +Here we call the function *f* and say it takes one [parameter](parameter.md) (the "input number") called *x*. The "output number" is defined by the right side of the equation, *x / 2*, i.e. the number output by the function will be half of the parameter (*x*). The domain of this function (the set of all possible numbers that can be taken as input) is the set of [real numbers](real_number.md) and the codomain is also the set of real numbers. This equation assigns each real number *x* another real number *x / 2*, therefore it is a function. + +{ I always imagined functions as kind of little boxes into which we throw a number and another number falls out. ~drummyfish } + +Now consider a function *f2(x) = 1 - 1 / x*. Note that in this case the domain is the set of real number minus [zero](zero.md); the function can't take zero as an input because we can't divide by zero. The codomain is the set of real numbers minus one because we can't ever get one as a result. + +Another common example of a function is the [sine](sin.md) function that we write as *sin(x)*. It can be defined in several ways, commonly e.g. as follows: considering a [right triangle](right_triangle.md) with one of its angles equal to *x* [radians](radian.md), *sin(x)* is equal to the ratio of the side opposing this angle to the triangle [hypotenuse](hypotenuse.md). For example *sin(pi / 2) = sin(45 degrees) = 1 / sqrt(2) ~= 0.71*. The domain of sine function is again the set of real number but its codomain is only the set of real numbers between 0 and 1 because the ratio of said triangle sides can never be negative or greater than 1, i.e. sine function will never yield a number outside the interval <0,1>. + +Note that these functions have to satisfy a few conditions to really be functions. Firstly each number from the domain must be assigned exactly one number (although this can be "cheated" by e.g. using a set of couples as a codomain), even though multiple input numbers can give the same result number. Also importantly **the function result must only depend on the function's parameter**, i.e. the function mustn't have any memory or inside state and it mustn't depend on any external factors (such as current time) or use any randomness (such as a dice roll) in its calculation. For a certain [argument](argument.md) (input number) a function must give the same result every time. For this reason not everything that transforms numbers to other numbers can be considered a function. + +Functions can have multiple parameters, for example: + +*g(x,y) = (x + y) / 2* + +The function *g* computes the average of its two parameters, *x* and *y*. Formally we can see this as a function that maps elements from a set of couples of real numbers to the set of real numbers. + +Of course function may also work with just [whole numbers](whole_number.md), also [complex numbers](complex_number.md), [quaternions](quaternion.md) and theoretically just anything crazy like e.g. the set of animals :) However in these "weird" cases we generally no longer use the word *function* but rather something like a *[map](map.md)*. In mathematical terminology we may hear things such as a *real function of a complex parameter* which means a function that takes a complex number as an input and gives a real number result. + +To get better overview of a certain function we may try to represent it graphically, most commonly we make function **[plots](plot.md)** also called **graphs**. For a function of a single parameter we draw graphs onto a grid where the horizontal axis represents number line of the parameter (input) and the vertical axis represents the result. For example plotting a function *f(x) = ((x - 1) / 4)^2 + 0.8* may look like this: + +``` + + |f(x) + 2+ +'.._ | + ''--1+.____...--' +___,__,__|__,__,_____x + -2 -1 |0 1 2 + -1+ + | + -2+ + | + + +``` + +This is of course done by plotting various points [*x*,*f(x)*] and connecting them by a line. + +Plotting functions of multiple parameters is more difficult because we need more axes and get to higher [dimensions](dimension.md). For functions of 2 parameters we can draw e.g. a [heightmap](heightmap.md) or create a [3D model](3d_model.md) of the surface which the function defines. 3D functions may in theory be displayed like 2D functions with added time dimension (animated) or as 3D density clouds. For higher dimensions we usually resort to some kind of cross-section or [projection](projection.md) to lower dimensions. + +Functions can have certain properties such as: + +- being **[bijective](bijection.md)**: A bijective function pairs exactly one element from the domain with one element from codomain and vice versa, i.e. for every result (element of codomain) of the function it is possible to unambiguously say which input created it. For bijective functions we can create **[inverse functions](inverse_function.md)** that reverse the mapping (e.g. [arcus sine](asin.md) is the inverse of a [sin](sin.md) function that's limited to the interval where it is bijective). For example *f(x) = 2 * x* is bijective with its inverse function being *f^(-1)(x) = x / 2*, but *f2(x) = x^2* is not bijective because e.g. both 1 and -1 give the result of 1. +- being an **[even function](even_function.md)**: For this function it holds that *f(x) = f(-x)*, i.e. the plotted function is symmetric by the vertical axis. Example is the [cosine](cos.md) function. +- being an **[odd function](odd_function.md)**: For this function it holds that *-f(x) = f(-x)*, i.e. the plotted function is symmetric by the center point [0,0]. Example is the [sine](sin.md) function. + +In context of functions we may encounter the term [composition](composition.md) which simply means chaining the functions. E.g. the composition of functions *f(x)* and *g(x)* is written as *(f o g)(x)* which is the same as *f(g(x))*. + +[Calculus](calculus.md) is an important mathematical field that studies changes of continuous functions. It can tell us how quickly functions grow, where they have maximum and minimum values, what's the area under the line in their plot and many other things. + +### Notable Mathematical Functions + +Functions commonly used in mathematics range from the trivial ones (such as the constant functions, *f(x) = constant*) to things like trigonometric functions ([sine](sin.md), [cosine](cos.md), [tangent](tan.md), ...), [factorial](factorial.md), [logarithm](log.md), [logistic](logistic_function.md) sigmoid function, [Gaussian function](gaussian_function.md) etc. Furthermore some more complex and/or interesting functions are (the term function may be applied liberally here): + +- **[Ackermann function](ackermann_function.md)**: Extremely fast growing function with some weird properties. +- **[busy beaver function](busy_beaver.md)**: One of [noncomputable](computability.md) functions. +- **Minkowski's [questionmark function](questionmark_function.md)**: Weird function with [fractal](fractal.md) properties. +- **sin(1/x)**: Simple function that gets [chaotic](chaos.md) close to zero. +- **[Dirichlet function](dirichlet_function.md)**: Function that can't really be plotted properly. +- **[Weierstrass function](weierstrass_function.md)**: Continuous everywhere, [differentiable](derivative.md) nowhere. +- **Drawing with function plots**: there are many formulas whose plots create pictures, for example the **[Tupper's formula](tuppers_formula.md)** is a self-referential formula that can be seen as a function which when plotted draws the text of the formula itself. There are also equations such as the [Batman equation](batman_equation.md) or an equation that draws the symbol of a heart, which can be seen as functions too. +- **[Thomae's function](thomaes_function.md)**: Function with a nice [fractal](fractal.md) plot. +- **[Cantor function](cantor_function.md)** +- **[Riemann zeta function](riemann_zeta_function.md)**: Function that's subject to [Riemann hypothesis](riemann_hypothesis.md), one of the most important unsolved problems in mathematics. +- **[Blancmange curve](blancmange.md)** +- **[space filling curves](space_filling_curve.md)** +- **[Dirac delta function](unit_impulse.md)**: Function representing infinitely short impulse with unit energy. +- TODO + +## Programming Functions + +In programming the definition of a function is less strict, even though some languages, namely [functional](functional.md) ones, are built around purely mathematical functions -- for distinction we call these strictly mathematical functions **pure**. In traditional languages functions may or may not be pure, a function here normally means a **subprogram** which can take parameters and return a value, just as a mathematical function, but it can further break some of the rules of mathematical functions -- for example it may have so called **[side effects](side_effect.md)**, i.e. performing additional actions besides just returning a number (such as modifying data in memory, printing something to the screen etc.), or use randomness and internal states, i.e. potentially returning different numbers when invoked (called) multiple times with exactly the same parameters. These functions are called **impure**; in programming a *function* without an adjective is implicitly expected to be impure. Thanks to allowing side effects these functions don't have to actually return any value, their purpose may be to just invoke some behavior such as writing something to the screen, initializing some hardware etc. The following piece of code demonstrates this in [C](c.md): + +``` +int max(int a, int b, int c) // pure function +{ + return (a > b) ? (a > c ? a : c) : (b > c ? b : c); +} + +unsigned int lastPresudorandomValue = 0; + +unsigned int pseudoRandom(unsigned int maxValue) // impure function +{ + lastPresudorandomValue = // side effect: working with global variable + lastPresudorandomValue * 7907 + 7; + + return (lastPresudorandomValue >> 2) % (maxValue + 1); +} +``` + +In older languages functions were also called *[procedures](procedure.md)* or *[routines](routine.md)*. Sometimes there was some distinction between them, e.g. in [Pascal](pascal.md) functions returned a value while procedures didn't. \ No newline at end of file diff --git a/future_proof.md b/future_proof.md new file mode 100644 index 0000000..1fbe824 --- /dev/null +++ b/future_proof.md @@ -0,0 +1,15 @@ +# Future-Proof Technology + +*see also [sustainability](sustainability.md)* + +Future-proof technology is technology that is very likely to stay functional for a very long time with minimal to no maintenance. This feature is generally pretty hard to achieve and today's [consoomerist](consumerism.md) society makes the situation much worse by focusing on immediate profit without long-term planning and by implementing things such as [bloat](bloat.md) and [planned obsolescence](planned_obsolescence.md). + +A [truly good technology](lrs.md) is trying to be future-proof because this saves us the great cost of maintenance and reinventing wheels. + +Despite the extremely bad situation not all hope is lost. At least in the world of [software](software.md) future-proofing can be achieved by: + +- Building on top of already well established and time-tested technology such as the [C language](c.md). Choosing to use the older standards with fewer features helps greatly as the less-feature-rich versions of languages are always more supported (for example there is many more C89 compilers than C17 compilers). +- Minimizing [dependencies](dependency.md) to absolute bare minimum. Dependencies are likely the single greatest cause of software death because if one of your dependencies dies, you whole project dies, and this goes recursively for all of the dependencies of the dependencies etc. This usually means software [libraries](library.md) but also goes for other software such as [build systems](build_system.md) and also [hardware](hardware.md) dependencies such as requiring GPU, floating point, special instructions etc. +- Practicing [minimalism](minimalism.md) and reducing complexity which minimizes the maintenance cost and therefore raises the probability of someone being able to fix any issues that arise over time. +- Making hard dependencies soft, i.e. optional. For example if your software is using GPU for real-time rendering, it should also offer a [software rendering](sw_rendering.md) option in case GPU is not present or is unsupported. +- Avoiding the hyped "modern" "feature-rich" ([bloated](bloat.md)) technology arising from the consumerist market. \ No newline at end of file diff --git a/game.md b/game.md new file mode 100644 index 0000000..bd07667 --- /dev/null +++ b/game.md @@ -0,0 +1,120 @@ +# Game + +In computer context game (also gayme, video game or vidya) is [software](software.md) whose main purpose is to be played and entertain the user. Of course, we can additionally talk about real life games such as [marble racing](marble_race.md). *Game* is also a mathematical term in [game theory](game_theory.md). Sadly most computer games are [proprietary](proprietary.md) and [toxic](toxic.md). + +Among [suckless](kiss.md) software proponents there is a disagreement about whether games are legit software or just a [meme](meme.md) and harmful kind of entertainment. The proponents of the latter argue something along the lines that technology is only for getting work done, that games are for losers, that they hurt [productivity](productivity_cult.md), are an unhealthy addiction, wasted time and effort etc. Those who like games see them as a legitimate form of relaxation, a form of art and a way of advancing technology along the way. The truth is that developing games leads to improvement of other kinds of software, e.g. for rendering, physics simulation or virtual reality. + +[LRS](lrs.md) fully accepts games as legitimate software; of course as long as their purpose is to help all people, i.e. while we don't reject games as such, we reject most games the industry produces nowadays. + +Despite arguments about the usefulness of games, most people agree on one thing: that the mainstream AAA games produced by big corporations are harmful, [bloated](bloat.md) and designed to be malicious. They are one of the worst cases of [capitalist software](capitalis_software.md). Such games are never going to be considered good from our perspective (and even the mainstream is turning towards classifying modern games as [shit](shit.md)). + +PC games are mostly made for and played on [MS Windows](windows.md) which is still the "gaming OS", even though in recent years we've seen a boom of "[Linux](linux.md) gaming", possibly thanks to Windows getting shittier and shittier every year. However, most games, even when played on [GNU](gnu.md)/Linux, are still [proprietary](proprietary.md). + +We might call this the **great tragedy of games**: the industry has become similar to that of **illegal drugs**. Games feel great and can become very addictive. Today not playing latest games makes a person left out socially, out of the loop, a weirdo. Therefore contrary to the original purpose of a game -- that of making life better and bringing joy -- a person "on games" from the capitalist industry will crave to constantly consume more and more "experiences" that get progressively more expensive to satisfy. This situation is purposefully engineered by the big game producers who exploit psychological and sociological phenomena to enslave *gamers* and make them addicted. Games become more and more predatory and abusive and of course, there are no moral limits for corporations of how far they can go: games with [microthefts](microtransaction.md) and lootboxes, for example, are similar to gambling, and are often targeted at very young children. The gaming addiction is so strong that even the [FOSS](foss.md) people somehow create a **mental exception** for games and somehow do not mind e.g. [proprietary](proprietary.dm) games even though they otherwise reject proprietary software. + +Therefore it is crucial to stress that **games are technology like any other**, they can be exploiting and abusive, and so indeed all the high standards we hold for other technology we must also hold for games. Too many people judge games solely by their gameplay. For us at [LRS](lrs.md) gameplay is but one attribute, and not even the one standing at the top; factors such as [software freedom](free_software.md), [cultural freedom](free_culture.md), [sucklessness](suckless.md), good internal design and being [future proof](future_proof.md) are even more important. + +A small number of games nowadays come with a [free](free_software.md) engine, which is either official (often retroactively freed by its developer in case of older games) or developed by volunteers. Example of the former are the engines of ID games ([Doom](doom.md), [Quake](quake.md)), example of the latter can be [OpenMW](openmw.md) (a free engine for TES: Morrowind) or [Mangos](mangos.md) (a free server for World of Warcraft). Console [emulators](emulator.md) (such as of Playstation or Gameboy) can also be considered a free engine for playing proprietary games. + +Yet a smaller number of games are completely free (in the sense of [Debian](debian.md)'s free software definition), including both the engine and game assets. These games are called **free games** or **libre games** and many of them are clones of famous proprietary games. Examples of these include [SuperTuxKart](stk.md), [Minetest](minetest.md), [Xonotic](xonotic.md), [FLARE](flare.md) or [Anarch](anarch.md). There exists a wiki for libre games at https://libregamewiki.org and a developer forum at https://forum.freegamedev.net/. Libre games can also be found in Debian software repositories. + +{ NOTE: Do not blindly trust libregamewiki, non-free games ocassionaly do appear there by accident, negligence or even by intention. I've actually found that most of the big games like SuperTuxKart have some licensing issues (they removed one proprietary mascot from STK after my report). Ryzom has been removed after I brought up the fact that the whole server content is proprietary and secret. So if you're a purist, focus on the simpler games and confirm their freeness yourself. Anyway, LGW is a good place to start looking for libre games. ~drummyfish } + +Some games are pretty based as they don't even require [GUI](gui.md) and are only played in the text shell (either using TUI or purely textual I/O) -- these are called TTY games or command line games. This kind of games may be particularly interesting for [minimalists](minimalism.md), hobbyists and developers with low (zero) budget, little spare time and/or no artistic skills. Roguelike games are especially popular here; there sometimes even exist GUI frontends which is pretty neat -- this demonstrates how the [Unix philosophy](unix_philosophy.md) can be applied to games. + +Another kind of cool games are computer implementations of pre-computer games, for example [chess](chess.md), backgammon, go or various card games. Such games are very often well tested and fine-tuned gameplay-wise, popular with active communities and therefore [fun](fun.md), yet simple to program with many existing free implementations and good AIs (e.g. GNU chess, GNU go or [Stockfish](stockfish.md)). + +## Games As LRS + +Games can be [suckless](suckless.md) and just as any other software should try to adhere to the [Unix philosophy](unix_philosophy.md). A [LRS](lrs.md) game should follow all the principles that apply to any other kind of such software, for example being completely [public domain](public_domain.md) or aiming for high [portability](portability.md). This is important to mention because, sadly, many people see games as some kind of exception among software and think that different technological or moral rules apply -- this is wrong. + +If you want to make a simple LRS game, there is an official LRS [C](c.md) library for it: [SAF](saf.md). + +Compared to mainstream games, a LRS game shouldn't be a consumerist product, it should be a tool to help people entertain themselves and relieve their stress. From the user perspective, the game should be focused on the fun and relaxation aspect rather than on pleasing look, i.e. it will likely utilize simple graphics and audio. Another aspect of an LRS game is that the technological part is just as important as how the game behaves on the outside (unlike mainstream games that have ugly, badly designed internals and mostly focus on rapid development and impressing the consumer with visuals). + +The paradigm of LRS gamedev differs from the mainstream gamedev just as the [Unix philosophy](unix_philosophy.md) differs from the [Window philosophy](windows_philosophy.md). While a mainstream game is a monolithic piece of software, designed to allow at best some simple, limited user modifications, a LRS game is designed with [forking](fork.md), [hacking](hacking.md), abuse and code reuse in mind. + +Let's take an example. A LRS game of a real-time 3D [RPG](rpg.md) genre may for example consist of several independent modules: the RPG library, the game code, the content and the [frontend](frontend.md). Yes, a mainstream game will consist of similar modules, however those modules will probably only exist for the internal organization of work and better testing, they won't be intended for real reuse or wild hacking. With the LRS RPG game it is implicitly assumed that someone else may take the 3D game and make it into a purely non-real-time [command line](cli.md) game just by replacing the frontend, in which case the rest of the code shouldn't be burdened by anything 3D-rendering related. The paradigm here should be similar to that existing in the world of computer [chess](chess.md) where there exist separate engines, graphical frontends, communication protocols, formats, software for running engine tournaments, analyzing games etc. [Roguelikes](roguelike.md) and the world of [quake](quake.md) engines show some of this modularity, though not in such a degree we would like to see -- LRS game modules may be completely separate projects and different processes communicating via text interfaces through [pipes](pipe.md), just as basic Unix tools do. We have to think about someone possibly taking our singleplayer RPG and make it into an MMORPG. Someone may even take the game and use it as a research tool for [machine learning](machine_learning.md) or as a VFX tool for making movies, and the game should be designed so as to make this as easy as possible -- the user interface should be very simple to be replaced by an [API](api.md) for computers. The game should allow easy creation of [tool assisted speedruns](tas.md), to record demos, to allow [scripting](script.md), modifying ingame variables, even creating [cheats](cheat.md) etc. And, importantly, **the game content is a module as well**, i.e. the whole RPG world, its lore and storyline is something that can be modified, forked, remixed, and the game creator should bear this in mind. + +Of course, LRS games must NOT contain such shit as "[anti-cheating](anti_cheat.md) technology". For our stance on cheating, see the article [about it](cheat.md). + +## Types Of Games + +Besides dividing games as any other software ([free](free_software.md) vs [proprietary](proprietary.md), [suckless](suckless.md) vs [bloat](bloat.md), ...) we can further divide them by the following: + +- by genre: + - [minigames](minigame.md) + - [shooters](shooter.md) + - [role playing](rpg.md) + - [tower defenses](tower_defense.md) + - [racing](racing.md) + - [platformers](platformer.md) + - [strategy](strategy.md) + - [adventures](adventure.md) + - [sport](sport.md) + - ... +- by game design: + - [easy to learn, hard to master](easy_to_learn_hard_to_master.md) + - [hard to learn, easy to master](hard_to_learn_easy_to_master.md) + - [easy to learn, easy to master](easy_to_learn_easy_to_master.md) + - [hard to learn, hard to master](hard_to_learn_hard_to_master.md) + - [symmetric](symmetry.md) vs assymetric gameplay + - ... +- by number of players: + - [zero player](zero_player.md) + - [single player](single_player.md) + - [multiplayer](multiplayer.md) + - [massively multiplayer](mmo.md) +- by information: + - [complete information](complete_information.md) + - [incomplete information](incomplete_information.md) +- by interface: + - [2D](2d.md) + - [3D](3d.md) + - ["pseudo3D"/primitive3D](pseudo3d.md) + - [command line/text](cli.md) + - audio + - ... +- by time management: + - [realtime](realtime.md) + - [turn based](turn_based.md) +- by platform + - [real life](irl.md) + - [computer](computer.md) ([console](console.md) vs [PC](pc.md)) +- by budget/scale/financing: + - amateur + - [indie](indie.md) + - [AAA](aaa.md) +- by [business model](business_model.md): + - [freeware](freeware.md) + - [shareware](shareware.md) + - [free to play](free_to_play.md) + - [subscription](subscription.md) + - buy once + - [pay to win](pay_to_win.md) + - [pay what you want](pay_what_you_want.md)/donation + - [adware](adware.md) + - [spyware](spyware.md) + - ... +- ... + +## Legal Matters + +Thankfully gameplay mechanisms cannot (yet) be [copyrighted](copyright.md) (however some can sadly be [patented](patent.md)) so we can mostly happily [clone](clone.md) proprietary games and so free them. However this must be done carefully as there is a possibility of stepping on other mines, for example violating a [*trade dress*](trade_dress.md) (looking too similar visually) or a [trade mark](trade_mark.md) (for example you cannot use the word *tetris* as it's owned by some shitty company) and also said patents (for example the concept of minigames on loading screens used to be patented in the past). + +Trademarks have been known to cause problems in the realm of libre games, for example in the case of Nexuiz which had to rename to [Xonotic](xonotic.md) after its original creator trademarked the name and started to make trouble. + +## Some Nice Gaymes + +[Anarch](anarch.md) and [microTD](utd.md) are examples of games trying to strictly follow the [less retarded](lrs.md) principles. [SAF](saf.md) is a less retarded game library/fantasy console which comes with some less retarded games such as [microTD](utd.md). + +{ I recommend checking out [Xonotic](xonotic.md), it's completely libre and one of the best games I've ever played. ~drummyfish } + +## See Also + +- [game engine](game_engine.md) +- [minigame](minigame.md) +- [open console](open_console.md) +- [fantasy console](fantasy_console.md) +- [SAF](saf.md) +- [chess](chess.md) \ No newline at end of file diff --git a/game_engine.md b/game_engine.md new file mode 100644 index 0000000..bdc2fec --- /dev/null +++ b/game_engine.md @@ -0,0 +1,47 @@ +# Game Engine + +Game engine is a [software](software.md), usually a [framework](framework.md) or a [library](library.md), that serves as a base code for [games](game.md). Such an engine may be seen as a [platform](platform.md) allowing [portability](portablity.md) and offering preprogrammed functionality often needed in games ([3D rendering](3d_rendering.md), [physics engine](physics_engine.md), [I/O](io.md), networking, [AI](ai.md), audio, scripting, ...) as well as [tools](tool.md) used in game development (level editor, [shader](shader.md) editor, 3D editor, ...). + +A game engine differs from a general multimedia engine/library, such as [SDL](sdl.md), by its specific focus on games. It is also different from generic rendering engines such as [3D engines](3d_engine.md) like [OpenSceneGraph](osg.md) because games require more than just rendering (audio, AI, physics, ...). While one may use some general purpose technology such as [C](c.md) or [SDL](sdl.md) for creating a game, using a game engine should make the process easier. However, **beware of [bloat](bloat.md)** that plagues most mainstream game engines. [LRS](lrs.md) advises against use of any frameworks, so try to at worst use a game library. Many game programmers such as [Jonathan Blow](jonathan_blow.md) advocate and practice writing own engines for one's games. + +## Existing Engines + +The following are some notable game engines. + +- **[free as in freedom](free_software.md)** + - **[Allegro](allegro.md)**: 2D [C](c.md) game library. + - **[BRender](brender.md)**: Old 3D engine that used mainly [software rendering](sw_rendering.md), used e.g. in Carmageddon, later released under [MIT](mit.md). + - **[Cube2](cube2.md)**: 3D [voxel](voxel.md) outdoor shooter engine with real-time editable levels, used e.g. in Cube 2: Sauerbraten. + - **[Godot](godot.md)**: A successful but [bloated](bloat.md) [FOSS](foss.md) ([MIT](mit.md)) [framework](framewrok.md) engine, alternative to the proprietary [Unity](unity.md) engine, written in [C++](cpp.md), supports many platforms, has 3D/2D graphics and physics engines, scripting in many languages and many "advanced" features. [Capitalist software](capitalist_software.md). + - *id Tech* engines (engines by [Id software](id_software.md)) + - **id Tech 0**: Simple 2D [raycasting](raycasting.md) engine, written in [ANSI C](C.md), used mainly in [Wolf3D](wolf3d.md) (1992). + - **id Tech 1**: [BSP](bsp.md) rendering engine used mainly in [Doom](doom.md) and Doom 2. + - **[Chocolate Doom](chocolate_doom.md)**: Doom engine [fork](fork.md) aiming to be very similar to the vanilla version. + - **[GZDoom](gzdoom.md)**: Another Doom fork, supports newer OpenGL etc. + - **[PrBoom](prboom.md)**: Doom engine fork adding e.g. [OpenGL](ogl.md) support. + - **id Tech 2**: 3D engine used mainly in [Quake](quake.md) and Quake 2, in a modified form ([GoldSrc](goldsrc.md), proprietary) also in [Half Life](half_life.md), features both GPU accelerated and [software rendering](sw_rendering.md). + - **[Darkplaces](darkplaces.md)**: [Fork](fork.md) of id Tech 2, used e.g. in [Xonotic](xonotic.md). + - **id Tech 3**: 3D engine used mainly in [Quake 3](quake3.md), sadly dropped [software rendering](sw_rendering.md) support. + - **[ioquake3](ioquake3.md)**: Fork of id Tech 3 aiming for bugfixes and improvements, e.g. [SDL](sdl.md) integration. + - **[OpenArena](openarena.md)**: Game-specific fork of id Tech 3. + - **id Tech 4**: 3D engine used mainly in [Doom 3](doom3.md) and [Quake 4](quake4.md). + - **[iodoom3](iodoom3.md)**: Fork of id Tech 4, in a similar spirit to ioquake3. + - **[Irrlicht](irrlicht.md)**: [C++](cpp.md) cross-platform library for 3D games, includes a physics engine and many rendering backends ([OpenGL](ogl.md), [software](sw_rendering.md), [DirectX](directx.md), ...). Used e.g. by [Minetest](minetest.md). + - **[OpenMW](openmw.md)**: [FOSS](foss.md) remake of the engine of a proprietary [RPG](rpg.md) game [TES: Morrowind](morrowind.md), can be used to make open-world 3D RPG games. + - **[Panda3D](panda3d.md)**: 3D game engine, under [BSD](bsd_license.md), written in [Python](python.md) and [C++](cpp.md). + - **[pygame](pygame.md)**: [Python](python.md) 2D game library. + - **[Raylib](raylib.md)**: [C99](c99.md) 2D/3D game library, relatively minimalist. + - **[SAF](saf.md)**: Official [LRS](lrs.md) library for tiny and simple portable games. + - **[Torque3D](torque3d.md)**: 3D game engine in [C++](cpp.md). +- **[proprietary](proprietary.md)** (no go!): + - **[Build Engine](build_engine.md)**: Old portal rendering "[pseudo 3D](pseudo_3d.md)" engine used mainly in [3D Realms](3d_realms.md) games such as [Duke3D](duke3d.md). It is [source available](source_available.md). + - *id Tech* engines (engines by [Id software](id_software.md)) + - **id Tech 5**: 3D engine used e.g. in Rage and some shitty Wolfenstein games. + - **id Tech 6**: 3D engine adding [Vulkan](vulkan.md) support, used e.g. in Doom 2016. + - **id Tech 7**: 3D engine used e.g. in Doom: Eternal. + - **[GameMaker](gamemaker.md)**: Laughable toy for non-programmers. + - **[RAGE](rage.md)**: 3D open-world engine developed and used by [Rockstar](rockstar.md) for games such as [GTA](gta.md). + - **[Source](source_engine.md)**: 3D engine by [Valve](valve.md) used in games such as [Half Life 2](half_life2.md). + - **[Source2](source2_engine.md)**: Continuation of Valve's source engine with added support of [VR](vr.md) and other shit. + - **[Unity](unity.md)**: Shitty nub all-in-one 3D game engine, very [bloated](bloat.md) and [capitalist](capitalist_software.md), extremely popular among [coding monkeys](code_monkey.md), includes [ads](ad.md). + - **[Unreal Engine](unreal_engine.md)**: One of the leading proprietary 3D game engines developed alongside [Unreal Tournament](unreal_tournament.md) games, EXTREMELY [BLOATED](bloat.md) and [capitalist](capitalist_software.md), known for hugely overcomplicated rendering (advertised as "[photorealistic](photorealism.md)"). \ No newline at end of file diff --git a/gay.md b/gay.md new file mode 100644 index 0000000..596a303 --- /dev/null +++ b/gay.md @@ -0,0 +1,11 @@ +# Gay + +Homosexuality is a disorder/disease which makes individuals sexually attracted primarily to the same sex. A homosexual individual is called gay, homo or faggot ([females](woman.md) are called lesbians). + +Even though homosexuality is largely genetically determined, it is also to a great extent a **choice**, sometimes a choice that's not of the person in question. Most people are actually [bisexual](bi.md) to a considerable degree, with a *preference* of certain sex. That is there is a certain probability in each individual of choosing one or the other sex for a sexual/life partner. However culture and social pressure can push these probabilities in either way. If a child grows up in a major influence of YouTubers and other celebrities that openly are gay, or promote gayness as something extremely cool and fashionable, if the culture constantly pains being homosexual as being more interesting and somehow "brave" and if the [competition](competition.md) of sexes fueled e.g. by the [feminist](feminism.md) propaganda paints the opposite sex as literal [Hitler](hitler.md), the child has a greater probability of (maybe involuntarily) choosing the gay side of his sexual personality. + +There is a terrorist fascist organization called [LGBT](lgbt.md) aiming to make gays superior to other people. + +Gays behave pretty weirdly, male gays are very feminine and talk in high pitched voice, lesbians are masculine, have short pink hair. You can usually tell when someone's gay. + +Of course, [we](lrs.md) have nothing against gay people as we don't have anything against people with any other disorder -- we love all people. But we do have an issue with any kind of terrorist organization, so while we are okay with gays, we are not okay with LGBT. \ No newline at end of file diff --git a/gigachad.md b/gigachad.md new file mode 100644 index 0000000..1e9049f --- /dev/null +++ b/gigachad.md @@ -0,0 +1,3 @@ +# Gigachad + +Gigachad is like [chad](chad.md), only more so. He has an ideal physique and makes [women](woman.md) orgasm merely by looking at them. \ No newline at end of file diff --git a/girl.md b/girl.md new file mode 100644 index 0000000..3f469ae --- /dev/null +++ b/girl.md @@ -0,0 +1,3 @@ +# Girl + +See [femoid](femoid.md). \ No newline at end of file diff --git a/global_discussion.md b/global_discussion.md new file mode 100644 index 0000000..23476d6 --- /dev/null +++ b/global_discussion.md @@ -0,0 +1,11 @@ +# Global Discussion + +This is a place for general discussion about anything related to our thing. To comment just edit-add your comment. I suggest we use a tree-like structure as shows this example: + +- Hello, this is my comment. ~drummyfish + - Hey, this is my response. ~drummyfish + +If the tree gets too big we can create a new tree under a new heading. + +## General Discussion + diff --git a/gnu.md b/gnu.md new file mode 100644 index 0000000..fa95a8a --- /dev/null +++ b/gnu.md @@ -0,0 +1,42 @@ +# GNU + +GNU (*"GNU is Not Unix"*, a [recursive](recursion.md) acronym) is a large project started by [Richard Stallman](rms.md), the inventor of [free (as in freedom) software](free_software.md), running since 1983 with the goal of creating a completely free (as in freedom) [operating system](os.md), along with other free [software](software.md) that computer users might need. The project doesn't tolerate any [proprietary](proprietary.md) software. The project achieved its goal of creating a complete operating system when a [kernel](kernel.md) named [Linux](linux.md) became part of it in the 90s as the last piece of the puzzle -- the system is now known as GNU/Linux. However, the GNU project didn't end and continues to further develop the operating system as well as a myriad of other software projects it hosts. GNU gave rise to the [Free Software Foundation](fsf.md) and is one of the most important software projects in history of computing. + +The GNU/Linux operating system has several variants in a form of a few GNU approved "Linux" [ditributions](distro.md) such as [Guix](guix.md), [Trisquel](trisquel.md) or [Parabola](parabola.md). Most other "Linux" distros don't meet the strict standards of GNU such as not including any proprietary software. In fact the approved distros can't even use the standard version of [Linux](linux.md) because that contains proprietary [blobs](blob.md), a modified variant called [Linux-libre](linux_libre.md) has to be used. + +GNU greatly prefers [GPL](gpl.md) [licenses](license.md), i.e. it strives for [copyleft](copyleft.md), even though it accepts even projects under permissive licenses. GNU also helps with enforcing these licenses legally and advises developers to transfer their [copyright](copyright.md) to GNU so that they can "defend" the software for them. + +Although GNU is great and has been one of the best things to happen in software ever, it has its flaws. For example their programs are known to be kind of a [bloat](bloat.md), at least from the strictly [suckless](suckless.md) perspective. It also doesn't mind proprietary non-functional data (e.g. assets in video games) and their obsession with copyleft also isn't completely aligned with [LRS](lrs.md). + +## History + +TODO + +## GNU Projects + +GNU has developed an almost unbelievable amount of software, it has software for all basic and some advanced needs. As of writing this there are 373 software packages in the official GNU repository (at https://directory.fsf.org/wiki/Main_Page). Below are just a few notable projects under the GNU umbrella. + +- [GNU Hurd](hurd.md) (OS [kernel](kernal.md), alternative to [Linux](linux.md)) +- [GNU Compiler Collection](gcc.md) (gcc, compiler for [C](c.md) and other languages) +- [GNU C Library](glibc.md) (glibc, [C](c.md) library) +- [GNU Core Utilities](gnu_coreutils.md) (coreutils, basic utility programs) +- [GNU Debugger](gdb.md) (gdb, [debugger](debugger.md)) +- [GNU Binary Utilities](gnu_binutils.md) (binutils, programs for working with binary programs) +- [GNU Chess](gnu_chess.md) (strong [chess](chess.md) engine) +- [GNU Go](gnu_go.md) ([go](go.md) game engine) +- [GNU Autotools](autotools.md) ([build system](build_system.md)) +- [CLISP](clisp.md) (common [lisp](lisp.md) language) +- GNU Pascal ([pascal](pascal.md) compiler) +- [GIMP](gimp.md) (image manipulation program, a "free [photoshop](photoshop.md)") +- GNU Emacs ([emacs](emacs.md) text editor) +- [GNU Octave](octave.md) ([mathematics](math.md) software, "free Matlab") +- [GNU Mediagoblin](mediagoblin.md) (decentralized file hosting on the [web](web.md)) +- GNU Unifont ([unicode](unicode.md) font) +- [GNU Privacy Guard](gpg.md) (gpg, OpenPGP encryption) + +## See Also + +- [Free Software Foundation](fsf.md) +- [Richard Stallman](rms.md) +- [copyleft](copyleft.md) +- [free software](free_software.md) \ No newline at end of file diff --git a/go.md b/go.md new file mode 100644 index 0000000..f0a8938 --- /dev/null +++ b/go.md @@ -0,0 +1,12 @@ +# Go + +Go is a compiled [programming language](programming_language.md) advertised as the the "[modern](modern.md)" [C](c.md) and is co-authored by one of C's authors, [Ken Thompson](ken_thompson.md). Neverheless Go is actually [shit](shit.md) compared to C. Some reasons for this are: + +- It is developed by [Google](google.md) and presented as "[open-source](open_source.md)" (not [free software](free_software.md)). +- It has (classless) [OOP](oop.md) features. +- It has [bloat](bloat.md) such as [garbage collection](garbage_collection.md), built-in [complex number](complex_number.md) type, [concurrency](concurrency.md) and something akin a [package manager](package_manager.md) (*go get/install*). +- It forces a programming style in which an opening function bracket (`{`) can't be on its own line. LMAO +- Huge standard library with shit like crypto, image and html. + +Anyway, it at least tries to stay *somewhat* simple in some areas and as such is probably better than other modern languages like [Rust](rust.md). It purposefully omits features such as [generics](generics.md) or static type conversions, which is good. + diff --git a/good_enough.md b/good_enough.md new file mode 100644 index 0000000..182abde --- /dev/null +++ b/good_enough.md @@ -0,0 +1,7 @@ +# Good Enough + +A good enough solution to a problem is a solution that solves the problem satisfyingly (not necessarily precisely or completely) while achieving minimal cost (effort, implementation time etc.). This is in contrast to looking for a better solutions for a higher cost. For example a tent is a good enough accommodation solution while a luxury house is a better solution (more comfortable, safe, ...) for a higher cost. + +To give an example from the world of programming, [bubble sort](bubble_sort.md) is in many cases better than quick sort for its simplicity, even though it's much slower. + +In technology we are often times looking for good enough solution to achieve [minimalism](minimalism.md) and save valuable resources (computational resources, programmer time etc.). It rarely makes sense to look for solutions that are more expensive than they necessarily need to be, however in the context of [capitalist software](capitalist_software.md) we see this happen many times as price is artificially and intentionally driven up for economic reasons (e.g. increasing the cost of maintenance of a software eliminates any competition that can't afford such cost). This is only natural in [capitalism](capitalism.md), we see the tendency for wasting resources everywhere. This needs to be stopped. \ No newline at end of file diff --git a/google.md b/google.md new file mode 100644 index 0000000..e20d4a0 --- /dev/null +++ b/google.md @@ -0,0 +1,11 @@ +# Google + +Google is one the very top [big tech](big_tech.md) corporations, as well as one of the worst corporations in history (if not THE worst), comparable only to [Microsoft](microsoft.md) and [Facebook](facebook.md). Google is gigantically evil and largely controls the [Internet](internet.md), pushes mass surveillance, data collection, ads, [bloat](bloat.md), [fascism](tranny_software.md) and censorship. + +Google's motto used to be **"Don't be evil"**, but in 2018 they ditched it lol xD + +Google raised to the top thanks to its [search engine](search_engine.md) launched in the 90s. It soon got a **monopoly on the Internet search** and started pushing ads. Nowadays Google's search engine basically just promotes "content" on Google's own content platforms such as [YouTube](youtube.md) and of course censors sites deemed politically incorrect. + +Google has created a malicious [capitalist](capitalist_software.md) mobile [operating system](operating_system.md) called [Android](android.md), which they based on [Linux](linux.md) with which they managed to bypass its [copyleft](copyleft.md) by making Android de-facto dependent on their proprietary *Play Store* and other programs. I.e. they managed to take a [free](free_software.md) project and make a de-facto [proprietary](proprietary.md) [malware](malware.md) out of it -- a system that typically doesn't allow users to modify its internals and turn off its malicious features. With Android they invaded a huge number of devices from cells phones to TVs and have the ability to spy on the users of these devices. + +Google also tries to steal the [public domain](public_domain.md): they scan and digitize old books whose [copyright](copyright.md) has expired and put the on the [Internet archive](internet_archive.md), however in these scans they put a condition that the scans should not be used for commercial purposes, i.e. they try to keep exclusive commercial right for public domain works, something they have no right to do at all. \ No newline at end of file diff --git a/gopher.md b/gopher.md new file mode 100644 index 0000000..8656a47 --- /dev/null +++ b/gopher.md @@ -0,0 +1,15 @@ +# Gopher + +Gopher is a network [protocol](protocol.md) for publishing, browsing and downloading files and is known as a much simpler alternative to the [World Wide Web](www.md) (i.e. to [HTTP](http.md) and [HTML](html.md)). In fact it competed with the Web in its early days and even though the Web won in the mainstream, gopher still remains used by a small community. Gopher is like the Web but well designed, it is the [suckless](suckless.md)/[KISS](kiss.md) way of doing what the Web does, it contains practically no [bloat](bloat.md) and so [we](lrs.md) highly advocate its use. Gopher inspired creation of [gemini](gemini.md), a similar but bit more complex and "[modern](modern.md)" protocol, and the two together have recently become the main part of so called [Smol Internet](smol_internet.md). + +Gopher **doesn't use any [encryption](encryption.md)**. This is good, encryption is [bloat](bloat.md). Gopher also **only uses [ASCII](ascii.md)**, i.e. there's no [Unicode](unicode.md). That's also good, Unicode is bloat (and mostly serves trannies to insert emojis of pregnant men into readmes, we don't need that). Gopher simple design is intentional, the authors deemed simplicity a good feature. Gopher is so simple that you may very well write your own client and server and comfortably use them (it is also practically possible to browse gopher without a specialized client, just with standard [Unix](unix.md) [CLI](cli.md) tools). + +From the user's perspective the most important distinction from the Web is that gopher is based on **menus** instead of "webpages"; a menu is simply a column of items of different predefined types, most importantly e.g. a *text file* (which clients can directly display), *directory* (link to another menu), *text label* (just shows some text), *binary file* etc. A menu can't be formatted or visually changed, there are no colors, images, scripts or [hypertext](hypertext.md) -- a menu is not a presentation tool, it is simply a navigation node towards files users are searching for (but the mentioned ASCII art and label items allow for somewhat mimicking "websites" anyway). Addressing works with [URLs](url.md) just as the Web, the URLs just differ by the protocol part (`gopher://` instead of `http://`), e.g.: `gopher://gopher.floodgap.com:70/1/gstats`. What on Web is called a "website" on gopher we call a **gopherhole** (i.e. a collection of resources usually under a single [domain](domain.md)) and the whole gopher network is called a **gopherspace**. [Blogs](blog.md) are common on gopher and are called **phlogs**. As menus can refer to one another, gopher creates something akin a **global [file system](file_system.md)**, so browsing gopher is like browsing folders and can comfortably be handled with just 4 arrow keys. Note that as menus can link to any other menu freely, the structure of the "file system" is not a [tree](tree.md) but rather a general [graph](graph.md). Another difference from the Web is gopher's great emphasis on **[plaintext](plaintext.md) and [ASCII art](ascii_art.md)** as it cannot embed images and other media in the menus (even though of course the menus can link to them). There is also a support for sending text to a server so it is possible to implement [search engines](search_engine.md), guest books etc. + +Strictly speaking gopher is just an [application layer](l7.md) [protocol](protocol.md) (officially running on [port](port.md) 70 assigned by [IANA](iana.md)), i.e it takes the same role as [HTTP](http.md) on the Web and so only defines how clients and servers talk to each other -- the gopher protocol doesn't say how menus are written or stored on servers. Nevertheless for the creation of menus so called **gophermaps** have been established, which is a simple format for writing menus and are the gopher equivalent of Web's [HTML](html.md) files (just much simpler, basically just menu items on separate lines, the exact syntax is ultimately defined by server implementation). A server doesn't have to use gophermaps, it may be e.g. configured to create menus automatically from directories and files stored on the server, however gophermaps allow users to write custom menus manually. Typically in someone's gopherhole you'll be served a welcoming intro menu similar to a personal webpage that's been written as a gophermap, which may then link to directiories storing personal files or other hand written menus. Some gopher servers also allow creating dynamic content with scripts called **moles**. + +**Gopher [software](software.md)**: sadly "[modern](modern.md)" browsers are so modern they have millions of lines of code but can't be bothered to support such a trivial protocol like gopher, however there are Web proxies you can use to explore gopherspace. Better browsers such as [lynx](lynx.md) (terminal) or [forg](forg.md) ([GUI](gui.md)) can be used for browsing gopherspace natively. As a server you may use e.g. Gophernicus (used by [SDF](sdf.md)) or search for another one, there are dozens. For the creation of gophermaps you simply use a plaintext editor. **Where to host gopher?** [Pubnixes](pubnix.md) such as [SDF](sdf.md), [tilde.town](tilde_town.md) and [Circumlunar community](circumlunar.md) offer gopher hosting but many people simply [self-host](self_hosting.md) servers e.g. on [Raspberry Pis](rpi.md), it's pretty simple. + +## Example + +TODO \ No newline at end of file diff --git a/graphics.md b/graphics.md new file mode 100644 index 0000000..6a787bb --- /dev/null +++ b/graphics.md @@ -0,0 +1,36 @@ +# Computer Graphics + +Computer graphics (CG or just graphics) is a field of [computer science](compsci.md) that deals with visual information. The field doesn't have strict boundaries and can blend and overlap with other possibly separate topics such as physical simulations, multimedia and machine learning. It usually deals with creating or analyzing 2D and 3D images and as such CG is used in data visualization, [game](game.md) development, [virtual reality](vr.md), [optical character recognition](ocr.md) and even astrophysics or medicine. + +We can divide computer graphics in different ways, traditionally e.g.: + +- by direction: + - **[rendering](rendering.md)**: Creating images. + - **[computer vision](computer_vision.md)**: Extracting information from existing images. +- by basic elements: + - **raster**: Deals with images composed of a uniform grid of points called [pixels](pixel.md) (in 2D) or [voxels](voxel.md) (in 3D). + - **vector**: Deals with images composed of geometrical primitives such as curves or triangles. +- by dimension: + - **[2D](2d.md)**: Deals with images of a 2D plane. + - **[3D](3d.md)**: Deals with images that capture three dimensional space. +- by speed: + - **[real time](real_time.md)**: Trying to work with images in real time, e.g. being able to produce or analyze 60 frames per second. + - **offline**: Processes or creates images over longer time-spans, e.g. hours or days. + +Since the 90s computers started using a dedicated hardware to accelerate graphics: so called [graphics processing units](gpu.md) (GPUs). These have allowed rendering of high quality images in high [FPS](fps.md), and due to the entertainment and media industry (especially gaming), GPUs have been pushed towards greater performance each year. Nowadays they are one of the most consumerist [hardware](hardware.md), also due to the emergence of general purpose computations being moved to GPUs (GPGPU) and lately the mining of [cryptocurrencies](crypto.md). Most lazy programs dealing with graphics nowadays simply expect and require a GPU, which creates a bad [dependency](dependency.md). At [LRS](lrs.md) we try to prefer the [suckless](suckless.md) **[software rendering](sw_rendering.md)**, i.e. rendering on the [CPU](cpu.md), without GPU, or at least offer this as an option in case GPU isn't available. This many times leads us towards the adventure of using old and forgotten algorithms used in times before GPUs. + +## 3D Graphics + +This is a general overview of 3D graphics, for more technical overview of 3D rendering see [its own article](3d_rendering.md). + +3D graphics is a big part of CG but is a lot more complicated than 2D. It tries to achieve **realism** through the use of **[perspective](perspective.md)**, i.e. looking at least a bit like what we see in the real world. 3D graphics can very often bee seen as **simulating the behavior of [light](light.md)**; there exists so called *[rendering equation](rendering_equation.md)* that describes how light behaves ideally, and 3D computer graphics tries to approximate the solutions of this equation, i.e. the idea is to use [math](math.md) and [physics](physics.md) to describe real-life behavior of light and then simulate this model to literally create "virtual photos". The theory of realistic rendering is centered around the rendering equation and achieving **[global illumination](global_illumination.md)** (accurately computing the interaction of light not just in small parts of space but in the scene as a whole) -- studying this requires basic knowledge of [radiometry](radiometry.md) and [photometry](photometry.md) (fields that define various measures and units related to light such as [radiance](radiance.md), radiant intensity etc.). + +In 2010s mainstream 3D graphics started to employ so called [physically based rendering](pbr.md) (PBR) that tries to yet more use physically correct models of [materials](material.md) (e.g. physically measured [BRDFs](brdf.md) of various materials) to achieve higher photorealism. This is in contrast to simpler (both mathematically and computationally), more [empirical](empiricism.md) models (such as a single texture + [phong lighting](phong_lighting.md)) used in earlier 3D graphics. + +Because 3D is not very easy (for example [rotations](rotation.md) are pretty complicated), there exist many **[3D engines](3d_engine.md)** and libraries that you'll probably want to use. These engines/libraries work on different levels of abstraction: the lowest ones, such as [OpenGL](opengl.md) and [Vulkan](vulkan.md), offer a portable API for communicating with the GPU that lets you quickly draw triangles and write small programs that run in parallel on the GPU -- so called [shaders](shader.md). The higher level, such as [OpenSceneGraph](osg.md), work with [abstraction](abstraction.md) such as that of a **virtual camera** and **virtual scene** into which we place specific 3D objects such as models and lights (the scene is many times represented as a hierarchical graph of objects that can be "attached" to other objects, so called [scene graph](scene_graph.md)). + +There is a tiny [suckless](suckless.md)/[LRS](lrs.md) library for real-time 3D: [small3dlib](small3dlib.md). It uses software rendering (no GPU) and can be used for simple 3D programs that can run even on low-spec embedded devices. [TinyGL](tinygl.md) is a similar software-rendering library that implements a subset of [OpenGL](opengl.md). + +**Real-time** 3D typically uses an **object-order** rendering, i.e. iterating over objects in the scene and drawing them onto the screen (i.e. we draw object by object). This is a fast approach but has disadvantages such as (usually) needing a memory inefficient [z-buffer](z_buffer.md) to not overwrite closer objects with more distant ones. It is also pretty difficult to implement effects such as shadows or reflections in object-order rendering. The 3D models used in real-time 3D are practically always made of **triangles** (or other polygons) because the established GPU pipelines work on the principle of drawing polygons. + +**Offline rendering** (non-real-time, e.g. 3D movies) on the other hand mostly uses **image-order** algorithms which go pixel by pixel and for each one determine what color the pixel should have. This is basically done by casting a ray from the camera's position through the "pixel" position and calculating which objects in the scene get hit by the ray; this then determines the color of the pixel. This more accurately models how rays of light behave in real life (even though in real life the rays go the opposite way: from lights to the camera, but this is extremely inefficient to simulate). The advantage of this process is a much higher realism and the implementation simplicity of many effects like shadows, reflections and refractions, and also the possibility of having other than polygonal 3D models (in fact smooth, mathematically described shapes are normally much easier to check ray intersections with). Algorithms in this category include [ray tracing](ray_tracing.md) or [path tracing](path_tracing.md). In recent years we've seen these methods brought, in a limited way, to real-time graphics on the high end GPUs. \ No newline at end of file diff --git a/gui.md b/gui.md new file mode 100644 index 0000000..98c53cd --- /dev/null +++ b/gui.md @@ -0,0 +1,21 @@ +# Graphical User Interface + +Graphical user interface (GUI) is a visual [user interface](ui.md) that uses graphics such as images and geometrical shapes. This stands in contrast with [text user interface](tui.md) (TUI) which is also visual but only uses text for communication. + +Expert computer users normally frown upon GUI because it is the "noobish", inefficient, limiting, cumbersome, hard to automate way of interacting with computer. GUI brings [complexity](complexity.md) and [bloat](bloat.md), they are slow, inefficient and distracting. We try no to use them and prefer the [command line](cli.md). + +GUIs mostly use [callback](callback.md)-based programming, which again is more complicated than standard polling non-interactive I/O. + +## When And How To Do GUI + +GUI is not forbidden, it has its place, but today it's way too overused -- it should be used only if completely necessary (e.g. in a painting program) or as a completely optional thing build upon a more [suckless](suckless.md) text interface or [API](api.md). So remember: first create a program and/or a [library](library.md) working without GUI and only then consider creating an optional GUI [frontend](frontend.md). GUI must never be tied to whatever functionality can be implemented without it. + +Still, when making a GUI, you can make it [suckless](suckless.md) and lighthweight. Do your buttons need to have reflections, soft shadows and rounded anti-aliased borders? No. Do your windows need to be transparent with light-refraction simulation? No. Do you need to introduce many MB of dependencies and pain such as [QT](qt.md)? No. + +The ergonomics and aesthetic design of GUIs has its own field and can't be covered here, but just keep in mind some basic things: + +- Don't have too many elements (buttons etc.) at the screen at once, it's confusing as hell and drives noobs away. +- Things must be intuitive, i.e. behave in a way that they normally do (e.g. main menu should be at the top of the window, not the bottom etc.). +- Just use your brain. If a button is important and often used, it should probably be bigger than a button that's used almost never, etc. + +The million dollar question is: **which GUI framework to use?** Ideally none. GUI is just pixels, buttons are just rectangles; make your GUI simple enough so that you don't need any shitty abstraction such as widget hierarchies etc. If you absolutely need some framework, look for a suckless one; e.g. [nuklear](nuklear.md) is worth checking out. The suckless community sometimes uses pure [X11](x11.md), however that's not ideal, X11 itself is kind of bloated and it's also getting obsoleted by [Wayland](wayland.md). The ideal solution is to make your GUI **backend agnostic**, i.e. create your own very thin abstraction layer above the backend (e.g. X11) so that any other backend can be plugged in if needed just by rewriting a few simple functions of your abstraction layer (see how e.g. [Anarch](anarch.md) does rendering). \ No newline at end of file diff --git a/hard_to_learn_easy_to_master.md b/hard_to_learn_easy_to_master.md new file mode 100644 index 0000000..e1f3f09 --- /dev/null +++ b/hard_to_learn_easy_to_master.md @@ -0,0 +1,5 @@ +# Hard To Learn, Easy To Master + +"Hard to learn, easy to master" is the opposite of "[easy to learn, hard to master](easy_to_lear_hard_to_master.md)". + +Example: drinking coffee while flying a plane. \ No newline at end of file diff --git a/hardware.md b/hardware.md new file mode 100644 index 0000000..5d3c302 --- /dev/null +++ b/hardware.md @@ -0,0 +1,3 @@ +# Hardware + +The article is [here](hw.md)! \ No newline at end of file diff --git a/hash.md b/hash.md new file mode 100644 index 0000000..d116d0d --- /dev/null +++ b/hash.md @@ -0,0 +1,49 @@ +# Hash + +Hash is a number computed by a **hash function**, a function that takes some data and turns it into a number (the hash) that's much smaller than the data itself, has a fixed size (number of [bits](bit.md)) and which has additional properties such as being completely different from hash values computed from very similar data. Thanks to these properties hashes have a very wide use in [computer science](compsci.md) -- they are often used to quickly compare whether two pieces of non-small data, such as documents, are the same, they are used in indexing structures such as **hash tables** which allow for quick search of data, and they find a great use in [cryptocurrencies](crypto.md) and [security](security.md), e.g. for [digital signatures](sigital_signature.md). Hashing is extremely important and as a programmer you won't be able to avoid encountering hashes somewhere in the wild. + +{ Talking about wilderness, Hyenas and other animals have their specific smells that are created by bacteria in them and are unique to each individual depending on the exact mix of the bacteria. They use these smells to quickly identify each other. The smell is kind of like the animal's hash. But of course the analogy isn't perfect, for example similar mixes of bacteria may produce similar smells, which is not how hashes should behave. ~drummyfish } + +It is good to know that we distinguish between "normal" hashes used for things such as indexing data and [cryptographic](cryptography.md) hashes that are used in computer security and have to satisfy some stricter mathematical criteria. For the sake of simplicity we will sometimes ignore this distinction here. Just know it exists. + +It is generally given that a hash (or hash function) should satisfy the following criteria: + +- **Have fixed size** (given in bits), even for data that's potentially of variable size (e.g. text strings). +- **Be fast to compute**. This is mostly important for non-security uses, cryptographic hashes may prioritize other properties to guarantee the hash safety. +- **Have uniform mapping**. That is if we hash a lot of different data the hashes we get should be uniformly spread over the space of the hashes, i.e. NOT be centered around some number. This is in order for hash tables to be balanced, and it's also required in security (non-uniform hashes can be easier to reverse). +- **Behave in a [chaotic](chaos.md) manner**, i.e. hashes of similar data should be completely different. This is similar to the point above; a hash should kind of appear as a "random" number associated to the data (but of course, the hash of the same data has to always be the same when computed repeatedly, i.e. be [deterministic](determinism.md)). So if you change just one bit in the hashed data, you should get a completely different hash from it. +- **Minimize collisions**, i.e. the probability of two different values giving the same hash. Mathematically collisions are always possible if we're mapping a big space onto a smaller one, but we should try to reduce collisions that happen in practice. This property should follow from the principle of uniformity and chaotic behavior mentioned above. +- **Be difficult to reverse** (mainly for security related hashes). Lots of times this comes naturally from the fact that a hash maps a big space onto a smaller space (i.e. it is a non-[injective](injective.md) function) and from their chaotic nature. Hashes can typically be reversed only by [brute force](brute_force.md). + +Hashes are similar to [checksums](checksum.md) but are different: checksums are simpler because their only purpose is for checking data integrity, they don't have to have a chaotic behavior, uniform mapping and they are often easy to reverse. Hashes are also different from database IDs: IDs are just sequentially assigned numbers that aren't derived from the data itself, they don't satisfy the hash properties and they have to be absolutely unique. + +Some common uses of hashes are: + +- [Hash tables](hash_table.md), [data structures](data_structure.md) that allows for quick search and access of data. For example in [chess](chess.md) programs and databases hashes of chess positions are used to identify and get some information associated with the position. +- [Passwords](password.md) in user databases are for security reasons not stored as plain text, instead only password hashes are stored. When a user enters a password, the system computes its hash and compares it to that stored in the database: if the hashes match, the password was correct. This is a way of allowing password authentication without giving the system the knowledge of user passwords. +- In [digital signatures](digital_signature.md) hashes of documents are used to prove a document hasn't been modified by a third party. +- [Digital fingerprints](fingerprint.md) are hashes computed from known data about a user. The fingerprint is a small number that identifies a tracked user. +- In [blockchain](blockchain.md) based on proof of work the computational difficulty of reversing a hash is used in the process of mining as a puzzle whose solution is rewarded. Miners compete in finding bits such that if appended to a newly added block will result in the block's hash being some defined number. + +## Code Example + +Let's say we want a has function for string which for any [ASCII](ascii.md) string will output a 32 bit hash. How to do this? We need to make sure that every character of the string will affect change the resulting hash. + +First though that may come to mind could be for example to multiply the ASCII values of all the characters in the string. However there are at least two mistakes in this: firstly short strings will result in small values as we'll get a product of fewer numbers. Secondly reordering the characters in a string (i.e. its [permutations](permutation.md)) will not change the hash at all (as with multiplication order is insignificant)! These violate the properties we want in a hash function. If we used this function to implement a hash table and then tried to store strings such as "abc", "bca" and "cab", all would map to the same hash and cause collisions that would negate the benefits of a hash table. + +The following is a better function, a variant of a function used in sdbm: + +``` +uint32_t stringHash(const char *s) +{ + uint32_t result = 123; + + while (*s) + { + r = s + (result << 16) + (result << 6) - result; + s++; + } + + return result; +} +``` \ No newline at end of file diff --git a/history.md b/history.md new file mode 100644 index 0000000..17c66b3 --- /dev/null +++ b/history.md @@ -0,0 +1,81 @@ +# History + +WIP + +{ There are probably errors, you can send me an email if you find some. ~drummyfish } + +This is a brief summary of history of [technology](technology.md) and [computers](computer.md). + +The earliest known appearance of technology related to humans is the use of **stone tools** of hominids in Africa some two and a half million years ago. Learning to start and control **fire** was one of the most important advances of earliest humans; this probably happened hundreds of thousands to millions years ago, even before modern humans. Around 8000 BC the **[Agricultural Revolution](agricultural_revolution.md)** happened: humans domesticated animals and plants and subsequently started to create cities. Primitive **writing** can be traced to about 7000 BC to China. **Wheel** was another extremely useful technology humans invented, it is not known exactly when or where it appeared, but it might have been some time after 5000 BC (in Ancient Egypt the Great Pyramid was built still without the knowledge of wheel). Around 4000 BC **history starts with first written records**. Humans learned to smelt and use metals approximately 3300 BC (**Bronze Age**) and 1200 BC (**Iron Age**). **[Abacus](abacus.md)**, one of the simplest devices aiding with computation, was invented roughly around 2500 BC. However people used primitive computation helping tools, such as bone ribs, probably almost from the time they started trading. Babylonians in around 2000 BC were already able to solve some forms of **[quadratic equations](quadratic_equation.md)**. + +After 600 BC the Ancient Greek [philosophy](philosophy.md) starts to develop which would lead to strengthening of rational, [scientific](science.md) thinking and advancement of [logic](logic.md) and [mathematics](math.md). Around 300 BC Euklid wrote his famous *Elements*, a mathematical work that proves theorems from basic [axioms](axiom.md). Around 400 BC **[camera obscura](camera_obscura.md)** was already described in a written text from China where **[gears](gear.md)** also seem to have been invented soon after. Ancient Greeks could communicate over great distances using **Phryctoria**, chains of fire towers placed on mountains that forwarded messages to one another using light. 234 BC Archimedes described the famous [Archimedes screw](archimedes_screw.md) and created an **[algorithm](algorithm.md) for computing the number [pi](pi.md)**. In 2nd century BC the **Antikythera mechanism, the first known [analog](analog.md) computer** is made to predict movement of heavenly bodies. Romans are known to have been great builders, they built many roads and such structures as the Pantheon (126 AD) and aqueducts with the use of their own type of concrete and advanced understanding of physics. + +Around 50 AD Heron of Alexandria, an Egyptian mathematician, created a number of highly sophisticated inventions such as a **vending machine** that accepted coins and gave out holy water, and a cart that could be "programmed" with strings to drive on its own. + +In the 3rd century Chinese mathematician Liu Hui describes operations with **negative numbers**, even though negative numbers have already appeared before. In 600s AD an Indian astronomer Brahmagupta first used the number **[zero](zero.md)** in a systematic way, even though hints on the number zero without deeper understanding of it appeared much earlier. + +Around 1450 a major technological leap known as the **Printing Revolution** occurred. Johannes Gutenberg, a German goldsmith, perfected the process of producing books in large quantities with the movable type press. This made books cheap to publish and buy and contributed to fast spread of information and better education. + +During 1700s a major shift in civilization occurred, called the **[Industrial Revolution](industrial_revolution.md)**. It spanned roughly from 1750 to 1850. It was a process of rapid change in the whole society due to new technological inventions that also led to great changes in how people worked and lived their everyday lives. It started in Great Britain but quickly spread over the whole world. One of the main changes was the **transition from manual manufacturing to factory manufacturing** using machines and sources of energy such as coal. **[Steam engine](steam_engine.md) played a key role**. Work became more organized, society became industrionalized. This revolution became [criticized](ted_kaczynski.md) as it unfortunately opened the door for [capitalism](capitalism.md), made people less independent as everyone had to become a specialized cog in the society machine, at this time people started to measure time in minutes and lead very planned lives. People became enslaved by the system. + +In 1712 Thomas Newcomen invented the first widely used **[steam engine](steam_engine.md)** used mostly for pumping water, even though steam powered machines have already been invented long time ago. The engine was significantly improved by [James Watt](james_watt.md) in 1776. Around 1770 Nicolas-Joseph Cugnot created a first somewhat working **steam-powered [car](car.md)**. In 1784 William Murdoch built a small prototype of a **[steam locomotive](steam_locomotive.md)** which would be perfected over the following decades, leading to a transportation revolution; people would be able to travel far away for work, the world would become smaller which would be the start of **[globalization](globalization.md)**. The railway system would make common people measure time with minute precision. + +In 1792 Clause Chappe invented **[optical telegraph](optical_telegraph.md)**, also called *semaphore*. The system consisted of towers spaced up to by 32 km which forwarded textual messages by arranging big arms on top of the towers to signal specific letters. With this messages between Paris and Strasbourg, i.e. almost 500 km, could be transferred in under half an hour. The system was reserved for the government, however in 1834 it was **[hacked](hack.md)** by two bankers who bribed the tower operators to transmit information about stock market along with the main message (by setting specific positions of arms that otherwise didn't carry any meaning), so that they could get an advantage on the market. + +By 1800 Alessandro Volta invented an **electric battery**. In 1827 André-Marie Ampère publishes a further work shedding light on [electromagnetism](electromagneticm.md). After this **[electric telegraph](telegraph.md)** would be worked on and improved by several people and eventually made to work in practice. In 1821 Michael Faraday invented the **[electromotor](electromotor.md)**. Georg Ohm and especially [James Maxwell](maxwell.md) would subsequently push the knowledge of electricity even further. + +In 1822 [Charles Babbage](charles_babbage.md), a great English mathematician, completed the first version of a manually powered **[digital](digital.md) mechanical computer** called the Difference Engine to help with the computation of [polynomial](polynomial.md) [derivatives](derivative.md) to create mathematical tables used e.g. in navigation. It was met with success and further development was funded by the government, however difficulties of the construction led to never finishing the whole project. In 1837 Babbage designed a new machine, this time a **[Turing complete](turing_complete.md) general purpose computer**, i.e. allowing for programming with branches and loops, a true marvel of technology. It also ended up not being built completely, but it showed a lot about what computers would be, e.g. it had an [assembly](assembly.md)-like programming language, memory etc. For this computer [Ada Lovelace](ada_lovelace.md) would famously write the Bernoulli number algorithm. + +In 1826 or 1827 French inventor Nicéphore Niépce captured **first [photography](photo.md)** that survived until today -- a view from his estate named Le Gras. About an 8 hour exposure was used (some say it may have taken several days). He used a [camera obscura](camera_obscura.md) and asphalt plate that hardened where the light was shining. Earlier cases of photography existed maybe as early as 1717, but they were only short lived. + +**Sound recording** with phonatograph was invented in 1857 in Paris, however it could not be played back at the time -- the first record of human voice made with this technology can nowadays be reconstructed and played back. It wouldn't be until 1878 when people could both record and play back sounds with [Edison](edison.md)'s improvement of phonatograph. A year later, in 1879, Edison also patented the **light bulb**, even though he didn't invent it -- there were at least 20 people who created a light bulb before him. + +Around 1888 so called **war of the currents** was taking place; it was a heated battle between companies and inventors for whether the [alternating](ac.md) or [direct](dc.md) current would become the standard for distribution of electric energy. The main actors were [Thomas Edison](edison.md), a famous iventor and a huge capitalist dick rooting for DC, and George Westinghouse, the promoter of AC. Edison and his friends used false claims and even killing of animals to show that AC was wrong and dangerous, however AC was objectively better, e.g. by its efficiency thanks to using high voltage, and so it ended up winning the war. AC was also supported by the famous genius inventor [Nikola Tesla](tesla.md) who during these times contributed hugely to electric engineering, he e.g. invented an AC motor and Tesla coil and created a system for wireless transmission of electric power. + +Also in 1888 probably the **first [video](video.md)** that survived until today was recorded by Lou Le Prince in Northern England, with a single lens camera. It is a nearly 2 second silent black and white shot of people walking in a garden. + +1895 can roughly be seen as the year of **invention of radio**, specifically wireless [telegraph](telegraph.md), by Italian engineer and inventor Guglielmo Marconi. He built on top of work of others such as [Hertz](hertz.md) and [Tesla](tesla.md) and created a device with which he was able to wirelessly ring a bell at a distance over 2 km. + +On December 17 1903 the Wright brothers famously performed the **first controlled flight of a motor airplane** which they built, in North Carolina. In repeated attempts they flew as far as 61 meters over just a few seconds. + +Around 1915 [Albert Einstein](einstein.md), a German physicist, completed his **[General Theory of Relativity](relativity.md)**, a groundbreaking physics theory that describes the fundamental nature of space and time and gives so far the best description of the Universe since [Newton](newton.md). This would shake the world of science as well as popular culture and would enable advanced technology including nuclear energy, space satellites, high speed computers and many others. + +Int 1907 Lee De Forest invented a practically usable **[vacuum tube](vacuum_tube.md)**, an extremely important part usable in electric devices for example as an amplifier or a switch -- this would enable construction of radios, telephones and later even primitive computers. The invention would lead to the [electronic](electronics.md) revolution. + +In 1924 about 50% of US households own a car. + +October 22 1925 has seen the invention of **[transistor](transistor.md)** by Julius Lilienfeld (Austria-Hungary), a component that would replace vacuum tubes thanks to its better properties, and which would become probably the most essential part of computers. At the time the invention didn't see much attention, it would only become relevant decades later. + +In 1931 [Kurt Gödel](kurt_godel.md), a genius mathematician and logician from Austria-Hunagry (nowadays Czech Republic), published revolutionary papers with his [incompleteness theorems](incompleteness.md) which proved that, simply put, mathematics has fundamental limits and "can't prove everything". This led to [Alan Turing](turing.md)'s publications in 1936 that nowadays stand as the **foundations of [computer science](compsci.md)** -- he introduced a theoretical computer called the **[Turing machine](turing_machine.md)** and with it he proved that computers, no matter how powerful, will never be able to "compute everything". Turing also predicted the importance of computers in the future and has created several [algorithms](algorithm.md) for future computers (such as a [chess](chess.md) playing program). + +In 1938 [Konrad Zuse](konrad_zuse.md), a German engineer, constructed **[Z1](z1.md), the first working electric mechanical [digital](digital.md) partially programmable computer** in his parents' house. It weighted about a ton and wasn't very reliable, but brought huge innovation nevertheless. It was programmed with punched film tapes, however programming was limited, it was NOT [Turing complete](turing_complete.md) and there were only 8 instructions. Z1 ran on a frequency of 1 to 4 Hz and most operations took several clock cycles. It had a 16 word memory and worked with [floating point](float.md) numbers. The original computer was destroyed during the war but it was rebuilt and nowadays can be seen in a Berlin museum. + +In hacker culture the period between 1943 (start of building of the [ENIAC](eniac.md) computer) to about 1955-1960 is known as the **Stone Age of computers** -- as the [Jargon File](jargon_file.md) puts it, the age when electromechanical [dinosaurs](dinosaur.md) ruled the Earth. + +In 1945 the construction of **the first electronic digital fully programmable computer** was completed at University of Pennsylvania as the US Army project. It was named **[ENIAC](eniac.md)** (Electronic Numerical Integrator and Computer). It used 18000 vacuum tubes and 15000 relays, weighted 27 tons and ran on the frequency of 5 KHz. [Punch cards](punch_card.md) were used to program the computer in its machine language; it was [Turing complete](turing_complete.md), i.e. allowed using branches and loops. ENIAC worked with signed ten digit decimal numbers. + +Among hackers the period between 1961 to 1971 is known as the **Iron Age of computers**. The period spans time since the first minicomputer ([PDP1](pdp1.md)) to the first microprocessor ([Intel 4004](intel4004.md)). This would be follow by so called *elder days*. + +On July 20 1969 **first men landed on the Moon** (Neil Armstrong and Edwin Aldrin) during the USA Apollo 11 mission. This tremendous achievement is very much attributed to the cold war in which USA and Soviet Union raced in space exploration. The landing was achieved with the help of a relatively simple on-board computer: Apollo Guidance Computer clocked at 2 MHz, had 4 KiB of [RAM](ram.md) and about 70 KB [ROM](rom.md). The assembly source code of its software is nowadays available online. + +Shortly after, on 29 October 1969, another historical event would happen that could be seen as the start of perhaps the greatest technological revolution yet, the **start of the [Internet](internet.md)**. The first letter, "L", was sent over a long distance via **[ARPANET](arpanet.md)**, a new experimental computer [packet switching](packet_switching.md) network without a central node developed by US defense department (they intended to send "LOGIN" but the system crashed). The network would start to grow and gain new nodes, at first mostly universities. The network would become the Internet. + +1st January 1970 is nowadays set as the start of the **Unix epoch**. It is the date from which [Unix time](unix_time.md) is counted. During this time the **[Unix](unix.md) [operating system](os.md), one of the most influential operating systems** was being developed at [Bell Labs](bell_labs.md), mainly by [Ken Thompson](ken_thompson.md) and [Dennis Ritchie](dennis_ritchie.md). Along the way they developed the famous [Unix philosophy](unix_philosophy.md) and also the **[C programming language](c.md)**, perhaps the most influential programming language in history. Unix and C would shape the technology far into the future, a whole family of operating systems called Unix-like would be developed and regarded as the best operating systems thanks to their minimalist design. + +By 1977 ARPANET had about 60 nodes. + +In 1983 **[Richard Stallman](rms.md) announced his [GNU](gnu.md) project and invented [free (as in freedom) software](free_software.md)**, a kind of software that is freely shared and developed by the people so as to respect the users' freedom. This kind of ethical software stands opposed to the [proprietary](proprietary.md) corporate software, it would lead to creation of some of the most important software and to a whole revolution in software development and its licensing, it would spark the creation of other movements striving for keeping ethics in the information age. + +August 12 1981 would see the released of **[IBM PC](ibm_pc.md)**, a person computer based on open, modular architecture that would immediately be very successful and would become the [de-facto standard](de_facto_standard.md) of personal computers. IBM PC was the first of the kind of desktop computers we have today. It had 4.77 MHz [Intel 8088](intel.md) CPU, 16 kB of [RAM](ram.md) and used 5.25" [floppy disks](floppy.md). + +On November 20 1985 the first version of **[Windows](windows.md) operating system** was sadly released by [Microsoft](microsoft.md). These systems would become the mainstream desktop operating systems despite their horrible design and they would unfortunately establish so called [Windows philosophy](windows_philosophy.md) that would irreversibly corrupt other mainstream technology. + +At the beginning of 1991 [Tim Berners-Lee](berners_lee.md) created the **[World Wide Web](www.md)**, a network of interlinked pages on the Internet. This marks another huge step in the Internet revolution, the Web would become the primary Internet service and the greatest software platform for publishing any kind of information faster and cheaper than ever before. It is what would popularize the Internet and bring it to the masses. + +On 25 August 1991 **[Linus Torvalds](linus_torvalds.md) announced [Linux](linux.md)**, his project for a completely free as in freedom Unix-like [operating system](os.md). Linux would become part of [GNU](gnu.md) and later one of the biggest and most successful software projects in history. It would end up powering Internet servers and supercomputers as well as desktop computers of a great number of users. Linux proved that free software works and surpasses proprietary systems. + +After this very recent history follows, it's hard to judge which recent events will be of historical significance much later. 1990s have seen a huge growth of computer power, video [games](game.md) such as [Doom](doom.md) led to development of [GPU](gpu.md)s and high quality computer graphics along with a wide adoption of computers by common people, which in turn helped the further growth of Internet. During the 90s we've also seen the rise of the [open source movement](open_source.md). Shortly after 2000 [Lawrence Lessig](lessig.md) founded [Creative Commons](creative_commons.md), an organization that came hand in hand with the [free culture](free_culture.md) movement inspired by the [free software movement](free_software.md). At this point over 50% of US households had a computer. Cell phones became a commonly owned item and after about 2005 so called "[smart](smart.md) phones" and other "smart" devices replaced them as a universal communication device capable of connecting to the Internet. Before 2020 we've seen a huge advancement in [neural network](neural_network.md) [Artificial Intelligence](ai.md) which will likely be the topic of the future. [Quantum computers](quantum.md) are being highly researched with already existing primitive prototypes; this will also likely be very important in the following years. Besides AI there has appeared a great interest and development of [virtual reality](vr.md), [drones](drone.md), electromobiles, robotic Mars exploration and others. However the society and technology has generally seen a decadence after 2010, [capitalism](capitalism.md) has pushed technology to become hostile and highly [abusive to users](capitalist_software.md), extreme [bloat](bloat.md) of technology causes highly inefficient, extremely expensive and unreliable technology. In addition society is dealing with a lot of serious issues such as the [global warming](global_warming.md) and many people are foreseeing a [collapse of society](collapse.md). + +## Recent History + +TODO: more detailed history since the start of Unix time \ No newline at end of file diff --git a/holy_war.md b/holy_war.md new file mode 100644 index 0000000..50f10f7 --- /dev/null +++ b/holy_war.md @@ -0,0 +1,25 @@ +# Holy War + +Holy war is a perpetual passionate argument over usually two possible choices. This separates people into almost religious teams. In holy wars people tend to defend whichever side they stand on to the death and can get emotional when discussing the topic. Some examples of holy wars are (in brackets indicated the side taken by [LRS](lrs.md)): + +- **[tabs](tab.md) vs spaces** (spaces) +- **[vim](vim.md) vs [emacs](emacs.md)** (vim) +- **[free software](free_software.md) vs [open source](open_source.md)** (free software) +- **[Chrome](chrome.md) vs [Firefox](firefox.md)**, and other browsers +- **[Java](java.md) vs [C++](cpp.md)**, and other [programming languages](programming_language.md) ([C](c.md)) +- **[curly brackets on separate lines or not](programming_style.md)**, and other [style](programming_style.md) choices +- **[KDE](kde.md) vs [GNOME](gnome.md)** (neither, both are [bloat](bloat.md)) +- **pronunciation of [gif](gif.md) as "gif" vs "jif"** +- **[Windows](windows.md) vs [Mac](mac.md)** (neither, this is a normie holy war) +- **[GNU](gnu.md)/Linux vs [Linux](linux.md)** +- **[copyleft](copyleft.md) vs [permissive](permissive.md)** (permissive, [public domain](public_domain.md)) +- **[AMD](amd.md) vs [Intel](intel.md)** +- **[AMD](amd.md) vs [NVidia](nvidia.md)** +- **"Linux" [distros](distro.md)** +- **[window managers](wm.md)** +- **[Metric](metric_system.md) vs [Imperial](imperial_units.md) units** (metric) +- **Star Trek vs Star Wars**, and other franchise wars +- **Pepsi vs Coca Cola**, and other brand wars +- **[Quake](quake.md) vs Unreal Tournament**, and similar gaming shit + +Things like cats vs dogs or sci-fi vs fantasy may or may not be a holy war, there is a bit of a doubt in the fact that one can easily like both and/or not be such a diehard fan of one or the other. A subject of holy war probably has to be something that doesn't allow too much of this. \ No newline at end of file diff --git a/how_to.md b/how_to.md new file mode 100644 index 0000000..e45b258 --- /dev/null +++ b/how_to.md @@ -0,0 +1,25 @@ +# How To + +WELCOME TRAVELER + +{ Don't hesitate to contact me. ~drummyfish } + +Are you tired of [bloat](bloat.md) and can't stand [shitty](shit.md) software like [Windows](windows.md) anymore? Do you hate [capitalism](capitalism.md)? Do you also hate the [fascist alternatives](tranny_software.md) you're being offered? Do you just want to create a genuinely good [bullshitless](bullshit.md) technology that would help all people? Do you just want to share knowledge freely without [censorship](censorship.md)? You have come to the right place. + +Firstly let us welcome you, no matter who you are, no matter your political opinions, your past and your skills, we are glad to have you here. Remember, you don't have to be a programmer to help and enjoy LRS. LRS is a lifestyle, a philosophy. Whether you are a programmer, artist, educator or just someone passing by, you are welcome, you may enjoy our culture and its fruit and if you want, you can help enrich it. + +If you don't know how to start, here are some basic steps: + +1. **Learn about the most essential topics and concepts**, mainly [free software](free_software.md), [open-source](open_source.md), [bloat](bloat.md), [kiss](kiss.md), [capitalist_software](capitalist_software.md), [suckless](suckless.md), [LRS](lrs.md) and [type A/B fail](fail_ab.md). You will also need to open up your mind and re-learn some toxic concepts you've been taught by the system, e.g. [we do NOT fight anything](fight_culture.md), we do NOT create any [heroes](hero.md) or "leaders" (we follow ideas, not people), [work](work.md) is bad, older is better than "[modern](modern.md)". +2. **Install [GNU](gnu.md)/[Linux](linux.md)** operating system to free yourself from shit like [Windows](windows.md) and [Mac](mac.md) (you can also consider [BSD](bsd.md) but you're probably too noob for that). Do NOT try to switch to "Linux" right away if it's your first time, it's almost impossible, you want to just install "Linux" as [dual boot](dual_boot.md) (alongside your main OS) or on another computer (easier). This way you'll be using both operating systems, slowly getting more comfortable with "Linux" and eventually you'll find yourself uninstalling Windows altogether. You can also just try "Linux" in a [virtual machine](vm.md), from a live CD/flash drive or you can buy something with "Linux" preinstalled like [Raspberry Pi](raspberry.md). **Which "Linux" to install?** There are many options and as a noob you don't have to go hardcore right away, just install any [distro](distro.md) that [just werks](just_werks.md) (don't listen to people who tell you to install [Gentoo](gentoo.md) tho). You can try these: + - [Devuan](devuan.md): Nice, [LRS](lrs.md) approved distro that respects your [freedom](free_software.md) that just works, is easy to install and is actually nice. Good for any skill level. + - [Debian](debian.md): Like Devuan but uses the evil [systemd](systemd.md) which doesn't have to bother you at this point. Try Debian if Devuan doesn't work for any reason. + - [Mint](mint.md): More noob, [bloated](bloat.md) and mainstream distro that only mildly cares about freedom, but is extremely easy and works almost everywhere. Try this if Debian didn't work for you. + - [Ubuntu](ubuntu.md): Kind of like Mint, try it if Mint didn't work. +2. **Learn a bit of [command line](cli.md)** and **start using [FOSS](foss.md) alternatives** to you [proprietary](proprietary.md) programs, e.g. [GIMP](gimp.md) instead of Photoshop, [LibreOffice](libreoffice.md) instead of MS Office etc. Find and start using alternatives to harmful web services, e.g. [invidious](invidious.md) or [Peertube](peertube.md) in relation to [YouTube](youtube.md). +3. If you want to program [LRS](lrs.md), **learn [C](c.md)** (see the [tutorial](c_tutorial.md)). Also learn a bit of [POSIX shell](posix_shell.md) and maybe some mainstream [scripting](script.md) language (can be even a bloated one like [Python](python.md)). Learn about [licensing](license.md) and [version control](vcs.md) ([git](git.md)). +4. Optionally make your own minimal [website](web.md) to help reshare ideas you like (static [HTML](html.md) site without [JavaScript](javascript.md)). This is very easy, and the site can be hosted for free e.g. on [git](git.md) hosting sites like Codeberg or GitLab. Get in touch with us. +5. Finally start creating something: either programs or other stuff like [free art](free_culture.md), educational materials etc. Don't forget to get in touch. +6. profit??? + +Would you like to create [LRS](lrs.md) but don't have enough spare time/money to make this possible? Read about [making living](living.md) with LRS. diff --git a/hw.md b/hw.md new file mode 100644 index 0000000..a3dd6e7 --- /dev/null +++ b/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. Anything you can smash when the machine pisses you off. \ No newline at end of file diff --git a/information.md b/information.md new file mode 100644 index 0000000..63a544b --- /dev/null +++ b/information.md @@ -0,0 +1,9 @@ +# Information + +*Information wants to be free.* + +Information is knowledge that can be used for making decisions. Information is interpreted [data](data.md), i.e. while data itself may not give us any information, e.g. if they're encrypted and we don't know the key or if we simply don't know what the data signifies, information emerges once we make sense of the data. Information is contained in books, on the [Internet](internet.md), in nature, and we access it through our senses. [Computers](computer.md) can be seen as machines for processing information and since the computer revolution information has become the focus of our society; we often encounter terms such as [information technology](it.md), informatics, information war etc. [Information theory](information_theory.md) is a [scientific field](science.md) studying information. + +**Information wants to be free**, i.e. it is free naturally unless we decide to limit its spread with [shit](shit.md) like [intellectual property](intellectual_property.md) laws. What does "free" mean? It is the miraculous property of information that allows us to duplicate information basically without any cost. Once we have certain information, we may share it with others without having to give up our own knowledge of the information. A file on a computer can be copied to another computer without deleting the file on the original computer. This is unlike with physical products which if we give to someone, we lose them ourselves. Imagine if you could make a piece of bread and then duplicate it infinitely for the whole world -- information works like this! We see it as a crime to want to restrict such a miracle. We may also very nicely store information in our heads. For all this information is [beautiful](beauty.md). It is sometimes discussed whether information is created or discovered -- if a mathematician invents an equation, is it his creation or simply his discovery of something that belongs to the nature? This question isn't so important because whatever terms we use, we at [LRS](lrs.md) decide to create, spread and freely share information without limiting it in any way. + +In [computer science](compsci.md) the basic unit of information amount is 1 **[bit](bit.md)** (for *binary digit*), also known as [shannon](shannon.md). It represents a choice of two possible options, for example an answer to a *yes/no* question, or one of two [binary](binary.md) digits: 0 or 1. From this we derive higher units such as [bytes](byte.md) (8 bits), [kilobytes](memory_units.md) (1000 bytes) etc. Other units of information include [nat](nat.md) or [hart](hart.md). With enough bits we can encode any information including text, sounds and images. For this we invent various [formats](file_format.md) and encodings with different properties: some encodings may for example contain [redundant](redundancy.md) data to ensure the encoded information is preserved even if the data is partially lost. Some encodings may try to hide the contained information (see [encryption](encryption.md), [obfuscation](obfuscation.md), [steganography](steganography.md)). For processing information we create [algorithms](algorithm.md). We store information in computer [memory](memory.md) or on storage media such as [CDs](cd.md), or with traditional potentially [analog](analog.md) media such as photographs or books. The opposite measure of information is **[entropy](entropy.md)**; it is measured in same units but says how much information is missing rather than what is present. \ No newline at end of file diff --git a/intellectual_property.md b/intellectual_property.md new file mode 100644 index 0000000..91e7e0f --- /dev/null +++ b/intellectual_property.md @@ -0,0 +1,9 @@ +# Intellectual Property + +Intellectual property (IP, not to be confused with [IP address](ip_address.md)) is a toxic [capitalist](capitalism.md) idea that says that people should be able to own [information](information.md) (such as ideas or songs) and that it should be treated in ways very similar to physical property. For example [patents](patent.md) are one type of intellectual property which allow an inventor of some idea to *own* that idea and be able to limit its use and charge money to people using that idea. [Copyright](copyright.md) is probably the most harmful of IP today, and along with patents the most relevant one in the area of technology. However, IP encompasses many other subtypes of this kind of "property" such as [trademarks](trademark.md), trade dress, plant varieties etc. + +IP exists to benefit corporations, it artificially limits the natural [freedom of information](information_freedom.md) and tries to eliminate freedom and competition, it fuels consumerism (for example a company can force deletion of old version of its program in order to force users to buy the new version), it helps keep malicious features in programs (by forbidding any study and modifications) and forces reinventing wheels which is extremely energy and resource wasting. Without IP, everyone would be able to study, share, improve and remix and combine existing technology and art. + +Many people protest against the idea of IP -- either wanting to abandon the idea completely, as [we](lrs.md) do, or at least arguing for great relaxation the insanely strict and aggressive forms that destroy our society. Movements such as [free software](free_software.md) and [free culture](free_culture.md) have come into existence in protest of IP laws. Of course, capitalists don't give a shit. It can be expected the IP [cancer](cancer.md) will be reaching even more extreme forms very soon, for example it will be perpetual and encompassing such things as mere though (thoughts will be monitored and people will be charged for thinking about ideas owned by corporations). + +It must be noted that as of 2020 **it is not possible to avoid the IP shenanigans**. Even though we can eliminate most of the harmful stuff (for now) with [licenses](license.md) and [waivers](waiver.md), there are many things that may be impossible to address or posing considerable dangers, e.g. trademark or patent troll attacks. In some countries (US) it is illegal to make free programs that try to circumvent [DRM](drm.md). Some countries make it explicitly impossible to e.g. waive copyright. It is impossible to safely check whether your creation violates on someone else's IP. There exists [shit](shit.md) such as [moral rights](moral_rights.md) that may exist even if copyright doesn't apply. \ No newline at end of file diff --git a/interesting.md b/interesting.md new file mode 100644 index 0000000..45b1672 --- /dev/null +++ b/interesting.md @@ -0,0 +1,7 @@ +# Interesting + +This is a great answer to anything, if someone tells you something you don't understand or something you think is [shit](shit.md) and you don't know what to say, you just say "interesting". + +**All numbers are interesting**: there is a [fun](fun.md) [proof](proof.md) by contradiction of this. Suppose there exists a set of uninteresting numbers; then the greatest of these numbers is interesting by being the greatest uninteresting number -- we've arrived at contradiction, therefore a set of uninteresting numbers cannot exist. + +TODO: just list some interesting shit here \ No newline at end of file diff --git a/internet.md b/internet.md new file mode 100644 index 0000000..62065dc --- /dev/null +++ b/internet.md @@ -0,0 +1,25 @@ +# Internet + +Internet is the grand, [decentralized](decentralization.md) global network of interconnected [computer](computer.md) [networks](network.md) that allows advanced, cheap, practically instantaneous intercommunication of people and computers and sharing of large amounts of data and information. Over just a few decades since its birth in 1970s it changed the society tremendously, shifted it to the information age and stands as possibly the greatest technological invention of our society. It is a platform for many services and applications such as the [web](www.md), [e-mail](email.md), [internet of things](iot.md), [torrents](torrent.md), phone calls, video streaming, multiplayer [games](game.md) etc. + +Internet is built on top of [protocols](protocol.md) (such as [IP](ip.md), [HTTP](http.md) or [SMTP](smtp.md)), standards, organizations (such as [ICANN](icann.md), [IANA](iana.md) or [W3C](w3c.md)) and infrastructure (undersea cables, satellites, [routers](routers.md), ...) that all together work to create a great network based on **[packet switching](packet_switching.md)**, i.e. a method of transferring digital data by breaking them down into small [packets](packet.md) which independently travel to their destination (contrast this to [circuit switching](circuit_switching.md)). The key feature of the Internet is its **[decentralization](decentralization.md)**, i.e. the attribute of having no central node or authority so that it cannot easily be destroyed or taken control over -- this is by design, the Internet evolved from [ARPANET](arpanet.md), a project of the US defense department. Nevertheless there are parties constantly trying to seize at least partial control of the Internet such as governments (e.g. China and its [Great Firewall](great_firewall.md), [EU](eu.md) with its "anti-pedophile" chat monitoring laws etc.) and corporations (by creating centralized services such as [social networks](social_network.md)). Some are warning of possible de-globalization of the Internet that some parties are trying to carry out, which would turn the Internet into so called [splinternet](splinternet.md). + +Access to the Internet is offered by [ISPs](isp.md) (internet service providers) but it's pretty easy to connect to the Internet even for free, e.g. via free [wifis](wifi.md) in public places, or in libraries. By 2020 more than half of world's population had access to the Internet -- most people in the first world have practically constant, unlimited access to it via their [smartphones](smartphone.md), and even in [poor countries](shithole.md) [capitalism](capitalism.md) makes these devices along with Internet access cheap as people constantly carrying around devices that display [ads](ad.md) and spy on them is what allows their easy exploitation. + +The following are some stats about the Internet as of 2022: there are over 5 billion users world-wide (more than half of them from Asia and mostly young people) and over 50 billion individual devices connected, about 2 billion websites (over 60% in [English](english.md)) on the web, hundreds of billions of emails are sent every day, average connection speed is 24 Mbps, there are over 370 million registered [domain](domain.md) names (most popular [TLD](tld.md) is .com), [Google](google.com) performs about 7 billion web searches daily (over 90% of all search engines). + +## History + +*see also [history](history.md)* + +TODO + +## See Also + +- [JWICS](jwics.md), [SIPRNet](siprnet.md), [NIPRNet](niprnet.md) (secret/military networks) +- [Smol Internet](smol_internet.md) +- [World Wide Web](www.md) +- [splinternet](splinternet.md) +- [Kwangmyong](kwangmyong.md) (North Korean intranet) +- [SNET](snet.md) (large computer network on Cuba) +- [interplanetary internet](interplanetary_internet.md) \ No newline at end of file diff --git a/interplanetary_internet.md b/interplanetary_internet.md new file mode 100644 index 0000000..8b1538a --- /dev/null +++ b/interplanetary_internet.md @@ -0,0 +1,11 @@ +# Interplanetary Internet + +Interplanetary Internet is at this time still hypothetical extension of the [Internet](internet.md) to multiple planets. As mankind is getting closer to start living on other planets and bodies such as [Mars](mars.md) and [Moon](moon.md), we have to start thinking about the challenges of creating a communication network between all of them. The greatest challenge is posed by the vast distances that increase the communication delay (which arises due to the limited [speed of light](speed_of_light.md)) and make errors such as [packet loss](packet_loss.md) much more painful. Two-way communication (i.e. request-response) to Moon and Mars can take even 2 seconds and 40 minutes respectively. Also things like planet motions, eclipses etc. pose problems to solve. + +We can see that e.g. [real time](real_time.md) [Earth](earth.md)-Mars communication (e.g. [chat](chat.md) or videocalls) are physically impossible, so not only do we have to create new [network](network.md) [protocols](protocol.md) that minimize the there-and-back communication (things such as [handshakes](handshakes.md) are out of question) and implement great [redundancy](redundancy.md) for reliable recovery from loss of data traveling through space, we also need to design **new [user interfaces](ui.md)** and communication paradigms, i.e. we probably need to create a new messaging software for "interplanetary chat" that will for example show the earliest time at which the sender can expect an answer etc. [Interesting](interesting.md) shit to think about. + +{ TFW no [Xonotic](xonotic.md) deathmatches with our Moon friends :( ~drummyfish } + +For things like [Web](web.md), each planet would likely want to have its own "subweb" (distinguished e.g. by [TLDs](tld.md)) and [caches](cache.md) of other planets' webs for quick access. This way a man on Mars wouldn't have to wait 40 minutes for downloading a webpage from the Earh web but could immediately access that webpage's slightly delayed version, which is of course much better. + +Research into this has already been ongoing for some time. InterPlaNet is a protocol developed by [NASA](nasa.md) and others to be the basis for interplanetary Internet. \ No newline at end of file diff --git a/ioccc.md b/ioccc.md new file mode 100644 index 0000000..8c1cd73 --- /dev/null +++ b/ioccc.md @@ -0,0 +1,30 @@ +# International Obfuscated C Code Contest + +The International Obfuscated C Code Contest (IOCCC for short) is an annual online contest in making the most creatively [obfuscated](obfuscation.md) programs in [C](c.md). It's kind of a "just for [fun](fun.md)" thing but similarly to [esoteric languages](esolang.md) there's an element of art and clever hacking that carries a great value. While the [productivity freaks](productivity_cult.md) will argue this is just a waste of time, the true programmer appreciates the depth of knowledge and creative thinking needed to develop a beautifully obfuscated program. The contest runs since 1984 and was started by Landon Curt Noll and Larry Bassel. + +Unfortunately some [shit](shit.md) is flying around IOCCC too, for example confusing licensing -- having a [CC-BY-SA](cc_by_sa.md) license in website footer and explicitly prohibiting commercial use in the text, WTF? Also the team started to use [Microshit](microsoft.md)'s [GitHub](github.md). They also allow latest [capitalist](capitalist_software.md) C standards, but hey, this is a contest focused on ugly C, so perhaps it makes sense. + +Hacking the rules of the contest is also encouraged and there is an extra award for "worst abuse of the rules". + +Some common ideas employed in the programs include: + +- formatting source code as [ASCII art](ascii_art.md) +- misleading identifiers and comments +- extreme [macro](macro.md) and [preprocessor](preprocessor.md) abuse +- abuse of compiler flags +- different behavior under different C standards +- doing simple things the hard way, e.g. by avoiding loops +- including weird files like `/dev/tty` or recursively including itself +- [code golfing](code_golf.md) +- weird stuff like the main function [recursion](recursion.md) or even using it as a signal handler :) + +And let us also mention a few winning entries: + +- program whose source code is taken from its file name (using `__FILE__`) +- [ray tracer](ray_tracing.md) in < 30 LOC formatted as ASCII art +- operating system with multi-tasking, GUI and filesystem support +- neural [machine learning](machine_learning.md) on text in < 4KB +- program printing "hello world" with error messages during compilation +- [X11](x11.md) Minecraft-like game +- [web browser](web_browser.md) +- self-replicating programs diff --git a/island.md b/island.md new file mode 100644 index 0000000..09f19ee --- /dev/null +++ b/island.md @@ -0,0 +1,28 @@ +# Welcome to the Island! + +This is the freedom island where we live! Feel free to build your house on any free spot. Planting trees and making landscape works are allowed too. + + ``` + ____ + __X/ '-X_ + '-~-. ____./ i X '-__ + __.-' /' XX i \_ '-~-. + ___,--' x x_/' Xi O '-_ + ___/ __-'' X X( i x '-._ + _-' i i [T] xX x ''-._ + ( O : ixx \ + '- \_ ) + ''-__ '. ____ ____-' + ''--___ [D] ; x \/ ''---' + ''--__ ;xX \__ + \ iX ''-__ + '-~-. / i O '--__ + | i \ + '-~-. \__ ) +'-~-. ''--___ ____/ + ''--__________--'' + +D: drummyfish's house + +T: The Temple, it has nice view of the sea and we go meditate here, it's a nice walk. + ``` \ No newline at end of file diff --git a/jargon_file.md b/jargon_file.md new file mode 100644 index 0000000..5c9ab3d --- /dev/null +++ b/jargon_file.md @@ -0,0 +1,7 @@ +# Jargon File + +Jargon File (also Hacker's Dictionary) is a computer [hacker](hacking.md) dictionary/compendium that's been written and updated by a number of prominent hackers, such as [Richard Stallman](rms.md) and [Erik S Raymond](esr.md), since 1970. It is a greatly important part of hacker culture and has also partly inspired this very wiki. + +It informally states that it's in the [public domain](pd.md) and some people have successfully published it commercially, however there is no standard [waiver](waiver.md) or [license](license.md) -- maybe because such waivers didn't really exist at the time it was started -- and so we have to suppose it is NOT formally [free as in freedom](free_culture.md). Nevertheless it is freely accessible e.g. at [Project Gutenberg](gutenberg.md) and no one will bother you if you share it around... we just wouldn't recommend treating it as true public domain. + +It is pretty nicely written with great amount of humor and good old political incorrectness, you can e.g. find the definition of terms such as *[rape](rape.md)* and *clit mouse*. Some other nice terms include *notwork* (non-functioning [network](network.md)), [Internet Exploiter](internet_explorer.md), *binary four* (giving a finger in binary) or *Maggotbox* ([Macintosh](mac.md)). At the beginning the book gives some theory about how the hacker terms are formed (overgeneralization, comparatives etc.). \ No newline at end of file diff --git a/java.md b/java.md new file mode 100644 index 0000000..57bc78e --- /dev/null +++ b/java.md @@ -0,0 +1,9 @@ +# Java + +*Unfortunately 3 billion devices run Java.* + +Java (not to be confused with [JavaScript](js.md)) is a highly [bloated](bloat.md), inefficient, "[programming language](programming_language.md)" that's sadly kind of popular. It is compiled to [bytecode](bytecode.md) and therefore "[platform independent](platform_independence.md)" (as long as the platform has a lot of resources to waste on running Java [virtual machine](vm.md)). Some of the features of Java include [bloat](bloat.md), slow loading, slow running, [supporting capitalism](capitalist_software.md), forced and unavoidable [object obsession](oop.md) and the necessity to create a billion of files to write even a simple program. + +Avoid this [shit](shit.md). + +{ I've met retards who seriously think Java is more portable than [C](c.md) lol. I wanna [suicide](suicide.md) myself. ~drummyfish } \ No newline at end of file diff --git a/javascript.md b/javascript.md new file mode 100644 index 0000000..7890c81 --- /dev/null +++ b/javascript.md @@ -0,0 +1,3 @@ +# JavaScript + +JavaScript (not to be confused with completely unrelated [Java](java.md) language) is a [bloated](bloat.md) [programming language](programming_language.md) used mainly on the [web](www.md). \ No newline at end of file diff --git a/john_carmack.md b/john_carmack.md new file mode 100644 index 0000000..6eb5c0e --- /dev/null +++ b/john_carmack.md @@ -0,0 +1,9 @@ +# 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](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. + +In 2013 he sadly sold his soul to [Facebook](facebook.md) to work on [VR](vr.md) (in a Facebook owned company Oculus). diff --git a/jokes.md b/jokes.md new file mode 100644 index 0000000..1bc8bfc --- /dev/null +++ b/jokes.md @@ -0,0 +1,31 @@ +# Jokes + +Here you can shitpost your jokes that are somehow related to this wiki's topic. Just watch out for [copyright](copyright.md) (no copy-pasting jokes from other sites)! + +Please do NOT post lame "big-bang-theory" jokes like *sudo make sandwich* or *there are 10 types of people*. + +{ Many of the jokes are original, some are shamelessly pulled from other sites and reworded. I don't believe [copyright](copyright.md) can apply if the expression of a joke is different, ideas can't be copyrighted. Also the exact origins of jokes are difficult to track so it's probably a kind of folklore. ~drummyfish } + +- [C++](cpp.md) +- What's the worst kind of [lag](lag.md)? Gulag. +- Ingame chat: "What's the country in the middle of north Africa?" [{BANNED}](niger.md) +- What sound does an angry [C](c.md) programmer make? ARGCCCC ARGVVVVVVVV +- I have a mentally ill friend who tried to design the worst [operating system](os.md) on purpose. It boots for at least 10 minutes, then it changes the user's desktop background to random ads and it randomly crashes to make the user angry. He recently told me he is getting sued by [Microsoft](microsoft.md) for violating their look and feel. +- Do you use [Emacs](emacs.md)? No, I already have an [operating system](os.md). +- `alias bitch=sudo` +- a joke for minimalists: +- Political activists walk into a bar. [Pseudoleftist](pseudoleft) tells his friends: "hey guys, how about we have oppressive rulers and call them a [government](government.md)?" Capitalist says: "well no, let's have oppressive rulers and call them [corporations](corporation.md)". [Liberal](liberal.md) replies: "Why not both?". Monarchist goes: "no, it's all wrong, let's have oppressive rulers and call them Kings." To this pseudo communist says: "that's just shit, let's have oppressive rulers and call them the [proletariat](proletariat.md)". Then [anarcho pacifist](anpac.md) turns to them and says: "Hmmm, how about we don't have any oppressive rulers?". They lynch him. +- There are a lot of jokes at https://jcdverha.home.xs4all.nl/scijokes/. +- Does the invisible hand exist in the [free market](free_market.md)? Maybe, but if so then all it's doing is masturbating. +- 90% of statistics are fake. +- When will they remove the *[touch](touch.md)* and *[kill](kill.md)* commands from [Unix](unix.md)? Probably when they rename *[man pages](man_page.md)* to *person pages*. +- If [law](law.md) was viewed as a programming code, it would be historically the worst case of [bloated](bloat.md) [spaghetti code](spaghetti_code.md) littered with [magic constants](magic_constant.md), undefined symbols and dead code, which is additionally deployed silently and without any [testing](testing.md). Yet it's the most important algorithm of our society. +- At the beginning there was [machine code](machine_code.md). Then they added [assembly](assembly.md) on top of it to make it more comfortable. To make programs portable they created an [operating system](os.md) and a layer of [syscalls](syscall.md). Except it didn't work because other people made other operating systems with different syscalls. So to try to make it portable again they created a high-level language [compiler](compiler.md) on top of it. To make it yet more comfortable they created yet a higher level language and made a [transpiler](transpiler.md) to the lower level language. To make building more platform independent and comfortable they created [makefiles](makefile.md) on top of it. However, more jobs were needed so they created [CMake](cmake.md) on top of makefiles, just in case. It seems like CMake nowadays seems too low level so a new layer will be needed above all the meta-meta-meta build systems. I wonder how high of a tower we can make, maybe they're just trying to get a Guinness world record for the greatest bullshit sandwich in history. +- How to install a package on [Debian](debian.md)? I don't know, but on my [Arch](arch.md) it's done with `pacman`. +- Difference between a beginner and pro programmer? Pro programmer fails in a much more sophisticated manner. +- What's a [computer](computer.md)? A device that can make a hundred million mistakes per second. +- Boss: "We're going to need to store additional information about gender of all 1600 people in our database." Me: "OK that's only 200 extra bytes.". Diversity department: "You're fired." + +## See Also + +- [LMAO](lmao.md) diff --git a/julia_set.md b/julia_set.md new file mode 100644 index 0000000..9d326dd --- /dev/null +++ b/julia_set.md @@ -0,0 +1,92 @@ +# Julia Set + +TODO + +``` + ___________________________________________________________________ +| Julia Set for -0.34 - 0.63i :. | +| ..':. .. | +| '':.:''' .. .. | +| :':::.. '' ::. .. :.' | +| '::::. :: :::. . :.'': . | +| ......':::.::.:: ...::.:::.::.. . | +| :::::::::':'.':.::::::::':.::''::.. | +| . '::::'':':::':'':::' ::'' ' | +| ':. . .. ..::'::':::. ' :' | +| . :: :' ::..::::::: ::: ':::.. ' | +| :':::: '.:::::::::'.::::' '' | +| .:::::' ':::::::::. ''::::'. | +| :. '::::'.::::::::::. '::':.' | +| . . '':::. ::: ::::::::'::' .:::: | +| :':. ... ':::.:':::'' ' ' ''. | +| ..:: .::::::...':.::::::.: | +| :::...' '.::::::::'.: .:.:'::::'': | +| '' :. : .:''':' :::'::':::. ' ' | +| '::'': '' '::: ::''::::: | +| :: ':. '' '':::.: | +| ' ' ' ::.:.'.' | +| ::' | +| ' | +|___________________________________________________________________| +``` + + +# Code + +The following code is a simple [C](c.md) program that renders given Julia set into terminal (for demonstrative purposes, it isn't efficient or do any [antialiasing](antialiasing.md)). + +``` +#include + +#define ROWS 30 +#define COLS 70 +#define SET_X -0.36 // Julia set parameter +#define SET_Y -0.62 // Julia set parameter +#define FROM_X -1.5 +#define FROM_Y 1.0 +#define STEP (3.0 / ((double) COLS)) + +unsigned int julia(double x, double y) +{ + double cx = x, cy = y, tmp; + + for (int i = 0; i < 1000; ++i) + { + tmp = cx * cx - cy * cy + SET_X; + cy = 2 * cx * cy + SET_Y; + cx = tmp; + + if (cx * cx * cy * cy > 10000000000) + return 0; + } + + return 1; +} + +int main(void) +{ + double cx, cy = FROM_Y; + + for (int y = 0; y < ROWS; ++y) + { + cx = FROM_X; + + for (int x = 0; x < COLS; ++x) + { + unsigned int point = + julia(cx,cy) + (julia(cx,cy + STEP) * 2); + + putchar(point == 3 ? ':' : (point == 2 ? '\'' : + (point == 1 ? '.' : ' '))); + + cx += STEP; + } + + putchar('\n'); + + cy -= 2 * STEP; + } + + return 0; +} +``` diff --git a/just_werks.md b/just_werks.md new file mode 100644 index 0000000..2e239e6 --- /dev/null +++ b/just_werks.md @@ -0,0 +1,17 @@ +# Just Werks + +"Just werks" (for "just works" if that's not clear) is a phrase used by [noobs](noob.md) to justify using a piece of technology while completely neglecting any other deeper and/or long term consequences. A noob doesn't think about technology further than how it can immediately perform some task for him. + +This phrase is widely used on [4chan](4chan.md)/g, it probably originated there. + +The "just werks" philosophy completely ignores questions such as: + +- **Is there anything better in the long run?** A normie will always prefer a shitty software he can immediately use to a software that would take one day to learn and that would make the task many times easier, comfortable, cheaper etc. +- **Is this affecting my freedom?** A normie doesn't realize that by using proprietary or bloated program will limit the number of people who can maintain, fix and improve his software. +- **Is this affecting my security?** Of course noobs are completely oblivious to the fact that certain types of technology are just plain spyware. +- **How is this affecting my computing in a wider sense?** A normie won't even think about such thing as that using some proprietary format will likely immediately close the door to working with it with a FOSS program, or that installing a specific OS will limit what programs he can run. +- **Am I becoming a slave to this technology?** By adopting something proprietary and/or bloated I am slowly becoming dependent on an ecosystem that's completely under control of some corporation, an ecosystem that can quickly change for the worse or even disappear completely. +- **Am I supporting evil?** E.g. by paying to a corporation, letting someone collect data in the background, promoting a bad piece of technology etc. +- **Am I hurting better alternatives by not using them?** E.g. by using a proprietary social network gives one more user to it and one fewer to a potentially more ethical free social network. +- **Is there anything just plain better?** A normie will take the first thing that's handed to him and "just werks" without even checking if something better exists that would satisfy him better. + diff --git a/kek.md b/kek.md new file mode 100644 index 0000000..adee269 --- /dev/null +++ b/kek.md @@ -0,0 +1,7 @@ +# Kek + +Kek means [lol](lol.md). It comes from [World of Warcraft](wow.md) where the two opposing factions (Horde and Alliance) were made to speak mutually unintelligibile languages so as to prevent enemy players from communicating; when someone from Horde typed "lol", an Alliance player would see him say "kek". The other way around (i.e. Alliance speaking to Horde) would render "lol" as "bur", however kek became the popular one. On the Internet this further mutated to forms like *kik*, kekw*, *topkek* etc. Nowadays in some places such as [4chan](4chan.md) kek seems to be used even more than lol, it's the newer, "cooler" way of saying lol. + +## See Also + +- [meme](meme.md) \ No newline at end of file diff --git a/kids_these_days.md b/kids_these_days.md new file mode 100644 index 0000000..44585ce --- /dev/null +++ b/kids_these_days.md @@ -0,0 +1,3 @@ +# Kids These Days + +TODO \ No newline at end of file diff --git a/kiss.md b/kiss.md new file mode 100644 index 0000000..3845fde --- /dev/null +++ b/kiss.md @@ -0,0 +1,9 @@ +# KISS + +KISS (Keep It Simple, Stupid!) is a design philosophy that favors simplicity, solutions that are **as simple as possible** to achieve given task (but no more). This comes from the fact that higher [complexity](complexity.md) comes with increasingly negative effects such the cost of development, cost of [maintenance](maintenance.md), greater probability of bugs and security vulnerabilities. More about this in [minimalism](minimalism.md) article. + +Apparently the term originated in the US Army plane engineering: the planes needed to be repairable by *stupid* soldiers with limited tools under field conditions. + +Compared to [suckless](suckless.md), [unix philosophy](unix_philosophy.md) and [LRS](lrs.md), KISS is a more general term, it doesn't imply any specifics but rather the general overall idea of simplicity being an advantage ([less is more](less_is_more.md)). + +[KISS Linux](kiss_linux.md) is an example of software developed under this philosophy and adapting the term itself. \ No newline at end of file diff --git a/kwangmyong.md b/kwangmyong.md new file mode 100644 index 0000000..5cd709f --- /dev/null +++ b/kwangmyong.md @@ -0,0 +1,14 @@ +# Kwangmyong + +Kwangmyong (meaning *bright light*) is a mysterious [intranet](intranet.md) that North Koreans basically have instead of the [Internet](internet.md). For its high political isolation North Korea doesn't allow its citizens open access to the Internet, they rather create their own internal network the government can fully control -- this is unsurprising, allegedly it is e.g. illegal to own a fax and North Korea also have their own operating system called [Red Star OS](red_star.md), for security reasons. Not so much is known about Kwangmyong for a number of reasons: it is only accessible from within North Korea, foreigners are typically not allowed to access it, and, of course, it isn't in English but in Korean. Of course the content on the network is highly filtered and/or created by the state propaganda. Foreigners sometimes get a chance to spot or even secretly photograph things that allow us to make out a bit of information about the network. + +North Koreans themselves almost never have their own computers, they typically browse the network in libraries. + +There seem to be a few thousand accessible sites. Raw [IP addresses](ip_address.md) (in the private 10.0.0.0/8 range) are sometimes used to access sites (posters in libraries list IPs of some sites) but [DNS](dns.md) is also up -- here sites use *.kp* [top level domain](tld.md). Some sites, e.g. of universities, are also accessible on the Internet (e.g. http://www.ryongnamsan.edu.kp/), others like http://www.ipo.aca.kp (patent/invention site) or http://www.ssl.edu.kp (sports site) are not. There seems to be a remote webcam education system in place -- it appeared on North Korean news. There exists something akin a [search engine](search_engine.md) (*Naenara*), [email](email.md), [usenet](usenet.md), even something like [facebook](facebook.md). Apparently there are some [video games](game.md) as well. + + + + +## See Also + +- [Red Start OS](red_star.md) (North Korea operating system) \ No newline at end of file diff --git a/lambda_calculus.md b/lambda_calculus.md new file mode 100644 index 0000000..8294a17 --- /dev/null +++ b/lambda_calculus.md @@ -0,0 +1,49 @@ +# Lambda Calculus + +Lambda calculus is a formal [mathematical](math.md) system for describing calculations with [functions](function.md). It is a theoretical basis for [functional languages](functional.md). It can be seen as a model of computation similar to e.g. a [Turing machine](turing_machine.md) -- in fact lambda calculus has exactly the same computational power as a Turing machine and so it is an alternative to it. It can also be seen as a simple [programming language](programming_language.md), however its so extremely simple it isn't used for practical programming, it is more of a mathematical tool for constructing proofs etc. Nevertheless, anything that can be programmed in any classic programming language can in theory be also programmed in lambda calculus. + +While Turing machines use memory in which computations are performed, lambda calculus performs computations only with pure mathematical functions, i.e. there are no [global variables](variable.md) or [side effects](side_effect.md). It has to be stressed that the functions in questions are mathematical functions, also called **pure functions**, NOT functions we know from programming. A pure function cannot have any side effects such as changing global state and its result also cannot depend on any global state or randomness, the only thing a pure function can do is return a value, and this value has to always be the same if the arguments to the function are same. + +## How It Works + +(For simplicity we'll use pure ASCII text. Let the letters L, A and B signify the Greek letters lambda, alpha and beta.) + +Lambda calculus is extremely simple, though it may not be so simple to learn to understand it. + +In lambda calculus function have no names, they are what we'd call anonymous functions or lambdas in programming (now you know why they're called lambdas). + +Computations in lambda calculus don't work with numbers but with sequences of symbols, i.e. the computation can be imagined as manipulating text strings with operations like "search/replace". + +In lambda calculus an expression, also a **lambda term** or "program" if you will, consists only of three types of [syntactical](syntax.md) constructs: + +1. *x*: **variables**, represent unknown values. +2. *(Lx.T)*: **abstraction**, where *T* is a lambda term, signifies a function definition (*x* is a variable that's the function's parameter, *T* is its body). +3. *(S T)*: **application** of *T* to *S*, where *S* and *T* are lambda terms, signifies a function call/invocation (*S* is the function, *T* is the argument). + +Brackets can be left out if there's no ambiguity. Furthermore we need to distinguish between two types of variables: + +- **bound**: A variable whose name is the same as some parameter of a function this variable is in. E.g. in *(Lx.(Ly.xyz))* variables *x* and *y* are bound. +- **free**: Variable that's not bound. + +Every lambda term can be broken down into the above defined three constructs. The actual computation is performed by simplifying the term with special rules until we get the result (similarly to how we simplify expression with special rules in [algebra](algebra.md)). This simplification is called a **reduction**, and there are only two rules for performing it: + +1. **A-conversion**: Renames (substitutes) a bound variable inside a function, e.g. we can apply A-conversion to *Lx.xa* and convert it to *Ly.ya*. This is done in specific cases when we need to prevent a substitution from making a free variable into a bound one. +2. **B-reduction**: Replaces a parameter inside a function with provided argument, i.e. this is used to reduce *applications*. For example *(Lx.xy) a* is an application, when we apply B-reduction, we take the function body (*xy*) and replace the bound variable (*x*) with the argument (*a*), so we get *ay* as the result. + +A function in lambda calculus can only take one argument. The result of the function, its "return value", is a "string" it leaves behind after it's been processed with the reduction rules. This means a function can also return a function (and a function can be an argument to another function), which allows us to implement functions of multiple variables with so called *[currying](currying.md)*. + +For example if we want to make a function of two arguments, we instead create a function of one argument that will return another function of one argument. E.g. a function we'd traditionally write as *f(x,y,z) = xyz* can in lambda calculus be written as *(Lx.(Ly.(Lz.xyz)))*, or, without brackets, *Lx.Ly.Lz.xyz* which will sometimes be written as *Lxyz.xyz* (this is just a [syntactic sugar](syntactic_sugar.md)). + +**This is all we need to implement any possible program**. For example we can encode numbers with so called Church numerals: 0 is *Lf.Lx.x*, 1 is *Lf.Lx.fx*, 2 is *Lf.Lx.f(fx)*, 3 is *Lf.Lx.f(f(fx))* etc. Then we can implement functions such as an increment: *Ln.Lf.Lx.f((nf)x)*, etc. + +Let's take a complete **example**. We'll use the above shown increment function to increment the number 0 so that we get a result 1: + +``` +(Ln.Lf.Lx.f((nf)x) (Lf.Lx.x) application +(Ln.Lf.Lx.f((nf)x) (Lf0.Lx0.x0) A-conversion (rename variables) +(Lf.Lx.f(((Lf0.Lx0.x0)f)x) B-reduction (substitution) +(Lf.Lx.f((Lx0.x0)x) B-reduction +(Lf.Lx.fx) B-reduction +``` + +We see we've gotten the representation of number 1. \ No newline at end of file diff --git a/langtons_ant.md b/langtons_ant.md new file mode 100644 index 0000000..dbea056 --- /dev/null +++ b/langtons_ant.md @@ -0,0 +1,157 @@ +# Langton's Ant + +Langton's ant is a simple [zero player](zero_player.md) [game](game.md) and [cellular automaton](cellular_automaton.md) simulating the behavior of an ant that behaves according to extremely simple rules but nevertheless builds a very complex structure. It is similar to [game of life](game_of_life.md). Langton's ant is **[Turing complete](turing_complete.md)** (it can be used to perform any computation that any other computer can). + +**Rules**: in the basic version the ant is placed in a square grid where each square can be either white or black. Initially all squares are white. The ant can face north, west, south or east and operates in steps. In each step it does the following: if the square the ant is on is white (black), it turns the square to black (white), turns 90 degrees to the right (left) and moves one square forward. + +These simple rules produce a quite complex structure, seen below. The interesting thing is that initially the ant behaves **[chaotically](chaos.md)** but after about 10000 steps it suddenly ends up behaving in an ordered manner by building a "highway" that's a non-chaotic, repeating pattern. From then on it continues building the highway until the end of time. + +``` +........................................................................... +.............................................................##............ +............................................................##......##..... +...........................................................#.##.#..#..#.... +...........................................................#..#.###..###... +.....##.....................................................#.##..####.#... +....##........................................................##........... +...#.##.#.....................................................##.##.##..... +...#..#.##................................................#.##.#..####..... +....#.A.#.#................................##....##....##.###.##.#####..... +....#...#.##..............................##..####....##..#.##.#.#..#...... +...###..#.#.#............................#.##..####....####.###.####....... +...#####.#..##......................##...#.......##..##....#...#.###....... +....#..###..#.#....................#..#..#......#..##..##...##.####........ +.....###...#..##..................#..#...#.......##.##...#..#..##.#........ +......#..###..#.#.................#..#....#.########.#.#.##..####.#........ +.......###...#..##..........##..##.#.#.#....##.##.#.#.##..#..##..##........ +........#..###..#.#........#####.#..##...##.#...#....#.#..#..#..#.#........ +.........###...#..##......#.##...##...#..#...####..#...##.####.##.......... +..........#..###..#.#.....#....#...####.#..#####.##...##########...##...... +...........###...#..##....#.....#.##.#####.##..#.#...#..#..##.#..#..#...... +............#..###..#.#...#.....#####.#.#####.....#.#..##.#....##...#...... +.............###...#..##...#..#.######.##.#.##.#.#....###.###...##...#..... +..............#..###..#.#...##..#.##...##.##.###.###...#..#.##..####.#..... +...............###...#..##......#.####..##..#########..#..##....#..##...... +................#..###..#.#..#...##..###########.#..####..#....#....#...... +.................###...#..##.###..##.#...##.......####.####...#......#..... +..................#..###..#.#.#..#.###.#.#.##......##...#.#.#....#...#..... +...................###...#.....#.##.#.##..##..#####.####..####.##...#...... +....................#..###..#.##....#..#.###..#......###.##.#..#..##....... +.....................###...#...#.#..#.#.####.##..#.##.###..#.....#......... +......................#..###..##...##.##...###..#....#..##.####...#........ +.......................###...#.#.##.###..#..##.....#...###.##..##.#........ +........................#..#.........##.##...#..##.....##.#.....##......... +...........................#.#...#.##.###...#...#.#..####....#.##.......... +.......................#.###.#.##.#.#.##.##.##.#...#####.###.##............ +.......................###.##...#.####..##.##.######.#.###.#...#........... +........................#.....#...#####.#.#..####..#...###.#.#.#........... +..........................#.###.##..#.##..###.#.#.....###...###............ +..........................#.#..###..##.####.##...#.#..#.##..##............. +.........................###.#..#...#.....#.....##.##..###................. +............................##..##.#.#.........###.......#................. +................................#.#..#.........#..#....#................... +................................###...##............##.#................... +.................................#..####..........#..##.................... +..................................##..############..##..................... +........................................................................... +``` + +*Langton's ant after 11100 steps, `A` signifies the ant's position, note the chaotic region from which the highway emerges left and up.* + +The Langton's ant game can be extended/modified, e.g. in following ways: + +- **multiple colors**: Squares can have more colors than just black/white that are cycled by the ant. Here we also need to specify which way the ant turns for each color it steps on, for example for 4 colors we may specify the rules as LRLL (turn left on 1st color, right on 2nd color etc.). +- **multiple ants**: called colonies +- **different grid**: e.g. hexagonal or 3D +- **multiple ant states**: Besides having a direction the ant can have a more complex state. Such ants are called **[turmites](turmite.md)** (Turing termite). + +The ant was invented/discovered by [Christopher Langton](langton.md) in his 1986 paper called *Studying Artificial Life With Cellular Automata* where he calls the ants *vants* (virtual ants). + +## Implementation + +The following is a simple [C](c.md) implementation of Langton's ant including the extension to multiple colors (modify `COLORS` and `RULES`). + +``` +#include +#include + +#define FIELD_SIZE 48 +#define STEPS 5000 +#define COLORS 2 // number of colors +#define RULES 0x01 // bit map of the rules, this one is RL + +unsigned char field[FIELD_SIZE * FIELD_SIZE]; + +struct +{ + int x; + int y; + char direction; // 0: up, 1: right, 2: down, 3: left +} ant; + +int wrap(int x, int max) +{ + return (x < 0) ? (max - 1) : ((x >= max) ? 0 : x); +} + +int main(void) +{ + ant.x = FIELD_SIZE / 2; + ant.y = FIELD_SIZE / 2; + ant.direction = 0; + + for (unsigned int step = 0; step < STEPS; ++step) + { + unsigned int fieldIndex = ant.y * FIELD_SIZE + ant.x; + unsigned char color = field[fieldIndex]; + + ant.direction = wrap(ant.direction + (((RULES >> color) & 0x01) ? 1 : -1),4); + + field[fieldIndex] = (color + 1) % COLORS; // change color + + // move forward: + + switch (ant.direction) + { + case 0: ant.y++; break; // up + case 1: ant.x++; break; // right + case 2: ant.y--; break; // down + case 3: ant.x--; break; // left + default: break; + } + + ant.x = wrap(ant.x,FIELD_SIZE); + ant.y = wrap(ant.y,FIELD_SIZE); + + // draw: + + for (int i = 0; i < 10; ++i) + putchar('\n'); + + for (int y = 0; y < FIELD_SIZE; ++y) + { + for (int x = 0; x < FIELD_SIZE; ++x) + if (x == ant.x && y == ant.y) + putchar('A'); + else + { + unsigned char val = field[y * FIELD_SIZE + x]; + putchar(val ? ('A' + val - 1) : '.'); + } + + putchar('\n'); + } + + usleep(10000); + } + + return 0; +} +``` + +## See Also + +- [game of life](game_of_life.md) +- [turmite](turmite.md) +- [rule 110](rule_110.md) +- [cellular automaton](cellular_automaton.md) \ No newline at end of file diff --git a/left.md b/left.md new file mode 100644 index 0000000..0c9bcc2 --- /dev/null +++ b/left.md @@ -0,0 +1,3 @@ +# Left + +See [left vs right](left_right.md). \ No newline at end of file diff --git a/left_right.md b/left_right.md new file mode 100644 index 0000000..c96d7a6 --- /dev/null +++ b/left_right.md @@ -0,0 +1,35 @@ +# Left Vs Right (Vs Pseudoleft) + +Left and right are two basic opposing political sides that roughly come down to the pro-equality (left) and pro-hierarchy (right). There is a lot of confusion and vagueness about these terms, so let us now define them as used on this wiki: + +- The (true) **left is pro social equality**, i.e. against social hierarchies. This includes equality of all living beings, period. Note that social equality does NOT imply people being made (or being made to appear) equal in other ways, e.g. physically -- true left accepts difference between people and [races](race.md) and doesn't hide them. Even if the perfectly ideally leftist society can't be completely achieved, true left tries to get **as close to it as possible**. The values of true left are for example sharing, [love](love.md), [selflessness](selflessness.md), [altruism](altruism.md), forgiveness and nonviolence. Groups and movements that are at least highly truly leftist include [anarcho pacifism](anpac.md), [veganism](veganism.md), [free software](free_software.md), [free culture](free_culture.md) and of course [LRS](lrs.md). +- The **right is pro social hierarchy**, i.e. against social equality. This means some people standing above others, be it by strength, power, wealth, social status, privileges etc. The rightist values are mostly those associated with [evil](evil.md), i.e. violence, oppression, conflict, war, revenge, survival of the fittest etc. Among rightism can be included [fascism](fascism.md) (i.e. extreme rightism), [capitalism](capitalism.md), US republican party, states, the military etc. One of right's identifying features is **hypocrisy**, i.e. it judges what's good/bad only by against whom it is targeted, e.g. violence is bad when targeted against "us" ("those Muslims are bad, they want to kill us!") but good when targeted against "them" ("we have to kill those Muslims because they're violent!"); so animals killing humans is judged as "bad" but humans killing animals is "good". In other words right has no sense of morality, only the sense of [self interest](self_interest.md). +- The **pseudoleft** is pretending to be left while in fact being right due to e.g. using non-leftist means (such as violence) or even having non-leftist goals (e.g. benefit of specific minority as opposed to benefit of everyone). Among pseudoleftist movements are [feminism](feminism.md), [LGBT](lgbt.md), [Antifa](antifa.md) or [Marxism](marxism.md). This fact is also supported by the [naming](name_matters.md) of these movements. + +There exists a "theory" called a horse shoe. It says that the extremes of the left-right spectrum tend to be alike (violent, hating, radical), just as the two ends of a horse shoe. This is only an illusion caused by ignoring the existence of pseudoleft. The following diagram shows the true situation: + +``` +TRUE LEFT (peace, selflessness, forgiveness, ...) + <-------------------. + / \ + | | <== illusion of horse shoe + | | + \ / + V V + PSEUDOLEFT RIGHT + (violence, conflict, aggressivity, ...) +``` + +We see pseudoleft is something that began as going away from the right but slowly turned around back to its values, just from a slightly different direction. This is because rightism is very easy, it offers tempting short-term solutions such as violence, and so it exhorts a kind of magnetic force on every human -- most cannot resist and only very few get to the true left despite this force. + +The current US-centered culture unfortunately forces a **right-pseudoleft false dichotomy**. It is extremely important to realize this dichotomy doesn't hold. Do not become [type A/B fail](fail_ab.md). + +What's called *left* in the [modern](modern.md) western culture usually means *pseudoleft*. The existence of pseudoleftism is often overlooked or unknown. It used to be found mainly in the [US](us.md), however globalization spreads this [cancer](cancer.md) all over the world. Pseudoleft justifies its actions with a goal that may seem truly leftist, such as "equality", but uses means completely unacceptable by true left (which are in fact incompatible with equality), such as [violence](violence.md), bullying, lynching, [cancelling](cancel_culture.md), [censorship](censorship.md) or brainwashing. Pseudoleft is aggressive. It believes that **"ends justify the means"** and that **"it's fine to bully a bully"** ("eye for an eye"). A pseudoleftist movement naturally evolves towards shifting its goals from a leftist one such as equality towards a [fascist](fascism.md) one such as a (blind) *fight for some group's rights* (even if that group may already have achieved equality and more). + +The difference between left and pseudoleft can be shown in many ways; one of them may be that pseudoleft always wants to **[fight](fight_culture.md)** something, usually the right (as they're essentially the same, i.e. natural competitiors). True left wants to end all fights. Pseudoleft invents [bullshit](bullshit.md) artificial issues such as [political correctness](political_correctness.md) that sparks conflict, as it lives by conflict. Left tries to find peace by solving problems. Pseudoleft sees it as acceptable to do bad things to people who commited something it deems bad. True left knows that violence creates violence, it "turns the other cheek", it cures hate with love. + +Pseudoleft is extra harmful by deceiving the public into thinking what it does really is leftist. Most normal people that don't think too much therefore stand between a choice of a lesser of two evils: the right and pseudoleft. True left, the true good, is not known, it is overshadowed. + +Why is there no pseudoright? Because it doesn't make sense :) Left is good, right is a sincere evil and pseudoleft is an evil pretending to be good. A good pretending to be evil doesn't probably exist in any significant form. + +**Centrism** means trying to stay somewhere mid way between left and right, but it comes with issues. From our point of view it's like trying to stay in the middle of good and evil, it is definitely pretty bad to decide to be 50% evil. Another issue with centrism is that it is **unstable**. Centrism means balancing on the edge of two opposing forces and people naturally tend to slip towards the extremes, so a young centrist will have about equal probabilities of slipping either towards extreme left or extreme right, and as society polarizes this way, people become yet more and more inclined to defend their team. Knowing centrism is unsustainable, we realize we basically have to choose which extreme to join, and we choose the left extreme, i.e. joining the good rather than the evil. \ No newline at end of file diff --git a/lgbt.md b/lgbt.md new file mode 100644 index 0000000..86cdbef --- /dev/null +++ b/lgbt.md @@ -0,0 +1,13 @@ +# LGBT + +*LGBT ruined the rainbow for me.* + +LGBT, LGBTQ+, LGBTQIKKAWTFJJJKKSSMMMAAK (lesbian [gay](gay.md), [bisexual](bisexual.md), [transsexual](tranny.md), [queer](queer.md) and whatever else they're gonna invent) is a [fascist](fascist.md) political group of terrorists whose gospel preaches superiority of certain selected minority sexual orientations. They are a highly [violent](violence.md), [bullying](bully.md) movement (not surprisingly centered in the [US](us.md)) practicing [censorship](censorship.md), Internet lynching ([cancel culture](cancel_culture.md)), discrimination, spread of extreme [propaganda](propaganda.md), [political correctness](political_correctness.md) and other [evil](evil.md). + +Note that **not all gay people support LGBT**, even though LGBT wants you to think so. The relationship gay-LGBT is the same as e.g. the relationship German-Nazi. LGBT isn't just about being gay but about approving of a very specific ideology that doesn't automatically come with being gay. + +LGBT works towards establishing [newspeak](newspeak.md) and [though crime](though_crime.md), their "pride" parades are not unlike military parades, they're mean to establish fear of their numbers. LGBT targets children and young whom their propaganda floods every day with messages like *"being gay makes you cool and more interesting"* so that they have a higher probability of developing homosexuality to further increase their ranks in the future. They also push the idea of children having same sex parents for the same reason. + +They oppose [straight](straight.md) people as they solely focus on gaining more and more rights and power only for their approved orientations. They also highly bully other, unpopular sexual orientations such as [pedophiles](pedophilia.md) (not necessarily child rapists), [necrophiles](necro.md) and [zoophiles](zoophilia.md), simply because supporting these would hurt their popularity and political power. They label the non-approved orientations a "disorder", they push people of such orientations to [suicide](suicide.md) and generally just do all the bad things that society used to do to gay people in the past -- the fact that these people are often gay people who know what it's like to be bullied like that makes it this even much more sad and disgusting. To them it doesn't matter you never hurt anyone, if they find some [loli](loli.md) images on your computer, you're gonna get lynched mercilessly. + +In the world of technology they are known for supporting [toxic](toxic.md) [codes of conduct](coc.md) in [FOSS](foss.md) projects (so called [tranny software](tranny_sw.md)), they managed to push them into most mainstream projects, even [Linux](linux.md) etc. Generally they just killed [free speech](free_speech.md) online, every platform now has some kind of surveillance and censorship justified by "offensive speech". They canceled [Richard Stallman](rms.md) for merely questioning a part of their gospel. They also managed to establish things like "diversity" quotas in Hollywood that only allow Oscars to be given to movies made by specific number of gays, lesbians etc. xD Apparently in the software development industry it is now standard to pretend to be a tranny on one's resume so as to greatly increase the chance of being hired xD WTF if I didn't live in this shitty world I wouldn't believe that's even possible, in a dystopian horror movie this would feel like crossing the line of believability too far [lmao](lmao.md). \ No newline at end of file diff --git a/library.md b/library.md new file mode 100644 index 0000000..3998145 --- /dev/null +++ b/library.md @@ -0,0 +1,22 @@ +# Library + +Software library is code that's not meant to run on its own but rather be used by other programs. A library provides resources such as [functions](function.md), [macros](macro.md), [classes](class.md) or [constants](constant.md) that are normally related to solving some specific class of problems, so e.g. there are [GUI](gui.md) libraries, [audio](audio.md) libraries, [mathematical](math.md) libraries etc. Libraries exist to prevent [reinventing wheels](reinventing_wheel.md) by only ever implementing the code once so that next time we can simply reuse it (respecting the [DRY](dry.md) principle). Examples of libraries are the [standard C library](clib.md), [SDL](sdl.md) or [JQuery](jquery.md). + +If a programmer wants to use a specific library, he has to first [install](install.md) it (if it's not installed already) and then *include* it in his program with a specific command (words like `include`, `using` or `import` are commonly used). Then he is able to use the resources the library exports. Depending on the type of the library he may also need to [link](linking.md) the library code after [compilation](compiler.md) and possibly distribute the library files along with his program. + +You will often hear a library as a certain [API](api.md) -- this is the interface of the library consisting of the elements via which programmer uses the library, mostly the [functions](function.md) the library offers. If a programmer wants to know the library API, he wants to know the names of the functions, what [parameters](parameter.md) they take etc. Sometimes there may be multiple libraries with the same API but different internal implementations, this is nice because these libraries can be easily [drop-in-replaced](drop_in.md). + +In a specific [programming language](programming_language.md) it IS generally possible to use a library written in a different language, though it may be more difficult to achieve. + +We generally divide libraries to two types: + +- **[static](static.md)**: The library code is embedded into the executable of the final program so that the library files have to be distributed along with the program. This is more convenient and also makes sure the program uses exactly the correct version of the library. But of course this results in bigger executable, and if we have multiple programs that use the same library which is statically linked, each program will have a [redundant](redundancy.md) copy of the library code, wasting memory (both storage and [RAM](ram.md)). +- **[dynamic](dynamic.md)** (also *shared*): The compiled library code resides in a separate file ([DLL](dll.md) on [Windows](windows.md), [.so](so.md) in [GNU](gnu.md)/[Linux](linux.md)) which may need to be distributed along with the program, but this one file can be shared among all programs that use the library so the compiled programs can be smaller. It may also be easier to update the library to a new version by simply replacing the compiled library file. RAM may also be saved as the dynamic library may be loaded just once for multiple simultaneously running programs. + +Many times a library can have both static and dynamic version available, or the compiler may allow to automatically link the library as static or dynamic. Then it's up to the programmer which way he wants to go. + +## C Libraries + +## LRS Libraries + +TODO \ No newline at end of file diff --git a/libre.md b/libre.md new file mode 100644 index 0000000..389815e --- /dev/null +++ b/libre.md @@ -0,0 +1,3 @@ +# Libre + +Libre is an alternative term for [free](free_software.md) (as in freedom). It is used to prevent confusion of *free* with *[gratis](gratis.md)*. \ No newline at end of file diff --git a/license.md b/license.md new file mode 100644 index 0000000..642e427 --- /dev/null +++ b/license.md @@ -0,0 +1,45 @@ +# License + +License is a legal text by which we share some of our exclusive rights (e.g. [copyright](copyright.md)) over [intellectual](intellectual_property.md) works with others. For the purpose of this Wiki a license is what enables us to legally implement [free (as in freedom) software](free_software.md) (as well as [free culture](free_culture.md)): we attach a license to our program that says that we grant to everyone the basic freedom rights to our software with optional conditions (which must not be in conflict with free software definition, e.g. we may require [attribution](attribution.md) or [copyleft](copyleft.md), but we may NOT require e.g. non-commercial use only). We call these licenses *free licenses* ([open source](open_source.md) licenses work the same way). Of course, there also exist [non-free](proprietary.md) licenses called [EULAs](eula.md), but we stay away from these. + +At [LRS](lrs.md) we highly prefer [public domain](public_domain.md) [waivers](waiver.md) instead of licenses, i.e. we release our works without any conditions/restrictions whatsoever (e.g. we don't require credit, [copyleft](copyleft.md) and similar conditions, even if by free software rules we could). This is because we oppose the very idea of being able to own information and ideas, which any license is inherently based on. Besides that, licenses are not as legally [suckless](suckless.md) as public domain and they come with their own issues, for example a license, even if free, may require that you promote some political ideology you disagree with (see e.g. the principle of [+NIGGER](plusnigger.md)). + +Some most notable free licenses for software include (FSF: FSF approved, OSI: OSI approved, LRS: approved by us, short: is the license short?): + +| license | type | FSF | OSI | LRS |short| +| ----------------------- | ----------------------- | --- | --- | --- | --- | +| [Apache 2](apache.md) | permissive, conditions |**+**|**+**| - | - | +| [AGPL](agpl.md) | network copyleft |**+**|**+**| - | - | +| [BSD (0,1,2,3)](bsdl.md)| permissive |**+**|**+**| - |**+**| +| [BOML](boml.md) | permissive | - | - | - |**+**| +| [CC0](cc0.md) | [PD](public_domain.md) waiver, 0 conditions |**+**| - |**+**| - | +| [GPLv2, GPLv3](gpl.md) | copyleft (strong) |**+**|**+**| - | - | +| [LGPL](lgpl.md) | copyleft (weak) |**+**|**+**| - | - | +| [MIT](mitl.md) | permissive, credit |**+**|**+**|**+**|**+**| +| [MIT-0](mitl.md) | permissive, 0 conditions| - |**+**|**+**|**+**| +|[Unlicense](unlicense.md)| PD waiver, 0 conditions |**+**|**+**|**+**|**+**| +| [WTFPL](wtfpl.md) | permissive, fun |**+**| - | - |**+**| +| [zlib](zlib.md) | permissive |**+**|**+**| - |**+**| +| [0BSD](bsdl.md) | permissive, 0 conditions| - |**+**|**+**|**+**| + +Some most notable free licenses for general artworks include: + +TODO + +## How To + +If you're a noob or even an advanced noob and want to make sure you license correctly, consider the following advice: + +- **Actually use a license or waiver**. Code without a license/waiver is proprietary. Statement like "do whatever you want" or "public domain" is legally absolutely insufficient and is worth nothing. +- **If you're collaborating with other people, put on a license ASAP.** Any change in legal conditions require an agreement of all authors so if you're developing code with dozen of people and then decide to add a license to it, you have to contact everyone and get a permission, and of course that can get difficult with more developers. +- **DO NOT fucking write "all rights reserved" if you're using a free license** since that literally means you're NOT reserving all the rights. +- Know that normally **you cannot take back your permissive license**, i.e. if you actually release something under permissive terms under a correct non-revokable waiver/license, you cannot introduce stricter conditions later on. What you CAN do is relax and drop conditions (e.g. [copyleft](copyleft.md)) of a license later on. I.e. you can make something strict less strict but not vice versa. +- **DO NOT use your own license**. Use an existing one. Firstly you're not a lawyer and secondly even if you are, your license will be non-standard, untested in practice, possibly buggy, untrusted and missing from the usual accepted license lists. +- **DO NOT modify existing licenses** (except for some special license modifiers, you should have experience to use these). You may add some conditions to the license if the license allows it and you should do it clearly, but do NOT change the text of the original license unless you change its name. +- **Put the license text into `LICENSE` or `COPYING` file in the root of your repository**. You can also put it as a comment in the header of your source code file and mention the license in `README`. Doing all of these is best. Be as clear and explicit as possible. +- **Read the license or at least its summary before you use it** so that you know what you can demand without violating it. If you use CC0 and then demand attribution, it's clear you don't know what you're doing and your work is seen as legally unsafe. +- **Be as clear as possible**, it's better to be extra clear and show your intent of using your license. Include a sentence such as "I release this code under XYZ (link)." Mention license version number and URL to its text. +- **Be extra clear and explicit about what your license covers, especially with non-software files**. E.g. when developing a game which has asset files such as 3D models, say if your license also applies to these files. +- **Have a list of authors and a reasonable evidence of their license acceptance.** This is in case an actual investigation takes place in legal case: authors need to be known (commit history, contributors.txt, ...) and it needs to be clear they knew a license was present and they agreed to it (e.g. the `LICENSE` file must have been present at the time of their contribution). +- **Think from the user's POV and consider worst case legal scenario**. Ask yourself: if I'm someone else and use this project commercially and for something controversial, am I well protected by the license? The answer has to be yes. +- **Include additional waivers if your license doesn't e.g. waive patents** (for example with [CC0](cco.md)). \ No newline at end of file diff --git a/lil.md b/lil.md new file mode 100644 index 0000000..b5605fb --- /dev/null +++ b/lil.md @@ -0,0 +1,15 @@ +# LIL + +Little interpreted language (LIL) is a very nice [suckless](suckless.md), yet practically unknown interpreted [programming language](programming_language.md) by Kostas Michalopoulos which can very easily be embedded in other programs. In this it is similar to [Lua](lua.md) but is even more simple: it is implemented **in just two [C](c.md) source code files** (lil.c and lil.h) that together count about 3700 [LOC](loc.md). It is provided under [zlib](zlib.md) [license](license.md). More information about it is available at http://runtimeterror.com/tech/lil. + +{ LIL is relatively amazing. I've been able to make it work on such low-specs hardware as Pokitto (32kb RAM embedded). ~drummyfish } + +LIL has two implementations, one in [C](c.md) and one in [Free Pascal](free_pascal.md), and also comes with some kind of [GUI](gui.md) and [API](api.md). + +The language design is very nice, its interesting philosophy is that **everything is a string**, for example arithmetic operations are performed with a function `expr` which takes a string of an arithmetic expression and returns a string representing the result number. + +For its simplicity there is no [bytecode](bytecode.md) which would allow for more efficient execution and [optimization](optimization.md). + +TODO: example + +{ I've been looking at the source and unfortunately there are some imperfections. The code uses [goto](goto.md) (may not be bad but I dunno). Also unfortunately stdlib, stdio, string and other standard libraries are used as well as [malloc](malloc.md). The code isn't really commented and I find the style kind of hard to read. } \ No newline at end of file diff --git a/linear_algebra.md b/linear_algebra.md new file mode 100644 index 0000000..ae00a4f --- /dev/null +++ b/linear_algebra.md @@ -0,0 +1,117 @@ +# Linear Algebra + +In [mathematics](math.md) linear algebra is an extension of the classical elemental algebra ("operations with numbers/variables") to [vectors](vector.md) and [matrices](matrix.md) ("arrays of numbers"). It is a basic tool of advanced mathematics and [computer science](computer_science.md) (and many other sciences) and at least at the very basic level should be known by every [programmer](programmer.md). + +Why is it called *linear* algebra? Basically because it deals with [linear equations](linear.md) which is kind of about proportionality, function plots being lines etc. A mathematician will probably puke at this explanation but it gives some intuition :) + +## Basics + +In "normal" algebra our basic elements are [numbers](number.md); we learn to add then, multiply then, solve equation with them etc. In linear algebra we call these "single numbers" **[scalars](scalar.md)** (e.g. 1, -10.5 or [pi](pi.md) are scalars), and we also add more complex elements: **[vectors](vector.md)** and **[matrices](matrix.md)**, with which we may perform similar operations, even though they sometimes behave a bit differently (e.g. the order in multiplication of matrices matters, unlike with scalars). + +Vectors are basically sequences ([arrays](array.md)) of numbers, e.g. a vector of length 3 may be [1.5, 0, -302]. A matrix can be seen as a [two dimensional](2d.md) vector (a 2D array of numbers), e.g. a 2x3 matrix may look like this: + +``` +|1 2.5 -10| +|24 -3 0 | +``` + +Similarly we may see vectors as matrices that have either only one column, so called **column vectors**, or only one row, so called **row vectors** -- it is only a matter of convention which type of vectors we choose to use (this affects e.g. "from which side" we will multiply vectors by matrices). For example a column vector + +``` +|5 7.3 -2| +``` + +is really a 3x1 matrix that as a row vector (1x3 matrix) would look as + +``` +|5 | +|7.3| +|-2 | +``` + +Why do we even work with vectors and matrices? Because these can represent certain things we encounter in math and programming better than numbers, e.g. vectors may represent points in space or velocities with directions and matrices may represent transformations such as rotations (this is not obvious but it's true). + +With vectors and matrices we can perform similar operations as with "normal numbers", i.e. addition, subtraction, multiplication, but there are also new operations and some operations may behave differently. E.g. when dealing with vectors, there are multiple ways to "multiply" them: we may multiply a vector with a scalar but also a vector with vector (and there are multiple ways to do this such as [dot product](dot_product.md) which results in a scalar and [cross product](cross_product.md) which results in a vector). Matrix multiplication is, unlike multiplication of real numbers, non-[commutative](commutativity.md) (A times B doesn't necessarily equal B times A), but it's still [distributive](distributivity.md). We can also multiply vectors with matrices but only those that have "compatible sizes". And we can also solve equations and systems of equations which have vectors and matrices in them. + +There is an especially important matrix called the **[identity matrix](identity_matrix.md)** (sometimes also *unit matrix*), denoted *I*, an NxN matrix by which if we multiply any matrix we get that same matrix. The identity matrix has 1s on the main diagonal and 0s elsewhere. E.g. a 3x3 identity matrix looks as + +``` +|1 0 0| +|0 1 0| +|0 0 1| +``` + +Now let's see some the details of basic operations with vectors and matrices: + +- **matrix/vector addition/subtraction**: We can add (subtract) vectors and matrices only if they have exactly the same size. We perform the operation very simply element-wise. E.g. adding vector `[1 0 -2]` to vector `[3 1.1 3]` results in vector `[4 1.1 1]`. +- **matrix/vector multiplication by scalar**: We simply multiply each element of the vector/matrix by the scalar, e.g. `[2 0 -3] * 7 = [14 0 -21]`. +- **matrix/vector multiplication**: We can multiply matrix (vector) *A* by matrix (vector) *B* only if *A* has the number of columns equal to the number of rows of *B*. I.e. we can e.g. multiply a 2x3 (2 rows, 3 columns) matrix by a 3x5 matrix, but NOT a 2x4 matrix by 2x4 matrix. Note that unlike with real numbers, **order in matrix multiplication matters** (matrix multiplication is non-[commutative](commutativity.md)), i.e. `AB` is not generally equal to `BA`. Multiplying a MxN matrix by NxO matrix results in a MxO matrix (e.g. 2x3 matrix times 3x4 matrix results in a 2x4 matrix) in which each element is a [dot product](dot_product.md) of the corresponding row from the first matrix with the corresponding column of the second matrix. An example will follow later. +- **matrix/vector "division"**: We mention just for clarity that the term *matrix division* isn't really used but we can achieve the principle of division by multiplication by inverse matrices (similarly to how division on real numbers is really a multiplication by [reciprocal](reciprocal.md) of a number). +- **matrix/vector transpose**: Transpose of a matrix *A* is denoted as *A^T*. It is the matrix *A* flipped by its main (top left to bottom right) diagonal, i.e. the transpose of an NxM matrix is an MxN matrix. Transpose makes column vectors into row vectors and back. +- **matrix inverse**: The inverse matrix of an NxN matrix *A* is denoted as *A^-1* and it is a matrix such that if we multiply *A* by it we get the identity matrix (*I*). Inverse matrix is similar to a [reciprocal value](reciprocal.md) in the world of real numbers. Note that non-square matrices don't have inverses and even some square matrices don't have inverses. How to invert a matrix? A general method is to simply solve the equation that defines it. +- **matrix [determinant](determinant.md)**: Determinant of a matrix is a scalar computed in a specific way from the matrix that reflects some of the properties of the matrix (e.g. its invertibility). It appears in many equations so it's good to know about it. + +**Example of matrix multiplication**: this is a super important operation so let's see an example. Let's have a 2x3 matrix *A*: + +``` + |1 2 3| +A = |4 5 6| +``` + +and a 3x4 matrix *B*: + +``` + |7 8 9 10| +B = |11 12 13 14| + |15 16 17 18| +``` + +The result, *AB*, will be a 2x4 matrix in which e.g. the top-left element is equal to 1 * 7 + 2 * 11 + 3 * 15 = 74 (the dot product of the row `1 2 3` with the column `7 11 15`). On paper we usually draw the matrices conveniently as follows: + +``` + |7 8 9 10 | + |11 12 13 14 | + |15 16 17 18 | + |7 8 9 10| +|1 2 3| |11 12 13 14| = |1 2 3| |74 80 86 92 | +|4 5 6| |15 16 17 18| |4 5 6| |173 188 203 218| +``` + +In case it's still not clear, here is a [C](c.md) code of the above shown matrix multiplication: + +``` +#include + +int main() +{ + int A[2][3] = { + {1, 2, 3}, + {4, 5, 6}}; + + int B[3][4] = { + {7, 8, 9, 10}, + {11, 12, 13, 14}, + {15, 16, 17, 18}}; + + for (int row = 0; row < 2; ++row) + { + for (int col = 0; col < 4; ++col) + { + int sum = 0; + + for (int i = 0; i < 3; ++i) + sum += A[row][i] * B[i][col]; + + printf("%d ",sum); + } + + putchar('\n'); + } + + return 0; +} +``` + +## See Also + +- [analytic geometry](analytic_geometry.md) \ No newline at end of file diff --git a/linux.md b/linux.md new file mode 100644 index 0000000..b9bcbc8 --- /dev/null +++ b/linux.md @@ -0,0 +1,47 @@ +# Linux + +Linux is a "[FOSS](foss.md)" [unix-like](unix_like.md) [operating system](operating_system.md) [kernel](kernel.md), probably the most successful and famous non-[proprietary](proprietary.md) kernel. Linux is NOT a whole operating system, only its basic part -- for a whole operating system more things need to be added, such as some kind of [user interface](ui.md) and actual user programs, and this is what [Linux distributions](linux_distro.md) do (there are dozens, maybe hundreds of these) -- Linux distributions, such as [Debian](debian.md), [Arch](arch.md) or [Ubuntu](ubuntu.md) are complete operating systems (but beware, most of them are not fully [FOSS](foss.md)). Linux is one of the biggest collaborative programming projects, as of now it has more than 15000 contributors. + +Linux is written in the [C](c.md) language, specifically the old C89 standard, as of 2022 (there seem to be plans to switch to a newer version). This is of course good. + +Linux is typically combined with a lot of [GNU](gnu.md) software and the [GNU](gnu.md) project (whose goal is to create a [free](free_software.md) OS) uses Linux as its official kernel, so in the wild we usually encounter the term [GNU/Linux](gnu_linux.md). Some people just can't be bothered to acknowledge the work of GNU and just call GNU/Linux systems "Linux" (without GNU/). Fuck them. Of course people are like "it's just a name bruh, don't be so mad about it" -- normally this may be true, however let's realize that GNU mustn't be forgotten, it is one of the few projects based on ethics while "Linux" is a shitty fascist tranny software hugely leaning to the business/open-source side. For the sake of showing our preference between those sides we at LRS often choose to call the system just GNU, i.e. by its original name. + +Linux is sometimes called [free as in freedom](free_software.md), however it is hardly deserving the label, it is more of an [open-source](open_source.md) or [FOSS](foss.md) project. **Linux is in many ways bad**, especially lately. Some reasons for this are: + +- It actually includes [proprietary](proprietary.md) software in the form of [binary blobs](blob.md) ([drivers](drivers.md)). The [Linux-libre](linux_libre.md) project tries to fix this. +- It is [tranny software](tranny_software.md) and has a fascist [code of conduct](coc.md) (`linux/Documentation/process/code-of-conduct.rst`). +- Its development practices are [sus](sus.md), it is involved with many unethical corporations (through the [linux foundation](linux_foundation.md)) including [Microsoft](microsoft.md) (one of the greatest enemies of free software) who is trying to take control over it ([EEE](eee.md)), [Google](google.md), [Intel](intel.md), [IBM](ibm.md) and others. Such forces will inevitably shape it towards corporate interests. +- It is a monolithic kernel which goes against the [KISS](kiss.md) philosophy. +- It is [bloat](bloat.md) and [bloat monopoly](bloat_monopoly.md) and in some ways [capitalist software](capitalist_software.md) (just try to fork Linux, maintain it and add/modify actual features). +- It uses a restrictive [GPL](gpl.md) license as opposed to a permissive one. Also it doesn't really enforce its license legally -- we're not advocating legal battles, but the fact that they entertain a license and then don't use it indicates it may be there just for good image. + +Nevertheless, despite its mistakes, GNU/Linux offers a relatively comfy, powerful and (still) safe [Unix](unix.md)/[POSIX](posix.md) environment which means it can be drop-in replaced with another unix-like system without this causing you much trouble, so using GNU/Linux is at this point considered OK (until Microsoft completely seizes it at which point we migrate probably to [BSD](bsd.md) or [GNU Hurd](hurd.md)). It can be made fairly [minimal](minimalism.md) (see e.g. [KISS Linux](kiss_linux.md) and [Puppy Linux](puppy.md)) and [LRS](lrs.md)/[suckless](suckless.md) friendly. + +Linux is so called monolithic kernel and as such is more or less [bloat](bloat.md). However it "[just works](just_works.md)" and has a great [hardware](hardware.md) support so it wins many users over alternatives such as [BSD](bsd.md). + +Some alternatives to Linux are: + +- [GNU Hurd](hurd.md), an unfinished (but somewhat usable) kernel developed by [GNU](gnu.md) itself. +- [BSD](bsd.md) operating systems such as [FreeBSD](freebsd.md), [NetBSD](netbsd.md) and [OpenBSD](openbsd.md) (best from the [LRS](lrs.md) point of view) +- [bare metal](bare_metal.md) UwU +- TODO: MOAR + +## GNU/Linux + +Many people nowadays use the word *Linux* to refer to any operating system running on Linux, even though they usually mean [GNU](gnu.md)/Linux. + +One of the basic mistakes of [noobs](noob.md) who just switched from [Windows](windows.md) to "Linux" is that they try to continue to do things the *Windows way*. They try to run Windows programs on "Linux", they look for program installers on the web, they install [antiviruses](antivirus.md), they try to find a [GUI](gui.md) program for a thing that is solved with 2 lines of [shell](shell.md) script (and fail to find one), they keep [distro hoppoing](distro_hopping.md) instead of customizing their system etc. Many give up and then go around saying "brrruh, Loooonix sux" -- yes, it kind of does, but for other reasons. You're just using it wrong. Despite its corruption, it's still a [Unix](unix.md) system, you do things elegantly and simply, however these ways are naturally completely different from how ugly systems like Windows do it. If you want to convert an image from *png* to *jpg*, you don't need to download and crack a graphical program that takes 100 GB and installs ads on your system, you do it via a simple [command line tool](cli.md) -- don't be afraid of the terminal, learn some basic commands, ask experiences people how they do it (not how to achieve the way you want to do it). Everyone single individual who learned it later thanked himself for doing it, so don't be stupid. + +## History + +{ Some history of Linux can be read in the biography of Linus Torvalds called *Just For Fun*. ~drummyfish } + +Linux was created by [Linus Torvalds](linus_torvalds.md). He started the project in 1991 as a university student. He read a book about operating system design and [Unix](unix.md) and became fascinated with it. Then when he bought a new no-name PC (4 MB RAM, 33 MHz CPU), he install [Minix](minix.md) on it, a then-[proprietary](proprietary.md) [Unix-like](unix.md) operating system. He was frustrated about some features of Minix and started to write his own software such as terminal emulator, disk driver and [shell](shell.md), and he made it all [POSIX](posix.md) compliant. These slowly started to evolve into an OS kernel. + +Linus originally wanted to name the project *Freax*, thinking *Linux* would sound too self-centered. However the admin of an FTP server that hosted the files renamed it to *Linux*, and the name stuck. + +On 25 August 1991 he made the famous public announcement of Linux on [Usenet](usenet.md) in which he claimed it was just a hobby project and that it "wouldn't be big and professional as [GNU](gnu.md)". In November 1991 Linux became [self-hosted](self_hosting.md) with the version 0.10 -- by the time a number of people were already using it and working on it. In 1992, with version 0.12, Linux became [free software](free_software.md) with the adoption of the [GPL](gpl.md) license. + +On 14 March 1994 Linux 1.0 -- a fully functional version -- was released. + +TODO: moar \ No newline at end of file diff --git a/living.md b/living.md new file mode 100644 index 0000000..098ec05 --- /dev/null +++ b/living.md @@ -0,0 +1,30 @@ +# Making Living + +The question of how to make a living by making something that's to be given out for free and without limitations is one of the most common in the context of [FOSS](foss.md)/[free culture](free_culture.md). Noobs often avoid this area just because they think it can't be done, even though there are ways of doing this and there are many people making living on FOSS, albeit ways perhaps more challenging than those of [proprietary](proprietary.md) products. + +One has to be aware that **money and commercialization always brings a high risk of profit becoming the highest priority** (which is a "feature" hard-wired in [capitalism](capitalism.md)) which will compromise the quality and ethics of the produced work. Profiting specifically requires abusing someone else, taking something away from them. Therefore **it is ideal to create [LRS](lrs.md) on a voluntary basis, for free, in the creator's spare time**. This may be difficult to do but one can choose a lifestyle that minimizes expenses and therefore also time needed to spend at work, which will give more free time for the creation of [LRS](lrs.md). This includes living frugally, not consuming hardware and rather reusing old machines, making savings, not spending on unnecessary things such as smoking or fashion etc. And of course, if you can't make LRS full-time, you can still find relatively ethical ways of it supporting you and so, again, giving you a little more freedom and resources for creating it. + +Also if can somehow rip off a rich corporation and get some money for yourself, do it. Remember, corporations aren't people, they can't feel pain, they probably won't even notice their loss and even if you hurt them, you help the society by hurting a predator. + +**Is programming software the only way to make money with LRS?** No, you can do anything related to LRS and you don't even have to know [programming](programming.md). You can create [free](free_culture.md) art such as [game](game.md) assets or writings, you can educate, write articles etc. + +## Making Money With "FOSS" + +For inspiration we can take a look at traditional ways of making money in FOSS, even if a lot of them may be unacceptable for us as the business of the big FOSS is many times not so much different from the business of big tech corporations. + +With [open source](open_source.md) it is relatively easy to make money and earn salary as it has become quite successful on the market -- the simplest way is to simply get a job at some company making open source software such as [Mozilla](mozilla.md), [Blender](blender.md) etc. However the [ethics](ethics.md) of the open source business is often questionable. Even though open source technically respects the rules of [free software](free_software.md) licenses, it has (due to its abandonment of ethicality) found ways to abuse people in certain ways, e.g. by being a [capitalist software](capitalist_software.md). Therefore open source software is not really [LRS](lrs.md) and we consider this way of making money rather harmful to others. + +Working for [free software](free_software.md) organizations such as the [FSF](fsf.md) is a better way of making living, even though still not perfect: FSF has been facing some criticism of growing corruption and from the [LRS](lrs.md) point of view they do not address many issues of software such as [bloat](bloat.md), [public domain](public_domain.md) etc. + +## Way Of Making Money With LRS + +Considering all things mentioned above, here are some concrete things of making money on LRS. Keep in mind that a lot of services (PayPal, Patreon etc.) listed here may possibly be [proprietary](proprietary.md) and unethical, so always check them out and consider free alternatives such as [Liberapay](liberapay.md). The methods are following: + +- **[donations](donation.md)**: You may ask for donations e.g. on your website or Patreon (people often ask for [cryptocurrencies](crypto.md) or traditional money via services like [Liberapay](liberapay.md), PayPal or Buy Me a Coffee). For significant earnings you need to be somewhat popular because people donate extremely rarely, but if your work is good, there sometimes appears a generous donor who sends you a lot of money ({Happened to me at least once. I hereby thank the person greatly. ~drummyfish}). It can help if you create "content" such as programming videos alongside your project to get some "following", but it may also distract you and take some of your energy. People like [Luke Smith](luke_smith.md) make quite some big money like this. A lot of [free culture](free_culture.md) artists are successful in creating free art this way. +- **[crowd funding](crowd_funding.md)**: A method similar to donations but a little more "encouraging" for the donors. You set a financial goal and if enough people donate to reach that goal, you get the money and create the project. Patreon and Kickstarter are typically used for this. +- **[pay what you want](pay_what_you_want.md)**: Here you create the work and then offer a download with optional payment, typically with some suggested price. People who can't afford to pay don't have to. This method has the advantage of not putting you under deadline pressures like the crowd funding method. Sites like [itch.io](https://itch.io/) are friendly to this option. +- **selling physical products and [merchandise](merch.md)** ("merch"): This method makes use of the fact that selling physical items is usually not considered unethical, unlike selling copies of information. So you can e.g. create a [free](free_software.md) video [game](game.md) and then sell T-shirts or coffee mugs with that video game's themes. In the past some [GNU](gnu.md)/[Linux](linux.md) distros used to sell their systems on nice "officials" CDs, but nowadays CDs are kind of dead. [Open consoles](open_console.md) kind of do this as well, they create [FOSS](foss.md) games and tools and then sell hardware that runs these games. +- You can specifically **make use of the advantages of LRS** and get some company to pay you. For example an [open console](open_console.md) creator will be highly interested in an engine for 3D games that will run on very low-spec embedded hardware because that will increase interest in their product. Existing FOSS engines, even the lightweight ones, are [bloated](bloat.md) and won't run on such hardware, however LRS ones, such as [small3dlib](small3dlib.md), will. Even if the company doesn't pay you directly, they might at least send you their product for free ({I got some open consoles for free for porting [Anarch](anarch.md) to them. ~drummyfish}). +- **selling services**: Like with merchandise, selling services is normally not considered unethical and so we can do it. The services can e.g. be running a server with [LRS](lrs.md) software with paid accounts or offering maintenance/configuration of someone else's servers. This supports the development of the software in question and helps you get paid. +- **selling on proprietary sites** (CONTROVERSIAL): This may not be acceptable by everyone, but it can be possible to create a free work and then distribute it under [free](free_software.md) conditions in some places and simultaneously sell this item in places distributing [proprietary](proprietary.md) assets. E.g. one may create a 3D model and put it under a free license on [opengameart](oga.md) while also selling it in 3D models stores like TurboSquid -- this will make the model available for everyone as free but will make people who don't bother to search the free sites pay for it. This may potentially bring much more money than the other methods as the proprietary stores have big traffic and people there are specifically willing to spend money. However, this supports the [intellectual property](intellectual_property.md) business. **Important note**: read the terms&condition of the proprietary site, it may for example be illegal for you to share your assets elsewhere if the proprietary site makes you *sign* an exclusive deal for them. {I am actually guilty of this, been selling some small 3D models on TurboSquid. It provides a kind of stable mini-income of about $3/month. ~drummyfish} +- **[non-profit](non_profit.md)**: It is possible to run a non-profit organization that creates [software](software.md) for public benefit -- details differ by each country but a non-profit may receive funding from the state and be exempted from taxes. This method may however require a lot of effort (as running an organization is much more difficult than setting a donation website) and may potentially be limiting in some ways (governments may have condition for the funding etc.). \ No newline at end of file diff --git a/lmao.md b/lmao.md new file mode 100644 index 0000000..c6c7bac --- /dev/null +++ b/lmao.md @@ -0,0 +1,26 @@ +# LMAO + +LMAO stands for *laughing my ass off*. + +## LMOA stuff + +- There was a guy who made a whole game (named *DRAGON: A Game About a Dragon*), some 30000+ lines of code, without knowing about the concept of loops. He only ever used the if statement. (This was posted on reddit along with a portion of the code.) +- In 2021 [Alexa](alexa.md) (the shitty Amazon voice spy agent) told a 10 year old to touch an electric plug with a penny after the kid asked her "for a challenge". +- Around 2015 some [niggas](nigger.md) got enraged when Google Photos tagged them as gorillas. +- The MMORPG *New World* by *Amazon Games* was programmed by retards (probably some diversity team) who made the client authoritative which allowed for [fun](fun.md) such as becoming invincible by draggine the game window or duplicate currency with lag switches. +- In 2016 there was a progaming team in Halo called Mi Seng which in a broadcast game did a pretty funny thing: when they were leading they went into hiding in buggy spots and then just did nothing until the time ran out. Normies were crying, the commentators were pretty awkward, they considered this "unethical" xD We consider it pretty cool. +- In 2016 [Micro$oft](microsoft.md) released a Twitter [AI](ai.md) bot called Tay which was made to teach itself how to talk from the text on the Internet. It can be guessed it quickly became extremely racist and enraged waves of [SJW](sjw.md)s so they had to shut it down. +- There are many funny stories from [4chan](4chan.md). In 2012 they made masses of Justin Bieber fans shave their heads by spreading fake news that Bieber had cancer under the hashtag #BaldForBieber. In 2013 they made a similarly funny prank by making Justin Bieber fans cut themselves with another faked campaign #CuttingForBieber. In 2013 they made a huge number of Appletoddlers destroy their [iPhones](iphone.md) with fake ads that promoted a new "feature" that makes the phone waterproof via a software update. Similarly in 2014 they spread fake ads about a new iPhone "feature" that would let users charge their phones in a microwave. 4chan also hijacked many internet polls such as the Mountain Dew's poll for naming their new drink in 2012: people from 4chan raided the poll and chose the name "Hitler Did Nothing Wrong", with names such as "Diabeetus" or "Soda" as followers. Another raided poll was that of Talor Swift about at which school she should perform -- 4chan mass voted for a school for deaf children which eventually won (Taylor Switch handled it by donating money to the school). 4chan also chose North Korea as a country for Justin Bieber's tour. Another hilarious story is from 2006 when 4chan raided the Habbo Hotel (a MMO game mostly for children); they made shitton of black characters with afros, went around blocking players from accessing game areas, grouping to form swastikas and famously blocking a hotel pool with the sign "Pool's closed due to AIDS". +- In 2022 a proprietary "[smart](smart.md) home" company Insteon got into financial trouble, shut down its servers and left people without functioning houses. Retards fucking deserved it xD +- In the 1985 book *Big Score: The Billion-Dollar Story: The Billion-Dollar Story of Silicon Valley* there is a nice chapter talking about the manufacturing of integrated chips that explains how the process is (or at least used to be) very unpredictable and how it's basically astrology for the managers to try to predict and maximize the yield rates (the percentage of manufactured chips that function correctly). There were companies whose research showed the number of good chips correlated with the phases of the Moon, another one found that chips were destroyed by tiny droplets of piss on the hands of workers who didn't wash their hands and that [women](woman.md) workers during menstruation destroyed more chips because of the increased amount of oil secreted from their hands. +- The unexpected assassination of Lord British in Ultima Online in 1997 was pretty funny. +- [Elizabeth Holmes](elizabeth_holmes.md) +- In 2019 a [progaming](progaming.md) ("esports") organization Vaevictis tried to make an all-[female](woman.md) League of Legends team, which would be the first such team in the high progaming league. The team quickly failed, it can't even be described how badly they played, of course they didn't even had a hope of gaining a single win, they gained several world records for their failures such as the fastest loss (13 minutes), eventually they got fired from the league xD +- { At my Uni a professor told us some guy turned in an assignment program but forgot to remove the debug prints. The fun part was he was using prints such as "my dick has a length X cm" where X was the debug value. So beware of that. ~drummyfish } + +## See Also + +- [lol](lol.md) +- [rofl](rofl.md) +- [jokes](jokes.md) +- [fun](fun.md) \ No newline at end of file diff --git a/loc.md b/loc.md new file mode 100644 index 0000000..91c1245 --- /dev/null +++ b/loc.md @@ -0,0 +1,12 @@ +# Lines of Code + +Lines of code (LOC, KLOC = 10K LOC, MLOC = 1M LOC etc., also SLOC = source LOC) are a metric of software [complexity](complexity.md) that simply counts the number of lines of program's [source code](source_code.md). It is not a perfect measure but despite some [soyboys](soydev.md) shitting on it it's actually pretty good, espcially when using only one language ([C](c.md)) with consistent [formatting style](code_formatting.md). + +Of course the metric becomes shitty when you have a project in 20 programming languages written by 100 pajeets out of which every one formats code differently. Also when you use it as a [productivity](productivity_cult.md) measure at [work](work.md) then you're guaranteed your devs are gonna just shit our as much meaningless code as possible in which case the measure fails again. Fortunately, at [LRS](lrs.md) we don't have such problems :) + +When counting lines, we need to define what kind of lines we count. We can either count: + +- raw (physical) lines: every single one +- lines that actually "matter" (*logical* lines), e.g. excluding comments, blank lines etc. + +A comfy tool for counting lines is [`cloc`](cloc.md). \ No newline at end of file diff --git a/logic.md b/logic.md new file mode 100644 index 0000000..b94c3cd --- /dev/null +++ b/logic.md @@ -0,0 +1 @@ +# Logic diff --git a/logic_circuit.md b/logic_circuit.md new file mode 100644 index 0000000..375b8c8 --- /dev/null +++ b/logic_circuit.md @@ -0,0 +1,27 @@ +# Logic Circuit + +Logic circuits are circuits made of [logic gates](logic_gate.md) that implement [Boolean functions](bool.md), i.e. they are "schematics to process 1s and 0s". They are used to design [computers](computer.md). Logic circuits are a bit similar to electronic circuits but are a level of [abstraction](abstraction.md) higher: they don't work with continuous [voltages](voltage.md) but rather with [discrete](discrete.md) [binary](binary.md) logic values: 1s and 0s. Logical circuits can be designed and simulated with specialized software and languages such as [VHDL](vhdl.md). + +Generally a logic circuit has *N* input bits and *M* output bits. Then we divide logic circuits into two main categories: + +- **combinational**: The output values only depend on the input values, i.e. the circuit implements a pure mathematical [function](function.md). Behavior of such circuit can be described with a [truth table](truth_table.md), i.e. a table that for any combination of input values list their corresponding output. +- **sequential**: The output values generally depend on the input values and the internal state of the circuit, i.e. the circuit has a kind of [memory](memory.md) (it can be seen as a [finite state machine](finite_state_machine.md)). The internal state is normally implemented with so called [flip-flops](flip_flop.md) (logic gates that take as input their own output). Truth tables can't be used for describing these circuits. These circuits also often work with **[clock](clock.md)** synchronization, i.e. they have a specialized input called *clock* that periodically switches between 1 and 0 which drives the circuit's operation (this is where [overclocking](overclocking.md) comes from). + +With logic circuits it is possible to implement any boolean function; [undecidability](undecidability.md) doesn't apply here as we're not dealing with [Turing machines](turing_machine.md) computations because the output always has a finite, fixed width, the computation can't end up in an infinite loop as there are no repeating steps, just a straightforward propagation of input values to the output. It is always possible to implement any function at least as a [look up table](lut.md) (which can be created with a [multiplexer](multiplexer.md)). + +Once we've designed a logic circuit, we can [optimize](optimization.md) it which usually means making it use fewer logic gates, i.e. make it cheaper to manufacture (but optimization can also aim for other things, e.g. shortening the maximum length from input to output, i.e. minimizing the circuit's [delay](delay.md)). The optimization can be done with a number of techniques such as manual simplification of the circuit's logic expression or with [Karnaugh maps](karnaugh_map.md). + +Some common logic circuits include: + +- **[adder](adder.md)**: Performs addition. It has many parameters such as the bit width, optional carry output etc. +- **[multiplier](multiplier.md)**: Performs multiplication. +- **[multiplexer](multiplexer.md)** (mux): Has *M* address input bits plus another *2^M* data input bits. The output of the gate is the value of *N*th data bit where *N* is the number specified by the address input. I.e. the circuit selects one of its inputs and sends it to the output. This can be used to implement e.g. [memory](memory.md), [look up tables](lut.md), [bus](bus.md) arbiters and many more things. +- **[demultiplexer](demultiplexer.md)** (demux): Does the opposite of multiplexer, i.e. has one *M* address inputs and 1 data input and *2^M* outputs. Depending on the given address, the input is redirected to *N*th output (while other outputs are 0). +- **[decoder](decoder.md)**: Has *M* inputs and *2^M* outputs. It sets *N*th output to 1 (others are 0) where *N* is the binary number on the input. I.e. decoder converts a binary number into one specific signal. It can be implemented as a demultiplexer whose data input is always 1. +- **[encoder](encoder.md)**: Does the opposite of encoder, i.e. has *2^M* inputs and *M* outputs, expects exactly one of the inputs to be 1 and the rest 0s, the output is a binary number representing the input that's 1. +- **[ALU](alu.md)** (arithmetic logic unit): A more complex circuit capable of performing a number of logic and arithmetic operations. It is a part of a [CPU](cpu.md). +- TODO: more + +## Example + +TODO \ No newline at end of file diff --git a/logic_gate.md b/logic_gate.md new file mode 100644 index 0000000..cb15695 --- /dev/null +++ b/logic_gate.md @@ -0,0 +1,53 @@ +# Logic Gate + +Logic gate is a basic element of [logic circuits](logic_circuit.md), a simple device that implements a [Boolean function](bool.md), i.e. it takes a number of [binary](binary.md) (1 or 0) input values and transforms them into an output binary value. Logic gates are kind of "small boxes" that eat 1s and 0s and spit out other 1s and 0s. Strictly speaking a logic gate must implement a mathematical function, so e.g. [flip-flops](flip_flop.md) don't fall under logic gates because they have an internal state/[memory](memory.md). + +Logic gates are to logic circuits kind of what [resistors](resistor.md), [transistors](transistor.md) etc. are for electronic circuits. They implement basic functions that in the realm of boolean logic are equivalents of addition, multiplication etc. + +Behavior of logic gates is, just as with logic circuits, commonly expressed with so called [truth tables](truth_table.md), i.e. a tables that show the gate's output for any possible combination of inputs. But it can also be written as some kind of equation etc. + +There are 2 possible logic gates with one input and one output: + +- **[identity](identity.md) (buffer)**: Output equals the input. This doesn't have any function from the logic perspective but can e.g. be used as a placeholder or to introduce intentional delay in the physical circuit etc. +- **[NOT](not.md)**: Negates the input (0 to 1, 1 to 0). + +There are 16 possible logic gates with two inputs and one output (logic table of 4 rows can have 2^4 possible output values), however only some of them are commonly used and have their own names. These are: + +- **[OR](or.md)**: Gives 1 if at least one input is 1, otherwise 0. +- **[AND](and.md)**: Gives 1 if both inputs are 1, otherwise 0. +- **[XOR](xor.md) (exclusive OR)**: Gives 1 if inputs differ, otherwise 0. +- **[NOR](nor.md)**: Negation of OR. +- **[NAND](nand.md)**: Negation of AND. +- **[XNOR](xnor.md)**: Negative XOR (equality). + +The truth table of these gates is as follows: + +| x | y | x OR y | x AND y | x XOR y | x NOR y | x NAND y | x XNOR y | +|---|---|--------|---------|---------|---------|----------|----------| +| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | +| 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | +| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | +| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | + +``` + ___ ___ _____ _____ + ---\ ''-. ---\ ''-. ---| '. ---| '. + ) )--- ) )O-- | )--- | )O-- + ---/__..-' ---/__..-' ---|_____.' ---|_____.' + OR NOR AND NAND + ___ ___ . . + --\\ ''-. --\\ ''-. ---|'. ---|'. + )) )--- )) )O-- | >--- | >O-- + --//__..-' --//__..-' ---|.' ---|.' + XOR XNOR ' BUFFER ' NOT +``` + +*Traditional symbols for logic gates.* + +Functions NAND and NOR are so called [functionally complete](functional_completeness.md) which means we can implement any other gate with only one of these gates. For example NOT(x) = NAND(x,x), AND(x,y) = NAND(NAND(x,y),NAND(x,y)), OR(x,y) = NAND(NAND(x,x),NAND(y,y)) etc. Similarly NOT(x) = NOR(x,x), OR(x,y) = NOR(NOR(x,y),NOR(x,y)) etc. + +## See Also + +- [logic circuit](logic_circuit.md) +- [quantum gate](quantum_gate.md) + diff --git a/lrs.md b/lrs.md new file mode 100644 index 0000000..6c2c9e8 --- /dev/null +++ b/lrs.md @@ -0,0 +1,95 @@ +# Less Retarded Software + +Less retarded software (LRS) is a specific kind of [software](software.md) aiming to be a truly good technology maximally benefiting and respecting its users, following the philosophy of extreme [minimalism](minimalism.md) ([Unix philosophy](unix_philosophy.md), [suckless](suckless.md), [KISS](kiss.md)), [anarcho pacifism](anpac.md) and [freedom](free_software.md). The term was invented by [drummyfish](drummyfish.md). By extension LRS can also stand for *less retarded society*. + +## Definition + +The definition here is not strict but rather fuzzy, it is in a form of ideas, style and common practices that together help us subjectively identify software as less retarded. + +[Software](software.md) is less retarded if it adheres, to a high-degree (not necessarily fully), to the following principles: + +- Being made with a [**truly selfless**](selfless.md) goal of maximally helping all living beings who may use the software without any intent of taking advantage of them in any way. +- Trying to follow the [Unix philosophy](unix_philosophy.md) (do one thing well, use text interfaces, ...). +- Trying to follow the [suckless](suckless.md) philosophy (configs as source files, distributing in source form, ...). +- Being [minimalist](minimalism.md) ([single compilation unit](single_compilation_unit.md), [header-only](header_only.md) libraries, no build systems, no [OOP](oop.md) languages, ...), countercomplex, [KISS](kiss.md), [appropriate technology](appropriate_tech.md). +- Being [free software](free_software.md) legally but ALSO practically (well commented, not bloated and obscured etc., so as to truly and practically enable the freedoms to study, modify etc.). This may also include attributes such as [decentralization](decentralization.md). +- Being [free culture](free_culture.md), i.e. LRS programs are free as a whole, including art assets, data etc. +- Minimizing [dependencies](dependency.md), even those such as standard library or relying on OS concepts such as files or threads, even indirect ones such as build systems and even non-software ones (e.g. avoiding [floating point](float.md), GPU, 64bit etc.). +- Very portable, non-discriminating, i.e. being written in a portable language (C etc.), using as little resources as possible (RAM, CPU, ...) and so on. +- [Future-proof](future_proof.md), [self-contained](self_contained.md), not controlled by anyone (should follow from other points). This may even include attributes such as physical durability and design that maximizes the devices life. +- [Hacking](hacking.md) friendly and inviting to improvements and customization. +- Built on top of other LRS technology such as the [C99](c.md) language, Unix OS, our own libraries etc. +- Simple permissive licensing (being suckless legally) with great preference of [public domain](public_domain.md), e.g. with [CC0](cc0.md) + patent [waivers](waiver.md). +- Elegant by its simple, well thought-through solutions. (This is to be contrasted with modern rapid development.) +- No [bullshit](bullshit.md) such as [codes of conduct](coc.md), tricky licensing conditions etc. + +## Why + +LRS exists for a number of reasons, one of the main ones is that we simply need better technology -- not better as in better performance but better in terms of design and ethics. Technology has to make us more free, not the other way around. Technology has to be a tool that serves us, not a device for our abuse. We believe [mainstream](capitalist_software.md) tech poses a serious, even existential threat for our civilization. We don't think we can prevent [collapse](collapse.md) or a dystopian scenario on our own, or even if these can be prevented at all, but we can help nudge the technology in a better direction, we can inspire others and perhaps make the future a little brighter, even if it's destined to be dark. Even if future seems hopeless, what better can we do than try our best to make it not so? + +There are other reason for LRS as well, for example it can be very satisfying and can bring back joy of programming that's been lost in the modern toxic environment of the mainstream. Minimalist programming is pleasant on its own, and in many things we do we can really achieve something great because not many people are exploring this way of tech. For example there are nowadays very few programs or nice artworks that are completely [public domain](public_domain.md), which is pretty sad, but it's also an opportunity: you can be the first human to create a completely public domain software of certain kind. Software of all kind has already been written, but you can be the first one who creates a truly good version of such software so that it can e.g. be run on embedded devices. If you create something good that's public domain, you may even make some capitalist go out of business or at least lose a lot of money if he's been offering the same thing for money. You free people. That's a pretty nice feeling. + +{ Here and there I get a nice email from someone who likes something I've created, someone who just needed a simple thing and found that I've made it, that alone is worth the effort I think. ~drummyfish. } + +## Politics + +LRS is connected to pretty specific political beliefs, but it's not a requirement to share those beliefs to create LRS or be part of its community. You may believe in whatever you want, as long as you create or support LRS, you are part of this. We just think that it doesn't make logical sense to support LRS and not the politics that justifies it and from which it is derived. This is up to your own reasoning though. + +With that said, the politics behind LRS is [anarcho pacifist](anpac.md) [communism](communism.md), but NOT [pseudoleftism](pseudoleftism.md) (i.e. we do not support political correctness, [COC](coc.md)s, [cancel culture](cancel_culture.md), Marxism-Leninism etc.). In out views, goals and means we are similar to the [Venus project](venus_project.md). We do NOT have any leaders or heroes; people are imperfect and giving some more power, louder voices or greater influence creates hierarchy and goes against anarchism, therefore we only follow ideas. We aim for true social (not necessarily physical) equality of everyone, our technology helps everyone equally. We reject anti-equality means such as violence, bullying, [censorship](censorship.md), [governments](government.md) and [capitalism](capitalism.md). We support things such as [universal basic income](ubi.md) and [slow movement](slow_movement.md). We highly prefer peaceful [evolution](evolution.md) to [revolution](revolution.md) as revolutions tend to be violent and have to be [fought](fight_culture.md) -- we do not intend to push any ideas by force but rather to convince enough people to a voluntary change. + +**We love all living beings**, even those we disagree with and whom we dislike. + +## Specific Software + +The "official" LRS programs and libraries have so far been solely developed by [drummyfish](drummyfish.md), the "founder" of LRS. These include: + +- **[Anarch](anarch.md)**: Game similar to [Doom](doom.md). +- **[raycastlib](raycastlib.md)**: Advanced 2D [raycasting](raycasting.md) rendering library. +- **[SAF](saf.md)**: Tiny library for small portable games. +- **[small3dlib](small3dlib.md)**: Simple software rasterizer for 3D rendering. +- **[smallchesslib](smallchesslib.md)**: Simple [chess](chess.md) library and engine ([AI](ai.md)). +- **[microtd](utd.md)**: Simple [tower defense](tower_defense.md) game written with [SAF](saf.md). + +Apart from this software a lot of other software developed by other people and groups can be considered LRS, at least to a high degree (there is usually some minor inferiority e.g. in licensing). Especially [suckless](suckless.md) software mostly fits the LRS criteria. The following programs and libraries can be considered LRS at least to some degree: + +- **[brainfuck](brainfuck.md)**: Extremely simple [programming language](programming_language.md). +- **[dwm](dwm.md)**: Official [suckless](suckless.md) [window manager](wm.md). +- **[OpenBSD](openbsd.md)**: Cool [operating system](os.md). +- **[LIL](lil.md)**: Tiny embeddable [scripting](script.md) programming language. +- **[lisp](lisp.md)**: Programming language with a pretty elegant design. +- **[st](st.md)**: Official [suckless](suckless.md) [terminal emulator](terminal.md). +- **[badwolf](badwolf.md)**: Very small yet very usable [web browser](browser.md). +- **[FORTH](forth.md)**: Small programming language with very nice design. +- **[surf](surf.md)**: Official [suckless](suckless.md) [web browser](browser.md). +- **[tcc](tcc.md)**: Small [C](c.md) [compiler](compiler.md) (alternative to [gcc](gcc.md)). +- **[musl](musl.md)**: Tiny [C](c.md) standard library (alternative to [glibc](glibc.md)). +- **[vim](vim.md)** (kind of): [TUI](tui.md) text/[programming](programming.md) [editor](editor.md). Vim is actually relatively big but there are smaller builds, flavors and alternatives. +- **[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), [uClibc](uclibc.md), [miniz](miniz.md), [nuklear](nuklear.md), [dmenu](dmenu.md), [sbase](sbase.md), [sic](sic.md), [tabbed](tabbed.md), [svkbd](svkbd.md), [busybox](busybox.md) and others. + +It is also possible to talk about LRS data formats, [protocols](protocol.md), standards, designs and concepts as such etc. These might include: + +- **[ASCII](ascii.md)**: Text encoding. +- **[fixed point](fixed_point.md)**: Fractional number format, as opposed to [floating point](float.md). +- **[RGB332](rgb332.md)**, **[RGB565](rgb565.md)**: Simple [RGB](rgb.md) formats/palettes. +- **[bytebeat](bytebeat.md)**: Simple and powerful [procedural](procedural.md) music technique. +- **[farbfeld](farbfeld.md)**: [Suckless](suckless.md) image format. +- **[gopher](gopher.md)**: Simple alternative to the [Web](www.md). +- **[json](json.md)**: Simple [data](data.md) text format. +- **[lambda calculus](lambda_calculus.md)**: Minimal [functional](functional.md) language. +- **[markdown](markdown.md)**: Very simple document format. +- **[ppm](ppm.md)**: Simple image format. +- **[qoi](qio.md)**: Lossless [compression](compression.md) image format in < 1000 LOC, practically as good as [png](png.md). +- **[reverse polish notation](rpn.md)** as opposed to traditional expression notation with brackets, operator precedence and other [bloat](bloat.md). +- **[set theory](set_theory.md)**: Basis of all [mathematics](math.md). +- **[textboards](textboard.md)**, **[imageboards](imageboard.md)** and pure [HTML](html.md) personal websites as opposed to [forums](forum.md) (no registration, no users, simple interface) or even [social networks](social_network.md) +- **[Turing machine](turing_machine.md)**: Minimal definition of a [computer](computer.md). +- **[txt2tags](txt2tags.md)**: Very simple document format. + +Other technology than software may also be aligned with LRS principles, e.g.: + +- Simple cheap **[bicycle](bicycle.md)** without changing gears, as opposed to e.g. a [car](car.md). +- **[Knives](knife.md)** are pretty less retarded. +- [rocks](rock.md) +- TODO \ No newline at end of file diff --git a/lrs_wiki.md b/lrs_wiki.md new file mode 100644 index 0000000..5875fa8 --- /dev/null +++ b/lrs_wiki.md @@ -0,0 +1,5 @@ +# LRS Wiki + +LRS wiki, also Less Retarded Wiki, is a [public domain](public_domain.md) encyclopedia focused on [technology](tech.md) and related topics such as the relationship between technology and society. The goal of LRS is to work towards creating a truly good technology that helps all living beings as much as possible, so called [less retarded software](lrs.md) (LRS). As such the wiki rejects for example [capitalist software](capitalist_software.md), [bloated](bloat.md) software, [intellectual property](intellectual_property.md) laws etc. It embraces [free as in freedom](free_software.md), simple technology, i.e. [Unix philosophy](unix_philosophy.md), [suckless](suckless.md) software etc. + +LRS wiki was started by [drummyfish](drummyfish.md) on November 3 2021 as a way of recording and spreading his views and findings about technology, as well as for creating a completely public domain educational resource. \ No newline at end of file diff --git a/luke_smith.md b/luke_smith.md new file mode 100644 index 0000000..5fdffd2 --- /dev/null +++ b/luke_smith.md @@ -0,0 +1,16 @@ +# Luke Smith + +Luke Smith is an Internet tech mini-celebrity known for making videos about [suckless](suckless.org) software, independent living in the woods and here and there about historical, political, linguist and religious topics. His look has been described as the *default Runescape character*: he is bald, over 30 years old and lives in a rural location in Florida (exact coordinates have been doxxed but legally can't be shared here, but let's just say the road around his house bears his name). He has a podcast called *Not Related!* in which he discusses things such as alternative historical theories -- actually a great podcast. He has a minimalist 90s style website https://lukesmith.xyz/ and his own [peertube](peertube.md) instace where his videos can be watched if one doesn't want to watch them on [YouTube](youtube.md). He is the author of [LARBS](larbs.md) and minimalist recipe site https://based.cooking/. Unfortunately he's a [crypto](cryptocurrency.md) and [brave](brave.md) browser shill. + +He's kind of based when it comes to many things but also retarded to a great degree other times, for example he used to shill the [Brave](brave.md) browser pretty hard before he realized it was actually a huge scam all along xD He's a crypto fascist, also probably a Nazi. In July 2022 he started promoting some shitty [bloated](bloat.md) [modern](modern.md) tranny website generator that literally uses [JavaScript](js.md)? WHAT THE FUCK. 100% he's getting paid for that promotion. He seems to be going to huge shit. It sadly seems like he's just another [capitalist](capitalism.md), so we recommend slowly unsubscribing from this guy's feed. + +Luke is a [type B fail](fail_ab.md). + +His videos consist of normie-friendly tutorials on suckless software, rants, independent living, live-streams and podcasts. The typical Luke Smith video is him walking somewhere in the middle of a jungle talking about how retarded modern technology is and how everyone should move to the woods. + +Luke studies PhD in linguistics but is very critical of academia -- he "speaks" several languages (including [Latin](latin.md)), though many of them to a low level with bad American accent and he can't sometimes even speak English correctly (using phrases such as "the reason is because", "less people" etc.). He is a self described [right-winder](left_right.md) and talks in meme phrases which makes his "content" kind of enjoyable. He despises such things as [soydevry](soydev.md), [bloat](bloat.md), "consoomerism" and [soyence](soyence.md). + +## See Also + +- [Mental Outlaw](mental_outlaw.md): Luke's black clone +- [Distro Tube](distro_tube.md) \ No newline at end of file diff --git a/main.md b/main.md new file mode 100644 index 0000000..6d6e24f --- /dev/null +++ b/main.md @@ -0,0 +1,80 @@ +# Welcome To The Less Retarded Wiki + +*Love everyone, help [selflessly](selflessness.md).* + +Welcome to [Less Retarded Wiki](lrs_wiki.md), an encyclopedia only I can edit. But you can [fork](fork.md) it, it is [public domain](public_domain.md) under [CC0](cc0.md) (see [wiki rights](wiki_rights.md)) :) Holy [shit](shit.md), I'm gonna get [cancelled](cancel_culture.md) hard as soon as [SJWs](sjw.md) find out about this. Until then, let's enjoy the ride. THERE'S NO [MODERATION](moderation.md), I can do whatever I want here lol. I love this. INB4 "[hate speech](hate_speech.md)" website. + +{ I no longer see hope, good is practically non existent in this world. This is my last attempt at preserving pure good, I will continue to spread the truth and unconditional love of all life as long as I will be capable of, until the society lynches me for having loved too much. At this point I feel very alone, this work now exists mostly for myself in my isolated world. But I hope that once perhaps my love will be shared with a reader far away, in space or time, even if I will never know him. This is the only way I can continue living. I wish you happy reading, my dear friend. ~[drummyfish](drummyfish.md) } + +This is a Wiki for [less retarded software](lrs.md), less retarded society (LRS) and related topics, mainly those of [politics](politics.md) and [society](society.md), idealization of which LRS should help achieve. LRS Wiki is a new, refreshing wiki without [political correctness](political_correctness.md). + +**We love all living beings. Even you.** We want to create technology that truly and maximally helps you. We do NOT [fight](fight_culture.md) anything. We want to move towards society that's not based on [competition](competition.md) but rather on [collaboration](collaboration.md). + +This wiki is **NOT** a satire. + +Are you failure? Learn [which type](fail_ab.md) you are. + +**Before contributing please read the [rules & style](wiki_style.md)! By contributing you agree to release your contribution under our [waiver](wiki_rights.md).** {But contributions aren't really accepted RN :) ~drummyfish } + +We have a **[C tutorial](c_tutorial.md)**! It [rocks](rock.md). + +Pay us a visit on the [Island](island.md) and pet our [dog](dog.md)! And come mourn with us in the [cathedral](cathedral.md), because **technology is dying**. The future is dark but we do our best to bring the light, even knowing it is futile. + +LRS Wiki is [collapse](collapse.md) ready! Feel free to print it out, take it to your prep shelter. You may also print copies of this wiki and throw it from a plane into the streets. Thanks. + +If you're new here, you may want to read answers to [frequently asked questions](faq.md) (**FAQ**), including "Are you a fascist?" (spoiler: no) and "Do you love Hitler?". + +## What Is Less Retarded Software + +Well, we're trying to figure this out on this wiki, but it is greatly related to [suckless](suckless.md), [Unix](unix.md), [KISS](kiss.md), [free](free_software.md), selfless and sustainable software created to maximally help all living beings. LRS stands opposed to all [shittiness](shit.md) of so called ["modern"](modern.md) software. We pursue heading towards an ideal society such as that of the [Venus project](venus_project.md). For more details see the article about [LRS](lrs.md). + +## Are You A Noob? + +Are you a noob but see our ideas as appealing and would like to join us? Say no more and head over to a [how to](how_to.md)! + +## Some Interesting Topics + +If you don't know where to start, here are some suggestions. If you're new, the essential topics are: + +- [free software](free_software.md) +- [suckless](suckless.md) +- [less retarded software](lrs.md) +- [anarcho pacifism](anpac.md) +- [capitalism](capitalism.md) +- [capitalist software](capitalist_software.md) +- [type A/B fail](fail_ab.md) +- [free culture](free_culture.md) +- [C tutorial](c_tutorial.md) +- [pseudoleft](pseudoleft.md) +- [antivirus paradox](antivirus_paradox.md) +- [public domain](public_domain.md) +- [history](history.md) +- [Venus project](venus_project.md) + +Some more specialized topics you may want to check out are: + +- [3D rendering](3d_rendering.md) +- [OOP](oop.md) +- [procedural generation](procgen.md) +- [optimization](optimization.md) +- [computer graphics](graphics.md) +- [portability](portability.md) + +And if you just want something more obscure and [fun](fun.md), check out these: + +- [jokes](jokes.md) +- [esoteric programming languages](esolang.md) +- [open consoles](open_console.md) +- [brain software](brain_software.md) +- [C obfuscation contest](ioccc.md) +- [Kwangmyong](kwangmyong.md) +- [bytebeat](bytebeat.md) +- [netstalking](netstalking.md) +- [steganography](steganography.md) +- [lmao](lmao.md) +- [shit](shit.md) +- [demoscene](demoscene.md) +- [gaymes](game.md) +- [Circumlunar](circumlunar.md) +- [Dodleston messages mystery](dodleston.md) +- [interplanetary internet](interplanetary_internet.md) diff --git a/maintenance.md b/maintenance.md new file mode 100644 index 0000000..79b60f4 --- /dev/null +++ b/maintenance.md @@ -0,0 +1,5 @@ +# Maintenance + +Maintenance is [shitty](shit.md) [work](work.md) whose goal is just to keep a program functioning without improving it. Maintenance is extremely expensive, tiresome and enslaves humans to machines -- we try to minimize the maintenance cost as much as possible! Good programs should go to great lengths in effort to becoming highly [future-proof](future_proof.md) and [suckless](suckless.md) in order to avoid high maintenance cost. + +Typical "[modern](modern.md)" capitalist/consumerist software (including most [free software](free_software)) is ridiculously bad at avoiding maintenance -- such programs will require one to many programmers maintaining it every single day and will become unrunnable in matter of months to years without this constant maintenance that just wastes time of great minds. I don't know what to say, this is just plainly fucked up. \ No newline at end of file diff --git a/malware.md b/malware.md new file mode 100644 index 0000000..9f8f60d --- /dev/null +++ b/malware.md @@ -0,0 +1,3 @@ +# Malware + +Malware is [software](software.md) whose purpose is to be malicious. Under this fall [viruses](virus.md), [proprietary software](proprietary.md), [spyware](spyware.md), [DRM](drm.md) software, [ransomware](ransomware.md), propaganda software, cyberweapons etc. \ No newline at end of file diff --git a/mandelbrot_set.md b/mandelbrot_set.md new file mode 100644 index 0000000..f50dd1c --- /dev/null +++ b/mandelbrot_set.md @@ -0,0 +1,88 @@ +# Mandelbrot Set + +TODO + +``` + ___________________________________________________________ +|[-2,1] . | +| .:. | +| ::::: | +| ...:::.. . | +| :..:::::::::::::.... | +| .:::::::::::::::::::' | +| :::::::::::::::::::::::: | +| :::::::::::::::::::::::::' | +| :..:::. .:::::::::::::::::::::::::: | +| .:::::::::. :::::::::::::::::::::::::: | +| .. ::::::::::: :::::::::::::::::::::::::' | +| ' ' '::':::::::::::'::::::::::::::::::::::::. | +| ::::::::::: :::::::::::::::::::::::::: | +| ':::::::' ::::::::::::::::::::::::::. | +| ' ''' :::::::::::::::::::::::::' | +| '::::::::::::::::::::::::' | +| ''::::::::::::::::::::'' | +| :::::::::::::::::::: | +| ' ''::::::::'': | +| .:::. | +| ':::' | +| : | +|___________________________________________________[0.5,-1]| +``` + +## Code + +The following code is a simple [C](c.md) program that renders the Mandelbrot set into terminal (for demonstrative purposes, it isn't efficient or do any [antialiasing](antialiasing.md)). + +``` +#include + +#define ROWS 30 +#define COLS 60 +#define FROM_X -2.0 +#define FROM_Y 1.0 +#define STEP (2.5 / ((double) COLS)) + +unsigned int mandelbrot(double x, double y) +{ + double cx = x, cy = y, tmp; + + for (int i = 0; i < 1000; ++i) + { + tmp = cx * cx - cy * cy + x; + cy = 2 * cx * cy + y; + cx = tmp; + + if (cx * cx * cy * cy > 1000000000) + return 0; + } + + return 1; +} + +int main(void) +{ + double cx, cy = FROM_Y; + + for (int y = 0; y < ROWS; ++y) + { + cx = FROM_X; + + for (int x = 0; x < COLS; ++x) + { + unsigned int point = + mandelbrot(cx,cy) + (mandelbrot(cx,cy + STEP) * 2); + + putchar(point == 3 ? ':' : (point == 2 ? '\'' : + (point == 1 ? '.' : ' '))); + + cx += STEP; + } + + putchar('\n'); + + cy -= 2 * STEP; + } + + return 0; +} +``` \ No newline at end of file diff --git a/marble_race.md b/marble_race.md new file mode 100644 index 0000000..205044b --- /dev/null +++ b/marble_race.md @@ -0,0 +1,7 @@ +# Marble Race + +Marble race is a simple [real life](irl.md) [game](game.md) in which marbles (small glass balls) are released onto a prepared track to race from start to finish by the force of gravity. This game is great because it is [suckless](suckless.md), cheap (i.e. accessible), [fun](fun.md) and has almost no [dependencies](dependency.md), not even a [computer](computer.md) -- such a game will be playable even after the technological [collapse](collapse.md). + +Even though this is a real life game, a computer version can be made too, in different forms: [2D](2d.md), [3D](3d.md), realistic or with added elements that would be impossible in real life, such as teleports. And indeed, there have been many games and mini-games made based on this form of entertainment. + +From the implementation point of view it is very convenient that marbles are of spherical shape as this is one of the simplest shapes to handle in physics engines. \ No newline at end of file diff --git a/marketing.md b/marketing.md new file mode 100644 index 0000000..4a502f0 --- /dev/null +++ b/marketing.md @@ -0,0 +1,16 @@ +# Marketing + +Marketing is an unethical practice, plentifully used in [capitalism](capitalism.md), of forcing a product or corporate propaganda by means of lying, tricks, brainwashing, torture, exploiting psychological weaknesses of people and others. This manifests mostly as advertisements and commercials in media but also in other ways such as fake product reviews, product placement etc. + +Specific practices used in marketing are: + +- **Lies** and falsehoods. Every ad will present the product as the best, even though not all products can be best. Actors will be paid to lie about how the product changed their life etc. -- so called **[astroturfing](astroturfing.md)**. Many times numbers and "facts" whose source is difficult to trace will be completely made up. **Fake discounts** are something constantly presented in ads. +- **Extreme repetition/[spam](spam.md)**: this includes repeating the same commercial over and over (e.g. every 10 minutes) as well as repeating the name of the product in a completely retarded way (*"We recommend X because X is the best. For more info about X visit www.X.com. Remember, X is the best. Your X."*). +- **Psychological tricks** such as **abusing songs** and shitty catchy melodies, often raping existing good music by for example changing the lyrics. This abuses the fact that a song will stick in one's head and keep torturing the person into thinking about the advertised product constantly. Other tricks include **shouting** or **fake empathy** ("we care about your" etc.). +- **Misleading statistics**, presentation and interpretation of data. For example any success rate will be presented as the upper bound as such a number will be higher, typically 99% or 100%, i.e. *"our product is successful in up to 100% cases!"* (which of course gives zero information and only says the product won't succeed in more than 100% cases). A company may also run its own competition for a "best product", e.g. on [Facebook](facebook.md), in which all products are of course their products, and then the winning product will be seen on TV as a "contest winning product". +- **Forcefully seizing attention**: ads are present practically everywhere, even embedded in "art" (even in that one pays for), in the sky (planes and blimps, ...), they play on every radio you hear in every shop, they pop up on electronic devices one paid for, they can't be turned off. They are present in education materials and targeted at children. Audio of a commercial will be made louder to catch an attention when it starts playing on a commercial break. +- **bribing celebrities/[influencers](influencer.md)**. An *influencer* is nowadays a culturally accepted "job" whose sole work consists of lying, forcing products and spreading corporate propaganda. + +These practices are not rare, they are not even a behavior of a minority, they are not illegal and people don't even see them as unusual or undesirable. People in the US are so brainwashed they even pay to see commercials (Super Bowl). Under capitalism these practices are the norm and are getting worse and worse ever year. + +A naive idea still present among people is that ethical marketing is possible or that it's something that can be fixed by some law, a petition or something similar. In late stage capitalism this is not possible as an "ethical" marketing is a non effective marketing. Deciding to drop the most efficient weapons in the market warfare will only lead to the company losing customers to competition who embraces the unethical means, eventually going bankrupt and disappearing, leaving the throne to the bad guys. Laws will not help as laws are made to firstly favor the market, corporations pay full time lobbyists and law makers themselves are owners of corporations. Even if some small law against "unethical marketing" passes, the immense force and pressure of all the strongest corporations will work 24/7 on reverting the law and/or finding ways around it, legal or illegal, ethical or unethical. \ No newline at end of file diff --git a/markov_chain.md b/markov_chain.md new file mode 100644 index 0000000..a6df0fe --- /dev/null +++ b/markov_chain.md @@ -0,0 +1,41 @@ +# Markov Chain + +Markov chain is a relatively simple [stochastic](stochastic.md) (working with probability) mathematical model for predicting or generating sequences of symbols. It can be used to describe some processes happening in the [real world](real_world.md) such as behavior of some animals, Brownian motion or structure of a language. In the world of programming Markov chains are pretty often used for generation of texts that looks like some template text whose structure is learned by the Markov chain (Markov chains are one possible model used in [machine learning](machine_learning.md)). Chatbots are just one example. + +There are different types of Markov chains. Here we will be focusing on discrete time Markov chains with finite state space as these are the ones practically always used in programming. They are also the simplest ones. + +Such a Markov chain consists of a finite number of states *S0*, *S1*, ..., *Sn*. Each state *Si* has a certain probability of transitioning to another state (including transitioning back to itself), i.e. *P(Si,S0)*, *P(Si,S1)*, ..., *P(Si,Sn)*; these probabilities have to, of course, add up to 1, and some of them may be 0. These probabilities can conveniently be written as a *n x n* matrix. + +Basically Markov chain is like a [finite state automaton](finite_state_automaton.md) which instead of input symbols on its transition arrows has probabilities. + +## Example + +Let's say we want to create a simple [AI](ai.md) for an NPC in a video [game](game.md). At any time this NPC is in one of these states: + +- **Taking cover** (state A): + - 50% chance to stay in cover + - 50% chance to start looking for a target +- **Searching for a target** (state B): + - 50% chance to remain searching for a target + - 25% chance to start shooting at what it's looking at + - 25% chance to throw a grenade at what it's looking at +- **Shooting a bullet at the target** (state C): + - 70% chance to remain shooting + - 10% chance to throw a grenade + - 10% chance to start looking for another target + - 10% chance to take cover +- **Throwing a grenade at the target** (state D): + - 50% chance to shoot a bullet + - 25% chance to start looking for another target + - 25% chance to take cover + +Now it's pretty clear this description gets a bit tedious, it's better, especially with even more states, to write the probabilities as a matrix (rows represent the current state, columns the next state): + +| | A | B | C | D | +| --- | --- | --- | --- | --- | +| A | 0.5 | 0.5 | 0 | 0 | +| B | 0 | 0.5 |0.25 |0.25 | +| C | 0.1 | 0.1 | 0.7 | 0.1 | +| D |0.25 |0.25 | 0.5 | 0 | + +We can see a few things: the NPC can't immediately attack from cover, it has to search for a target first. It also can't throw two grenades in succession etc. Let's note that this model will now be yielding random sequences of actions such as [*cover*, *search*, *shoot*, *shoot*, *cover*] or [*cover*, *search*, *search*, *grenade*, *shoot*] but some of them may be less likely (for example shooting 3 bullets in a row has a probability of 0.1%) and some downright impossible (e.g. two grenades in a row). Notice a similarity to for example natural language: some words are more likely to be followed by some words than others (e.g. the word "number" is more likely to be followed by "one" than for example "cat"). \ No newline at end of file diff --git a/math.md b/math.md new file mode 100644 index 0000000..4f60e6d --- /dev/null +++ b/math.md @@ -0,0 +1,30 @@ +# Mathematics + +Mathematics (also math or maths) is the best [science](science.md) (yes, it is a formal science), which deals with numbers, abstract structures and [logic](logic.md) in as rigorous and objective way as possible. In fact it's the only true science that can actually prove things. It is immensely important in [programming](programming.md) and [computer science](compsci.md). + +Some see math not as a science but rather a discipline that develops formal tools for "true sciences". The reasoning is usually that a science has to use [scientific method](scientific_method.md), but that's a limited view as that's not the only way of obtaining reliable knowledge. Besides that math can and does use the principles of scientific method -- mathematicians first perform "experiments" with numbers and generalize into [conjectures](conjecture.md), however this is not considered [good enough](good_enough.md) in math as it actually has the superior tool of [proof](proof.md) that is considered the ultimate goal of math. In this sense mathematics is more than a science. + +[Soydevs](soydev.md), coding monkeys (such as webdevs) and just retards in general hate math because they can't understand it. They think they can do programming without math, which is just ridiculous. This delusion stems mostly from these people being highly incompetent and without proper education -- all they've ever seen was a shallow if-then-else [python](python.md) "[coding](coding.md)" of baby programs or point-and-click "coding" in gigantic [GUI](gui.md) frameworks such as [Unity](unity.md) where everything is already preprogrammed for them. By Dunning–Kruger they can't even see how incompetent they are and what real programming is about. In reality, this is like thinking that being able to operate a calculator makes you a capable mathematician or being able to drive a car makes you a capable car engineer. Such people will be able to get jobs and do some repetitive tasks such as web development, [Unity](unity.md) game development or system administration, but they will never create anything innovative and all they will ever make will be ugly, [bloated](bloat.md) [spaghetti](spaghetti.md) solution that will likely do more harm than good. + +On the other hand, one does not have to be a math [PhD](phd.md) in order to be a good programmer in most fields. Sure, knowledge and overview of advanced mathematics is needed to excel, to be able to spot and sense elegant solutions, but beyond these essentials that anyone can learn with a bit of will it's really more about just not being afraid of math, accepting and embracing the fact that it permeates what we do and studying it when the study of a new topic is needed. + +**The power of math is limited.** In 1932 [Kurt Godel](godel.md) mathematically proved, with his [incompleteness theorems](incompleteness.md), that (basically) there are completely logical truths which however math itself can never prove, and that math itself cannot prove its own consistency (which killed so called Hilbert's program which seeked to do exactly that). This is related to the limited power of [computers](computer.md) due to [undecidability](undecidability.md) (there are problems a computer can never decide). + +## Overview + +Following are some areas and topics which a programmer should be familiar with: + +- **basics** (high-school level math): arithmetic, algebra, expressions, [functions](function.md), [equations](equation.md), geometry, [trigonometry](trigonometry.md)/goniometry, systems of linear equations, quadratic equations, [complex numbers](complex_number.md), [logarithms](lofarithm.md), analythical geometry (many problems are equivalent to relationships of shapes in N dimensional spaces), [polynomials](polynomial.md) (used in many areas, e.g. error correction codes in networking), ... +- **advanced notation**: ability to understand the notation that's often used in papers etc. (the big sigma for sum, calculus notation etc.) +- **formal [logic](logic.md)**: computers are based on [Boolean](boolean.md) logic, knowing basic formulas and theorems here is crucial (e.g. the completeness of [NAND](nand.md)), formal logic is also just generally used in formal texts, one should know about predicate vs propositional logic etc. +- **[proofs](proof.md)**: core of high level mathematics, one should know the basic proof techniques (direct, [contradiction](contradiction.md), [induction](induction.md), ...). +- **[linear algebra](linear_algebra.md)**: aka "vectors and matrices", essential in almost every field ([graphics](graphics.md), [machine learning](machine_learning.md), ...). +- **[calculus](calculus.md) and differential equations**: just essential for advanced math and many fields (graphics, machine learning, electricity, physics, any optimization, ...). +- **theoretical [computer science](compsci.md)**: [computational complexity](computational_complexity.md) (very important), [computability](computability.md), [formal languages](formal_language.md), computational models ([automata](automaton.md), [Turing machines](turing_machine.md), ...), ... +- **[graph theory](graph.md)**: generally useful tools, especially important e.g. in networks or indexing structures in [databases](database.md). +- **[number](number.md) and [set](set.md) theory**: sets of numbers ([natural](natural_number.md), [rational](rational_number.md), [real](real_number.md), [complex](complex_number.md), ...), [prime numbers](prime.md) (important e.g. for [cryptography](cryptography.md), [quantum computing](quantum.md), ...), ... +- **discrete math**: basic structures such as [groups](group.md) and [fields](field.md), [abstract algebras](abstract_algebra.md) and the properties of these structures. +- **[signal processing](signal_processing.md)**: [Fourier transform](fourier_transform.md) and other integral transforms (important e.g. for [compression](compression.md) and analysis of signals), [aliasing](aliasing.md), filter theory, ... +- **[numerical methods](numerical.md)**: for simulations and [approximations](approximation.md) of solutions to problems we can't solve exactly. +- **[probability](probability.md)/statistics**: encountered practically everywhere but very important e.g. in [cryptography](cryptography.md). +- **other**: things important in specific fields and/or other weird stuff, e.g. [topology](topology.md), [quaternions](quaternion.md) (graphics, physics), [lambda calculus](lambda_calculus.md), [game theory](game_theory.md), [fractal geometry](fractal.md), ... diff --git a/mental_outlaw.md b/mental_outlaw.md new file mode 100644 index 0000000..f4d5e8a --- /dev/null +++ b/mental_outlaw.md @@ -0,0 +1,5 @@ +# Mental Outlaw + +Mental Outlaw is a black/[N-word](nigger.md) [youtuber](youtube.md)/vlogger focused on [FOSS](foss.md) and, to a considerable degree, [suckless](suckless.md) software. He's kind of a copy-paste of [Luke Smith](luke_smith.md) but a little closer to the [mainstream](mainstream.md) and normies. + +Like with Luke, sometimes he's real based and sometimes he says very stupid stuff. Make your own judgement. \ No newline at end of file diff --git a/microsoft.md b/microsoft.md new file mode 100644 index 0000000..cca2d6f --- /dev/null +++ b/microsoft.md @@ -0,0 +1,7 @@ +# Micro$oft + +Micro$soft (officially Microsoft, MS) is a terrorist organization, [software](software.md) [corporation](corporation.md) named after its founder's dick -- it is, along with [Google](google.md), [Apple](apple.md) [et al](et_al.md) one of the biggest organized crime groups in history, best known for holding the world captive with its highly abusive "[operating system](os.md)" called [Windows](windows.md), as well as for leading an aggressive war on [free software](free_software.md) and utilizing many unethical and/or illegal business practices such as destroying any potential competition with the [*Embrace Extend Extinguish*](eee.md) strategy. + +Microsoft is unfortunately among the absolutely most powerful entities in the world (that sucks given they're also among the most hostile ones) -- likely more powerful than any government and most other corporations, it is in their power to **immediately destroy any country** with the push of a button, it's just a question of when this also becomes their interest. This power is due to them having **complete control over almost absolute majority of personal computers in the world** (and therefore by extension over all devices, infrastructure, organization etc.), through their [proprietary](proprietary.md) ([malware](malware.md)) "[operating system](os.md)" [Windows](windows.md) that has built-in [backdoor](backdoor.md), allowing Microsoft immediate access and control over practically any computer in the world. The backdoor "feature" isn't even hidden, it is officially and openly admitted (it is euphemistically called [auto updates](autoupdate.md)). Microsoft prohibits studying and modification of Windows under threats including physical violence (tinkering with Windows violates its [EULA](eula.md) which is a lawfully binding license, and law can potentially be enforced by police using physical force). Besides legal restrictions Microsoft applies high [obfuscation](obfuscation.md), [bloat](bloat.md), [SAASS](saass.md) and other techniques preventing user freedom and defense against terrorism, and forces its system to be installed in schools, governments, power plants, hospitals and basically on every computer anyone buys. Microsoft can basically (for most people) turn off the [Internet](internet.md), electricity, traffic control system etc. Therefore every hospital, school, government and any other institution has to bow to Microsoft. + +TODO: it would take thousands of books to write just a fraction of all the bad things, let's just add the most important ones \ No newline at end of file diff --git a/microtheft.md b/microtheft.md new file mode 100644 index 0000000..e83e883 --- /dev/null +++ b/microtheft.md @@ -0,0 +1,3 @@ +# Microtheft + +See [microtransaction](microtransaction.md). \ No newline at end of file diff --git a/microtransaction.md b/microtransaction.md new file mode 100644 index 0000000..27e9638 --- /dev/null +++ b/microtransaction.md @@ -0,0 +1,5 @@ +# Microtransaction + +Microtransaction, also microtheft, is the practice of selling -- for a relatively "low" price -- virtual goods in some virtual environment, especially [games](game.md), by the owner of that environment. It's a popular business model of many [capitalist games](capitalist_software.md) -- players have an "option" (which they are pushed to take) to buy things such as skins and purely cosmetic items but also items giving an unfair advantage over other players (in-game currency, stronger weapons, faster leveling, ...). This is often targeted at children. + +Not only don't they show you the source code they run on your computer, not only don't they even give you an independently playable copy of the game you paid for, not only do they spy on you, they also have the audacity to ask for more and more money after you've already paid for the thing that abuses you. \ No newline at end of file diff --git a/minigame.md b/minigame.md new file mode 100644 index 0000000..d2feea6 --- /dev/null +++ b/minigame.md @@ -0,0 +1,52 @@ +# Minigame + +Minigame is a very small and simple [game](game.md) intended to entertain the player for just a short amount of time, unlike a full fledged game. Minigames may a lot of times be embedded into a bigger game (as an [easter egg](easter_egg.md) or as a part of a game mechanic such as lock picking), they may come as an extra feature on primarily non-gaming systems, or appear in collections of many minigames as a bigger package (e.g. various party game collections). Minigames include e.g. [minesweeper](minesweeper.md), [sokoban](sokoban.md), the Google [Chrome](chrome.md) T-rex game, [Simon Tatham's Portable Puzzle Collection](stppc.md), as well as many of the primitive old games like [Pong](pong.md) and [Tetris](tetris.md). Minigames are nice from the [LRS](lrs.md) point of view as they are [minimalist](minimalism.md), simple to create, often [portable](portability.md), while offering a potential for great [fun](fun.md) nevertheless. + +Despite the primary purpose of minigames many players invest huge amounts of time into playing them, usually competitively e.g. as part of [speedrunning](speedrun.md). + +Minigames are still very often built on the principles of old arcade games such as getting the highest score or the fastest time. For this they can greatly benefit from [procedural generation](procgen.md) (e.g. endless runners). + +## List Of Minigames + +This is a list of just some of many minigames and minigame types. + +- **[2048](2048.md)** +- **[angry bird](angry_bird.md)** +- **[arkanoid](arkanoid.md)** +- **[asteroids](asteroids.md)** +- **[backgammon](backgammon.md)** +- **[checkers](checkers.md)** +- **[chess](chess.md)** (and chess puzzles) +- **city bomber**: a plane is descending on the screen, player has to drop bombs to destroy building so that it can land +- **concentration** +- **[donkey kong](donkey_kong.md)** +- **[endless runner](endless_runner.md)** +- **[fifteen](fifteen.md)** +- **[game of life](gol.md)** +- **[go](go_game.md)** +- **guess a number** +- **[hangman](hangman.md)** +- **[invaders](invaders.md)** +- **knowledge quiz** +- **[loderunner](loderunner.md)** +- **[ludo](ludo.md)** +- **[lunar lander](lunar_lander.md)** +- **[mahjong](mahjong.md)** +- **maze** +- **[minigolf](minigolf.md)** +- **[minesweeper](minesweeper.md)** +- **[pacman](pacman.md)** +- **[pinball](pinball.md)** +- **[pong](pong.md)** +- **[rock-paper-scissors](rock_paper_scissors.md)** +- **[shoot'em up](shmup.md)** +- **[sokoban](sokoban.md)** +- **[solitaire](solitaire.md)** +- **[snake](snake.md)** +- **[sudoku](sudoku.md)** +- **[tetris](tetris.md)** (block game, "tetris" is trademarked) +- **[tic-tac-toe](tic_tac_toe.md)** +- **[tower of hanoi](tower_of_hanoi.md)** +- **[tron](tron.md)** +- **[untangle](untangle.md)** +- **[QWOP](qwop.md)** \ No newline at end of file diff --git a/minimalism.md b/minimalism.md new file mode 100644 index 0000000..3cbe96c --- /dev/null +++ b/minimalism.md @@ -0,0 +1,31 @@ +# Technological Minimalism + +*No gain, no pain.* + +Technological minimalism is a philosophy of designing technology to be as simple as possible while still achieving given goal. Minimalism is one of the most (if not the most) important concepts in [programming](programming.md) technology in general. **Minimalism is necessary for [freedom](freedom.md)** as a free technology can only be that over which no one has a monopoly, i.e. which many people and small parties can utilize, study and modify with affordable effort. Minimalism goes against the creeping overcomplexity of technology which always brings huge costs and dangers, e.g. the cost of [maintenance](maintenance.md) and further development, obscurity, inefficiency ("[bloat](bloat.md)", wasting resources), consumerism, the increased risk of bugs, errors and failure. + +Up until recently in history every engineer would tell you that *the better machine is that with fewer moving parts*. This still seems to hold e.g. in mathematics, a field not yet so spoiled by huge commercialization and mostly inhabited by the smartest people -- there is a tendency to look for the most minimal equations -- such equations are considered [beautiful](beauty.md). Science also knows this rule as the Occam's razor. In technology invaded by aggressive commercialization the situation is different, minimalism lives only in the underground and is ridiculed by the mainstream propaganda. Some of the minimalist movements, terms and concepts include: + +- [suckless](suckless.md) +- [Unix philosophy](unix_philosophy.md) +- [KISS](kiss.md) +- [countercomplex](countercomplex.md) +- [less retarded software](lrs.md) +- [less is more](less_is_more.md)/[worse is better](worse_is_better.md) +- [appropriate technology](appropriate_tech.md) + +Under [capitalism](capitalism.md) technological minimalism is suppressed in the mainstream as it goes against corporate interests, i.e. those of having monopoly control over technology, even if such technology is "[FOSS](foss.md)" (which then becomes just a cool brand, see [openwashing](openwashing.md)). We may, at best, encounter a "shallow" kind of minimalism, so called [pseudominimalism](pseudominimalism.md) which only tries to make things appear minimal, e.g. aesthetically, and hides ugly overcomplicated internals under the facade. [Apple](apple.md) is famous for this [shit](shit.md). + +There are movements such as [appropriate technology](appropriate_tech.md) (described by E. F. Schumacher in a work named *Small Is Beautiful: A Study of Economics As If People Mattered*) advocating for small, efficient, decentralized technology, because that is what best helps people. + +**Does minimalism mean we have to give up the nice things?** Well, not really, it is more about giving up the [bullshit](bullshit.md), and changing an attitude. **We can still have technology for entertainment**, just a non-consumerist one -- instead of consuming 1 new game per month we may rather focus on creating deeper games that may last longer, e.g. those of a *simple to learn, hard to master* kind and building communities around them, or on modifying existing games rather than creating new ones from scratch over and over. Sure, technology would LOOK different, our computer interfaces may become less of a thing of fashion, our games may rely more on aesthetics than realism, but ultimately minimalism can be seen just as trying to achieve the same effect while minimizing waste. If you've been made addicted to bullshit such as buying a new GPU each month so that you can run games at 1000 FPS at progressively higher resolution then of course yes, you will have to suffer a bit of a withdrawal just as a heroin addict suffers when quitting the drug, but just as him in the end you'll be glad you did it. + +There is a so called *[airplane rule](airplane_rule.md)* that states a plane with two engines has twice as many engine problems than a plane with a single engine. + +## 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). + +Even if a user of software is not a programmer himself, it is important he chooses to use minimal tools because that makes it more likely his tool can be repaired or improved by SOMEONE from the people. Some people naively think that if they're not programmers, it doesn't matter if they have access and rights to the program's source code, but indeed that is not the case. You want to choose tools that can easily be analyzed and repaired by someone, even if you yourself can't do it. + +Minimalism and simplicity increases freedom even of [proprietary](proprietary.md) technology which can be seen e.g. on [games](game.md) for old systems such as [GameBoy](gameboy.md) or [DOS](dos.md) -- these games, despite being proprietary, can and are easily and plentifully played, modified and shared by the people, DESPITE not being free legally, simply because it is easy to handle them due to their simplicity. This just further confirms the correlation of freedom and minimalism. \ No newline at end of file diff --git a/mipmap.md b/mipmap.md new file mode 100644 index 0000000..afe94af --- /dev/null +++ b/mipmap.md @@ -0,0 +1,41 @@ +# Mipmap + +Mipmap (from Latin *multum in parvo*, *many in little*), is a digital image that is stored along with progressively smaller versions of itself; mipmaps are useful in [computer graphics](graphics.md), especially as a representation of [textures](texture.md) in which they may eliminate [aliasing](aliasing.md) during rendering. But mipmaps also have other uses such as serving as [acceleration structures](acceleration_structure.md) or helping performance (using a smaller image can speed up memory access). Mipmaps are also sometimes called **pyramids** because we can imagine the images of different sizes laid one on another to form such a shape. + +A basic form of a mipmap can be explained on the following example. Let's say we have an [RGB](rgb.md) image of size 1024x1024 pixels. To create its mipmap we call the base image level 0 and create progressively smaller versions (different levels) of the image by reducing the size four times (twice along one dimension) at each step. I.e. level 1 will be the base image downscaled to the size 512x512. If we are to use the mipmap for the common purpose of reducing aliasing, the downscaling itself has to be done in a way that doesn't introduce aliasing; this can be done e.g. by downscaling 2x2 areas in the base image into a single pixel by **averaging** the values of those 4 pixels (the averaging is what will prevent aliasing; other downscaling methods may be used depending on the mipmap's purpose, for example for a use as an accelerating structure we may take a maximum or minimum of the 4 pixels). Level 2 will be an image with resolution 256x256 obtained from the 512x512 image, and so on until the last level with size 1x1. In this case we'll have 11 levels which together form our mipmap. + +This RGB mipmap can be shown (and represented in memory) as a "fractal image": + +``` + _______________________________ + | | | + | | | + | level 0 | level 0 | + | red | green | + | channel | channel | + | | | + | | | + |_______________|_______________| + | |level 1|level 1| + | | red | green | + | level 0 |channel|channel| + | blue |_______|_______| + | channel |level 1|l2r|l2g| + | | blue |___|___| + | |channel|l2b|_|_| + |_______________|_______|___|_|+| +``` + +This may be how a texture is represented inside a [graphics card](gpu.md) if we upload it (e.g. with [OpenGL](opengl.md)). When we are rendering e.g. a 3D model with this texture and the model ends up being rendered at the screen in such size that renders the texture smaller than its base resolution, the renderer (e.g. OpenGL) automatically chooses the correct level of the mipmap (according to Nyquist-Shannon sampling theorem) to use so that aliasing won't occur. If we're using a rendering system such as OpenGL, we may not even notice this is happening, but indeed it's what's going on behind the scenes (OpenGL and other systems have specific functions for working with mipmaps manually if you desire). + +Do we absolutely need to use mipmaps in rendering? No, some simple (mostly software) renderers don't use them and you can turn mipmaps off even in OpenGL. Some renderers may deal with aliasing in other ways, for example by denser sampling of the texture which will however be slower (in this regard mipmaps can be seen as precomputed, already antialiased version of the image which [trades memory for speed](space_time_tradeoff.md)). + +We can also decide to not deal with aliasing in any way, but the textures will look pretty bad when downscaled on the screen (e.g. in the distance). They are kind of noisy and flickering, you can find examples of this kind of messy rendering online. However, if you're using low resolution textures, **you may not even need mipmaps** because such textures will hardly ever end up downscaled -- this is an advantage of the [KISS](kiss.md) approach. + +One shortcoming of the explained type of mipmaps is that they are *isotropic*, i.e. they suppose the rendered texture will be scaled uniformly in all directions, which may not always be the case, especially in 3D rendering. Imagine a floor rendered when the camera is looking forward -- the floor texture may end up being downscaled in the vertical direction but upscaled in the horizontal direction. If in this case we use our mipmap, we will prevent aliasing, but the texture will be rendered in lower resolution horizontally. This is because the renderer has chosen a lower resolution of the texture due to downscale (possible aliasing) in vertical direction, but horizontal direction will display the texture upscaled. This may look a bit weird, but its completely workable, it can be seen in most older 3D games. + +The above issue is addressed mainly by two methods. + +The first is [trilinear filtering](trilinear_filtering.md) which uses several levels of the mipmap at once and [linearly blends](linear_interpolation.md) between them. This is alright but still shows some [artifacts](artifact.md) such as visible changes in blurriness. + +The second method is [anisotropic filtering](anisotropic.md) which uses different, *anisotropic* mipmaps. Such mipmaps store more version of the image, resized in many different ways. This method is nowadays used in quality graphics. \ No newline at end of file diff --git a/moderation.md b/moderation.md new file mode 100644 index 0000000..b62e15c --- /dev/null +++ b/moderation.md @@ -0,0 +1,3 @@ +# Moderation + +Moderation is an [euphemism](euphemism.md) for [censorship](censorship.md) encountered mostly in the context of Internet communication platforms (forum discussions, chats etc.). \ No newline at end of file diff --git a/modern.md b/modern.md new file mode 100644 index 0000000..89a3400 --- /dev/null +++ b/modern.md @@ -0,0 +1,20 @@ +# Modern + +Modern [software](software.md)/[hardware](hardware.md) might as well be synonymous with [shit](shit.md). + +## Modern Vs Old Technology + +It's sad and dangerous that newer generation won't even remember technology used to be better, people will soon think that status quo is the best we can do. That is wrong. It is important we leave here a note on at least a few way in which old was much better. + +And before you say "it was faster and longer on battery etc. because it was simpler" -- **yes, that is exactly the point**. + +- Old technology was simpler and **better engineered with minimum [bloat](bloat.md)**. Fewer incompetent people were present in the field and capitalism wasn't yet pushing as hard on extreme development speed and abuse of the user, products competed in true usefulness. +- **Old computers were faster** and astronomically more efficient. Computers with a few MhZ single-core CPU and under a megabyte of RAM booted faster to [DOS](dos.md) than modern computers boot to Windows 10, despite [Moore's law](moores_law.md) (this shittiness is known as [Wirth's law](wirths_law.md)). Old tech also **reacted faster to input** (had shorter lag) thanks to shorter input and output processing [pipelines](pipeline.md). { I've heard this confirmed from [John Carmack](carmack.md) in a talk on his development of [VR](vr.md). ~drummyfish } +- Old devices such as cell phones **lasted much, much longer on battery**. The old phones such as Nokia 3310 would **last long over a week** on stand-by. +- **Old software was shipped finished, complete and with minimum [bugs](bug.md)**. Nowadays newly released "[apps](app.md)" and [games](game.md) are normally released unfinished, even in pre-alpha states and even "finished" ones have [bugs](bug.md) often rendering the software unsuable (see Cyberpunk 2077, GTA: Definiteve Edition etc.), user is supposed to wait years for fixes (without any guarantees), pay for content or even subscriptions. Old software was difficult or even impossible to patch (e.g. on [Gameboy](gameboy.md)) so it had to work. +- **Old tech had minimum malicious features**. There wasn't [spyware in CPUs](intel_me.md), **[DRM](drm.md) was either absent or primitive**, there weren't ads in file explorers, there weren't [microtransactions](microtransaction.md) in games, there weren't [autoupdates](autoupdate.md), there weren't psychologically abusive [social networks](social_network.md), technology was **designed to last**, not to be [consoomed](consumerism.md), there was much less [censhorship](censorship.md). +- **Old tech was much easier to modify and customize**, thanks to not being so overcomplicated and not containing so many anti-repair "features". Old software wasn't in the [cloud](cloud.md) which makes it impossible to be modified. +- **Old tech was much more independent**, did not require Internet connectivity, subscription etc. +- There was **minimum [bullshit](bullshit.md)**. True usefulness was more important than killer features to help marketing. +- Old tech was **simpler and more [fun](fun.md) to program**, allowing direct access to hardware, not complicating things with [OOP](oop.md) and similar [shit](shit.md), and so **old programmers were more [productive](productivity_cult.md)**. +- **Old "look n feel" of software was objectively better**. Just compare the graphics of [Doom](doom.md) and any shitty soulless "modern" game. \ No newline at end of file diff --git a/modern_software.md b/modern_software.md new file mode 100644 index 0000000..73029d5 --- /dev/null +++ b/modern_software.md @@ -0,0 +1,3 @@ +# Modern Software + +Go [here](modern.md). \ No newline at end of file diff --git a/monad.md b/monad.md new file mode 100644 index 0000000..a30b9ca --- /dev/null +++ b/monad.md @@ -0,0 +1,48 @@ +# Monad + +{ This is my poor understanding of a monad. ~drummyfish } + +Monad is a [mathematical](math.md) concept which has become useful in [functional programming](functional.md) and is one of the very basic [design patterns](design_pattern.md) in this paradigm. A monad basically wraps some [data type](data_type) into an "envelope" type and gives a way to operate with these wrapped data types which greatly simplifies things like error checking or abstracting [input/output](io.md) side effects. + +A typical example is a **maybe** monad which wraps a type such as integer to handle exceptions such as division by zero. A maybe monad consists of: + +1. The *maybe(T)* data type where *T* is some other data type, e.g. *maybe(int)*. Type *maybe(T)* can have these values: + - *just(X)* where *X* is any possible value of *T* (for int: -1, 0, 1, 2, ...), or + - *nothing*, a special value that says no value is present +2. A special function *return(X)* that converts value of given type into this maybe type, e.g. *return(3)* will return *just(3)* +3. A special combinator *X >>= f* which takes a monadic (*maybe*) values *X* and a function *f* and does the following: + - if *X* is *nothing*, gives back *nothing* + - if *X* is a value *just(N)*, gives back the value *f(N)* (i.e. unwraps the value and hand it over to the function) + +Let's look at a pseudocode example of writing a safe division function. Without using the combinator it's kind of ugly: + +``` +divSafe(x,y) = // takes two maybe values, returns a maybe value + if x == nothing + nothing else + if y == nothing + nothing else + if y == 0 + nothing else + just(x / y) +``` + +With the combinator it gets much nicer (note the use of [lambda expression](lambda.md)): + +``` +divSafe(x,y) = + x >>= { a: y >== { b: if b == 0 nothing else a / b } } +``` + +Languages will typicall make this even nicer with a [syntax sugar](syntax_sugar.md) such as: + +``` +divSafe(x,y) = do + a <- x, + b <- y, + if y == 0 nothing else return(a / b) +``` + +TODO: I/O monad +TODO: general monad +TODO: example in real lang, e.g. haskell diff --git a/murderer.md b/murderer.md new file mode 100644 index 0000000..6de7054 --- /dev/null +++ b/murderer.md @@ -0,0 +1,3 @@ +# Murderer + +You misspelled [entrepreneur](entrepreneur.md). \ No newline at end of file diff --git a/myths.md b/myths.md new file mode 100644 index 0000000..8eb431f --- /dev/null +++ b/myths.md @@ -0,0 +1,9 @@ +# Myths + +This is a list of myths and common misconceptions. + +- **"[Java](java.md) is highly [portable](portability.md)"**; FALSE: While Java runs on several platforms, it's inefficiency and overhead of its extremely high level programming makes it unusable on devices with limited resources such as [embedded systems](embedded.md). Its [bloated](bloat.md) nature and high number of dependencies limit it to running on a few types of **mainstream** devices that are privileged to have the Java virtual machine implemented. +- **"[C](c.md) is not [portable](portability.md)"**; FALSE: C is extremely portable if written [correctly](lrs.md) (e.g. without dependencies), in fact it is probably the **most portable language in history** because firstly a C compiler is available for almost any platform -- a C compiler is one of the most essential things to have -- and secondly because C is extremely efficient and will run even on devices with extremely limited resources such as [embedded systems](embedded.md). +- **"[Capitalism](capitalism.md) fuels progress"**; FALSE: Monopolies that inevitably arise in capitalism want to forever prevent others from creating innovations that would make the subject of their business obsolete (e.g. fossil fuel businessmen will want to prevent electric cars). Of course, small businesses cannot compete with large corporations, therefore corporations win and keep the status quo. Small businesses can mostly only succeed in creating [bullshit](bullshit.md) that exists for its own sake (there is e.g. an online store selling literal shit) -- this we would not call a progress. Furthermore capitalism is against the important kind of progress such as social progress or education, because of course educated, independent and mature people would engage less in consumerism and even realize that capitalism is bad. +- **Feminism, LGBT, Antifa and similar are leftist movements**; FALSE: These are in fact [pseudoleftist](pseudoleft.md), fascist movements who don't care about true equality but rather privileges for a certain minority, just as the Italian fascist or Nazis did. This is proven by their [naming](name_matters.md) and means of operation such as violence, censorship, bullying etc. which are anti-equality. +- TODO \ No newline at end of file diff --git a/name_is_important.md b/name_is_important.md new file mode 100644 index 0000000..be5b19d --- /dev/null +++ b/name_is_important.md @@ -0,0 +1,15 @@ +# Name Is Important + +Naming of a philosophy, movement, group, ideology etc. is probably much more important than most people think. This is because the name is the single most stable defining feature of such entity; everything else, all the books and knowledge associated to it may be distorted by history, but the name will always stay the same and will hold a scrutiny over all actions of the entity, it will always be a permanent reminder to every follower of what he is trying to achieve. But what if the name of the movement changes? Then it is to be considered a new, different movement. The name holds the one true goal. + +For this we have to keep in mind two thing: + +- When encountering a new movement/philosophy/ideology etc., we can tell a lot about it from its name: the name is its ultimate goal which **will be pursued on detriment of other goals**. A lot of times the bad movements are those **named after the means** (e.g. *capitalism*) rather than goals (e.g. *pacifism*) because by this dominance the focus on means will inevitably subordinate the goal. +- When starting a new movement, we have to pay very careful attention to giving it a name. + +Let us comment on a few examples: + +- **[Capitalism](capitalism.md)**: The goal is maximization of capital. There is no promise of a good society, it is not mentioned in the name, and indeed what we get is a system that evolves corporations that get progressively better at maximizing capital, on the detriment of people. +- **[Free Software Movement](free_software.md)**: The movement is about user's freedom and therefore ethics. Notice that even though definitions of free software may slightly differ between different branches of it, the groups calling themselves *free software* movements always pursue freedom. This is why capitalism couldn't embrace free software: because thanks to the name it always firmly stands against abusing the user. +- **[Open Source Movement](open_source.md)**: The movement has been born from the Free Software Movement with a specific goal of abandoning ethics and supporting business. The ethics (freedom) has been dropped from the name and was replaced with the word "open", and indeed what we're seeing is software that is somewhat "open" -- whatever that means -- but mostly [capitalism software](capitalist_software.md) abusing and restricting its users by means other than proprietary licenses (see e.g. [Firefox](firefox.md)). +- **Feminism**: The goal is to benefit the females, i.e. make the superior to males. There is no mention of equality of sexes in the name even this idea might have appeared somewhere in the movement's beginning. And indeed, what we're seeing is a progressively more aggressive fascist movement that is downright hostile to males, is completely uninterested in inequality in the opposite direction and only ever looks for empowering the women, without any concern of equality. \ No newline at end of file diff --git a/netstalking.md b/netstalking.md new file mode 100644 index 0000000..70ca2a7 --- /dev/null +++ b/netstalking.md @@ -0,0 +1,10 @@ +# Netstalking + +Netstalking means searching for obscure, hard-to-find and somehow valuable (even if only by its entertaining nature) information buried in the depths of the [Internet](internet.md), for example searching for funny photos on Google Streetview (https://9-eyes.com/), unindexed [deepweb](deepweb.md) sites or secret documents on [FTP](ftp.md) servers. Netstalking is relatively unknown in the English-speaking world but is pretty popular in Russian communities. + +Netstalking can be divided into two categories: + +- **deli-search** (deliberate search): trying to find a specific information, e.g. a specific video that got lost. +- **net-random**: randomly searching for interesting information in places where it is likely to be found. + +Techniques of netstalking include port scanning, randomly generating web domains, using advanced search queries and different [search engines](search_engine.md), searching caches and archives and obscure networks such as [darknet](darknet.md) or [gopher](gopher.md). \ No newline at end of file diff --git a/niger.md b/niger.md new file mode 100644 index 0000000..53d369e --- /dev/null +++ b/niger.md @@ -0,0 +1,7 @@ +# Niger + +*Not to be confused with [nigger](nigger.md).* + +Niger is an African country with a racist name. + +How long before [SJWs](sjw.md) rename it [LMAO](lmao.md)? \ No newline at end of file diff --git a/nigger.md b/nigger.md new file mode 100644 index 0000000..dfabbb5 --- /dev/null +++ b/nigger.md @@ -0,0 +1,11 @@ +# Nigger + +*Not to be confused with [Niger](niger.md).* + +Nigger (also nigga, niBBa, N-word, negro or chimp) is a forbidden word that refers to a member of the black [race](race.md). Black people themselves use this word on a daily basis. + +The word's used in a number of projects, e.g. in [niggercoin](niggercoin.md) [cryptocurrency](crypto.md) or [+NIGGER](plusnigger.md) license modifier that uses this politically incorrect term to prevent corporations from adopting free projects. + +[LMAO](lmao.md) they're even censoring art and retrospectively changing classical works of art to suit this propaganda, just like the fascist communists did. E.g. Agatha Christie's book *Ten Little Niggers* was renamed to *And Then There Were None*. Are they also gonna repaint Mona Lisa when it somehow doesn't suit their liking? + +LOL take a look at this website: http://niggermania.com. Also https://www.chimpout.com. \ No newline at end of file diff --git a/niggercoin.md b/niggercoin.md new file mode 100644 index 0000000..9275c22 --- /dev/null +++ b/niggercoin.md @@ -0,0 +1,3 @@ +# Niggercoin + +Niggercoin (abbreviated NGR) is a [cryptocurrency](crypto.md) invented by [4chan](4chan.md). \ No newline at end of file diff --git a/nokia.md b/nokia.md new file mode 100644 index 0000000..f7ca27a --- /dev/null +++ b/nokia.md @@ -0,0 +1,9 @@ +# Nokia + +TODO + +Kids today will absolutely NOT remember what Nokia did with phones back then, the richness, amazing creativity, fun. [Apple](apple.md)? WTF, that's like absolute nothing, Nokia was absolutely dominating the shit and coming up with INSANE designs you wouldn't believe. The guys must have been smoking some shit all day, they were like what haven't we done yet? Let's put the buttons all over the shit, let's make it round, let's make it fat, let's make the phone a literal square, let's make it a handheld console. And it worked, it was freakin art, everyone loved it, each phone was unique like, even with different [GUI](gui.md) and everything. It was beautiful. + +{ IMHO the peak of Nokia was 6600. Just look it up, I've never seen such beautiful design, AND it was such a high tech device back them, unreachable for a kid like me. Just the idea of having a real computer with an operating system in a pocket, with games, even a freaking video camera to shoot videos with, that was absolutely unreal to me. I wanted it so badly, I wanted it more than anything else. I had dreams about it. I also extremely enjoyed comparing it to the biggest competition Siemens SX1, that was a great device too. It was like a clash of two bosses. ~drummyfish } + +{ Also I remember I was once kicked out of a cell phone shop because they had 6600 there for customers to try it out and I was spending hours playing some LOTR games on it xD I remember it like today, it kind of marked me. ~drummyfish } \ No newline at end of file diff --git a/normalization.md b/normalization.md new file mode 100644 index 0000000..cfd4be8 --- /dev/null +++ b/normalization.md @@ -0,0 +1,7 @@ +# Normalization + +Normalization is a term that can mean slightly different things but generally it either refers to adjusting a set of values to some desired range by multiplying or dividing each of the values by some predetermined number, or to converting some data or expression into a unified format. The idea is to "tame" possibly very wildly differing values that we can encounter "in the wild" into something more "normal" that we can better work with. The following are some specific meanings of the term depending on context: + +- **[vector](vector.md) normalization**: Making given vector into a unit vector by dividing all its components by the length of the vector, i.e. we keep the direction of the vector the same but force its length to be exactly 1. +- **signal normalization**: Adjusting the range of the signal to a desired range, for example with audio or images in which samples can range from -1 to 1 we may want to divide all the samples by the maximum of absolute values of all the samples which will stretch the signal so that the peak exactly fits the range: this will fully utilize the range (e.g. increase contrast in images) without cutting the signal off. +- **[URI](uri.md) normalization**: Converting URI into a unified format (e.g. `HTTP://www.MYSITE.COM:80/index.html` to `http://www.mysite.com`). \ No newline at end of file diff --git a/npc.md b/npc.md new file mode 100644 index 0000000..8f7fbc7 --- /dev/null +++ b/npc.md @@ -0,0 +1,3 @@ +# NPC + +NPC (non-player character) is a character in a video [game](game.md) that's not controlled by a player but rather by [AI](ai.md). NPC is also used as a term for people in [real life](irl.md) that exhibit low intelligence and just behave in accordance with the system. \ No newline at end of file diff --git a/often_confused.md b/often_confused.md new file mode 100644 index 0000000..5eccff1 --- /dev/null +++ b/often_confused.md @@ -0,0 +1,75 @@ +# Often Confused Terms + +There are many terms that are very similar and are sometimes used interchangeably. This isn't wrong per se, a slight difference may be insignificant in certain contexts. However it's good to know the differences for those cases when they matter. The following list tries to document some of the often confused terms. + +- **[AI](ai.md)** vs **[machine learning](machine_learning.md)** vs **[neural networks](neural_net.md)** +- **[algebra](algebra.md)** vs **[arithmetic](arithmetic.md)** +- **[algorithm](algorithm.md)** vs **[program](program.md)** +- **[analog](analog.md)** vs **[mechanical](mechanical.md)** +- **[anarchy](anarchism.md)** vs **[chaos](chaos.md)** +- **[argument](argument.md)** vs **[parameter](parameter.md)** +- **binary** vs **[executable](executable.md)** +- **[array](array.md)** vs **[list](list.md)** +- **[cepstrum](cepstrum.md)** vs **[spectrum](spectrum.md)** +- **[ASCII art](ascii_art.md)** vs **[ANSI art](ansi_art.md)** +- **[assembler](assembler.md)** vs **[assembly](assembly.md)** +- **[causation](causation.md)** vs **[correlation](correlation.md)** +- **[demo](demo.md)** vs **[intro](intro.md)** +- **[chaos](chaos.md)** vs **[randomness](random.md)** vs **[pseudorandomness](pseudorandom.md)** vs **[entropy](entropy.md)** +- **[class](class.md)** vs **[set](set.md)** +- **[closed source](closed_source.md)** vs **[proprietary](proprietary.md)** +- **[CLI](cli.md)** vs **[TUI](tui.md)** vs **[terminal](terminal_emulator.md)** vs **[console](console.md)** +- **[color model](color_model.md)** vs **[color space](color_space.md)** +- **[communism](communism.md)** vs **[Marxism](marxism.md)** +- **[computer language](computer_language.md)** vs **[programming language](programming_language.md)** +- **[computer science](compsci.md)** vs **[information technology](it.md)** vs **[informatics](informatics.md)** +- **[concurrency](concurrency.md)** vs **[parallelism](parallelism.md)** +- **[constant](constant.md)** vs **[literal](literal.md)** +- **[coding](coding.md)** vs **[programming](programming.md)** +- **[codec](codec.md)** vs **[container format](container_format.md)** +- **[coherence](coherence.md)** vs **[consistency](consistency.md)** +- **[convolution](convolution.md)** vs **[correlation](correlation.md)** +- **[copyright](copyright.md)** vs **[patent](patent.md)** vs **[trademark](trademark.md)** +- **[crossplatform/multiplatform](multiplatform.md)** vs **[portable](portability.md)** +- **[cryptography](cryptography.md)** vs **[security](security.md)** +- **[data](data.md)** vs **[information](information.md)** +- **[data structure](data_structure.md)** vs **[data type](data_type.md)** +- **[decentralized](decentralization.md)** vs **[distributed](distributed.md)** +- **[declaration](declaration.md)** vs **[definition](definition.md)** +- **[desktop environment](de.md)** vs **[window manager](wm.md)** +- **[digital](digital.md)** vs **[electronic](electronics.md)** +- **[directed acyclic graph](dag.md)** vs **[tree](tree.md)** +- **[directory](directory.md)** vs **[folder](folder.md)** +- **[discrete Fourier transform](dft.md)** vs **[discrete time Fourier transform](dtft.md)** +- **[emulation](emulation.md)** vs **[simulation](simulation.md)** +- **[equation](equation.md)** vs **[expression](expression.md)** vs **[inequality](inequality.md)** +- **[equivalence](equivalence.md)** vs **[implication](implication.md)** +- **[error](error.md)** vs **[exception](exception.md)** vs **[fault](fault.md)** vs **[failure](fail.md)** +- **[evolutionary programming](evolutionary.md)** vs **[evolutionary algorithm](evolutionary.md)** vs **[genetic programming](genetic_programming.md)** vs **[genetic algorithm](genetic_algorithm.md)** +- **[floating point number](float.md)** vs **[real number](real_number.md)** +- **[font](font.md)** vs **[typeface](typeface.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)** +- **[GNU](gnu.md)/Linux** vs **[Linux](linux.md)** +- **[hypothesis](hypothesis.md)** vs **[theory](theory.md)** vs **[conjecture](conjecture.md)** +- **[ID](id.md)** vs **[token](token.md)** vs **[hash](hash.md)** vs **[handle](handle.md)** vs **[identifier](identifier.md)** +- **[infinite](infinity.md)** vs **[arbitrarily large/unbounded](unbounded.md)** +- **[internet](internet.md)** vs **[web](web.md)** +- **[Java](java.md)** vs **[JavaScript](js.md)** +- **[kB/mB/gB/tB](memory_units.md)** vs **[KiB/MiB/GiB/TiB](memory_units.md)** +- **[latency/ping/lag](latency.md)** vs **[throughput/bandwidth](throughput.md)** +- **[leftism](left_right.md)** vs **[pseudoleftism](pseudoleft.md)** +- **[method](method.md)** vs **[methodology](methodology.md)** +- **[modem](modem.md)** vs **[router](router.md)** +- **[NP](p_vs_np.md)** vs **[NP-hard](np_hard.md)** +- **[path tracing](path_tracing.md)** vs **[ray tracing](ray_tracing.md)** vs **[ray casting](ray_casting.md)** +- **[pointer](pointer.md)** vs **[reference](reference.md)** +- **[principal square root](principal_sqrt.md)** vs **[square root](sqrt.md)** (especially when defining [i](i.md)) +- **[probability](probability.md)** vs **[probability density](probability_density.md)** +- **[pseudo](pseudo.md)** vs **[quasi](quasi.md)** +- **[shading](shading.md)** vs **[shadows](shadow.md)** +- **[science](science.md)** vs **[soyence](soyence.md)** +- **[Unicode](unicode.md)** vs **[UTF](utf.md)** +- **[URI](uri.md)** vs **[URL](url.md)** +- **[webpage](webpage.md)** vs **[website](website.md)** \ No newline at end of file diff --git a/old.md b/old.md new file mode 100644 index 0000000..1000459 --- /dev/null +++ b/old.md @@ -0,0 +1,3 @@ +# Old + +Nowadays old correlates with better. For comparison of new and old see [modern tech](modern.md). \ No newline at end of file diff --git a/oop.md b/oop.md new file mode 100644 index 0000000..25fa4dd --- /dev/null +++ b/oop.md @@ -0,0 +1,58 @@ +# Object-Oriented Programming + +*"I invented the term 'object oriented' and [C++](cpp.md) was not what I had in mind"* --[Alan Kay](alan_kay.md), inventor of OOP + +Object-oriented programming (OOP, also object-obsessed programming) is a [programming paradigm](paradigm.md) that tries to model reality as a collection of abstract objects that communicate with each other and obey some specific rules. While the idea itself isn't bad and can be useful in certain cases, **OOP has become extremely overused, extremely badly implemented and downright forced in programming languages** which apply this [abstraction](abstraction.md) to every single program and concept, creating [anti-patterns](anti_pattern.md), unnecessary issues and of course [bloat](bloat.md). We therefore see OOP as a **[cancer](cancer.md) of software development**. + +Ugly examples of OOP gone bad include [Java](java.md) and [C++](cpp.md) (which at least doesn't force it). Other languages such as [Python](python.md) and [Javascript](javascript.md) include OOP but have lightened it up a bit and at least allow you to avoid using it. + +You should learn OOP but only to see why it's bad (and to actually understand 99% of code written nowadays). + +## Principles + +Bear in mind that OOP doesn't have a single, crystal clear definition. It takes many forms and mutations depending on language and it is practically always combined with other paradigms such as the [imperative](imperative.md) paradigm, so things may be fuzzy. + +Generally OOP programs solve problems by having **[objects](object.md)** that communicate with each other. Every object is specialized to do some thing, e.g. one handles drawing text, another one handles [caching](cache.md), another one handles rendering of pictures etc. Every object has its **data** (e.g. a human object has weight, [race](race.md) etc.) and **methods** (object's own [functions](function.md), e.g. human may provide methods `getHeight`, `drinkBeer` or `petCat`). Objects may send **messages** to each other: e.g. a human object sends a message to another human object to get his name (in practice this means the first object calls a method of the other object just like we call functions, e.g.: `human2.getName()`). + +Now many OO languages use so called **class OOP**. In these we define object [classes](class.md), similarly to defining [data types](data_type.md). A class is a "template" for an object, it defines methods and types of data to hold. Any object we then create is then created based on some class (e.g. we create the object `alice` and `bob` of class `Human`, just as normally we create a variable `x` of type `int`). We say an object is an **instance** of a class, i.e. object is a real manifestation of what a class describes, with specific data etc. + +The more "lightweight" type of OOP is called **classless OOP** which is usually based on having so called prototype objects instead of classes. In these languages we can simply create objects without classes and then assign them properties and methods dynamically at runtime. Here instead of creating a `Human` class we rather create a prototype object that serves as a template for other objects. To create specific humans we clone the prototype human and modify the clone. + +OOP furthermore comes with some basic principles such as: + +- **[encapsulation](encapsulation.md)**: Object should NOT be able to access other object's data directly -- they may only use their methods. For example an object shouldn't be able to access the `height` attribute of a `Human` object, it should be able to access it only via methods of that object such as `getHeight`. (This leads to the setter/getter antipattern). +- **[polymorphism](polymorphism.md)**: Different objects (e.g. of different classes) may have methods with the same name which behave differently for either object and we may just call that method without caring what kind of object that is (the correct implementation gets chosen at runtime). E.g. objects of both `Human` and `Bomb` classes may have a method `setOnFire`, which with the former will kill the human and with the latter will cause an explosion killing many humans. This is good e.g. in a case when we have an array of [GUI](gui.md) components and want to perform e.g. resize on every one of them: we simply iterate over the whole array and call the method `resize` on each object without caring whether the object is a button, checkbox or a window. +- **[inheritance](inheritance.md)**: In class OOP classes form a [hierarchy](hierarchy.md) in which parent classes can have child classes, e.g. a class `LivingBeing` will have `Human` and `Animal` subclasses. Subclasses inherit stuff from the parent class and may add some more. However this leads to other antipatterns such as the [diamond_problem](diamond_problem.md). Inheritance is nowadays regarded as bad even by normies and is being replaced by [composition](composition.md). + +## Why It's Shit + +- OOP is just a bad abstraction for many problems that by their nature aren't object-oriented. OOP is not a [silver bullet](silver_bullet.md), yet it tries to behave as one. **The greatest issue of OOP is that it's trying to solve everything**. You may ask what else to use then? See the section below. +- For simple programs (which most programs should be) OOP is an unnecessarily high and overly complex abstraction. +- Great number of the supposed "features" and design-patterns (setters/getters, singletons, inheritance, ...) turned out to actually be anti-patterns and burdens. +- OOP as any higher abstraction very often comes with overhead, memory footprint and performance loss ([bloat](bloat.md)) as well as more complex [compilers](compiler.md) and language specifications. +- The relatively elegant idea of pure OOP didn't catch up and the practically used OOP languages are abomination hybrids of imperative and OOP paradigms that just take more head space, create friction and unnecessary issues to solve. Sane languages now allow the choice to use OOP fully, partially or avoid it completely, which leads to a two-in-one overcomplication. +- The naive idea of OOP that the real world is composed of nicely defined objects such as `Human`s and `Tree`s also showed to be completely off, we instead see shit like `AbstractIntVisitorShitFactory` etc. +- The idea that OOP would lead to code reusability also completely went to shit, it's simply not the case at all, implementation code of specific classes is typically burdened with internal and external dependencies just like any other bloated code. +- Good programmers don't need OOP because they know how to program -- OOP doesn't invent anything, it is merely a way of trying to **force** good programming mostly on incompetent programmers hired in companies, to prevent them from doing damage. However this of course doesn't work, a shit programmer will always program shit, he will find his way to fuck up despite any obstacles and if you invent obstacles good enough for stopping him from fucking up, you'll also stop him from being able to program something that works well as you tie his hands. +- OOP just mostly repeats what other things like modules already do. +- If you want to program in object-oriented way and have a good justification for it, **you don't need an OOP language anyway**, you can emulate all aspects of OOP in simple languages like C. So instead of building the idea into the language itself and dragging it along forever and everywhere, it would be better to have optional OOP libraries. +- It generalizes and simplifies programming into a few rules of thumb such as encapsulation, again for the sake of inexperienced noobs. However there are no simple rules for how to program well, good programming requires a huge amount of experience and as in any art, good programmer knows when breaking the general rules is good. OOP doesn't let good programmers do this, it preaches things like "global variables bad" which is just too oversimplified and hurts good programming. + +## So Which Paradigm To Use Instead Of OOP? + +After many people realized OOP is kind of shit, there has been a boom of "OOP alternatives" such as [functional](functional.md), [traits](traits.md), [agent oriented programming](agent_oriented_programming.md), all kinds of "lightweight" OOP etc etc. Which one to use? + +In short: NONE, **by default use the [imperative](imperative.md) paradigm** (also called "procedural"). Remember this isn't to say you shouldn't ever apply a different paradigm, but imperative should be the default, most prevalent and suitable one to use in solving most problems. There is nothing new to invent or "beat" OOP. + +But why imperative? Why can't we simply improve OOP or come up with something ultra genius to replace it with? Why do we say OOP is bad because it's forced and now we are forcing imperative paradigm? The answer is that the **imperative paradigm is special because it is how computers actually work**, it is not made up but rather it's the **natural low level paradigm with minimum [abstraction](abstraction.md) that reflects the underlying nature of computers**. You may say this is just bullshit arbitrary rationalization but no, these properties makes procedural paradigm special among all other paradigms because: + +- Its implementation is simple and [suckless](suckless.md)/[LRS](lrs.md) because it maps nicely and naturally to the underlying hardware -- basically commands in a language simply translate to one or more instructions. This makes construction of compilers easy. +- It's predictable and efficient, i.e. a programmer writing imperative code can see quite clearly how what he's writing will translate to the assembly instructions. This makes it possible to write highly efficient code, unlike high level paradigms that perform huge amounts of [magic](magic.md) for translating foreign concepts to machine instructions -- and of course this magic may differ between compilers, i.e. what's efficient code in one compiler may be inefficient in another (similar situation arose e.g. in the world of [OpenGL](opengl.md) where driver implementation started to play a huge role and which led to the creation of a more low level API [Vulkan](vulkan.md)). +- It doesn't force high amounts of unnecessary high level abstraction. This means we MAY use any abstraction, even OOP, if we currently need it, e.g. via a [library](library.md), but we aren't FORCED to use a weird high level concepts on problems that can't be described easily in terms of those concepts. That is if you're solving a non-OOP problem with OOP, you waste effort on translating that problem to OOP and the compiler then wastes another effort on un-OOPing this to translate this to instructions. With imperative paradigm this can't happen because you're basically writing instructions which has to happen either way. +- It is generally true that the higher the abstraction, the smaller its scope of application should be, so the default abstraction (paradigm) should be low level. This works e.g. in science: psychology is a high level abstraction but can only be applied to study human behavior, while quantum physics is a low level abstraction which applies to the whole universe. + +Once computers start fundamentally working on a different paradigm, e.g. functional -- which BTW might happen with new types of computers such as [quantum](quantum.md) ones -- we may switch to that paradigm as the default, but until then imperative is the way to go. + +## History + +TODO \ No newline at end of file diff --git a/open_console.md b/open_console.md new file mode 100644 index 0000000..0cecdd8 --- /dev/null +++ b/open_console.md @@ -0,0 +1,53 @@ +# Open Console + +{ Open consoles are how I got into [suckless](suckless.md) programming, they taught me about the low-level, optimizations and how to actually program efficiently on very limited hardware. I recommend you grab one of these. ~drummyfish } + +Open consoles are tiny [GameBoy](gameboy.md)-like [gaming](game.md) consoles powered by [free software](free_software.md) and [hardware](free_hardware.md), which have relatively recently (some time after 2015) seen a small boom. Examples include [Arduboy](arduboy.md), [Pokitto](pokitto.md) or [Gamebuino](gamebuino.md). These are **NOT** to be confused with the [Raspberry Pi](rpi.md) handhelds that run GameBoy emulators. + +In summary, open consoles are: + +- **GameBoy-like gaming consoles** (but also allow and encourage non-gaming uses). +- Powered by **[free hardware](free_hardware.md) and [free software](free_software.md)** (usually [Arduino](arduino.md) plus a custom library, although mostly advertised as [open source](open_source.md) and not so strict about freedom). Schematics are a lot of times available. +- **Retro**. +- **Indie** (sometimes developed by a single guy), often [crowd-funded](crowd_funding.md). +- **Educational**. +- **[DIY](dyi.md)**, often leaving assembly to the customer. +- **Very cheap** (compared to proprietary mainstream consoles). +- **[Hacking](hacking.md) friendly**. +- Typically **[embedded](embedded.md) [ARM](arm.md)**. +- **[Bare metal](bare_metal.md)** (no operating system). +- Pretty **low spec** hardware ([RAM](ram.md) amount in kilobytes, CPU frequency in MHz). +- Relying on **user created games** which are many times also free-licensed. + +Recommended consoles for starters are [Arduboy](arduboy.md) and [Pokitto](pokitto.md) which are not only very well designed, but most importantly have actual friendly active communities. + +These nice little toys are great because they are anti-[modern](modern.md), [simple](minimalism.md), out of the toxic mainstream, like the oldschool bullshit-free computers. This supports (and by the low specs kind of "forces") [suckless](suckless.md) programming and brings the programmer the joy of programming (no headaches of resizable windows, multithreading etc., just plain programming of simple things with direct access to hardware). They offer an alternative [ISA](isa.md), a non-x86 platform without botnet and [bloat](bloat.md) usable for any purpose, not just games. Besides that, this hobby teaches low level, efficiency-focused programming skills. + +## Programming + +Open consoles can be programmed without proprietary software, GNU/[Linux](linux.md) works just fine. Most of the consoles are [Arduino](arduino.md)-based so the Arduino IDE is the official development tool with [C++](cpp.md) as a language ([C](c.md) being thankfully an option as well). The IDE is "open-source" but also [bloat](bloat.md); thankfully [CLI](cli.md) development workflow can be set up without greater issues (Arduino comes with CLI tools and for other platforms [gcc](gcc.md) cross-compiler can be used) so comfy programming with [vim](vim.md) is nicely possible. + +If normies can do it, you can do it too. + +Some consoles (e.g. Arduboy, Pokitto and Gamebuino META) have their own [emulators](emulator.md) which make the development much easier... or rather bearable. Without an emulator you're forced to constantly reupload the program to the real hardware which is a pain, so you want to either use a nice [LRS](lrs.md) library such as [SAF](saf.md) or write your game to be platform-independent and just make it run on your development PC as well as on the console (just abstract the I/O and use SDL for the PC and the console's library for the console -- see how [Anarch](anarch.md) does it). + +## Open Console List + +Some notable open consoles are listed here. Symbol meaning: + +- `A` = Arduino +- `C` = great active community +- `*` = recommended +- `+` = many games/programs +- `-` = discontinued + +| name | CPU |RAM (K)| ROM (K)| display | notes | +| ----------------------- | --------- | ----- | ------ | ------------ | ------------------- | +|[Arduboy](arduboy.md) |8b 16 MHz | 2.5 | 32 | 64x32 1b |* A C +, tiny | +|[Gamebuino](gamebuino.md)|8b 16 MHz | 2 | 32 | 84x48 1b |+ A -, SD | +|[Pokitto](pokitto.md) |32b 48 MHz | 36 | 256 | 220x176 |* C +, ext. hats, SD | +|[ESPboy](espboy.md) |32b 80 MHz | | | 128x128 |A | +|[GB META](gamebuino.md) |32b 48 MHz | 32 | 256 | 168x120 |A + -, SD | +|[Nibble](nibble.md) |32b 160 MHz| 80 | 4000 | 128x128 |A, AAA bat. | +|[UzeBox](uzebox.md) | | | | | | +|Tiny Arcade | | | | | | \ No newline at end of file diff --git a/open_source.md b/open_source.md new file mode 100644 index 0000000..614edad --- /dev/null +++ b/open_source.md @@ -0,0 +1,22 @@ +# Open Source + +*"[Micro$oft](microsoft.md) <3 open source"* + +Open source (OS) is a [capitalist](capitalist_software.md) movement forked from the [free software movement](free_software.md); it is advocating "openness", sharing and collaboration in software and hardware development and though legally it is mostly identical to free (as in freedom) software, in practice and in spirit it is very different by **abandoning the goal of freedom and ethics in favor of business** (to which ethics is an obstacle), due to which we see open source as inherently [evil](evil.md) and recommend following the free software way instead. [Richard Stallman](rms.md), the founder of free software, distances himself from the open source movement. Fascist organizations such as Microsoft and Google, on the other hand, embrace open source (while restraining from using the term *free software*) and slowly shape it towards their goals. The term [FOSS](foss.md) is sometimes used to refer to both free software and open source without expressing any preference. + +Open source is unfortunately (but unsurprisingly) becoming more prevalent than free software, as it better serves [capitalism](capitalism.md) and abuse of people, and its followers are more and more hostile towards the free software movement. This is very dangerous, ethics and focus on actual user freedom is replaced by shallow legal definitions that can be bypassed, e.g. by [capitalist software](capitalist_software.md) and [bloat monopoly](bloat_monopoly.md). In a way open source is capitalism reshaping free software so as to weaken it and eventually make its principles of freedom ineffective. Open source tries to shift the goal posts: more and more it offers only an illusion of some kind of ethics and/or freedom, it pushes towards mere partial openness ("open source" for proprietary platforms), towards high complexity, inclusion of unethical business-centered features ([autoupdates](autoupdate.md), [DRM](drm.md), ...), high interdependency, difficulty of utilizing the rights granted by the license, exclusion of developers with "incorrect" political opinions or bad brand image etc. In practice open source has become something akin a mere **brand** which is stick to a piece of software to give users with little insight a feeling they're buying into something good -- this is called **[openwashing](openwashing.md)**. This claim is greatly supported by the fact that corporations such as [Microsoft](microsoft.md) and [Google](google.md) widely embrace open source ("Microsoft <3 open source", the infamous [GitHub](github.md) acquisition etc.). + +One great difference of open source with respect to free software is that **open source doesn't mind proprietary dependencies**: [Windows](windows.md) only programs or [games](game.md) in [proprietary](proprietary.md) engines such as [Unity](unity.md) are happily called open source -- this would be impossible in the context of free software because as Richard Stallman says software can only be free if it is free as a whole, it takes a single proprietary line of code to allow abuse of the user. + +The open source definition is maintained by the [Open Source Initiative](osi.md) (OSI) -- they define what exactly classifies as open source and which [licenses](license.md) are compatible with it. These licenses are mostly the same as those approved by the [FSF](fsf.md) (even though not 100%). The open source definition is a bit more complex than that of free software, in a nutshell it goes along the lines: + +1. The license has to allow **free redistribution** of the software without any fees. +2. **Source code must be freely available**, without any [obfuscation](obfuscation.md). +3. **Modification of the software must be allowed** as well as redistribution of these modified versions under the same terms as the original. +4. **Direct modification may be forbidden only if [patches](patch.md) are allowed**. +5. **The license must not discriminate against people**, everyone has to be given the same rights. +6. **The license must not discriminate against specific uses**, i.e. use for any purpose must be allowed. +7. **The license applies automatically** to everyone who receives the software with the license. +8. **The license must apply generally**, it cannot be e.g. limited to the case when the software is part of some larger package. +9. **The license must not restrict other software**, i.e. it cannot for example be forbidden to run the software alongside some other piece of software. +10. **The license must be technology neutral**, i.e. it cannot for example limit the software to certain platform or API. \ No newline at end of file diff --git a/openarena.md b/openarena.md new file mode 100644 index 0000000..e5681e1 --- /dev/null +++ b/openarena.md @@ -0,0 +1,19 @@ +# OpenArena + +OpenArena (OA) is a first person arena shooter [game](game.md), a [free as in freedom](free_software.md) [clone](clone.md) of the famous game Quake 3. It runs on [GNU](gnu.md)/[Linux](linux.md), [Winshit](windows.md), [BSD](bsd.md) and other systems, it is quite light on system resources but does require a [GPU](gpu.md) acceleration (no [software rendering](sw_rendering.md)). Quake 3 engine ([Id tech 3](id_tech3.md)) has retroactively been made free software: OpenArena [forked](fork.md) it and additionally replaced the proprietary Quake assets, such as 3D models, sounds and maps, with community-created Japanese/nerd/[waifu](waifu.md)-themed [free culture](free_culture.md) assets, so as to create a completely free game. OpenArena plays almost exactly the same as Quake 3, it basically just looks different and has different maps. It has an official [wiki](wiki.md) at https://openarena.fandom.com and a forum at http://www.openarena.ws/board/. OpenArena has also been used as a research tool. + +As of version 0.8.8 there are 45 maps and 12 game modes ([deathmatch](deathmatch.md), team deatchmatch, [capture the flag](ctf.md), last man standing, ...). + +Character art exhibits what [SJWs](sjw.md) would call high sexism. This is great, it's the good old [90s](90s.md) art style. The art is very nice and professional looking (no programmer art). Characters such as Angelyss are basically naked with just bikini strings covering her nipples. Other characters like Merman and Penguin (a typical "[Linux](linux.md) user") are pretty funny. Ratmod has very nice taunts that would definitely be labeled offensive to gays and other minorities nowadays. The community is also pretty nice, free speech is allowed in chat, no [codes of conduct](coc.md) anywhere, [boomers](boomer.md) thankfully don't buy into such bullshit. Very refreshing in the politically correct era. + +OpenArena is similar to e.g. [Xonotic](xonotic.md) -- another free arena shooter -- but is a bit simpler and oldschool, both in graphics, features and gameplay. It has fewer weapons, game modes and options. However there exist additional modifications, most notably the Ratmod (or RatArena) which makes it a bit more "advanced" (adds game modes, projectiles go through portals, improved prediction code etc.). As of 2022 an asset reboot in a more Anime style, called OA3, is planned and it seems to be aiming in the right direction -- instead of making a "modern HD game" (and so basically just remake Xonotic) they specifically set to create a *2000 game* (i.e. keep the models low poly etc.). It could also help distinguish OpenArena from Quake more and so make it legally safer (e.g. in terms of [trade dress](trade_dress.md)). + +{ I've been casually playing OA for a while alongside Xonotic. I love both games. OA is more oldschool, boomer, straightforward and KISS, feels slower in terms of movement and combat but DM matches are much quicker, fragging is very rapid. ~drummyfish } + +The project was established on August 19 2005, one day after the Quake 3 engine was freed. + +## See Also + +- [Freedoom](freedoom.md) +- [Xonotic](xonotic.md) +- [clone](clone.md) \ No newline at end of file diff --git a/operating_system.md b/operating_system.md new file mode 100644 index 0000000..42fd16c --- /dev/null +++ b/operating_system.md @@ -0,0 +1,39 @@ +# Operating System + +Operating System (OS) is normally a hugely complex program that's typically installed before any other program and serves as a platform for running other programs as well as managing resources (CPU usage, [RAM](ram.md), [files](file.md), [network](network.md), ...) and offering services and interfaces for humans and programs. + +There is a nice [CC0](cc0.md) wiki for OS development at https://wiki.osdev.org/. + +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. + +An OS, as a software, consists of two main parts: + +- **[kernel](kernel.md)**: The base/core of the system, running in the most privileged mode, offering an environment for user applications. +- **[userland](userland.md) (applications)**: The set of programs running on top of the kernel. These run in lower-privileged mode and use the services offered by the kernel via so called [system calls](syscall.md). + +For example in GNU/Linux, [Linux](linux.md) is the kernel and [GNU](gnu.md) is the userland. + +## Attributes/Features + +TODO + +## Notable Operating Systems + +Below are some of the most notable OSes. + +- [Android](android.md) +- [BSD](bsd.md) systems such as [OpenBSD](openbsd.md) and [freeBSD](freebsd.md): Unix-like OSes +- [Collapse OS](collapseos.md) +- [DOS](dos.md), [FreeDOS](freedos.md) +- [GNU](gnu.md)/[Linux](linux.md) systems encompassing many [distributions](distro.md) +- [Inferno](inferno.md): OS in the style of Plan 9 +- [MacOS](macos.md) +- [Minix](minix.md) +- [Plan 9](plan9.md): research OS, continuing the ideas of [Unix](unix.md) +- [ReactOS](reactos.md) +- [Replicant](replicant.md) +- [Solaris](solaris.md) +- [TempleOS](templeos.md): simple [meme](meme.md) OS written by a [Terry Davis](terry_davis.md) +- [Unix](unix.md) +- [Windows](windows.md): very bad [proprietary](proprietary.md) [capitalist](capitalist_software.md) OS +- [9front](9front.md): OS based on Plan 9 \ No newline at end of file diff --git a/optimization.md b/optimization.md new file mode 100644 index 0000000..207091e --- /dev/null +++ b/optimization.md @@ -0,0 +1,42 @@ +# Optimization + +Optimization means making a program more efficient in terms of consumption of some computing resource or by any similar metric, commonly aiming for greater execution speed or lower memory usage (but also e.g. lower power consumption, lower network usage etc.) while preserving how the program functions externally. Unlike [refactoring](refactoring.md), which aims primarily for a better readability of source code, optimization changes the inner behavior of the executed program to a more optimal one. + +## General Tips'N'Tricks + +These are mainly for [C](c.md), but may be usable in other languages as well. + +- **Tell your compiler to actually optimize** (`-O3`, `-Os` etc.). +- **gprof is a utility you can use to profile your code**. +- **`` has fast type nicknames**, types such as `uint_fast32_t` which picks the fastest type of at least given width on given platform. +- **Keywords such as `inline`, `static` and `const` can help compiler optimize well**. +- **Optimize the [bottlenecks](bottleneck.md)!** Optimizing in the wrong place is a complete waste of time. If you're optimizing a part of code that's taking 1% of your program's run time, you will never speed up your program by more than that 1% even if you speed up the specific part by 10000%. Bottlenecks are usually inner-most loops of the main program loop, you can identify them with [profiling](profiling.md). +- **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 (more demanding on CPU). +- **Be smart, use [math](math.md)**. 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. +- **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). +- **You can use good-enough [approximations](approximation.md) instead of completely accurate calculations**, e.g. taxicab distance instead of Euclidean distance, and gain speed or memory without trading. +- **Use quick opt-out conditions**: many times before performing some expensive calculation you can quickly check whether it's even worth performing it and potentially skip it. For example in physics [collision detections](collision_detection.md) you may first quickly check whether the bounding spheres of the bodies collide before running an expensive precise collision detection -- if bounding spheres of objects don't collide, it is not possible for the bodies to collide and so we can skip further collision detection. +- **Operations on static data can be accelerated with accelerating structures** ([look-up tables](lut.md) for functions, [indices](indexing.md) for database lookups, spatial grids for collision checking, ...). +- **Use powers of 2** whenever possible, this is efficient thanks to computers working in binary. Not only may this help nice utilization and alignment of memory, but mainly multiplication and division can be optimized by the compiler to mere bit shifts which is a tremendous speedup. +- **Write [cache-friendly](cache-friendly.md) code** (minimize long jumps in memory). +- **Compare to [0](zero.md) rather than other values**. There's usually an instruction that just checks the zero flag which is faster than loading and comparing two arbitrary numbers. +- **Consider moving computation from run time to compile time**. 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 the first **arguments to a function may be passed via registers**, so it may be better to have fewer parameters in functions. +- **Optimize when you already have a working code**. As Donald Knuth 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. +- **Use your own caches 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) 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 are a nice example). +- For the sake of embedded platforms **avoid [floating point](floating_point.md)** as that is often painfully slowly emulated in software. Use [fixed point](fixed_point.md). +- **Early branching can create a speed up** (instead of branching inside the loop create two versions of the loop and branch in front of them). This is a kind of space-time tradeoff. +- **Reuse variable to save space**. A warning about this one: readability may suffer, mainstreamers will tell you you're going against "good practice", and some compilers may do this automatically anyway. Be sure to at least make this clear in your comments. Anyway, on a lower level and/or with dumber compilers you can just reuse variables that you used for something else rather than creating a new variable that takes additional RAM; the only prerequisite for "merging" variables is that the variables aren't used at the same time. +- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses portability! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages. + +## When To Actually Optimize? + +Nubs often ask this. Generally fine, sophisticated optimization should come as one of the last steps in development, when you actually have a working thing. These are optimizations requiring significant energy/time to implement -- you don't want to spend resources on this at the stage when they may well be dropped in the end, or they won't matter because they'll be outside the bottleneck. However there are two "exceptions". + +The highest-level optimization is done as part of the initial design of the program, before any line of code gets written. This includes the choice of data structures and mathematical models you're going to be using, the very foundation around which you'll be building your castle. This happens in your head at the time you're forming an idea for a program, e.g. you're choosing between [server-client](server_client.md) or [P2P](p2p.md), [monolithic or micro kernel](kernel.md), [raytraced](ray_tracing.md) or [rasterized](rasterization.md) graphics etc. These choices affect greatly the performance of your program but can hardly be changed once the program is completed, so they need to be made beforehand. **This requires wide knowledge and experience** as you work by intuition. + +Another kind of optimization done during development is just automatically writing good code, i.e. being familiar with specific patterns and using them without much thought. For example if you're computing some value inside a loop and this value doesn't change between iterations, you just automatically put computation of that value **before** the loop. Without this you'd simply end up with a shitty code that would have to be rewritten line by line at the end. Yes, compilers can often do this simple kind of optimization for you, but you don't want to rely on it. \ No newline at end of file diff --git a/os.md b/os.md new file mode 100644 index 0000000..4ed3f76 --- /dev/null +++ b/os.md @@ -0,0 +1,3 @@ +# OS + +OS can stand for either [operating system](operating_system.md) or [open source](open_source.md). \ No newline at end of file diff --git a/p_vs_np.md b/p_vs_np.md new file mode 100644 index 0000000..1571a29 --- /dev/null +++ b/p_vs_np.md @@ -0,0 +1,19 @@ +# P vs NP + +*P vs NP* is one of the greatest and most important yet unsolved problems in [computer science](computer_science.md): it is the question of whether the [computational class](computational_complexity.md) [P](p.md) is equal to class [NP](np.md) or, in simple terms, whether certain problems for which no "fast" solution is known can in fact be solved "fast". This is very important e.g. for algorithms used in [cryptography](cryptography.md). This problem is in fact so important that it's one of the seven Millennium Prize Problems. **There is a million dollar reward for solving this problem**. + +It is believed and sometimes relied on that P != NP (in which case P would be a proper subset of NP), but a mathematical proof doesn't exist yet. If it was surprisingly proven that P = NP, there might be practical consequences for cryptography in which most algorithms rely on the problems in question being difficult (slow) to solve -- a proof of P = NP could lead to fast algorithms for breaking encryption, but that is not a certainty, only one of possible scenarios. However any solution to this problem would be revolutionary and ground breaking. + +## Explanation + +In the context of [computational complexity](computational_complexity.md) of algorithms we talk about different types of algorithm time complexities, i.e. different "speeds" of algorithms. This "speed" doesn't mean actual running time of the algorithm in real life but rather how quickly the running time grows depending on the amount of input data to it, i.e. we are interested only in the shape of the function that describes how the amount of input data affects the running time of the algorithm. The types of time complexity are named after mathematical functions that grow as quickly as this dependence, so we have a *constant* time complexity, *logarithmic* time complexity, *linear* time complexity etc. + +Then we have classes of computational problems. The classes divide problems based on how "fast" they can be solved. + +The class P stands for **polynomial** and is defined as all problems that can be solved by an algorithm run on a **deterministic [Turing machine](turing_machine.md)** (a theoretical computer) with a *polynomial* time complexity. + +The class NP stands for **non-deterministic polynomial** and is defined as all problems that can be solved by an algorithm run on a **non-deterministic Turing machine** with a *polynomial* time complexity. I.e. the definition is the same as for the P class with the difference that the Turing machine is non-deterministic -- such a machine is faster because it can make kind of "random correct guesses" that lead to the solution more quickly. Non-deterministic computers are only theoretical (at least for now), computers we have in real life cannot perform such randomly correct guesses. It is known that the solution to all NP problems can be verified in *polynomial* time even by a deterministic Turing machine, we just don't know if the solution can also be found this quickly. + +Basically P means *"problems that can be solved quickly"* and NP means *"problems that can be verified quickly but we don't know if they can also be solved quickly"*. + +The question is whether all NP problems are in fact P problems, i.e. whether *all problems that can be verified quickly can also be solved quickly*. It is believed this is not the case. diff --git a/pd.md b/pd.md new file mode 100644 index 0000000..3df1057 --- /dev/null +++ b/pd.md @@ -0,0 +1,3 @@ +# PD + +PD stands for [public domain](public_domain.md). \ No newline at end of file diff --git a/pedophilia.md b/pedophilia.md new file mode 100644 index 0000000..a82aeb2 --- /dev/null +++ b/pedophilia.md @@ -0,0 +1,9 @@ +# Pedophilia + +{ [Rape](rape.md) of anyone is bad as is any violence against any living being. That's it. Any thought, desire or perception of any information must however never be considered wrong in itself. ~drummyfish } + +Pedophilia is a sexual orientation towards children, nowadays wrongfully labeled a "disorder" just as e.g. homosexuality used to be labelled an illness. It is the forbidden sexual orientation of our age, even though all healthy people are pedophiles (just don't pretend you've never seen a [jailbait](jailbait.md) you found sexy), even though one cannot choose this orientation and even though pedophiles don't hurt anyone any more than for example gay people do, they are highly oppressed and tortured. Despite what the propaganda says, a pedophile is not automatically a rapist of children any more than a gay person is automatically a rapist of people of the same gender, and watching child porn won't make you want to rape children more than watching gay porn will make you want to rape people of the same gender. Nevertheless the society, especially the fascists from the [LGBT](lgbt.md) movement who ought to know better than anyone else what it is like to be oppressed only because of private sexual desires, actively hunt pedophiles, [bully](cancel_culture.md) them and lynch them on the internet and in the real life by both civilians and state (I shit you not, in [Murica](usa.md) there are whole police teams of pink haired lesbians who pretend to be little girls on the internet and tease guys so that they can lock them up and get a medal for it). There is a literal witch hunt going on against completely innocent people, just like in the middle ages. Innocent people are tortured, castrated, cancelled, rid of their careers, imprisoned, beaten, rid of their friends and families and pushed to suicide sometimes only for having certain files on their computers (not that any of the above is ever justified to do to anyone, even the worst criminal). + +The pedophile witch hunt exists because it's a great political tool. It is an arbitrarily invented victimless crime. By the principles of [fear culture](fear_culture.md), it allows to push things such as hard surveillance, similarly to e.g. "war on terror". You're a government or a corporation and want to spy on people chatting? Just make a law requiring mandatory [spyware](spyware.md) in all chat and justify it by "pedophiles" (this is what [EU](eu.md) did). You're against the surveillance law? You must be a pedophile! The witch hunt also allows to immediately cancel anyone uncomfortable. There's a guy who the government doesn't like? Maybe a political competition. Simple, just plant some files on his computer, make up a little story and they're gone. + +Defending pedophilia in itself is enough to be cancelled, however it is the morally right thing to always say the truth. \ No newline at end of file diff --git a/people.md b/people.md new file mode 100644 index 0000000..0e08968 --- /dev/null +++ b/people.md @@ -0,0 +1,34 @@ +# Tech People + +*"People are retarded."* --[Osho](osho.md) + +Here is a list of people notable in context of this wiki. + +- **[Alan Turing](turing.md)**: mathematician, father of [computer science](compsci.md), [gay](gay.md) +- **[Alexandre Oliva](alexandre_oliva.md)**: [free software](free_software.md) advocate, founding member of [FSFLA](fsfla.md), maintainer of [Linux-libre](linux_libre.md) +- **[Bill Gates](bill_gates.md)**: founder and CEO of [Micro$oft](microsoft.md), huge faggot +- **[Dennis Ritchie](dennis_ritchie)**: creator of [C](c.md) language and co-creator of [Unix](unix.md) +- **[Donald Knuth](knuth.md)**: computer scientist, Turing-award winner, author of the famous [Art of Computer Programming](taocp.md) books and the [TeX](tex.md) typesetting system +- **[drummyfish](drummyfish.md)** (Miloslav Číž): creator of [LRS](lrs.md), a few programs and this wiki, anarcho-pacifist +- **[Eric S. Raymond](esr.md)**: proponent of [open source](open_source.md), co-founder of [OSI](osi.md) and tech writer +- **[Geoffrey Knauth](geoffrey_knauth.md)**: very [shitty](shit.md) president of [Free Software Foundation](fsf.md) since 2020 who embraces [proprietary](proprietary.md) software lol +- **[Jesus](jesus.md)**: prolly the most famous guy in history, had a nice teaching of [nonviolence](nonviolence.md) and [love](love.md) +- **[Jimmy Wales](jimmy_wales.md)**: co-founder of [Wikipedia](wikipedia.md) +- **[John Carmack](john_carmack.md)**: legendary game ([Doom](doom.md), [Quake](quake.md), ...) and [graphics](graphics.md) developer, often called a programming god +- **[Ken Thompson](ken_thompson.md)**: co-creator of [Unix](unix.md), [C](c.md) and [Go](go.md) +- **[Larry Sanger](larry_sanger.md)**: co-founder of [Wikipedia](wikipedia.md), also one of its biggest critics +- **[Larry Wall](larry_wall.md)**: creator of [Perl](perl.md) language, linguist +- **[Lawrence Lessig](lessig.md)**: lawyer, founder of [free culture](free_culture.md) movement and [Creative Commons](creative_commons.md), critic of [copyright](copyright.md) +- **[Linus Torvalds](linus_torvalds.md)**: Finnish programmer who created [Linux](linux.md) and [git](git.md) +- **[Luke Smith](luke_smith.md)**: [suckless](suckless.md) vlogger/celebrity +- **[Melvin Kaye](mel.md) aka Mel**: genius old time programmer that appears in [hacker lore](hacker_culture.md) (*Story of Mel*) +- **[Mental Outlaw](mental_outlaw.md)**: [suckless](suckless.md) vlogger/celebrity +- **[Nina Paley](nina_paley.md)**: [female](woman.md) artist, one of the most famous proponents of [free culture](free_culture.md) +- **[Noam Chomsky](noam_chomsky.md)**: linguist notable in theoretical [compsci](computer_science.md), anarchist +- **[Óscar Toledo G.](toledo.md)**: programmer of tiny programs and [games](game.md) (e.g. the smallest [chess](chess.md) program), sadly [proprietary](proprietary.md) [winfag](windows.md) +- **[Richard Stallman](rmd.md)**: inventor of [free software](free_software.md) and [copyleft](copyleft.md), founder of [GNU](gnu.md) and [FSF](fsf.md), hacker, also created [emacs](emacs.md) +- **[Steve Jobs](steve_jobs.md)**: founder and CEO of [Apple](apple.md), huge retard and dickhead +- **[Ted Kaczynski](ted_kaczynski.md)**: AKA the Unabomber, mathematician, primitivist and murderer who pointed out the dangers of modern technology +- **[Terry Davis](terry_davis.md)**: deceased schizophrenic genius, creator of [Temple OS](temple_os.md), became a tech [meme](meme.md) +- **[Uriel](uriel.md)**: deceased member of the [suckless](suckless.md) community, philosophical advisor +- **[viznut](viznut.md)** (Ville-Matias Heikkilä): creator or [countercomplex](countercomplex.md), minimalist programmer, inventor of [bytebeat](bytebeat.md), hacker, [collapse](collapse.md) "[prepper](prepping.md)" \ No newline at end of file diff --git a/physics_engine.md b/physics_engine.md new file mode 100644 index 0000000..b22af22 --- /dev/null +++ b/physics_engine.md @@ -0,0 +1,24 @@ +# Physics Engine + +Physics engine is a [software](software.md) (usually a [library](library.md)) whose purpose is to simulate physics laws of mechanics, i.e. things such as forces, [rigid](rigid_body.md) and [soft](soft_body.md) body collisions, [particle](particle.md) motion, fluid dynamics etc. + +{ When it comes to classic 3D rigid body physics engines, they're extremely hard to make, much harder than for example an advanced 3D rendering engine, especially when you want to make them [LRS](lrs.md) (without floating point, ...) and/or general and somewhat physically correct (being able to simulate e.g. the Dzhanibekov effect, satisfying all the conservation laws, continuous collision detection etc.). Good knowledge of mechanics and things like [quaternions](quaternion.md) and 3D rotations is just the beginning, difficulties arise in every aspect of the engine, and of those there are many. As I've found, 32 bit fixed point is not enough for a general engine (even though it is enough for a rendering engine), you'll run into precision problems as you need to represent both relatively high and low energies. You'll also run into stability issues such as stable contacts, situations with multiple objects stacked on top of each other starting to bounce on their own etc. Even things such as deciding in what order to resolve collisions are very difficult, they can lead to many bugs such as a car not being able to drive on a straight road made of several segments. Collision detection alone for all combinations of basic shapes (sphere, cuboid, cylinder, capsule, ... let alone general triangle mesh) are hard as you want to detect general cases (not only e.g. surface collisions) and you want to extract all the parameters of the collisions (collision location, depth, normal etc.) AND you want to make it fast. And of course you'll want to add acceleration structures and many other thing on top. So think twice before deciding to write your own physics engine. + +A sane approach may be to write a simplified engine specifically for your program, for example a Minecraft-like game may just need non-rotating capsules in a voxel environment, that's not that hard. You may perhaps get away with a bit of cheating, e.g. simulating rigid bodies as really stiff soft bodies, it may not be as efficient and precise but it's simpler to program. It may be [good enough](good_enough.md). ~drummyfish } + +Physics engine is a wide term even though one usually imagines the traditional 3D rigid body engine used in games such as [GTA](gta.md). These engines may nevertheless have different purposes, features and even basic paradigms, some may e.g. be specialized just for computing precise ballistic trajectories for the army, some may serve for simulating weather etc. Some common classifications and possible characteristics of physics engines follow: + +- **[2D](2d.md) vs [3D](3d.md)**: 2D engines are generally much more simple to implement than 3D, for example because of much more simple math for rotations and collision detection. Graphics and physics are usually loosely interconnected (though they should be [decoupled](coupling.md)) in that the way in which we represent graphics (2D, general 3D, [BSP](bsp.md), [voxels](voxel.md), ...) usually also determines how we compute physics, so that there may also exist e.g. "[pseudo 3D](pseudo_3d.md)" physics engines as part of "pseudo 3D" renderers, e.g. the one used in [Doom](doom.md) etc. +- **[real time](real_time.md) vs [offline](offline.md)**: Real-time ones are mostly intended to be used in the entertainment industry, i.e. [games](game.md), movies etc. as they can compute somewhat realistic looking results quickly but for the price of dropping high accuracy (they use many [approximations](approximation.md)). Scientific engines may prefer to be offline and taking longer time to compute more precise results. +- **[rigid body](rigid_body.md) vs [soft body](soft_body.md)**: Rigid body engines don't allow bodies to deform while soft body ones do -- in real life all bodies are soft, but neglecting this detail and considering shapes rigid can have benefits (such as being able to consider the body as a whole and not having to simulate all its individual points). Of course, a complex engine may implement both rigid and soft body physics. +- **paradigm**: The basic approach to implementing the simulation, e.g. being [impulse](impulse.md)-based (applying impulses to correct errors), constraint-based (solving equations to satisfy imposed constraints), penalty-based (trying to find equilibriums of forces) etc. +- **[discrete](discrete.md) vs [continuous](continuous.md) collision detection**: Discrete collision detection only detects collisions at single points in time (at each engine tick) and are simple than those implementing continuous collision detection. Discrete engine are less accurate, consider e.g. that a very fast moving object can pass through a wall because at one instant it is in front of it while at the next tick it is behind it. Continuous collisions won't allow this to happen, but are more difficult to program, may be slower etc. For games discrete collisions are usually [good enough](good_enough.md). +- **features: fluid, cloth, particles, [ragdoll](ragdoll.md), [inverse kinematics](inverse_kinematics.md), [GPU](gpu.md) acceleration, [determinism](determinism.md), [voxels](voxel.md), [acceleration](acceleration.md) [data structures](data_structure.md) ...**: These are a number of additional features the engine can have such as the ability to simulate fluids (which itself is a huge field of its own) or cloths, some go as far as e.g. integrating motion-captured animations of humans with physics to create smooth realistic animations e.g. of running over walking pedestrians with a car and so on. + +A typical physics engine will work something like this: we create a so called **physics world**, a [data structure](data_structure.md) that represents the space in which the simulation takes place (it is similar to a [scene](scene.md) in rendering engines). We then populate this world with physics elements such as rigid bodies (which can have attributes such as mass, elasticity etc.). These bodies are normally basic geometric shapes such as spheres, cylinders, boxes or capsules, or objects composed of several such basic shapes. This is unlike with rendering engines in which we normally have triangle meshes -- in physics engines triangle meshes are extremely slow to process, so for the sake of a physics engine we approximate this mesh with some of the above basic shapes (for example a creature in a game that's rendered as a hi-poly 3D model may in the physics engine be represented just as a simple sphere). Furthermore the bodies can be **[static](static.md)** (cannot move, this is sometimes done by setting their mass to infinity) or **[dynamic](dynamic.md)** (can move); static bodies normally represent the environment (e.g. the game level), dynamic ones the entities in it (player, NPCs, projectiles, ...). Making a body static has performance benefits as its movement doesn't have to be calculated and the engine can also precalculate some things for it that will make e.g. collision detections faster. We then simulate the physics of the world in so called *ticks* (similar to [frames](frame.md) in rendering); in simple cases one tick can be equivalent to one rendering frame, but properly it shouldn't be so (physics shouldn't be affected by the rendering speed, and also for the physics simulation we can usually get away with smaller "[FPS](fps.md)" than for rendering, saving some performance). Usually one tick has set some constant time length (e.g. 1/60th of a second). In each tick the engine performs a **[collision detection](collision.md)**, i.e. it finds out which bodies are touching or penetrating other bodies (this is accelerated with things such as [bounding spheres](bounding_volume.md)). Then it performs so called **collision resolution**, i.e. updating the positions, velocities and forces so that the bodies no longer collide and react to these collisions as they would in the real world (e.g. a ball will bounce after hitting the floor). There can be many more things, for example **constraints**: we may e.g. say that one body must never get further away from another body than 10 meters (imagine it's tied to it by a rope) and the engine will try to make it so that this always holds. The engine will also offer a number of other functions such as casting rays and calculating where it hits (obviously useful for shooter games). + +**Integrating physics with graphics**: you will most likely use some kind of graphics engine along with physics engine, even if just for [debugging](debugging.md). As said above, keep in mind a graphics and physics engines should be **strictly separated** ([decoupled](coupling.md), for a number of reasons such as [reusability](reusability.md), easier debugging, being able to switch graphics and physics engines etc.), even though they closely interact and may affect each other in their design, e.g. by the data structures you choose for your program (voxel graphics will imply voxel physics etc.). In your program you will have a **physics world and a graphics scene**, both contain their own elements: the scene has graphics elements such as 3D models or particle systems, the physics world has elements such as rigid bodies and force fields. Some of the graphical and physics entities are connected, for example a 3D model of a tree may be connected to a physics rigid body of a cone shape. NOT ALL graphics elements have counterparts in the physics simulation (e.g. a smoke effect or light aren't present in the physics simulation) and vice versa (e.g. player in a first-person game has no 3D model but still has some physics shape). The connection between graphics and physics elements should be done **above** both engines (i.e. do NOT add pointers to physics object to graphics elements etc.). This means that e.g. in a game you create a higher abstract environment -- for example a level -- which stands above the graphics scene and physics world and has its own game elements, each game element may be connected to a graphics or physics element. These game elements have attributes such as a position which gets updated according to the physics engine and which is transferred to the graphics elements for rendering. Furthermore remember that **graphics and physics should often run on different "FPS"**: graphics engines normally try to render as fast as they can, i.e. reach the highest [FPS](fps.md), while physics engines often have a time step, called a **tick**, of fixed time length (e.g. 1/30th of a second) -- this is so that they stay [deterministic](determinism.md), accurate and also because physics may also run on much lower FPS without the user noticing ([interpolation](interpolation.md) can be used in the graphics engine to smooth out the physics animation for rendering). "[Modern](modern.md)" engines often implement graphics and physics in separate [threads](thread.md), however this is not [suckless](suckless.md), in most cases we recommend the [KISS](kiss.md) approach of a single thread (in the main loop keep a timer for when the next physics tick should be simulated). + +## Existing Engines + +One of the best and most famous [FOSS](foss.md) 3D physics engines is [Bullet](bullet_physics.md) ([zlib](zlib.md) license), it has many features (rigid and soft bodies, GPU acceleration, constraints, ...) and has been used in many projects ([Blender](blender.md), [Godot](godot.md), ...). [Box2D](box2d.md) is a famous 2D physics engine under [MIT](mit.md) license, written in [C++](cpp.md). \ No newline at end of file diff --git a/piracy.md b/piracy.md new file mode 100644 index 0000000..ec9bd75 --- /dev/null +++ b/piracy.md @@ -0,0 +1,5 @@ +# Piracy + +Piracy is a capitalist propaganda term for the act of illegally sharing copyrighted information such as [non-free](proprietary.md) books, movies, music, video [games](game.md) or scientific papers. + +**[We](lrs.md) highly support piracy**, however also keep in mind the following: if you pirate a proprietary piece of information, you get it gratis but it stays proprietary, it abuses you, it limits your freedom -- you won't get the source code, you won't be able to publicly host it, you won't be allowed to create and share derivative works etc. Therefore **prefer [free (as in freedom)](free_culture.md) alternatives to piracy**, i.e. pieces of information that are not only gratis but also freedom supporting. \ No newline at end of file diff --git a/plusnigger.md b/plusnigger.md new file mode 100644 index 0000000..607c93a --- /dev/null +++ b/plusnigger.md @@ -0,0 +1,5 @@ +# +NIGGER + ++NIGGER is a [license](license.md) modifier that's meant to be added to a [free software](free_software.md) license to prevent corporations from adopting this software by making it impossible to make politically correct forks of such software. Its text is available at https://plusnigger.autism.exposed/. + +The modifier adds a condition that all modified version of this software have to contain the word "NIGGER". For example a license GPLv3+NIGGER has all the conditions of a GPLv3 license plus the condition of including the word "NIGGER". diff --git a/pokitto.md b/pokitto.md new file mode 100644 index 0000000..36b5241 --- /dev/null +++ b/pokitto.md @@ -0,0 +1,27 @@ +# Pokitto + +Pokitto is a very nice educational [open gaming console](open_console.md) friendly to [hacking](hacking.md) and [FOSS](foss.md). It is also very family friendly, aiming to be used as an educational device for kids on schools, which doesn't at all take away any of its value for hardcore hackers. Its website is https://www.pokitto.com/. + +Its great advantage is its great active and friendly community that's constantly writing software, documenting Pokitto and helping newcomers. + +The console was created by Jonne Valola from Finland. He started the project on Kickstarter on April 28 2017, pledged over $27000 and released Pokitto in February 2018. { Jonne is a really nice guy who loves the project, puts his soul into the project and always personally helps people and shares technical details of the console. ~drummyfish } + +Pokito, unlike most other open consoles, is NOT based on [Arduino](arduino.md), but on [NXP](nxp.md)'s LPC11U6x [microcontroller](mcu.md) (MCU). Some features and specs of Pokitto are: + +- Up to **220x176 color display** ([TFT](tft.md)). (Resolution and color depth depends on chosen mode and how much [RAM](ram.md) you want to dedicate to [screen buffer](screen_buffer.md)). +- Up to **72 MHz [ARM](arm.md) CPU**. The base frequency is 48 MHz but the hardware is easily [overclocked](overclocking.md). +- **256 kB [ROM](rom.md)** (program storage space). +- **36 kB [RAM](ram.md)** (working memory). +- **4 kB [EEPROM](eeprom.md)** (persistent storage). +- **7 buttons**. +- **Speaker and headphone jack**. +- Both **[emulator](emulator.md) and simulator** which make programming much more efficient and comfortable. +- **Custom library** -- PokittoLib -- [free](free_software.md)-licensed { even though it contains a few small "fair use" files from the MCU vendor. ~drummyfish }. It has many features, unfortunately it's also kind of [bloated](bloat.md). +- **[SD](sd.md) card support**. +- Hardware extensions called **hats**. Available is e.g. a hat with [joystick](joystick.md) and extra buttons. +- Programming via [USB](usb.md), works on [GNU](gnu.md)/[Linux](linux.md) with [gcc](gcc.md) ARM cross compiler. Supports a few languages: **[C++](cpp.md), [C](c.md), [MicroPython](micropython.md) and [Java](java.md)**. +- Custom [IDE](ide.md) for [noobs](noob.md): FemtoIde. +- Schematics and 3D print files available. +- A huge number of games and other software has already been written. + +Downsides of Pokitto are that the community is an [open source](open_source.md) community rather than [free software](free_software.md) one, purists like us will find they lean towards [bloated](bloat.md) solutions even though the technical limitation of the console largely prevent their implementation. The web forums runs on [discourse](discourse.md) and requires [JavaScript](js.md) for interactivity. [Discord](discord.md) is also actively used for communication, even though some community members bridged it to free alternatives. The official library is relatively bloated and even contains some small pieces of unlicensed code from the MCU manufacturer -- they are very simple assembly snippets that may be easily replacaeble, but we should be cautious even about this. Anyway, a reasonably dedicated programmer might create a suckless Pokitto library without greater problems. \ No newline at end of file diff --git a/political_correctness.md b/political_correctness.md new file mode 100644 index 0000000..50cb1ee --- /dev/null +++ b/political_correctness.md @@ -0,0 +1,5 @@ +# Political Correctness + +*The issue is not my language but your ego.* + +Political correctness is a [bullshit](bullshit.md) [pseudoleftist](pseudoleft.md) idea that says we should forcefully restrain from using language they define as "[offensive](offended_culture.md)" to certain selected groups of people. For example the [SJW](sjw.md) gospel declared that in the realm of technology the word *[blackbox](blackbox.md)* is "offensive" to [black people](nigger.md) and as such should be [censored](censorship.md) and replaced with another term (one they would call more "inclusive"). Indeed this is probably the peak of retardedness. \ No newline at end of file diff --git a/prime.md b/prime.md new file mode 100644 index 0000000..78a6c26 --- /dev/null +++ b/prime.md @@ -0,0 +1,104 @@ +# Prime Number + +Prime number (or just *prime*) is a [whole](integer.md) positive [number](number.md) only divisible by 1 and itself, except for the number [1](one.md). I.e. prime numbers are 2, 3, 5, 7, 11, 13, 17 etc. Prime numbers are extremely important, [interesting](interesting.md) and mysterious for their properties and distribution among other numbers, they have for millennia fascinated [mathematicians](math.md), nowadays they are studied in the math subfield called [number theory](number_theory.md). Primes are for example essential in [assymetric cryptography](assymetric_cryptography.md). + +The largest known prime number as of 2022 is 2^82589933 - 1 (it is so called [Mersenne prime](mersenne_prime.md), i.e. a prime of form 2^N - 1). + +Every natural number greater than 1 has a unique **prime factorization**, i.e. a [set](set.md) of prime numbers whose product it is. For example 75 is a product of three primes: 3 * 5 * 5. This is called the *fundamental theorem of arithmetic*. Naturally, each prime has a factorization consisting of a single number -- itself -- while factorizations of non-primes consist of at least two primes. To mathematicians prime numbers are what chemical elements are to chemists -- a kind of basic building blocks. + +**Why is 1 not a prime?** Out of convenience -- if 1 was a prime, the fundamental theorem of arithmetic would not hold because 75's factorization could be 3 * 5 * 5 but also 1 * 3 * 5 * 5, 1 * 1 * 3 * 5 * 5 etc. + +The unique factorization can also nicely be used to encode [multisets](multiset.md) as numbers. We can assign each prime number its sequential number (2 is 0, 3 is 1, 5 is 2, 7 is 3 etc.), then any number encodes a set of numbers (i.e. just their presence, without specifying their order) in its factorization. E.g. 75 = 3 * 5 * 5 encodes a multiset {1, 2, 2}. This can be exploited in cool ways in some [cyphers](cypher.md) etc. + +When in 1974 the Arecibo radio message was sent to space to carry a message for [aliens](alien.md), the resolution of the bitmap image it carried was chosen to be 73 x 23 pixels -- two primes. This was cleverly done so that when aliens receive the 1679 sequential values, there are only two possible ways to interpret them as a 2D bitmap image: 23 x 73 (incorrect) and 73 x 23 (correct). This increased the probability of correct interpretation against the case of sending an arbitrary resolution image. + +**There are infinitely many prime numbers**. The proof is pretty simple (shown below), however it's pretty interesting that it has still not been proven whether there are infinitely many [twin primes](twin_prime.md) (primes that differ by 2), that seems to be an extremely difficult question. + +Euklid's [proof](proof.md) shows there are infinitely many primes, it is done by contradiction and goes as follows: suppose there are finitely many primes *p1*, *p2*, ... *pn*. Now let's consider a number *s* = *p1* * *p2* * ... * *pn* + 1. This means *s* - 1 is divisible by each prime *p1*, *p2*, ... *pn*, but *s* itself is not divisible by any of them (as it is just 1 greater than *s* and multiples of some number *q* greater than 1 have to be spaced by *q*, i.e. more than 1). If *s* isn't divisible by any of the considered primes, it itself has to be a prime. However that is in contradiction with the original assumption that *p1*, *p2*, ... *pn* are all existing primes. Therefore a finite list of primes cannot exist, there have to be infinitely many of them. + +**Distribution and occurrence of primes**: the occurrence of primes seems kind of """[random](random.md)""" (kind of like digits of [decimal](decimal.md) representation of [pi](pi.md)), without a simple pattern, however hints of patterns appear such as the [Ulam spiral](ulam_spiral.d) -- if we plot natural numbers in a square spiral and mark the primes, we can visually distinguish dimly appearing 45 degree diagonals as well as horizontal and vertical lines. Furthermore the **density of primes decreases** the further away we go from 0. The *prime number theorem* states that a number randomly chosen between 0 and *N* (for large *N*) has approximately 1/log(N) probability of being a prime. **Prime counting function** is a function which for *N* tells the number of primes smaller or equal to *N*. While there are 25 primes under 100 (25%), there are 9592 under 100000 (~9.5%) and only 50847534 under 1000000000 (~5%). + +``` + , , , ', ' ,' , , ' + ',', ' , ' ', ' ', +,, , ,' ' ', ,' ,' , ' ' + , , ', , ' ,' ', ,' ' ,', , + ' ',', , , ', ', +, , , ,' ,' ' ', , , ' + ,', ,', ' , , ,' ' , ' , +, ', ' ', , ,' , ', ' ' ' , + ',', , ,' ' , ,' ' ' ,',' ', , , + ' ' ' ', , , , ', , ', , + ' ' ' ' ' ', , ,' ' ' ', + ' ', ', , , ,', ,',', ,' ' ' , ' ' ' , , + , , ,',;,', , , , ,', , + ' ' ' ',' ', +,,' ' , ' ,' ', ',' ', ' ', ,' ,' ' ', + , , , , ' , , ,' , , ' + ' ', ', ' , , , ' ' ' +,, , , , , ' ' ,', ', ' , ,' ,',' + , , ,', ' , , ',', , , + ', ' ' ', , , ,' ', ', +, ', , ,' ', ' ' , ' ' + , ' ' ' ' ', ', , + , ' ' ' ' ,' , , ,' ', + ,' ', , ,', , ' , , ' ' + , ', , , , , ,' ', +``` + +*Ulam spiral: the center of the image is the number 1, the number line continues counter clockwise, each point represents a prime.* + +Here are prime numbers under 1000: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997. + +``` + ______/ + / / + _____ ______/_ / + ____ / X /__\ / + ___ / \/__ / \ /__ \/ + / \ / /\ \ / \ / \ /\ +--2--3--/--5--X--7--/--\--X--11-X--13-X--\-- + \__\/ \ \/ \__\/ \ \/ \__\/ \ \/ \__\/ + \__\_/\ \ /\ \ /\__\_/\ \ /\ \ /\ + \__\__X \ X \ X \ X__\__X + \__\__\/ \ \/ \ \/ \ \/ \ + \__\__\_/\ \ /\ \ /\ \ +``` + +## Algorithms + +**Primality test**: testing whether a number is a prime is quite easy and not computationally difficult (unlike factoring the number). A [naive](naive.md) algorithm is called *trial division* and it tests whether any number from 2 up to the tested number divides the tested number (if so, then the number is not a prime, otherwise it is). This can be optimized by only testing numbers up to the [square root](sqrt.md) (including) of the tested number (if there is a factor greater than the square root, there is also another smaller than it which would already have been tested). A further simple optimization is to to test division by 2, 3 and then only numbers of the form 6q +- 1 (other forms are divisible by either 2 or 3, e.g 6q + 4 is always divisible by 2). Further optimizations exist and for maximum speed a [look up table](lut.md) may be used for smaller primes. A simple [C](c.md) function for primality test may look e.g. like this: + +``` +int isPrime(int n) +{ + if (n < 4) + return n > 1; + + if (n % 2 == 0 || n % 3 == 0) + return 0; + + int test = 6; + + while (test <= n / 2) // replace n / 2 by sqrt(n) if available + { + if (n % (test + 1) == 0 || n % (test - 1) == 0) + return 0; + + test *= 6; + } + + return 1; +} +``` + + +[Sieve of Eratosthenes](sieve_of_eratosthenes.md) is a simple algorithm to find prime numbers up to a certain bound *N*. The idea of it is following: create a list of numbers up to *N* and then iteratively mark multiples of whole numbers as non-primes. At the end all remaining (non-marked) numbers are primes. If we need to find all primes under *N*, this algorithm is more efficient than testing each number under *N* for primality separately (we're making use of a kind of [dynamic programming](dynamic_programming.md) approach). + +**[Prime factorization](factorization.md)**: We can factor a number by repeatedly [brute force](brute_force.md) checking its divisibility by individual primes and there exist many algorithms applying various optimizations (wheel factorization, Dixon's factorization, ...), however for factoring large (hundreds of bits) primes there exists no known efficient algorithm, i.e. one that would run in [polynomial time](polynomial_time.md), and it is believed no such algorithm exists (see [P vs NP](p_vs_np.md)). Many cryptographic algorithms, e.g. [RSA](rsa.md), rely on factorization being inefficient. For [quantum](quantum.md) computers a polynomial ("fast") algorithm exists, it's called [Shor's algorithm](shors_algorithm.md). + +Prime generation: TODO + +## See Also + +- [happy number](happy_number.md) \ No newline at end of file diff --git a/primitive_3d.md b/primitive_3d.md new file mode 100644 index 0000000..64d9302 --- /dev/null +++ b/primitive_3d.md @@ -0,0 +1,3 @@ +# Primitive 3D + +See [pseudo 3D](pseudo3D.md). \ No newline at end of file diff --git a/privacy.md b/privacy.md new file mode 100644 index 0000000..07e5d06 --- /dev/null +++ b/privacy.md @@ -0,0 +1,9 @@ +# Privacy + +Privacy means the ability of an individual to hide sensitive information about himself. From now on we'll only refer to the digital privacy (privacy with respect to computers, e.g. on the [Internet](internet.md)). + +In [LRS](lrs.md) the view on privacy differs from that of most [free software](free_software.md), [hacker](hacker.md) and [suckless](suckless.md) communities: to us privacy is a form of [censorship](censorhip.md) and as such is seen as inherently bad. We dream of a world without abuse where (digital) privacy is not needed because society has adopted our philosophy of information freedom, non-violence and non-competition and there is no threat of sensitive information abuse. Even though we know this utopian goal is unreachable, we try to at least get close to it by restricting ourselves to bare minimum privacy (so we are very open but won't e.g. publish our passwords). We believe that abuse of sensitive information is an issue of the basic principles of our society (e.g. capitalism) and should be addressed by fixing these issues rather than by harmful methods such as censorship. + +Digital privacy can be further categorized. We can talk e.g. about **communication privacy** (emails, chat, ...), **data privacy** (cookies, tracking, medical data, ...), **personal privacy** (intimate photos, sexual orientation, ... ), **individual privacy** (identifying information, anonymity, spam, ...) etc. + +Privacy is closely related to [cryptography](cryptography.md), as encryption is how information can be "protected" against reaching unauthorized entities, and to [free software](free_software.md), as using safe tools with available source code is crucial to avoid malware. Still, to achieve high privacy additional appropriate behavior has to be adopted, e.g. protection against [spyware](spyware.md), using proxies and/or onion routing, turning off browser [cookies](cookie.md), avoiding fingerprinting, avoiding [social networks](social_network.md), avoiding revealing potentially identifying information etc. \ No newline at end of file diff --git a/procgen.md b/procgen.md new file mode 100644 index 0000000..13e6a6a --- /dev/null +++ b/procgen.md @@ -0,0 +1,24 @@ +# Procedural Generation + +Procedural generation (procgen) refers to creation of data, such as art in [games](game.md) or test data for software, by using [algorithms](algorithm.md) and mathematical formulas rather than creating this data manually. This can be used for example for automatic generation of [textures](texture.md), texts, music, game levels or 3D models but also to practically anything else, even computer programs. Procedural art still cannot reach qualities and creativity of a skilled human artist, but it can be a good filler, substitute, an addition to manually created art. Procedural generation has many advantages such as saving space (instead of large data we only store small code of the algorithm that generates it), saving time (one we have an algorithm we can generate many data extremely quickly), increasing resolution practically to infinity, extending data to more dimensions (e.g. [3D textures](3d_texture.md)). Procedural generation can also be used as a helper and guidance, e.g. an artist may use a procedurally generated game level as a starting point and fine tune it manually, or vice versa, procedural algorithm may create a level from manually created building blocks. + +As neural [AI](ai.md) approaches human level of creativity, we may see it actually replacing many artists in near future, however it is debatable whether AI generated content should be called procedural generation as AI models are quite different from the traditional hand-made algorithms. From now on we'll only be considering the traditional approach. + +[Minecraft](minecraft.md) (or [Minetest](minetest.md)) is a popular example of a game in which the world is generated procedurally, which allows it to have near-infinite worlds. [Roguelikes](roguelike.md) also heavily utilize procgen. However this is nothing new, an old game Daggerfall was known for its extremely vast procedurally generated world. + +For its extreme save of space procedural generation is extremely popular in [demoscene](demo.md) where programmers try to create as small programs as possible. German programmers made a full fledged 3D shooter called [.kkrieger](kkrieger.md) that fits into just 96 kB! It was thanks to heavy use of procedural generation for the whole game content. [Bytebeat](bytebeat.md) is a simple method of generating procedural "8bit" music, it is used e.g. in [Anarch](anarch.md). Procedural generation is generally popular in indie game dev thanks to offering a way of generating huge amounts of content quickly, without having to pay artists. + +We may see procgen as being similar to [compression](compression.md) algorithms: we have large data and are looking for an algorithm that's much smaller while being able to reproduce the data (but here we normally go the other way around, we start with the algorithm and see what data it produces rather than searching for an algorithm that produces given data). [John Carmack](john_carmack.md) himself called procgen "basically a shitty compression". + +Using [fractals](fractal.md) is a popular technique in procgen because they basically perfectly fit the definition of it: a fractal is defined by a simple equation or a set of a few rules that yield an infinitely complex shape. Nature is also full of fractals such as clouds, mountain or trees, so fractals look organic. + +A good example to think of is generating procedural [textures](texture.md). This is generally done by first generating a basis image or multiple images, e.g. with [noise](noise.md) functions such as [Perlin noise](perlin_noise.md) (it gives us a grayscale image that looks a bit like clouds). We then further process this base image(s) and combine the results in various ways, for example we may use different transformations, modulations, shaders, blending, adding color using [color ramps](color_ramp.md) etc. The whole texture is therefore described by a [graph](graph.md) in which nodes represent the operations we apply; this can literally be done visually in software like [Blender](blender.md) (see its [shader](shader.md) editor). The nice things are that we can now for example generalize the texture to 3 dimensions, i.e. not only have a flat image, but have a whole volume of a texture that can extremely easily be mapped to 3D objects simply by intersecting it with their surfaces which will yield a completely smooth texturing without any seams (this is quite often used along with [raytracing](raytracing.md)). We can also write the algorithm so that the generates texture has no seams if repeated side-by-side (by using modular "wrap-around" coordinates). We can also generate the texture at any arbitrary resolution as we have a continuous mathematical description of it; we may perform an infinite zoom into it if we want. As if that's not enough, we can also generate almost infinitely many slightly different versions of this texture by simply changing the [seed](seed.md) of [pseudorandom](pseudorandom.md) generators. + +We use procedural generation in two ways: + +- **offline**: We pre-generate the data before we run the program, i.e. we let the algorithm create our art, save it to a file and then use it as we would use traditionally created art. +- **online**: We generate the data on the run and only parts of it that we currently need. For example with an procedural texture mapped onto a 3D model, we would compute the texture pixels ([texels](texel.md)) when we're actually drawing them: this has the advantage of giving an infinite resolution of the texture because no matter how close-up we view the model, we can always compute exactly the pixels we need. This would typically be implemented inside a fragment/pixel [shader](shader.md) program. Online generation is also used in the voxel games that generate the world only in the area the player currently occupies. + +## Example + +TODO \ No newline at end of file diff --git a/productivity_cult.md b/productivity_cult.md new file mode 100644 index 0000000..4e8449d --- /dev/null +++ b/productivity_cult.md @@ -0,0 +1,11 @@ +# Productivity Cult + +Productivity cult is one of [modern](modern.md) [capitalist](capitalism.md) religions which praises human productivity above everything, even happiness, well being, sanity etc. Kids nowadays are all about "how to be more productive", they make daily checklists, analyze tables of their weekly performance, give up sleep to study some useless shit required by the current market fluctuation. Productivity cult is all about voluntarily making oneself a robot, a slave to the system. + +The name of the cult itself [says a lot about it](name_is_important.md). While a name such as *efficiency* would probably be better, as efficiency means doing less work with the same result and therefore being happier, it is not a surprise that capitalism has chosen the word *productivity*, i.e. producing more which means working more, e.g. for the price of free time and mental health. + +One of the funniest examples of productivity cult gone too far is so called "[life couching](life_couching.md)" in which the aspiring producer robots hire bullshit cult leaders, so called "life couches", to shout at them to be more productive. At least in the past slaves were aware of being slaves and tried to free themselves. I literally want to [kill myself](suicide.md). + +Productivity is such a big deal because **programmers are in fact actually getting exponentially less productive** due to overcomplicated buggy [bloat](bloat.md) and billions of frameworks needed to get basic thing done nowadays -- this has been pointed out by [Jonathan Blow](jonathan_blow.md) in his talk *Preventing the Collapse of Civilization* in which he refers to the video of [Ken Thompson](ken_thompson.md) talking about how he developed the [Unix](unix.md) operating system in **three weeks**. + +A considerable number of people are attracted to [suckless](suckless.md) software due to its positive effects on productivity. These are mostly idiots who just try to exploit anything they encounter for [self interest](self_interest.md) without ever aiming for greater good, they don't care about Unix philosophy beyond its effects on increasing their salary. Beware of them, they poison the community. \ No newline at end of file diff --git a/programming.md b/programming.md new file mode 100644 index 0000000..879308e --- /dev/null +++ b/programming.md @@ -0,0 +1,7 @@ +# Programming + +Programming is the act and [art](art.md) of writing computer [programs](program.md); it involves creation of [algorithms](algorithm.md) and [data structures](data_structure.md) and implementing them in [programming languages](programming_language.md). + +You may also encounter the term [coding](coding.md) which is used by [noob](noob.md) [wannabe programmers](soydev.md), so called "coders" or [code monkeys](code_monkey.md). "Coding" doesn't reach the quality of programming, it is done in baby handholding languages like [Python](python.md) and [JavaScript](javascript.md) by people with very shallow knowledge of technology and its context, barely qualified to turn on a computer (like [jewtubers](youtube.md)), who have flooded the computer industry since it became lucrative. What they do is not real programming. Do not try to imitate them. + +At high level programming becomes [spiritual](spirituality.md). Check out e.g. the famous [Tao of Programming](tao.md) (yes, it's kind of a [joke](jokes.md) but it's based on reality, programming can truly be kind of a [meditation](meditation.md) and pursuit of enlightenment). Many people say that learning programming opens your eyes in a certain new way, you then see the world like never before (but that's probably kind of true of almost all skills so this may be a [shit](shit.md) statement). Others say too much programming cripples you mentally and gives you [autism](autism.md). Anyway it's [fun](fun.md). Programming requires a good knowledge of advanced [math](math.md). Also probably at least above average [IQ](iq.md), as well as below average social intelligence. Being [man](man.md) is an advantage. \ No newline at end of file diff --git a/programming_language.md b/programming_language.md new file mode 100644 index 0000000..5278396 --- /dev/null +++ b/programming_language.md @@ -0,0 +1,29 @@ +# Programming Language + +Programming language is an artificial language created so that humans can relatively easily communicate [algorithms](algorithm.md) to computers. Such language often tries to mimic human language (practically always English) but is much MUCH simpler so that a computer can actually analyze it and understand it precisely so it also partially looks like [math](math.md) expressions. + +For beginners: a programming language is actually much easier to learn than a foreign language, it will typically have fewer than 100 "words" to learn (out of which you'll mostly use like 10) and once you know one programming language, learning another becomes a breeze because they're all (usually) pretty similar in basic concepts. The hard part may be learning some of the concepts. + +A programming language is distinct from a general computer language by its purpose to express algorithms and be used for creation of [programs](program.md). There are computer languages that are NOT programming languages (at least in the narrower sense), such as [HTML](html.md), [json](json.md) and so on. + +We divide programming languages into different groups. Perhaps the most common divisions is to two groups: + +- **compiled** languages: Meant to be transformed by a [compiler](compiler.md) to a [native](native.md) (directly executable) binary program. These languages are more efficient but usually more difficult to program in, less flexible and the compiled programs are non-portable (can't just be copy-pasted to another computer with different [architecture](isa.md) and expected to run). These languages are usually [lower level](low-level), use static and strong [typing](typing.md) and manual [memory management](memory_management.md). Examples: [C](c.md), [C++](cpp.md), [go](go.md), [rust](rust.md), [Haskell](haskell.md) or [Pascal](pascal.md). +- **interpreted** languages: Meant to be interpreted by an [interpreter](interpreter.md) "on-the-go". Basically to run the program you need the interpreter of the language installed on your computer and this interpreter reads the [source code](source_code.md) as it is written and performs what it dictates. These languages are generally less efficient (slower, use more RAM) but also more flexible, easier to program in and [independent of platforms](platform_independent.md). These languages usually [higher-level](high_level.md), use weak and dynamic [typing](typing.md) and automatic [memory management](memory_management.md) ([garbage collection](garbage_collection.md)). Examples: [Python](python.md), [Perl](perl.md), [JavaScript](js.md) and [BASH](bash.md). + +Sometimes the distinction here may not be completely clear, for example Python is normally considered an interpreted language but it can also be compiled into [bytecode](bytecode.md) and even native code. [Java](java.md) is considered more of a compiled language but it doesn't compile to native code (it compiles to bytecode). + +We can divide language in many more ways, for example based on their paradigm ([impertaive](imperative.md), [declarative](declarative.md), [object-oriented](oop.md), [functional](functional.md), [logical](logical.md), ...), purpose (general purpose, special purpose), computational power ([turing complete](turing_complete.md) or weaker), level of abstraction (high, low), [typing](data_type.md) (strong, weak, dynamic, static) or function evaluation (strict, lazy). + +## Nice Languages + +{ *THIS IS NOT A COMPREHENSIVE LIST, I can only include languages that I am familiar with, please add more* ~drummyfish } + +- [C](c.md): the one and only, the go-to language of the [suckless](suckless.md) community and of compiled languages in general, greatly [future-proof](future_proof.md), uncontested in performance and with nice oldschool [meme](meme.md)-free design, our beloved C +- [Scheme](scheme.md): the minimal/elegant member of [lisp](lisp.md) family of [functional](functional.md) languages +- [Forth](forth.md): beautifully simple stack-based language +- [Lambda calculus](lambda_calculus.md): ultra extremely [minimal](minimalism.md) [mathematical](math.md) [functional](functional.md) language +- [LIL](lil.md): very nice KISS & [suckless](suckless.md) interpreted language +- [Lua](lua.md) +- [Sigma calculus](sigma_calculus): yes or no? seems like yes +- [Brainfuck](brainfuck.md): However funny and meme this language may look, its simple design is actually pretty beautiful and interpreters are ultra extremely simple to make. \ No newline at end of file diff --git a/programming_style.md b/programming_style.md new file mode 100644 index 0000000..7f59c86 --- /dev/null +++ b/programming_style.md @@ -0,0 +1,49 @@ +# Programming Style + +Here we discuss a good programming style (formatting, conventions etc.). Remember that nothing is set in stone, the most important thing is to be consistent and actually think about why you're doing things the way you're doing them. Think from the point of view of a programmer who gets just your source code without any way to communicate with you, make his life as easy as possible. + +## Recommended C Programming Style + +This is our recommendation or perhaps just a suggestion/guide on the [C](c.md) programming style. + +- Respect the [LRS](lrs.md) principles. +- Use **two spaces** for indentation. **Do not use [tabs](tab.md)!** Tabs are ugly, tricky non-standard behaving characters. +- **Format to 80** columns or a similar width. Keep in mind the source may be edited on computers with small screens (like old [thinkpads](thinkpad.md)) with a screen split vertically. +- Write **opening and closing curly brackets on its own line, in the same columns**, e.g.: + +``` +if (a == b) +{ + doSomething(); + doSomethingElse(); +} +``` + +- Prefer not writing curly brackets if you don't have to (e.g. with a single command in the block). You may still do it in tricky cases like nested branches. +- **naming**: + - **camelCase for variables and functions** (like `myVariable`). Global and big-scope variables should have a descriptive, self-documenting name (e.g. `getTicksSinceStart`), local/short-scope ones can be just one letter. + - **CapitalCamelCase for data types** (like `ImaginaryNumber`). + - **ALL_CAPS_SNAKE_CASE for macros and constants** (like `PI` or `MY_MACRO`). + - It is advised that for your project you come up with a **three letter namespace prefix** that will come in front of your global identifiers. (E.g. [small3dlib](small3dlib.md) uses the prefix `S3L_`, [SDL](sdl.md) uses `SDL` etc.). If you choose a prefix `XYZ_`, prepend it to all global identifiers, it will prevent name clashes and help readability. + - **Prefix private global identifiers with `_`**, e.g. `_myInternalVar`. +- **Use spaces** to make code more readable, so e.g. `int x = 10, y = 20;` instead of `int x=10,y=20;`, write space between `if` and its condition etc. +- **Use blank lines** to logically group relevant lines of code. E.g.: + +``` +int a = x; +char b = y; + +c += 3 * a; +d -= b; + +if (c < d) +a = b; +``` + +- Each file shall have a **global [comment](comment.md)** with at least: short description of the file's purpose (this is almost always missing), [license](license.md), the author(s) and year of creation. +- **Use [comments](comment.md)** to make your code better readable and searchable (add keywords to relevant parts of code etc.). +- **Don't use [enums](enum.md)**, use `#define`s. +- **Global variables are great**, use them. **Long functions are fine**. +- **Adhere to C99 or C89 standard**. +- **Try to not create many source files**, many times your project can very well be in a single file which is the ideal case. Create **[header only libraries](header_only.md)** If you have multiple files, keep them in the same directory and try to have just a **[single compilation unit](single_compilation_unit.md)** (only one .c file with several .h files). Try to make files no longer than 10k lines. +- **Do not use non-ASCII characters in the source code**. \ No newline at end of file diff --git a/programming_tips.md b/programming_tips.md new file mode 100644 index 0000000..080d29b --- /dev/null +++ b/programming_tips.md @@ -0,0 +1,7 @@ +# Programming Tips + +This is a place for sharing some practical programming tips. + +- **add by small steps**: When adding features/functionality etc. into your code, do it by very small steps and test after each step. Do NOT add multiple things at once. If you add 3 features at once and then find out the program doesn't work, you will have an extremely hard time finding out the bug because it may be in feature 1, feature 2, feature 3 or ANY COMBINATION of them, so you may very well never find the bug. If you instead test after adding each step, you find potential bugs immediately which will make fixing them very quick and easy. +- **no indentation for temporary code**: Tiny "workflow" tip: when adding new code, keep it unindented so that you know it's the newly added code and can delete it at any time. Only when you test the added code, indent it correctly to incorporate it as the final code. Of course, this fails in languages where indentation matters ([Python](python.md) cough cough) but similar effects can be achieved e.g. by adding many empty lines in front of/after the temporary code. +- **comments/preprocessor to quickly hide code**: It is a basic trick to comment out lines of code we want to temporarily disable. However preprocessor may work even better, e.g. in C if you want to be switching between two parts of code, instead of constantly commenting one part and uncommenting the other just use `#if 0` and `#else` directives around the two parts. You can switch between them by just changing 0 to 1 and back. This can also disable parts of code that already contain multiline comments (unlike a comment as nested multiline comments aren't allowed). diff --git a/proprietary.md b/proprietary.md new file mode 100644 index 0000000..c97b3b2 --- /dev/null +++ b/proprietary.md @@ -0,0 +1,5 @@ +# Proprietary Software + +Proprietary software is any software that is not [free (as in freedom) software](free_software.md). This kind of software is basically always [evil](evil.md), in fact it is mostly [capitalist software](capitalist_software.md) designed to abuse its user in some way. Examples of proprietary software are [MS Windows](windows.md), [MacOS](macos.md), [Adobe Photoshop](photoshop.md) and almost every [game](game.md). + +Proprietary software licenses are usually called [EULAs](eula.md). \ No newline at end of file diff --git a/proprietary_software.md b/proprietary_software.md new file mode 100644 index 0000000..f5bfef6 --- /dev/null +++ b/proprietary_software.md @@ -0,0 +1,3 @@ +# Proprietary Software + +Go [here](proprietary.md). \ No newline at end of file diff --git a/pseudo3d.md b/pseudo3d.md new file mode 100644 index 0000000..318999b --- /dev/null +++ b/pseudo3d.md @@ -0,0 +1,13 @@ +# Pseudo 3D + +The term pseudo 3D, also 2.5D or primitive 3D, is used for [computer graphics](graphics.md) that tries to create the illusion of [3D](3d.md) [rendering](rendering.md) while in fact only utilizing simpler techniques; genuine 3D rendering is in this case called [true 3D](true_3d.md). On consumer computers it is nowadays mostly a thing of the past as everything including cell phones now has a powerful [GPU](gpu.md) capable or most advanced 3D rendering, nevertheless for [suckless](suckless.md)/[KISS](kiss.md)/[LRS](lrs.md) programming the techniques used in the past are very interesting and useful. + +For example [BSP rendering](bsp.md) rendering in early games such as [Doom](doom.md) is generally called pseudo 3D in the mainstream, however it is pretty debatable what exactly should classify as true 3D and what not because any computer rendering technique will inevitably have some kind of simplification of the true 3D reality of real life. And so the debate of "was Doom really 3D" arises. One side argues that in Doom's BSP rendering it for example wasn't possible to look up and down or have rooms above other rooms, all due to the limitations of the rendering system which this side sees as "not real 3D". However even modern 3D renderers have limitations such as mostly being able to only render models made out of triangles (while reality can have completely smooth shapes) or having a limited resolution of textures. Where to draw the line for "true 3D" is subjective -- we see it as reasonable to say that **if it looks 3D, it IS 3D**, i.e. we think Doom's graphics WAS really 3D, albeit limited. For this reason we also advise to rather use the term **primitive 3D** rather than pseudo 3D. + +Techniques associated with primitive 3D are for example [2D raycasting](raycasting.md), [BSP rendering](bsp.md), [mode7](mode7.md), [parallax scrolling](parallax.md), [voxel space](voxel_space.md) terrain rendering or perspective-scaled [sprites](sprite.md). + +## See Also + +- [sofware rendering](sw_rendering.md) +- [bsp rendering](bsp.md) +- [raycasting](raycasting.md) \ No newline at end of file diff --git a/pseudoleft.md b/pseudoleft.md new file mode 100644 index 0000000..621a02f --- /dev/null +++ b/pseudoleft.md @@ -0,0 +1,3 @@ +# Pseudoleft + +See [left vs right](left_right.md). \ No newline at end of file diff --git a/pseudominimalism.md b/pseudominimalism.md new file mode 100644 index 0000000..63d4c5f --- /dev/null +++ b/pseudominimalism.md @@ -0,0 +1,7 @@ +# Pseudominimalism + +Pseudominimalism is the property of technology of trying to appear [minimalist](minimalism.md) on the surface while being [bloated](bloat.md) on the inside. A typical example could be a website that has minimal look -- a blank white background with some fancy-font text perhaps -- which in the background uses dozens of [JavaScript](js.md) frameworks and libraries and requires a high end CPU to even appear responsive. [Apple](apple.md) is heavily practicing pseudominimalism. + +Another example are many [modern](modern.md) [CLI](cli.md) programs that [code monkeys](coder.md) use to impress their [YouTube](youtube.md) viewers or to feel like matrix haxors. Some people think that anything running in the command line is minimalist which is less and less true as we progress into the future. A lot of [capitalist software](capitalist_software.md) add a CLI interface ex post **on top** of an already bloated program, often by simply disabling [GUI](gui.md) (but leaving all its dependencies in). An example may be the [gomux](gomux.md) chat client. + +Yet another kind of pseudominimalism appearing among the new generation of pseudoprogrammers is about writing very few LOC in some hugely bloated language and calling that "minimalism". Something like a *Minecraft clone in 100 LOC of Python using only Python standard library*, the catch of course being that [Python](python.md) itself is hugely bloated and its standard library is enormous, therefore they just hide all the complexity out of view. Such effort is of course completely useless and only serves for flexing in front of beginners who can't spot the trick. \ No newline at end of file diff --git a/public_domain.md b/public_domain.md new file mode 100644 index 0000000..f503c7e --- /dev/null +++ b/public_domain.md @@ -0,0 +1,69 @@ +# Public Domain + +If an "intellectual work" (a song, a book, a computer program, ...) is in the public domain (PD), it has no "owner", meaning no one has any exclusive rights (such as [copyright](copyright.md) or [patent](patent.md)) over the work, no one can dictate how and by whom such work can be used and so anyone can basically do anything with such work (anything that's not otherwise illegal of course). + +[LRS](lrs.md) highly supports public domain and recommends programmers and artists put their works in the public domain using [waivers](waiver.md) such as [CC0](cc0.md). + +Public domain is the ultimate form of freedom in the creative world. In public domain the creativity of people is not restricted. Anyone can study, remix, share and improve public domain works in any way, without a fear of being legally bullied by someone else. + +Public domain is NOT the same thing as [free (as in freedom) software](free_software.md), [free culture](free_culture.md) or freeware (gratis, free as in beer) software. The differences are these: + +- Unlike public domain, **[free software](free_software.md) and [free cultural](free_culture.md) works are usually still "owned" by someone**, they just try to relax the rules and make them less oppressive. A public domain work is completely unlimited and belongs to everyone and no one, while free software/culture may still require and legally enforce certain freedom-compatible conditions such as giving credit to the author or [copyleft](copyleft.md). +- **Public domain software is not always [free software](free_software.md)** -- PD software is free (as in freedom) only if its source code is available and also in the public domain (without source code freedoms 1 and 2 in the definition of free software are violated). +- **Freeware/gratis just means available for no price**, very often under specific restrictive conditions such as "for personal use" only and without the access to the source code. Public domain is not only gratis but also without any legal limitations on use. + +## Which Works Are In The Public Domain? + +This is not a trivial question, firstly because the term *public domain* is not clearly defined: the definition varies by each country's laws, and secondly because it is non-trivial and sometimes very difficult to assess the legal status of a work. + +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 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. + +We therefore devise the term **safe/strong public domain**. Under this we include works that are pretty safely PD more or less world-wide, even considering possible changes in laws etc. Let us include these works: + +- Works published at least 100 years ago whose author probably died at least 70 years ago. +- Works **clearly and properly** marked by a reliable PD [waiver](waiver.md) such as [CC0](cc0.md). However an extra effort needs to be taken to assure that the work e.g. isn't a derivative work of copyrighted work, or that patents are waived with software. +- Works that under any "reasonable" law can not be covered by "intellectual property", e.g. math equations, colors etc. + +[Creative commons](creative_commons.md) has created a **public domain mark** that helps mark and find works that should be in a world-wide public domain (this is not a waiver though, it is basically only used as a metadata for very old works to be better searchable). + +There are a number of places on the internet to look for public domain works, for a list see below. + +## How To Create Public Domain Works + +If you want to create a PD work (which you should), then generally in that work **you must not use any non-public domain work**. So, for example, you can NOT create a public domain fan fiction story about Harry Potter because Harry Potter and his universe is copyrighted. Similarly you can't just use randomly googled images in a game you created because the images are most likely copyrighted. Small and obscure exceptions (fonts, freedom of panorama, ...) to this may exist in laws but it's never good to rely on them, it's best to keep it safe and simply avoid utilizing anything non-PD within your works. + +Also you can NOT rely on [fair use](fair_use.md)! Even though you could lawfully use someone else's copyrighted work under fair use, inclusion of such material would, by the fair use rules, limit what other would be able to do with your work, making it restricted and therefore not public domain. + +So you can only use your own original creations and other public domain works within your PD work. Here you should highly prefer your own creations because that is legally the safest, no one can ever challenge your right to reuse your own creation, but there is a low but considerable chance that someone else's PD work isn't actually PD or will seize to be PD by some retroactive law change. So when it only takes a small effort to e.g. photograph your own textures for a game instead of using someone else's PD textures, choose to use your own. + +{ NOTE: The above is kind of arguing for reinventing wheels which goes a little bit against our philosophy or remixing and information sharing, but we are forced to do this by the system. We are forced to reinvent wheel to ensure that users of our works can't be legally bullied. ~drummyfish } + +In cases where you DO reuse other PD works, try to minimize their number and try to make sure they belong to the actual **safe** public domain (see above). This again minimizes legal risk and additionally makes it easy to document and prove the sources. + +As a next step make sure you clearly **document** your work and the sources you use. This means you write down where all the works contained in your work come from, e.g. in your [readme](read_me.md). Explicitly mention which things you have created yourself (*"I, ..., have created everything myself except for X, Y and Z"*) and which things come from other people and where you have found them. It is great to also archive the proofs of the third party source being public domain (e.g. use the [Internet Archive](internet_archive.md) to snapshot the page with a PD texture you've found). + +Finally you need to actually release your work into the public domain. It must be stressed that it is NOT enough to write *"my work is public domain"*, this is simply legally insufficient (and in many countries you can't even put your work into public domain which is why you need a more sophisticated tool). You need to use a public domain [waiver](waiver.md) (similar to a [license](license.md)) which you just put alongside your work (e.g. into the `LICENSE` file), plus it is also good to explicitly write (e.g. in your readme) a sentence such as *"I, ..., release this work into public domain under CC0 1.0 (link)"*. Currently the best waiver you can use is [Creative Commons Zero](cc0.md) (CC0) which is what we recommend. However note that CC0 only waives copyright and not other things like [trademarks](trademark.md) or [patents](patent.md), so e.g. for [software](software.md) you might need to add an extra waiver of these things as well. + +NOTE: You may be thinking that it doesn't really matter if you waive your rights properly and very clearly if you know you simply won't sue anyone, you may think it's enough to just write "do whatever you want with my creation". But you have to remember others, and even you yourself, can't know if you won't change your mind in the future. A clear waiver is a **guarantee** you provide to others, not just a *vague promise of someone on the internet*, and this guarantee is very valuable, so valuable that whether someone uses your work or not will often come down to this. So waiving your rights properly may increase the popularity and reusability of your work almost as much as the quality of the work itself. + +For an example of a project project properly released into public domain see the repository of our [LRS](lrs.md) game [Anarch](anarch.md). + +## Where To Find Public Domain Works + +There are quite a few places on the Internet where you may find public domain works. But firstly let there be a warning: you always **have to** check the public domain status of works you find, it is extremely common for people on the Internet to not know what public domain is or how it works so you will find many *false positives* that are called public domain but are, in fact, not. This article should have given you a basic how-to on how to recognize and check public domain works. With this said, here is a list of some places to search (of course, this list will rot with time): + +- **[Wikimedia Commons](https://commons.wikimedia.org/wiki/Main_Page)**: Contains only free as in freedom works among which are many PD ones. You can search for them with queries such as `cat incategory:cc-zero`. This site is quite reliable and serious about licensing, if you find a work marked as PD here, you can be reasonably sure this information is true. +- **[Internet Archive](https://archive.org/)**: The biggest Internet archive, huge amount of mainly old works such as scanned books and photos. Beware that this site contains all kinds of works from PD to [proprietary](proprietary.md) and works marked as PD should be checked as there can be errors. There is an *advanced search* tool that can help in searching for PD works, for example [this query](https://archive.org/search.php?query=possible-copyright-status%3A%28NOT_IN_COPYRIGHT%29%20OR%20licenseurl%3A%28%22http%3A%2F%2Fcreativecommons.org%2Fpublicdomain%2Fmark%2F1.0%2F%22%29%20OR%20licenseurl%3A%28%22http%3A%2F%2Fcreativecommons.org%2Fpublicdomain%2Fzero%2F1.0%2F%22%29) tries to achieve this. +- **[Opengameart](https://opengameart.org/)**: Site for sharing free as in freedom [game](game.md) art (pictures, 3D models, sounds, ...) among which are many under [CC0](cc0.md), i.e. PD. Submitted works are checked reasonably well so any CC0 work you find here is likely truly PD. +- **[Freesound](https://freesound.org/)**: Site for sharing sound recordings and sound effects, contains many [CC0](CC0.md) sounds that should be PD. +- **[Project Gutenberg](https://www.gutenberg.org/)**: Archive of old digitized books. NOT ALL are PD, but the real old ones should be. Generally books from before the 20th century should be PD. +- **[Stocksnap](https://stocksnap.io)**: Quality photos and "stock images" under [CC0](CC0.md), i.e. PD. +- **[Librivox](https://librivox.org)**: Public domain audiobooks made by volunteers that read PD books from Project Gutenberg. +- **[Wikisource](https://en.wikisource.org/wiki/Main_Page)**: Repository of texts, similar to Project Gutenberg, same rules apply (not all texts here will be PD but the real old ones should be). +- **[Openclipart](http://openclipart.org)**: Vector graphics, all under [CC0](cc0.md), i.e. PD in theory, **however** there do appear pictures that are derivative works of copyrighted works for which of course this is irrelevant. Check very well anything you download from here. +- **[Blendswap](https://www.blendswap.com/)**: Site for exchanging 3D models for [Blender](blender.md), not all models are PD but the ones marked CC0 should be, however **NOT those marked as "fan art"!** +- **[Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page)**: Database of "everything", published as a whole under [CC0](cc0.md) which should make it PD, **however** it will contain information about proprietary works which may make this status questionable sometimes. If you only use data that don't fall under this you should be safe. \ No newline at end of file diff --git a/python.md b/python.md new file mode 100644 index 0000000..e19bb9a --- /dev/null +++ b/python.md @@ -0,0 +1,5 @@ +# Python + +*What if [pseudocode](pseudocode.md) was actually code?* + +TODO \ No newline at end of file diff --git a/quantum_gate.md b/quantum_gate.md new file mode 100644 index 0000000..978aa64 --- /dev/null +++ b/quantum_gate.md @@ -0,0 +1,64 @@ +# Quantum Gate + +{ Currently studying this, there may be errors. ~drummyfish } + +Quantum (logic) gate is a [quantum computing](quantum.md) equivalent of a traditional [logic gate](logic_gate.md). A quantum gate takes as an input *N* [qubits](qubit.md) and transforms their states to new states (this is different from classical logical gates that may potentially have a different number of input and output values). + +Quantum gates are represented by [complex](complex_number.md) [matrices](matrix.md) that transform the qubit states (which can be seen as points in multidimensional space, see Bloch sphere). A gate operating on *N* qubits is represented by a *2^N*x*2^N* matrix. These matrices have to be **unitary**. Operations performed by quantum gates may be reversed, unlike those of classical logic gates. + +We normally represent a single qubit state with a **column** [vector](vector.md) *|a> = a0 * |0> + a1 * |1> => [a0, a1]* (look up bra-ket notation). Multiple qubit states are represented as a [tensor product](tensor_product.md) of the individual state, e.g. *|a,b> = [a0 * b0, a0 * b1, a1 * b0, a1 * b1]*. Applying a quantum gate *G* to such a qubit vector *q* is performed by simple matrix multiplication: *G * v*. + +## Basic gates + +Here are some of the most common quantum gates. + +### Identity + +Acts on 1 qubit, leaves the qubit state unchanged. + +``` +1 0 +0 1 +``` + +## Pauli Gates + +Act on 1 qubit. There are three types of Pauli gates: X, Y and Z, each one rotates the qubit about the respective axis by [pi](pi.md) radians. + +The X gate is: + +``` +0 1 +1 0 +``` + +The Y gate is: + +``` +0 -i +i 0 +``` + +The Z gate is: + +``` +1 0 +0 -1 +``` + +## NOT + +The not gate is identical to the Pauli X gate. It acts on 1 qubit and switches the probabilities of measuring 0 vs 1. + +## CNOT + +Controlled NOT, acts on 2 qubits. Performs NOT on the second qubit if the first qubit is *|1>*. + +``` +1 0 0 0 +0 1 0 0 +0 0 0 1 +0 0 1 0 +``` + +TODO diff --git a/quaternion.md b/quaternion.md new file mode 100644 index 0000000..a62b211 --- /dev/null +++ b/quaternion.md @@ -0,0 +1,31 @@ +# Quaternion + +Quaternion is a type of number, just like there are integer numbers, real numbers or [imaginary numbers](complex_number.md). They are very useful for certain things such as 3D rotations (they have some advantages over using e.g. Euler angles, for example they avoid Gimbal lock, they are also faster than transform matrices etc.). Quaternions are not so easy to understand but you don't actually need to fully grasp and visualize how they work in order to use them if that's not your thing, there are simple formulas you can copy-paste to your code and it will "just work". + +Quaternions are an extension of [complex numbers](complex_number.md) (you should first check out complex numbers before tackling quaternions); while complex numbers can be seen as two dimensional -- having the real and imaginary part -- quaternions would be seen as four dimensional. A quaternion can be written as: + +*a + bi + cj + dk* + +where *a*, *b*, *c* and *d* are real numbers and *i*, *j* and *k* are the basic quaternion units. For the basic units it holds that + +*i^2 = j^2 = k^2 = ijk = -1* + +**Why four components and not three?** Simply put, numbers with three components don't have such nice properties, it just so happens that with four dimensions we get this nice system that's useful. + +Operations with quaternions such as their multiplication can simply be derived using basic algebra and the above given axioms. Note that **quaternion multiplication is non-commutative** (*q1 * q2 != +2 * q1*), but it is still associative (*q1 * (q2 * q3) = (q1 * q2) * q3*). + +A **unit quaternion** is a quaternion in which *a^2 + b^2 + c^2 + d^2 = 1*. + +A **quaternion negation** (*q^-1*) is obtained by multiplying *b*, *c* and *d* by -1. + +## Rotations + +Only unit quaternions represent rotations. + +Rotating point *p* by quaternion *q* is done as + +*q^-1 * (0 + p.x i + p.y j + p.z k) * q* + +Rotation quaternion can be obtained from axis (*v*) and angle (*a*) as + +*q = cos(a/2) + sin(a/2) * (v.x i + v.y j + v.z k)* \ No newline at end of file diff --git a/qubit.md b/qubit.md new file mode 100644 index 0000000..3b676e4 --- /dev/null +++ b/qubit.md @@ -0,0 +1,23 @@ +# Qubit + +Qubit is a [quantum computing](quantum.md) equivalent of a [bit](bit.md). While bits in classical computers can have one of two state -- either 0 or 1 -- a qubit can additionally have infinitely many states "in between" 0 and 1 (so called [superposition](superposition.md)). Physically qubits can be realized thanks to quantum states of particles, e.g. the polarization of a photon or the spin of a photon. Qubits are processed with [quantum gates](quantum_gate.md). + +**Whenever we measure a qubit, we get either 1 or 0**, just like with a normal bit. However during quantum computations the internal state of a qubit is more complex. This state determines the **probabilities** of measuring either 1 or 0. When the measurement is performed (which is basically any observation of its state), the qubit state collapses into one of those two states. + +Now we will be dealing with so called **pure states** -- these are the states that can be expressed by the following representation. We will get to the more complex (mixed) states later. + +The state of a qubit can be written as + +*A * |0> + B * |1>* + +where *A* and *B* are [complex numbers](complex_number.md) such that *A^2 + B^2 = 1*, *|0>* is a vector [0, 1] and *|1>* is a vector [1, 0]. *A^2* gives the probability of measuring the qubit in the state 0, *B^2* gives the probability of measuring 1. + +The vectors *|0>* and *|1>* use so called bra-ket notation and represent a vector basis of a two dimensional state. So the qubit space is a point in a space with two axes, but since *A* and *B* are complex, the whole space is four dimensional (there are 4 variables: *A* real, *A* imaginary, *B* real and *B* imaginary). However, since *A + B* must be equal to 1 ([normalized](normalization.md)), the point cannot be anywhere in this space. Using logic^TM we can figure out that the final state of a qubit really IS a point in two dimensions: a point on a sphere (Bloch sphere). A point of the sphere can be specified with two coordinates: *phase* ([yaw](yaw.md), 0 to 2 [pi](pi.md), can be computed from many repeated measurements) and *p* ([pitch](pitch.md), says he probability of measuring 1). It holds that: + +*A = sqrt(1 - p)* + +*B = e^(i * phase) * sqrt(p)* + +The sphere has the state |0> at the top (north pole) and |1> at the bottom (south pole); these are the only points a normal bit can occupy. The equator is an area of states where the probability of measuring 0 and 1 are equal (above the equator gives a higher probability to 0, below the equator to 1). + +Now a qubit may actually be in a more complex state than the pure states we've been dealing with until now. Pure states can be expressed with the state vector described above. Such a state is achieved when we start with a qubit of known value, e.g. if we cool down the qubit, we know it has the value *|0>*, and transforming this state with quantum gates keep the state pure. However there are also so called **mixed states** which are more complex and appear e.g. when the qubit may have randomly been modified by an external event, or if we start with a qubit of unknown state. Imagine if we e.g. start with a qubit that we known is either *|0>* or *|1>*. In such case we have to consider all those states separately. A mixed state is composed of multiple pure states. Mixed states can be expressed with so called **density matrices**, an alternative state representation which is able to encode these states. \ No newline at end of file diff --git a/race.md b/race.md new file mode 100644 index 0000000..6e4290f --- /dev/null +++ b/race.md @@ -0,0 +1,22 @@ +# Race + +Races of people are very large, loosely defined groups of genetically similar (related) people. Races usually significantly differ by their look and in physical, mental and cultural aspects. This topic is nowadays forbidden to be discussed and researched in "[science](soyence.md)", however there exists a number of older research and some things are just obvious. Theories such as polygenism -- the idea that different races evolved from different pre-humans, i.e. Asians from asian monkeys, Africans from african monkeys etc. -- are forbidden to be supported and they're ridiculed and demonized by mainstream information sources like [Wikipedia](wikipedia.md) who only promote the politically correct "out of Africa" theory. [SJWs](sjw.md) reject any idea of a race with the same religious fanaticism with which Christian fanatics opposed Darwin's evolution theory. + +Race can be told from the shape of the skull or one's [DNA](dna.md), which finds use e.g. in forensics to help solve crimes. It is officially called the *ancestry estimation*. Some idiots say this should be forbidden to do because it's "racist" lmao. + +Most generally races are called by the color of their skin, i.e. White (Caucasian), Black (African), Yellow (Asian) and Brown (Indian). But the lines can be drawn in many ways, some go as far as calling different nations separate races (e.g. the Norwegian race, Russian race etc.). + +There is a controversial 1994 book called *The Bell Curve* that deals with differences in intelligence between races. [SJWs](sjw.md) indeed tried to attack it, however international experts on intelligence agree the book is correct in saying average intelligence between races differs (see e.g. [The Wall Street Journal's Mainstream Science on Intelligence](https://web.archive.org/web/20120716184838/http://www.lrainc.com/swtaboo/taboos/wsj_main.html)). An online resource with a lot of information on racial differences is e.g. http://www.humanbiologicaldiversity.com/. + +In relation to [technology](tech.md)/[math](math.md)/[science](science.md) it is useful to know the differences in intellect between different races, though cultural and other traits linked to races may also play a big role. It is important to keep in mind intelligence isn't one dimensional, it's one of the most complex and complicated concepts we can be dealing with (remember the famous test that revealed that chimpanzees greatly outperform humans at certain intellectual tasks such as remembering the order of numbers seen for a very short period of time). We can't simplify to a single measure such as [IQ](iq.md) score. Let intelligence here mean simply the ability to perform well in the area of our art. And of course, there are smart and stupid people in any race, the general statements we make are just about statistics and probabilities. + +The smartest races in this regard seem to be [Jews](jew.md) and [Asians](asian.md) (also found so by the book *Bell Curve*), closely followed by the general white race. There is no question about the intelligence of Jews, the greatest thinkers of all times were Jewish ([Richard Stallman](rms.md), [Einstein](einstein.md), [Marx](marx.md), [Chomsky](chomsky.md), even [Jesus](jesus.md) and others). Jews seem to have a very creative intelligence while Asians are more mechanically inclined, they can learn a skill and bring it to perfection with an extremely deep study and dedication. The African black race (in older literature known as the *negro*) is decisively the least intelligent -- this makes a lot of sense, the race has been oppressed and living in harsh conditions for centuries and didn't get much chance to evolve towards good performance in intellectual tasks, quite the opposite, those who were physically fit rather than smart were probably more likely to survive and reproduce as slaves or jungle people (even if white people split from the blacks relatively recently, a rapid change in environment also leads to a rapid change in evolution, even that of intelligence). 1892 book *Hereditary Genius* says that the black race is *about two grades* below the white race (nowadays the gap will most likely be lower). Hispanics were found to perform in between the white and black people. There isn't so much info about other races such as the red race or Eskimos, but they're probably similarly intelligent to the black race (The above mentioned book *Hereditary Genius* gives an intelligence of the Australian race *at least one grade below that of the negro*). The brown races are kind of complicated, the Indian people showed a great intellectual potential, e.g. in [chess](chess.md), [math](math.md), philosophy (nonviolence inherently connected to India is the most intellectually advanced philosophy), and lately also [computer science](compsci.md) (even though many would argue that "[pajeets](pajeet.md)" are just trained coding monkeys). + +Increasing multiculturalism and mixing of the races will likely make all of this less and less relevant. But for now the differences still stand. + +[LRS](lrs.md) philosophy is of course FOR multiculturalism and mixing of races. Biodiversity is good and it would probably also help reduce racial [fascism](fascism.md)/nationalism. + +## See Also + +- [stereotype](stereotype.md) + diff --git a/rationalwiki.md b/rationalwiki.md new file mode 100644 index 0000000..6eda9f4 --- /dev/null +++ b/rationalwiki.md @@ -0,0 +1,5 @@ +# RationalWiki + +RationalWiki (https://rationalwiki.org/) is a [toxic](toxic.md) child [atheist](atheism.md) [SJW](sjw.md) [wiki](wiki.md) website that specializes in attacking rational views on controversial topics on the Internet. It is recommended you delete this website from your bookmarks or it will probably give you brain cancer. + +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. \ No newline at end of file diff --git a/raycasting.md b/raycasting.md new file mode 100644 index 0000000..031c201 --- /dev/null +++ b/raycasting.md @@ -0,0 +1,288 @@ +# Raycasting + +In [computer graphics](graphics.md) raycasting refers to a rendering technique in which we determine which parts of the scene should be drawn according to which parts of the scene are hit by rays cast from the camera. This is based on the idea that we can trace rays of light that enter the camera by going backwards, i.e. starting from the camera towards the parts of the scene that reflected the light. The term raycasting specifically has two main meanings: + +- **[3D](3d.md) raycasting**: [Algorithm](algorithm.md) that works the same as [raytracing](raytracing.md) but without [recursion](recursion.md). I.e. raycasting is simpler than raytracing and only casts primary rays (those originating from the camera), hence, unlike in raytracing, there are no shadows, reflections and refractions. Raytracing is the extension of raycasting. +- **[2D](2d.md) raycasting**: Technique for rendering so called "[pseudo3D](pseudo3D.md)" (primitive 3D) graphics, probably best known from the old [game](game.md) Wolf3D (predecessor of [Doom](doom.md)). The principle of casting the rays is the same but we only limit ourselves to casting the rays within a single 2 dimensional plane and render the environemnt by columns (unlike the 3D variant that casts rays and renders by individual pixels). + +## 2D Raycasting + +{ We have an official [LRS](lrs.md) library for advanced 2D raycasting: [raycastlib](raycastlib.md)! And also a game built on top of it: [Anarch](anarch.md). ~drummyfish } + +2D raycasting can be used to relatively easily render "3Dish" looking environments (commonly labeled "[pseudo 3D](pseudo3D.md)"), mostly some kind of right-angled labyrinth. There are limitations such as the inability for the camera to tilt up and down (which can nevertheless be faked with shearing). It used to be popular in very old games but can still be used nowadays for "retro" looking games, games for very weak hardware (e.g. [embedded](embedded.md)), in [demos](demoscene.md) etc. It is pretty cool, very [suckless](suckless.md) rendering method. + +``` +.................................................................................................... +.................................................................................................... +###................................................................................................. +#########........................................................................................... +#########........................................................................................... +#########........................................................................................... +#########........................................................................................... +#########.................///######..................................../#........................... +#########..............//////############.....................//////////###......................... +#########..............//////############............///////////////////####............//////////// +#########......///#####//////############.........//////////////////////####//////////////////////// +###############///#####//////############.........//////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############//#####////////////////////////####//////////////////////// +###############///#####//////############.........//////////////////////####//////////////////////// +#########......///#####//////############.........//////////////////////####//////////////////////// +#########..............//////############............///////////////////####............//////////// +#########..............//////############.....................//////////###......................... +#########.................///######..................................../#........................... +#########........................................................................................... +#########........................................................................................... +#########........................................................................................... +#########........................................................................................... +###................................................................................................. +.................................................................................................... +.................................................................................................... +``` + +*raycasted view, rendered by the example below* + +The method is called *2D* because even though the rendered picture looks like a 3D view, the representation of the world we are rendering is 2 dimensional (usually a grid, a top-down plan of the environment with cells of either empty space or walls) and the casting of the rays is performed in this 2D space -- unlike with the 3D raycasting which really does cast rays in fully 3D environments. Also unlike with the 3D version which casts one ray per each rendered pixel (x * y rays per frame), 2D raycasting only casts **one ray per rendered column** (x rays per frame) which actually, compared to the 3D version, drastically reduces the number of rays cast and makes this method **fast enough for [real time](real_time.md)** rendering even using [software_rendering](sw_rendering.md) (without a GPU). + +The principle is following: for each column we want to render we cast a ray from the camera and find out which wall in our 2D world it hits first and at what distance -- according to the distance we use [perspective](perspective.md) to calculate how tall the wall columns should look from the camera's point of view, and we render the column. Tracing the ray through the 2D grid representing the environment can be done relatively efficiently with algorithms normally used for line rasterization. There is another advantage for weak-hardware computers: we can easily use 2D raycasting **without a [framebuffer](framebuffer.md)** (without [double_buffering](double_buffering.md)) because we can render each frame top-to-bottom left-to-right without overwriting any pixels (as we simply cast the rays from left to right and then draw each column top-to-bottom). And of course, it can be implemented using [fixed point](fixed_point.md) (integers only). + +The classic version of 2D raycasting -- as seen in the early 90s games -- only renders walls with [textures](texture.md); floors and ceilings are untextured and have a solid color. The walls all have the same height, the floor and ceiling also have the same height in the whole environment. In the walls there can be sliding doors. 2D sprites ([billboards](billboard.md)) can be used with raycasting to add items or characters in the environment -- for correct rendering here we usually need a 1 dimensional [z-buffer](z_buffer.md) in which we write distances to walls to correctly draw sprites that are e.g. partially behind a corner. However we can **extend** raycasting to allow levels with different heights of walls, floor and ceiling, we can add floor and ceiling texturing and, in theory, probably also use different level geometry than a square grid (however at this point it would be worth considering if e.g. [BSP](bsp.md) rendering wouldn't be better). + +### Implementation + +The core element to implement is the code for casting rays, i.e. given the square plan of the environment (e.g. game level), in which each square is either empty or a wall (which can possibly be of different types, to allow e.g. different textures), we want to write a function that for any ray (defined by its start position and direction) returns the information about the first wall it hits. This information most importantly includes the distance of the hit, but can also include additional things such as the type of the wall, texturing coordinate or its direction (so that we can [shade](shading.md) differently facing walls with different brightness for better realism). The environment is normally represented as a 2 dimensional [array](array.md), but instead of explicit data we can also use e.g. a function that [procedurally](procgen.md) generates infinite levels (i.e. we have a function that for given square coordinates computes what kind of square it is). As for the algorithm for tracing the ray in the grid we may actually use some kind of line [rasterization](rasterization.md) algorithm, e.g. the **[DDA](dda.md) algorithm** (tracing a line through a grid is analogous to drawing a line in a pixel grid). This can all be implemented with [fixed point](fixed_point.md), i.e. integer only! No need for [floating point](float.md). + +**Note on distance calculation and distortion**: When computing the distance of ray hit from the camera, we usually DO NOT want to use the [Euclidean](euclidean.md) distance of that point from the camera position (as is tempting) -- that would create a so called fish eye effect, i.e. looking straight into a perpendicular wall would make the wall look warped/bowled (as the part of the wall in the middle of the screen is actually closer to the camera position so it would, by perspective, look bigger). For non-distorted rendering we have to compute a distance that's perpendicular to the camera plane -- we can see the camera plane as a "canvas" onto which we project the scene, in 2D it is a line (unlike in 3D where it really is a plane) at a certain distance from the camera (usually conveniently chosen to be e.g. 1) whose direction is perpendicular to the direction the camera is facing. The good news is that with a little trick this distance can be computed even more efficiently than Euclidean distance, as we don't need to compute a square root! Instead we can utilize the similarity of triangles. Consider the following situation: + +``` + I-_ + / '-X + / r.'/| + '-._ / ,' / | + p '-C_.' / | + 1/,'|-./ | + /' | / | + V-._-A/-----B + 'J + +``` + +In the above *V* is the position of the camera (viewer) which is facing towards the point *I*, *p* is the camera plane perpendicular to *VI* at the distance 1 from *V*. Ray *r* is cast from the camera and hits the point *X*. The length of the line *r* is the Euclidean distance, however we want to find out the distance *JX = VI*, which is perpendicular to *p*. There are two similar triangles: *VCA* and *VIB*; from this it follows that *1 / VA = VI / VB*, from which we derive that *JX = VB / VA*. We can therefore calculate the perpendicular distance just from the ratio of the distances along one principal axis (X or Y). However watch out for the case when *VA = VB = 0* to not divide by zero! In such case use the other principal axis (Y). + +Here is a complete **[C](c.md) example** that uses only [fixed point](fixed_point.md) with the exception of the stdlib [sin](sin.md)/[cos](cos.md) functions, for simplicity's sake (these can easily be replaced by custom fixed point implementation): + +``` +#include +#include // for simplicity we'll use float sin, cos from stdlib + +#define U 1024 // fixed-point unit +#define LEVEL_SIZE 16 // level resolution +#define SCREEN_W 100 +#define SCREEN_H 31 + +int wallHeight[SCREEN_W]; +int wallDir[SCREEN_W]; + +int perspective(int distance) +{ + if (distance <= 0) + distance = 1; + + return (SCREEN_H * U) / distance; +} + +unsigned char level[LEVEL_SIZE * LEVEL_SIZE] = +{ +#define E 1, // wall +#define l 0, // floor + l l l l E l l l l l l l l l E E + l E l l E E E l l l l l E l l E + l l l l l l l l l l l l l l l l + l E l l E l E l E l E l E l l l + l l l l E l l l l l l l l l E l + l l l l E l l l l l l l l l E l + l E E l E l l l l l l l l l l l + l E E l E l l l l l l l l l l l + l E l l l l l l l l l l l l l E + l E l l E l l l l l l l l E l l + l E l l E l l l l l l l l E l l + l E l l l l E E E l l l l l l l + l E E l E l l l l l E E E l l E + l E E l E l l l l l E l l l E E + l l l l l l E E E E E l l E E E + l l E l l l l l l l l l E E E E +#undef E +#undef l +}; + +unsigned char getTile(int x, int y) +{ + if (x < 0 || y < 0 || x >= LEVEL_SIZE || y >= LEVEL_SIZE) + return 1; + + return level[y * LEVEL_SIZE + x]; +} + +// returns perpend. distance to hit and wall direction (0 or 1) in dir +int castRay(int rayX, int rayY, int rayDx, int rayDy, int *dir) +{ + int tileX = rayX / U, + tileY = rayY / U, + addX = 1, addY = 1; + + // we'll convert all cases to tracing in +x, +y direction + + *dir = 0; + + if (rayDx == 0) + rayDx = 1; + else if (rayDx < 0) + { + rayDx *= -1; + addX = -1; + rayX = (tileX + 1) * U - rayX % U; + } + + if (rayDy == 0) + rayDy = 1; + else if (rayDy < 0) + { + rayDy *= -1; + addY = -1; + rayY = (tileY + 1) * U - rayY % U; + } + + int origX = rayX, + origY = rayY; + + for (int i = 0; i < 20; ++i) // trace at most 20 squares + { + int px = rayX % U, // x pos. within current square + py = rayY % U, + tmp; + + if (py > ((rayDy * (px - U)) / rayDx) + U) + { + tileY += addY; // step up + rayY = ((rayY / U) + 1) * U; + + tmp = rayX / U; + rayX += (rayDx * (U - py)) / rayDy; + + if (rayX / U != tmp) // don't cross the border due to round. error + rayX = (tmp + 1) * U - 1; + + *dir = 0; + } + else + { + tileX += addX; // step right + rayX = ((rayX / U) + 1) * U; + + tmp = rayY / U; + rayY += (rayDy * (U - px)) / rayDx; + + if (rayY / U != tmp) + rayY = (tmp + 1) * U - 1; + + *dir = 1; + } + + if (getTile(tileX,tileY)) // hit? + { + px = rayX - origX; + py = rayY - origY; + + // get the perpend dist. to camera plane: + return (px > py) ? ((px * U) / rayDx) : ((py * U) / rayDy); + + // the following would give the fish eye effect instead + // return sqrt(px * px + py * py); + } + } + + return 100 * U; // no hit found +} + +void drawScreen(void) +{ + for (int y = 0; y < SCREEN_H; ++y) + { + int lineY = y - SCREEN_H / 2; + + lineY = lineY >= 0 ? lineY : (-1 * lineY); + + for (int x = 0; x < SCREEN_W; ++x) + putchar((lineY >= wallHeight[x]) ? '.' : (wallDir[x] ? '/' : '#')); + + putchar('\n'); + } +} + +int main(void) +{ + int camX = 10 * U + U / 4, + camY = 9 * U + U / 2, + camAngle = 600, // U => full angle (2 * pi) + quit = 0; + + while (!quit) + { + int forwX = cos(2 * 3.14 * camAngle) * U, + forwY = sin(2 * 3.14 * camAngle) * U, + vecFromX = forwX + forwY, // leftmost ray + vecFromY = forwY - forwX, + vecToX = forwX - forwY, // rightmost ray + vecToY = forwY + forwX; + + for (int i = 0; i < SCREEN_W; ++i) // process each screen column + { + // interpolate rays between vecFrom and vecTo + int rayDx = (SCREEN_W - 1 - i) * vecFromX / SCREEN_W + (vecToX * i) / SCREEN_W, + rayDy = (SCREEN_W - 1 - i) * vecFromY / SCREEN_W + (vecToY * i) / SCREEN_W, + dir, + dist = castRay(camX,camY,rayDx,rayDy,&dir); + + wallHeight[i] = perspective(dist); + wallDir[i] = dir; + } + + for (int i = 0; i < 10; ++i) + putchar('\n'); + + drawScreen(); + + char c = getchar(); + + switch (c) // movement + { + case 'a': camAngle += 30; break; + case 'd': camAngle -= 30; break; + case 'w': camX += forwX / 2; camY += forwY / 2; break; + case 's': camX -= forwX / 2; camY -= forwY / 2; break; + case 'q': quit = 1; break; + default: break; + } + } + + return 0; +} +``` + +How to make this more advanced? Here are some hints and tips: + +- **textured walls**: This is pretty simply, the ray hit basically gives us a horizontal texturing coordinate, and we simply stretch the texture vertically to fit the wall. I.e. when the ray hits a wall, we take the hit coordinate along the principal axis of the wall (e.g. for vertical hit we take the Y coordinate) and [mod](mod.md) it by the fixed point unit which will give us the texturing coordinate. This coordinate tells us the column of the texture that the rendered column shall have; we read this texture column and render it stretched vertically to fit the column height given by the perspective. Note that for [cache](cache.md) friendliness ([optimization](optimization.md)) textures should be stored column-wide in memory as during rendering we'll be reading the texture by columns (row-wise stored textures would make us jump wide distances in the memory which CPU caches don't like). +- **textured floor/ceiling**: Something aking [mode7](mode7.md) rendering can be used. +- **sliding door**: TODO +- **jumping**: Camera can easily be shifted up and down. If we are to place the camera e.g. one fixed point unit above its original position, then for each column we render we compute, with perspective applied to this one fixed point unit (the same way with which we determine the column size on the screen) the vertical screen-space offset of the wall and render this wall column that many pixel lower. +- **looking up/down**: Correct view of a camera that's slightly tilted up/down can't be achieved (at least not in a reasonably simple way), but there's a simple trick for faking it -- camera shearing. Shearing literally just shifts the rendered view vertically, i.e. if we're to look a bit up, we render that same way as usual but start higher up on the screen (in the part of the rendered image that's normally above the screen and not visible), so that the vertical center of the screen will be shifted downwards. For smaller angles this looks [good enough](good_enough.md). +- **multilevel floor/ceiling**: This is a bit more difficult but it can be done e.g. like this: for each level square we store its floor and ceiling height. When casting a ray, we will consider any change in ceiling and/or floor height a hit, AND we'll need to return multiple of those hits (not just the first one). When we cast a ray and get a set of such hits, from each hit we'll know there are tiny walls on the floor and/or ceiling, and we'll know their distances. This can be used to correctly render everything. +- **different level geometry**: In theory the level doesn't have to be a square grid but some kind of another representation, or we may keep it a square grid but allow placement of additional shapes in it such as cylinders etc. Here you simply have to figure out how to trace the rays so as to find the first thing it hits. +- **adding [billboards](billboard.md) (sprites)**: TODO +- **reflections**: We can make our 2D raycaster a 2D [raytracer](raytracing.md), i.e. when we cast a camera ray and it hits a reflective wall (a mirror), we cast another, secondary reflected ray and trace it to see which wall it hits, i.e. which wall will get reflected in the reflective wall. +- **partly transparent walls**: We can make some walls partially transparent, both with [alpha blending](alpha.md) or textures with transparent pixels. In both cases we'll have to look not just for the first hit of the ray, but also for the next. \ No newline at end of file diff --git a/raycastlib.md b/raycastlib.md new file mode 100644 index 0000000..3183d8f --- /dev/null +++ b/raycastlib.md @@ -0,0 +1,5 @@ +# Raycastlib + +TODO + +The repository is available at https://codeberg.org/drummyfish/raycastlib. \ No newline at end of file diff --git a/recursion.md b/recursion.md new file mode 100644 index 0000000..239ccea --- /dev/null +++ b/recursion.md @@ -0,0 +1,44 @@ +# Recursion + +*See [recursion](recursion.md).* + +In general recursion is a situation in which a [definition](definition.md) refers to itself; for example the definition of a human's ancestor as "the human's parents and the ancestors of his parents" ([fractals](fractal.md) are also very nice example of what a simple recursive definition can achieve). In programming recursion takes on a meaning of a **function that calls itself**; this is the meaning we'll suppose in this article, unless noted otherwise. + +We divide recursion to a **direct** and **indirect** one. In direct recursion the function calls itself directly, in indirect function *A* calls a function *B* which ends up (even possibly by calling some more functions) calling *A* again. Indirect recursion is tricky because it may appear by mistake and cause a [bug](bug.md) (which is nevertheless easily noticed as the program will mostly run out of memory and crash). + +When a function calls itself, it starts "diving" deeper and deeper and in most situations we want this to stop at some point, so in most cases **a recursion has to contain a terminating condition**. Without this condition the recursion will keep recurring and end up in an equivalent of an infinite loop (which in case of recursion will however crash the program with a [stack overflow](stack_overflow.md) exception). Let's see this on perhaps the most typical example of using recursion, a [factorial](factorial.md) function: + +``` +unsigned int factorial(unsigned int x) +{ + if (x > 1) + return x * factorial(x - 1); // recursive call + else + return 1; // terminating condition +} +``` + +See that as long as x > 1, recursive calls are being made; with each the x is decremented so that inevitably x will at one point come to equal 1. Then the *else* branch of the condition will be taken -- the terminating condition has been met -- and in this branch no further recursive call is made, i.e. the recursion is stopped here and the code starts to descend from the recursion. + +Note that even in computing we can use an infinite recursion sometimes. For example in [Hashell](haskell.md) it is possible to define infinite [data structures](data_structure.md) with a recursive definition; however this kind of recursion is intentionally allowed, it is treated as a mathematical definition and with correct use it won't crash the program. + +**Every recursion can be replaced by iteration and vice versa** (iteration meaning a loop such as `while`). In fact some language (e.g. [functional](functional.md)) do not have loops and handle repetition solely by recursion. This means that you, a programmer, always have a choice between recursion and iteration, and here you should know that **recursion is typically slower than iteration**. This is because recursion has a lot of overhead: remember that every level of recursion is a function call that involves things such as pushing and popping values on stack, handling return addresses etc. The usual advice is therefore to **prefer iteration**, even though recursion can sometimes be more elegant/simple and if you don't mind the overhead, it's not necessarily wrong to go for it. Typically this is the case when you have multiple branches to dive into, e.g. in case of [quicksort](quicksort.md). In the above example of factorial we only have one recurring branch, so it's much better to implement the function with iteration: + +``` +unsigned int factorial(unsigned int x) +{ + unsigned int result = 1; + + while (x > 1) + { + result *= x; + x--; + } + + return result; +} +``` + +How do the computers practically make recursion happen? Basically they use a [stack](stack.md) to remember states on each level of the recursion. In programming languages that support recursive function calls this is hidden behind the scenes in the form of [call stack](call_stack.md). This is why an infinite recursion causes stack overflow. + +Another important type of recursion is **tail recursion** which happens when the recursive call in a function is the very last command. It is utilized in functional languages that use recursion instead of loops. This kind of recursion can be optimized by the compiler into basically the same code a loop would produce, so that e.g. stack won't grow tremendously. \ No newline at end of file diff --git a/right.md b/right.md new file mode 100644 index 0000000..dac9a1d --- /dev/null +++ b/right.md @@ -0,0 +1,3 @@ +# Right + +See [left vs right](left_right.md). \ No newline at end of file diff --git a/rms.md b/rms.md new file mode 100644 index 0000000..fee563b --- /dev/null +++ b/rms.md @@ -0,0 +1,15 @@ +# Richard Stallman + +The great doctor Richard Matthew Stallman (RMS, born 1953 in New York) is one of the biggest figures in software history, inventor of [free software](free_software.md), founder of the [GNU project](gnu.md), [free software foundation](fsf.md), a great [hacker](hacking.md) and the author of a famous text editor [emacs](emacs.md). + +Stallman's life along with free software's history is documented by a free-licensed book named *Free as in Freedom: Richard Stallman's Crusade for Free Software* on which he collaborated. You can get it for free e.g. at [Project Gutenberg](https://www.gutenberg.org/ebooks/5768). You should read this! + +As [anarchists](anarchism.md) we of course despise the idea of worshiping people, creating heroes and cults of personalities, but the enormous historical significance of Stallman has to be stressed as a plain and simple fact. Even though in our days his name is overshadowed in the mainstream by rich businessman and creators of commercially successful technology and even though we ourselves disagree with Stallman on some points, in the future history may well see Stallman as perhaps the greatest man of the software era, and rightfully so. Stallman isn't a mere creator of a commercially successful software product, he is literally as important as the great philosophers of ancient Greece -- he brilliantly foresaw the course of history and quickly defined ethics needed for the new era of mass available programmable computers, and not only that, he also basically alone established this ethics as a standard IN SPITE of all the world's corporations fighting back. He is also extremely unique in not pursuing self interest, in TRULY living his own philosophy, dedicating his whole life to his cause and refusing to give in even partially. All of this is at much higher level than simply becoming successful and famous within the contemporary capitalist system, his life effort is pure, true and timeless, unlike things achieved by pieces of shit such as [Steve Jobs](steve_jobs.md). + +Regarding [software](software.md) Stallman has for his whole life strongly and tirelessly promoted free software and [copyleft](copyleft.md) and has himself only used such software; he has always practiced what he preched and led the best example of how to live without [proprietary](proprietary.md) software. This is amazing. Nevertheless he isn't too concerned about [bloat](bloat.md) (judging by the GNU software and his own creation, [emacs](emacs.md)) and he also doesn't care that much about [free culture](free_culture.md) (some of his written works prohibit modification and his GNU project allows proprietary non-functional data). Sadly he has also shown signs of being a [type A fail](fail_ab.md) personality by writing about some kind of newspeak "*gender neutral language*" and by seeming to be caught in a [fight culture](fight_culture.md) (e.g. by supporting copyleft). Nevertheless he definitely can't be accused of populism as he basically tells what he considers to be the truth no matter what, and he is very consistent in this. Some of his unpopular opinions brought him a lot of trouble, e.g. the wrath of SJWs in 2019 for his criticism of the [pedo](pedophile.md) witch hunt. + +He is a weird guy, having been recorded on video eating dirt from his feet before giving a lecture. In the book *Free as in Freedom* he admits he might be autistic. Nevertheless he's pretty smart, has magna cum laude degree in physics from Harvard, 10+ honorary doctorates, fluently speaks English, Spanish and French and has many times proven his superior programming skills (even though he later stopped programming to fully work on promoting the FSF). + +Stallman has a beautifully minimalist website http://www.stallman.org where he actively comments on current news and issues. He also made the famous free software song (well, only the lyrics, the melody is taken from a Bulgarian folk song Sadi Moma). + +In 2019 Stallman was [cancelled](cancel_culture.md) by [SJW](sjw.md) fascists for merely commenting rationally on the topic of child sexuality following the Epstein scandal. He resigned from the position of president of the FSF but continues to support it. \ No newline at end of file diff --git a/rock.md b/rock.md new file mode 100644 index 0000000..38f5450 --- /dev/null +++ b/rock.md @@ -0,0 +1,19 @@ +# Rock + +Rocks and stones are natural formations of minerals that can be used to create the most primitive [technology](technology.md). Stone age was the first stage of our civilization; it was characterized by use of stone tools. Rock [nerds](nerd.md) are called geologists. + +Rocks are pretty [suckless](suckless.md) and [LRS](lrs.md) because they are simple, they are everywhere, free and can be used in a number of ways such as: + +- As a building material. +- For [fun](fun.md) and entertainment, you can play various games with rocks: rock skipping, petanque, even [chess](chess.md). +- As [weapons](weapon.md), even though we discourage this use. +- For making tools such as [knives](knife.md) or [hammers](hammer.md). +- To hold heat: you can e.g. heat stones in fire and let them heat you while you sleep or use them to cook something. +- For writing, some can be used as a chalk, some may be used to carve text into. A dust from some rocks can be used to make dye to paint or write with. +- As weights. +- For help with counting (e.g. [abacus](abacus.md)) -- this makes rocks a kind of [computer](computer.md)! +- To make [art](art.md), decorations, small statues etc. +- For breaking things, grinding, sharpening etc. +- With advanced technology we can get metals out of rocks, extract geological knowledge from them etc. +- Some rocks can be used to start [fire](fire.md). +- Some are pretty rare and can be used as a [currency](currency.md), even though we hate money and discourage this as well. \ No newline at end of file diff --git a/rsa.md b/rsa.md new file mode 100644 index 0000000..1e85511 --- /dev/null +++ b/rsa.md @@ -0,0 +1,24 @@ +# RSA + +TODO + +generating keys: + +1. *p := large random prime* +2. *q := large random prime* +3. *n := p * q* +4. *f := (p - 1) * (q - 1)* (this step may differ in other versions) +5. *e := 65537* (most common, other constants exist) +6. *d := solve for x: x * e = 1 mod f* +7. *public key := (n,e)* +8. *private key := d* + +message encryption: + +1. *m := message encoded as a number < n* +2. *encrypted := m^e mod n* + +message decryption: + +1. *m := encrypted^d mod n* +2. *decrypted := decode message from number m* \ No newline at end of file diff --git a/rust.md b/rust.md new file mode 100644 index 0000000..b84efeb --- /dev/null +++ b/rust.md @@ -0,0 +1,7 @@ +# Rust + +TODO + +Rust is [shit](shit.md). + +LMAO https://github.com/mTvare6/hello-world.rs \ No newline at end of file diff --git a/saf.md b/saf.md new file mode 100644 index 0000000..fc36c66 --- /dev/null +++ b/saf.md @@ -0,0 +1,45 @@ +# SAF + +TODO + +The repository is available at https://codeberg.org/drummyfish/SAF. + +``` + microTD + ________________________________________________________________ + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;' ';; ' ' ;;' ';;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;' ';, ,;, ,;, ,;;';;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;,;'' ''' ''' '', ,;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;',''''''''''''''''''',';;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;; ' ,;';;';, ;';'; ;';, ; ;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;; ' ;; ;; ;; ; ; ; ; ;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;; ' ;; ,,;;; ; ; ,; ; ;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;,', '''''' ' ''' ,',;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;,' ' ' ' ' ' ' ' ' ',;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + | ';;;' , ';;;' , ';;;' , ';;;' , ';;;' , ';;;' , ';;;' , ';;;' ,| + |;, ' ,;;;, ' ,;;;, ' ,;;;, ' ,;;;, ' ,;;;, ' ,;;;, ' ,;;;, ' ,;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + | ,, , ,,, ,,, ,, | + | ;''; ;,; ;,; ; | + | ' ' ' ' ' ''' | + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;| + |;';;;;;;'';;;;;;;;;;';;;;;;;;;;;;;;;;''';;;;;;;;;;;;;;;;;;;;;;;;| + |; ,';;; ',,;;; ,;;;, ,;;;;,;;;;;;;;;;,, ;;;;;;;;;;;;;;;;;;;;;;;;| + |;,,;;;;;,,;;;,,;;;;;,,;;;;,;;;;;;;;;;,,,;;;;;;;;;;;;;;;;;;;;;;;;| + ---------------------------------------------------------------- +``` + +*screenshot of a SAF game ([uTD](utd.md)) running in terminal with [ncurses](ncurses.md)* \ No newline at end of file diff --git a/science.md b/science.md new file mode 100644 index 0000000..ce6b99d --- /dev/null +++ b/science.md @@ -0,0 +1,8 @@ +# Science + +*Not to be confused with [soyence](soyence.md)*. + +Science means inference and organization of knowledge, in more strict sense this process has to be kept rational by obeying some specific rules. Sciences include [mathematics](math.md) (so called formal science), [physics](physics.md), biology and [computer science](computer_science.md). Science is not to be confused with: + +- [Pseudoscience](pseudoscience.md) such as gender studies. +- [Soyence](soyence.md). \ No newline at end of file diff --git a/sdf.md b/sdf.md new file mode 100644 index 0000000..fdbe2f2 --- /dev/null +++ b/sdf.md @@ -0,0 +1,26 @@ +# Signed Distance Function + +Signed distance function (SDF, also signed distance field) is a [function](function.md) that for any point in space returns its distance to the closest point of some geometric shape, and also the information whether that point is outside or inside that shape (if inside, the distance is negative, outside it's positive and exactly on the surface it is zero -- hence *signed* distance function). SDFs find use in elegantly representing some surfaces and solving some problems, most notably in computer [graphics](graphics.md), e.g. for smoothly rendering upscaled [fonts](font.md), in [raymarching](raymarching.md), implementing [global illumination](gi.md), as a 3D model storage representation, for [collision detection](collision_detection.md) etc. SDFs can exist anywhere where [distances](distance.md) exist, i.e. in 2D, 3D, even non-[Euclidean](euclidean.md) spaces etc. (and also note the distance doesn't always have to be Euclidean distance, it can be anything satisfying the [axioms](axiom.md) of a distance metric, e.g. [taxicab distance](taxicab.md)). + +Sometimes SDF is extended to also return additional information, e.g. the whole [vector](vector.md) to the closest surface point (i.e. not only the distance but also a direction towards it) which may be useful for specific algorithms. + +**What is it all good for?** We can for example implement quite fast [raytracing](raytracing.md)-like rendering of environments for which we have a fast SDF. While traditional raytracing has to somehow test each ray for potential intersection against all 3D elements in the scene, which can be slow (and complicated), with SDF we can performs so called [raymarching](raymarching.md), i.e. iteratively stepping along the ray according to the distance function (which hints us on how big of a step we can make so that we can potentially quickly jump over big empty areas) until we get close enough to a surface which we interpret as an intersection -- if the SDF is fast, this approach may be pretty efficient ([Godot](godot.md) implemented this algorithm to render real-time global illumination and reflections even in GPUs that don't support accelerated raytracing). Programs for rendering 3D [fractals](fractal.md) (such as Mandelbulber) work on this principle as well. SDFs can also be used as a format for representing shapes such as [fonts](font.md) -- there exists a method (called multi-channel SDF) that stores font glyphs in bitmaps of quite low-resolution that can be rendered at arbitrary scale in a quality almost matching that of the traditional vector font representation -- the advantage over the traditional vector format is obviously greater simplicity and better compatibility with GPU hardware that's optimized for storing and handling bitmaps. Furthermore we can trivially increase or decrease weight (boldness) of a font represented by SDFs simply by adjusting the rendering distance threshold. SDFs can also be used for [collision detection](collision_detection.md) and many other things. One advantage of using SDFs is their **generality** -- if we have an SDF raymarching algorithm, we can plug in any shape and environment just by constructing its SDF, while with traditional raytracing we normally have to write many specialized algorithms for detecting intersections of rays with different kinds of shapes, i.e. we have many special cases to handle. + +**How is an SDF implemented?** Well, it's a [function](function.md), it can be implemented however we wish and need, it depends on each case, but we probably want it to be **fast** because algorithms that work with SDFs commonly call it often. SDF of simple mathematical shapes (and their possible combinations such as unions, see. e.g. [CSG](csg.md)), e.g. spheres, can be implemented very easily (SDF of a sphere = distance to the sphere center minus its radius); even the already mentioned 3D [fractals](fractal.md) have functions that can be used to quickly estimate the distance towards their surface. Other times -- e.g. where arbitrary shapes may appear -- the function may be [precomputed](precomputing.md) into some kind of N dimensional [array](array.md), we might say we use a precomputed [look up table](LUT.md). This can be done in a number of ways, but as a simple example we can imagine raymarching mirror reflections with which we can subdivide the 3D scene into a grid and into each cell we store the SDF value at its center point (which here may be computed by even a relatively slow algorithm), which will allow for relatively fast search of intersections of rays with the surface (at any point along the ray we may check the SDF value of the current cell which will likely provide information for how big a step we can make next). + +``` +. . . . . . . . 3 2 2 2 2 2 2 2 +. . . . . . . . 3 2 1 1 1 1 1 1 +. . . X X X X X 2 2 1 0 0 0 0 0 +. . . X X X X X 2 1 1 0-1-1-1 0 +. . X X X X X X 2 1 0 0-1-2-1 0 +. . X X X X X X 2 1 0-1-1-2-1 0 +. . X X X X X X 2 1 0-1-1-1-1 0 +. . X X X X X X 2 1 0 0 0-1-1 0 +. . . . X X X X 2 1 1 1 0 0 0 0 +. . . . . . . . 2 2 2 1 1 1 1 1 +``` + +*Shape (left) and its SDF (right, distances rounded to integers).* + +SDFs in computer graphics were being explored a long time ago but seem to have start to become popular since around the year 2000 when Frisken [et al](et_al.md) used adaptive SDFs as an efficient representation for 3D models preserving fine details. In 2007 [Valve](valve.md) published a paper at [SIGGRAPH](siggraph.md) showing the bitmap representation of SDF shapes that they integrated into their [Source](source_engine.md) engine. \ No newline at end of file diff --git a/selflessness.md b/selflessness.md new file mode 100644 index 0000000..6177e80 --- /dev/null +++ b/selflessness.md @@ -0,0 +1,17 @@ +# Selflessness + +Selflessness means acting with the intent of helping others without harming them, gaining edge over them or taking advantage of them in any way. It is the opposite of [self interest](self_interest.md). Selflessness is the basis of an [ideal society](ideal_society.md) and [good technology](lrs.md) (while sadly self interest is the basis of our current dystopian [capitalist](capitalism.md) society). + +Selflessness is about the **intent** behind behavior rather than about the behavior itself; for example being a [vegetarian](vegetarian.md) (or even [vegan](vegan.md)) for ethical reasons (to spare animals of suffering) is selfless while being a vegetarian only because of one's health concerns is not selfless. Similarly if a selfless behavior unpredictably results in harming someone, it is still a selfless behavior as long as the intent behind it was pure. (Note that this does **NOT** at all advocate the "[ends justify the means](ends_justify_the_means.md)" philosophy.) + +In the real world absolutely pure selflessness may be very hard to find, partly because such behavior by definition seeks no recognition. Acts of sacrificing one's life for another may a lot of times be seen as selfless, but not always (saving one's child in such way may just serve perpetuating own genes, it can also be done to posthumously increase one's fame etc.). An example of high selflessness may perhaps be so called [Langar](langar.md), a big community kitchen run by [Sikhs](sikhism.md) that prepare and serve free [vegetarian](vegetarian.md) food to anyone who comes without differentiating between religious beliefs, skin color, social status, gender etc. Sikhs sometimes also similarly offer a place to stay etc. The mentioned ethical vegetarianism and veganism is another example of selflessness, as well as [LRS](lrs.md) itself, of course. + +**Selflessness doesn't mean one seeks no reward**, there is practically always at least one reward for a selflessly behaving individual: the good feeling that comes from the selfless action. Selfless acting may also include physical rewards, for example if a programmer dedicates years of his life to developing a [free](free_software.md) [public domain](public_domain.md) software that will help all people, he himself will get the benefits of using that program. The key thing is that he doesn't use the program to harm others, e.g. by charging money for it or even by using a license that forces others to credit him and so increase his reputation. He sacrificed part of his life purely to increase good in the world for everyone without trying to gain an edge over others. + +The latter is important to show that what's many times called selflessness nowadays is only **pseudoselflessness**, fake selflessness. This includes e.g. all the celebrities who publicly financially support charities; this seems like a nice gesture but it's of course just a PR stunt, the money spent on charities is money invested into promoting oneself, increasing fame, sometimes even tax hacking etc. This also goes for professional firefighters, doctors, [FOSS](foss.md) programmers that use licenses with conditions such as attribution etc. This is not saying the behavior of such people is always pure evil, just that it's not really selfless. + +Selfless programs and art should be put into the [public domain](public_domain.md) with waivers such as [CC0](cc0.md). Using licenses (free or not) that give the programmer some advantage over others (even e.g. attribution) are not selfless. + +## See Also + +- [dog](dog.md) \ No newline at end of file diff --git a/semiconductor.md b/semiconductor.md new file mode 100644 index 0000000..d04ed0d --- /dev/null +++ b/semiconductor.md @@ -0,0 +1,14 @@ +# Semiconductor + +{ For a physicist there's probably quite a lot of simplification, this is written from the limited point of view of a programmer. ~drummyfish } + +Semiconductors are materials whose electrical conductivity varies greatly with conditions such as temperature, illumination or their purity, unlike insulators who generally don't conduct electricity very well (have a great [resistivity](resistivity.md)) and conductors who do. Semiconductors, especially [silicon](silicon.md) (Si), are the key component of [digital](digital.md) [electronic](electronic.md) [computers](computer.md) and integrated circuits. Other semiconductors include germanium, selenium or compound ones (composed of multiple elements). + +Semiconductors are important for computers because they help implement the [binary](binary.md) logic circuits, they can behave like a switch that is either on (1) or off (0). Besides that they can serve e.g. for making measurements (a component whose resistivity depends on its illumination can be used to measure amount of light by measuring the resistivity). Especially important electronic components based on semiconductors are the **[diode](diode.md)** (lets current flow only one way) and **[transistor](transistor.md)** (a purely electrical "switch" that can be made extremely tiny). + +Normally semiconductors don't conduct so well at room temperature (they conduct better at higher temperatures, unlike metals), but their conductivity can be increased by so called **doping** -- introducing small impurities of other elements. By doing this we can get two types of semiconductors: + +- **N type**: By adding e.g. an arsenic atom to a grid of silicon atoms we get an extra free electron because arsenic has 5 outer electrons while silicon has 4. Arsenic binds its 4 electrons with neighboring silicon atoms (with so called covalent bond, sharing pairs of electrons), but will have one unbound electron, which thanks to not being bound can move easily and help conduct electricity (note that when the electron does move away, arsenic will still want to get another electron because it will become positive charged, but the fifth electron is simply always more "loose" thanks to not being bound). In this type of semiconductor we have negative particles, the **electrons**, moving around. +- **P type**: By similarly adding e.g. an boron atom to a silicon grid, we get a similar situation; boron only has 3 outer electrons, so it will only bind to 3 silicon atoms, leaving one the bond with one silicon incomplete, forming a **hole**. This hole can be seen as a [virtual](virtual.md) positively charged particle, it is simply a lack of electron. An electron can temporarily jump in this hole but will want to move away as boron doesn't want it there. In this type of semiconductor we can imagine the holes moving around (even though physically only electrons are moving, of course). + +If we connect a P and N type semiconductors, we get so called **PN junction** which only conducts current one way and is used in diodes and transistors. After putting P and N materials together, at the boundary some electrons from the N type material fill the holes in the P type material which creates a small *depletion region* of certain width. This region is an electric field that's negative on the P side and positive on the N side (because negative electrons have moved from N to P). If we connect the PN junction to a voltage source, with P side to the positive and N side to the negative terminal, we create an opposite electric field which will eliminate the depletion region and allow the flow of current. Connecting the sides the other way around will result in increasing the width of the depletion region and blocking the current flow. \ No newline at end of file diff --git a/settled.md b/settled.md new file mode 100644 index 0000000..430d8df --- /dev/null +++ b/settled.md @@ -0,0 +1,9 @@ +# Settled + +When a [software](software.md) is so good it makes you stop searching further for any other software in the same category, it makes the debate settled -- you've found the ultimate tool, you're now free, you no longer have to think about the topic or invest any more precious time into trying different alternatives. You've found the [ultimate](ultimate.md), nearly [perfect](perfect.md) tool for the job, the one that makes the others obsolete. Settling the competition of different tools is one of the goal of [good technology](lrs.md) as it frees users as well as programmers. + +For example [Vim](vim.md) often settles the search for a text and programming editor for many programmers. + +Nevertheless some soyboys just like hopping and switching their tools just because, they simply like wasting their time with things like [distrohopping](distrohopping.md) etc. There's no help to these people. + +{ software that made the debate settled for me: [vim](vim.md), [dwm](dwm.md), [st](st.md), [badwolf](badwolf.md) ~drummyfish } \ No newline at end of file diff --git a/shader.md b/shader.md new file mode 100644 index 0000000..c9421fb --- /dev/null +++ b/shader.md @@ -0,0 +1,18 @@ +# Shader + +Shader is a program running on the [graphics processing unit](gpu.md) (GPU), typically in many parallel instances as to utilize the GPU's highly parallel nature. As such they are simple to mid complexity programs. + +The word *shader* is also used more loosely to stand for any specific effect, material or look in 3D graphics (e.g. [games](games.md)), as shaders are usually the means of achieving such effects. + +Shaders are normally written in a special **shading language** such as [GLSL](glsl.md) in the [OpenGL](opengl.md) [API](api.md), [HLSL](hlsl.md) ([proprietary](proprietary.md)) in [Direct3D](d3d.md) API or the Metal shading language ([proprietary](proprietary.md)) in [Metal](metal.md) API. These languages are often similar to [C](c.md) with some additions (e.g. vector and matrix data types) and simplifications (e.g. no function [recursion](resursion.md)). High level [frameworks](framework.md) like [Blender](blender.md) many times offer [visual programming](visual_programming.md) (point-n-click) of shaders with graph/node editors. + +Initially (back in the 90s and early 2000s) shaders were used only for graphics, i.e. to transform 3D vertices, draw triangles and compute pixel colors. Later on as GPUs became more [general purpose](gpgpu.md), flexibility was added to shaders that allowed to solve more problems with the GPU and eventually general *compute* shaders appeared (OpenGL added them in version 3.3 in 2010). + +To put shaders in the context, the flow of data is this: a [CPU](cpu.md) uploads some data (3D models, textures, ...) to the GPU and then issues a draw command -- this makes the GPU start its **pipeline** consisting of different **stages**, e.g. the vertices of 3D models are transformed to screens space (the vertex stage), then triangles are generated and rasterized (the shading stage) and the data is output (on screen, to a buffer etc.). Some of these stages are programmable and so they have their own type of a shader. The details of the pipeline differ from API to API, but in general, depending on the type of data the shader processes (the stage), we talk about: + +- **vertex shaders**: Perform per-vertex computations on 3D models, typically their transformation from their world position to the position in the camera and screen space. +- **fragment/pixel shaders**: Compute the final color of each pixel (sometimes called more generally *fragments*), i.e. work per-pixel. A typical use is to perform [texturing](texture.md) and amount of reflected light (lighting model). +- **geometry shaders**: Advanced stage, serves to modify the geometry of 3D models (these shaders can, unlike vertex shaders, generate of discard vertices). +- **tesselation shaders**: Advanced stage, serves for subdividing primitives to create smoother geometry. +- **compute shaders**: Perform general computations, used e.g. for computing physics simulations, [AI](ai.md) etc. +- **[ray tracing](ray_tracing.md) shaders** and other specific types \ No newline at end of file diff --git a/shit.md b/shit.md new file mode 100644 index 0000000..cad6bcc --- /dev/null +++ b/shit.md @@ -0,0 +1,13 @@ +# Shit + +Shit is something that's awfully bad. + +## List of Things That Are Shit + +- [MS Windows](windows.md) +- [OOP](oop.md) (the ugly overused kind) +- [systemd](systemd.md) + +## See Also + +- [cancer](cancer.md) \ No newline at end of file diff --git a/shortcut_thinking.md b/shortcut_thinking.md new file mode 100644 index 0000000..239d77a --- /dev/null +++ b/shortcut_thinking.md @@ -0,0 +1,11 @@ +# Shortcut Thinking + +Shortcut thinking means making conclusions by established associations (such as "theft = bad") rather than making the extra effort of inferring the conclusion from known, possibly updated facts. This isn't bad in itself, in fact it is a great and necessary [optimization](optimization.md) of our thinking process and it's really why we have long term memory -- imagine we'd have to deduce all the facts from scratch each time we think about anything. However shortcut thinking can be a weakness in many situations and leaves people prone to manipulation by [propaganda](propaganda.md). As such this phenomenon is extremely abused by politicians, i.e. they for example try to shift the meaning of a certain negative word to include something they want to get rid of. + +Some commonly held associations appearing in shortcut thinking of common people nowadays are for example "theft = piracy = bad", "laziness = bad", "pedophiles = child rapists = bad", "competition = good", "more jobs = good", "more complex technology = better", etc. Of those most are of course either extremely simplified or just plain wrong. however some association may of course be correct, such as "murder = bad". + +Let's focus on the specific example of the association "theft = bad". Indeed it has some sense in it -- if we turn shortcut thinking off, we may analyze why this association exists. For most of our history the word theft has meant *taking a physical personal possession of someone else against their will*. Indeed, in a society of people of which most weren't rich, this was bad in most cases as it hurt the robbed person, he has lost something he probably needed. However the society evolved, the meaning of property itself has changed from "personal property" to "private property", i.e. suddenly there were people who could own a whole forest or a factory even if they have never seen it, and there were people who had much more than they needed. If a poor starving person steals food from the rich who doesn't even notice this, suddenly the situation is different and many will say this is no longer bad. Nevertheless the word theft stayed in use and now included even such cases that were ethical because of the shifted meaning of the word "property" and due to changes in conditions of people. Recently the word property was shifted to the extreme with the invention of **[intellectual property](intellectual_property.md)**, i.e. the concept of being able to own information such as ideas or stories in books. Intellectual property is fundamentally different from physical property as it can't be stolen in the same way, it can only be copied, duplicated, but this copying doesn't rid the "owner" of the original information. And so nowadays the word "theft", or one of its modern forms, "[piracy](piracy.md)", includes also mere copying of information or even just reusing an idea (patent) for completely good purposes, for example writing computer programs in certain (patented) ways is considered a theft. Of course, some may argue that such a download or reuse prevents the "owner's" profit from selling copies of that information or licenses to that idea, however it must be known that again, society is completely different nowadays and this so called "theft" actually doesn't hurt anyone but some gigantic billion dollar corporation that doesn't even notice, no actual person gets hurt, only a legal entity, and these so called "theft" actually give rise to good, helpful things. In fact, hurting a corporation, by definition a [fascist](fascism.md) entity hostile to people, may further be seen as a good thing, so stealing from corporation is also good by this view. Furthermore the illusion of profit theft here is arbitrarily made, the "theft" exists only because we've purposefully created a system which allows selling copies of information and restricting ideas and therefore enables this "theft", i.e. this is no longer a natural thing, this is something miles away from the original meaning of the word "theft". With all this in mind we may, in today's context of the new meaning of old words, reconsider theft to no longer be generally bad. + +When confronted with a new view, political theory etc., we should try to turn shortcut thinking off. Doing this can be called **being open minded**, i.e. opening one's mind to reinterpretation of very basic concepts by a new view. Also we should probably update our association from time to time just to keep them up with the new state of the word. + +The politics and views of [LRS](lrs.md) requires extreme open mindedness to be accepted by someone indoctrinated by the standard capitalist fascist propaganda of today. \ No newline at end of file diff --git a/sin.md b/sin.md new file mode 100644 index 0000000..19ecd3b --- /dev/null +++ b/sin.md @@ -0,0 +1,110 @@ +# Sine + +Sine, abbreviated *sin*, is a [trigonometric](trigonometry.md) [function](function.md) that simply said models a smooth oscillation, it is one of the most important and basic functions in geometry, [mathematics](math.md) and [physics](physics.md), and of course in [programming](programming.md). Along with [cosine](cos.md), [tangent](tan.md) and [cotangent](cot.md) it belongs to a group of functions that can be defined by ratios of sides of a right triangle depending on one of the angles in it (hence *trigonometric* -- "triangle measuring"). If some measurement looks like sine function, we say it is *harmonic*. This is very common in nature and technology, e.g. a weight on a spring goes up and down by this function, [alternating current](ac.md) voltage has the sine shape (because it is generated by a circular motion) etc. + +The function is most commonly defined using a right triangle as follows. Consider the following triangle: + +``` + /| + / | + / | + c/ | + / |a + / | + / _| + /A____|_| + b +``` + +*Sin(A)*, where *A* is the angle between side *b* and *c*, is the ratio *a* / *c*. The function can be defined in many other ways, for example it is the curve we get when tracking only one direction (e.g. horizontal) of a point moving alongside circle. It can also be defined as a solution to some [differential equations](differential_equation.md) etc. + +The graph of the sine function is following: + +``` + ^ sin(x) + | + 1_|_ + | .--'''--. + -1/2 pi | _.'' ''._ 3/2 pi +.________|________.'________|________'|________|________.' --> x + '._ | _.'|0 | |'._ | _.'| + ''--___--'' _|_ 1/2 pi pi ''--___--'' 2 pi + -1 | +``` + +**Why the fuck are there these [pi](pi.md) values on the x line???** Nubs often can't comprehend this. These pi values are values in **[radians](radian.md)**, units of measuring angles where *2 pi* is the full angle (360 degrees). In fact sine is sometimes shown with [degrees](degree.md) instead of radians (so imagine 90 degrees on the line where there is 1/2 pi etc.), but mathematicians prefer radians. **But why are there angles in the first place???** Why doesn't it go e.g. from 0 to 1 like all other nice functions? Well, it's because of the relation to geometry, remember the fucking triangle above... also if you define sine with a circle it all repeats after *2 pi*. Just draw some picture if you don't get it. + +Some additional facts and properties regarding the sine functions are: + +- The domain are all [real numbers](real_number.md), the [codomain](codomain.md) are real numbers in interval <-1,1> (including both bounds). +- It is an [odd function](odd_function.md) (*-sin(x) = sin(-x)*). +- It is periodic, with a period of 2 [pi](pi.md). +- Sine is just shifted [cosine](cos.md), i.e. *sin(x) = cos(x - 1/2 pi)* +- Its inverse function is [arcus sine](asin.md), abbreviated *asin*, also written as *sin^-1* -- this function tells you what argument you need to give to sin to get a specific result number. It's actually an inverse of only part of the sine function because the whole sine function can't be inverted, it isn't [bijective](bijection.md). +- [Derivative](derivative.md) of *sin(x)* is *cos(x)*, the [integral](integral.md) of *sin(x) dx* is *-cos(x)*. +- By adding many differently shifted and scaled sine functions we can create basically any other function, see e.g. [cosine transform](cosine_transform.md). +- *sin(x)^2 + cos(x)^2 = 1* + +Some values of the sine function are: + +| x (rad) | x (deg) | sin(x) | +|----------|----------|--------------------| +| 0 | 0 | 0 | +| pi / 12 | 15 | ~0.259 | +| pi / 6 | 30 | 0.5 | +| pi / 4 | 45 | sqrt(2)/2 ~= 0.707 | +| pi / 3 | 60 | sqrt(3)/2 ~= 0.866 | +| pi / 2 | 90 | 1 | +| 2 pi | 360 | 0 | + + + +## Programming + +In programming languages sine is generally available in some math library, for example in [C](c.md) the function `sin` is in `math.h`. Spare yourself bugs, **always check if your sin function expects [radians](radian.md) or degrees!** + +There exists an **ugly engineering [approximation](approximation.md)** of sine that can be useful sometimes, it says that + +*sin(x) = x, for small x* + +Indeed, sine looks similar to a mere line near 0, but you can see it quickly diverges. + + +When implementing your own `sin` function, consider what you expect from it. + +If you want a small, fast and perhaps integer only `sin` function (the one we'd prefer in [LRS](lrs.md)) that doesn't need extreme accuracy, consider using a **[look up table](lut.md)**. You simply precompute the values of the sine function into a static table in memory and the function just retrieves them when called -- this is super fast. Note that you can save a lot of space by **only storing sine values between 0 and 1/2 pi**, the remaining parts of the function are just different transformations of this part. You can further save space and/or make the function work with [floats](float.md) by further [interpolating](interpolation.md) (even just linearly) between the stored values, for example if `sin(3.45)` is called and you only have values stored for `sin(3.4)` and `sin(3.5)`, you simply average them. + +If you don't need extreme speed there exist nice sine [approximation](approximation.md), e.g. the extremely accurate **Bhaskara I's approximation** (angle in radians): *sin(x) ~= (16 * x * (pi - x)) / (5 * pi^2 - 4 * x * (pi - x))*. (This formula is actually more elegant for cosine, so it may be even better to consider using that.) Here is a [C](c.md) [fixed point](fixed_point.md) implementation: + +``` +#define UNIT 1024 +#define PI ((int) (UNIT * 3.14159265)) + +/* Integer sine using Bhaskara's approx. Returns a number +in <-UNIT, UNIT> interval. Argument is in radians * UNIT. */ + +int sinInt(int x) +{ + int sign = 1; + + if (x < 0) // odd function + { + x *= -1; + sign = -1; + } + + x %= 2 * PI; + + if (x > PI) + { + x -= PI; + sign *= -1; + } + + int tmp = PI - x; + + return sign * (16 * x * tmp) / ((5 * PI * PI - 4 * x * tmp) / UNIT); +} +``` + +Another approach is to use [Taylor series](taylor_series.md) to approximate sine with a [polynomial](polynomial.md) to whatever precision we need (this is used e.g. in calculators etc.). \ No newline at end of file diff --git a/sjw.md b/sjw.md new file mode 100644 index 0000000..f824e25 --- /dev/null +++ b/sjw.md @@ -0,0 +1,5 @@ +# Social Justice Warrior + +Social justice [warrior](fight_culture.md) (SJW) is an especially active, [toxic](toxic.md) and aggressive kind of [pseudoleftist](pseudoleft.md) (a kind of [fascist](fascism.md)) that tries to [FIGHT](fight_culture.md) (especially on the Internet) anyone opposing the mainstream pseudoleftist gospel such as the [feminist](feminism.md) and [LGBT](lgbt.md) propaganda. An SJW is a very stupid and easily manipulated [NPC](npc.md), powered by mass hysteria and brainwashed by the cult of [political correctness](political_correctness.md) to which it is a slave and a servant. It is insecure and desperately seeks recognition, a place to belong, and places this goal before any other goals such as being a good man or doing good. An SJW spreads hatred and aims for bullying of those who commit [thought crime](thought_crime.md). + +SJWs say the term is pejorative. We say it's not pejorative enough xD \ No newline at end of file diff --git a/slowly_boiling_the_frog.md b/slowly_boiling_the_frog.md new file mode 100644 index 0000000..b44601b --- /dev/null +++ b/slowly_boiling_the_frog.md @@ -0,0 +1,9 @@ +# Slowly Boiling The Frog + +*Slowly boiling the frog* is a phrase said to communicate the idea that people will tolerate a great change for the worse if that change is very gradual, even if they would absolutely not tolerate this change being made quickly. It refers to an experiment in which a frog doesn't jump out of boiling water if the water temperature is raised very gradually (even though according to "modern science" this experiment isn't real). + +For example the amount and aggressiveness of brainwashing [ads](ad.md) and technological abuse that young people tolerate nowadays would have been absolutely unacceptable a few decades ago, but now it's the reality of life that few even question (some complete retards like that *linus tech* [faggot](faggot.md) even defend it). + +The technique of slowly boiling the frog is used by [corporations](corporation.md), [governments](government.md), fascists and idiots to slowly take away people's freedom in small steps: each step takes away a bit of freedom while promising some reward, normally in form of additional comfort -- normal people are too braindead to see the obvious trick and are enthusiastic about the change. If you tell them that giving up [net neutrality](net_neutrality.md) or [P2P](p2p.md) encryption will eventually lead to almost complete loss of freedom, they label you a [tinfoil](tinfoil.md) or "conspiracy theorist", they tell you that "it's not a big deal". So it will go on with other and other changes and the normie is still happy because he can only see one step ahead or behind. The bad thing is that it's not only the normie who will suffer --in fact he may even be happy as a slave robot of the system -- but you will suffer as well. Normies decide the future of the environment we all have to live in. + +Slowly boiling the frog works very well when spanning several generations because a new generation won't remember that things used to be better. Parents can tell them but young never listen to older generations, or take them seriously. A [zooomer](genz.md) won't remember that computers used to be better, he thinks that [bloated](bloat.md) phones filled with [ads](ad.md) and [DRM](drm.md) that don't work without Internet connection and that spy on you constantly are the only way of technology. \ No newline at end of file diff --git a/small3dlib.md b/small3dlib.md new file mode 100644 index 0000000..b64653b --- /dev/null +++ b/small3dlib.md @@ -0,0 +1,36 @@ +# Small3dlib + +Small3dlib (S3L) is a very portable [LRS](lrs.md)/[suckless](suckless.md) [single header](signle_header.md) 3D [software renderer](software_rendering.md) [library](library.md) written by [drummyfish](drummyfish.md) in the [C](c.md) programming language. It is very efficient and runs on many resource-limited computers such as embedded [open consoles](open_console.md). It is similar to [TinyGL](tinygl.md), but yet more simple. Small3dlib is [public domain](public_domain.md) [free software](free_software.md) under [CC0](cc0.md). + +The repository is available at https://codeberg.org/drummyfish/small3dlib and https://gitlab.com/drummyfish/small3dlib. + +Small3dlib can be used for rendering 3D graphics on almost any device as it is written in pure [C99](c99.md) without any software and hardware [dependencies](dependency.md); it doesn't use the standard library, [floating point](float.md) or [GPU](gpu.md). It is also very flexible, not forcing any preprogrammed [shaders](shader.md) -- instead it only computes which pixels should be rasterized and lets the programmer of the main application decide himself what should be done with these pixels (this is typically applying some [shading](shading.md) and writing them to screen). + +Some of the rendering features include: + +- different drawing strategies ([z-buffer](z_buffer.md), sorted rendering, ...) +- top-left rasterization rule (no holes between or overlaps of triangles) +- [perspective correction](perspective_correction.md) (either none, full or approximate) +- different near plane collision handling strategies (culling, clipping, shifting, ...) + +``` + xx#### + xxx######## + xxxx######### + xxxxx######### + xxxxxx######### + xxxxxxx######### + xxxxxxxx########## + xxxxxxxx######### + xxxxxxxx######### + xxxxxxxx######### + xxxxxxxx########## + xxxxxxxx########## + xxxxxxx########## + xxxxxxx########## + xxxxxxx....... + xxxxx...... + xxx..... +``` + +*Simple ASCII rendering made with small3dlib.* diff --git a/smallchesslib.md b/smallchesslib.md new file mode 100644 index 0000000..2791fea --- /dev/null +++ b/smallchesslib.md @@ -0,0 +1,5 @@ +# Smallchesslib + +TODO + +The repository is available at https://codeberg.org/drummyfish/smallchesslib. \ No newline at end of file diff --git a/smart.md b/smart.md new file mode 100644 index 0000000..96f6a7e --- /dev/null +++ b/smart.md @@ -0,0 +1,3 @@ +# Smart + +The adjective "smart", as in e.g. *smartphone*, is in the context of [modern](modern.md) technology used as a euphemism for malicious features that include [spyware](spyware.md), [bloat](bloat.md), [DRM](drm.md), ads, programmed [planned obsolescence](planned_obsolescence.md), unnecessary [dependencies](dependency.md) (such as required Internet connection), anti-repair design and others. "Smart" technology is far inferior to traditional technology and usually just downright harmful to its users and society as a whole, but normal (i.e. retarded) people think it's good because it has a nice name, so they buy and support such technology. They are [slowly boiled](slowly_boiling_the_frog.md) to accept "smart" technology as the standard. \ No newline at end of file diff --git a/smol_internet.md b/smol_internet.md new file mode 100644 index 0000000..d850163 --- /dev/null +++ b/smol_internet.md @@ -0,0 +1,7 @@ +# Smol Internet + +*TFW Internet became such shit people are running away from it.* + +Smol Internet, smol web, small web, smol net, dork web, poor man's web, web revival and similar terms refer to Internet technology (such as [gopher](gopher.md), [gemini](gemini.md), plain [HTML](html.md) etc.) and communities that are smaller, [simpler](kiss.md), less controlled and less [toxic](toxic.md) than the "big mainstream Internet" (especially the [Web](www.md)) which due to [capitalism](capitalism.md) became littered with [shit](shit.md) like [ads](marketing.md), unbearable [bloat](bloat.md), censorhip, [spyware](spyware.md), corporate propaganda, masses of [retarded people](influencer.md), [bullshit](bullshit.md) cheap visuals like animations etc. Consider this analogy: the mainstream, i.e. [world wide web](www.md), [Discord](discord.md), [Facebook](facebook.md) etc., is like a big shiny city, but as the city grows and becomes too stressful, overcrowded, hasted, overcontrolled with police and ads on every corner, people start to move to the countryside where life is simpler and happier -- smol Internet is the countryside. + +What EXACTLY constitutes a Smol Internet? Of course we don't really have exact definitions besides what people write on blogs, it also depends on the exact term we use, e.g. smol web may refer specifically to lightweight self-hosted websites while smol net will also include different protocols than [HTTP(s)](http.md) (i.e. things outside the Web). But we are usually talking about simpler ([KISS](kiss.md), [suckless](suckless.md), ...), alternative, [decentralized](decentralization.md), [self hosted](self_hosting.md) technology (protocols, servers, ...), and communities that strive to escape commercially spoiled spaces. These communities don't aim to grow to big sizes or compete with the mainstream Web, they do not seek to replace the Web or achieve the same things (popularity, profitability, ...) but rather bring back the quality the Web (and similar services such as [Usenet](usenet.md)) used to have in the early days such as relative freedom, unrestricted sharing, free speech, simplicity, decentralization, creative personal sites, comfiness, [fun](fun.md) and so on. It is for the people, not for companies and corporations. Smol Internet usually refers to [gopher](gopher.md) and [gemini](gemini.md), the alternative protocols to [HTTP](http.md), the basis of the Web. Smol Web on the other hand stands for simple, plain [HTML](html.md) web 1.0 static personal/community sites on the Web itself which are however hosted independently, often on one's own server (self hosted) -- such sites can be searched e.g. with the [wiby](wiby.md) search engine. It may also include small communities such as [pubnixes](pubnix.md) like [SDF](sdf.md) and [tildeverse](tildeverse.md). Other KISS communication technology such as [email](email.md) and [IRC](irc.md) may also fall under Smol Internet. \ No newline at end of file diff --git a/social_inertia.md b/social_inertia.md new file mode 100644 index 0000000..df2f880 --- /dev/null +++ b/social_inertia.md @@ -0,0 +1,3 @@ +# Social Inertia + +Social inertia appears when a social group continues to behave in an established way mainly because it has behaved that way for a long time, even if such behavior is no longer justified. \ No newline at end of file diff --git a/software.md b/software.md new file mode 100644 index 0000000..44fe4fa --- /dev/null +++ b/software.md @@ -0,0 +1,3 @@ +# Software + +The article you're looking for is [here](sw.md). \ No newline at end of file diff --git a/sorting.md b/sorting.md new file mode 100644 index 0000000..9ea06c5 --- /dev/null +++ b/sorting.md @@ -0,0 +1,22 @@ +# Sorting + +Sorting means rearranging a sequence, such as a [list](list.md) of numbers, so that the elements are put in a specific order (e.g. ascending or descending). In [computer science](compsci.md) sorting is quite a wide topic, there are dozens of sorting [algorithms](algorithm.md), each with pros and cons and different attributes are being studied, e.g. the algorithm's [time complexity](time_complexity.md), its stability etc. Sorting algorithms are a favorite subject of programming classes as they provide a good exercise for programming and analysis of algorithms and can be nicely put on tests :) + +Some famous sorting algorithms include [bubble sort](bubble_sort.md) (a simple KISS algorithm), [quick](quick_sort.md) and [merge](merge_sort.md) sort (some of the fastest algorithms) and [stupid sort](bogosort.md) (just tries different [permutations](permutation.md) until it hits the jackpot). + +In practice however we oftentimes end up using some of the simplest sorting algorithms (such as [bubble sort](bubble_sort.md)) anyway, unless we're programming a database or otherwise dealing with enormous amounts of data. If we need to sort just a few hundred of items and/or the sorting doesn't occur very often, a simple algorithm does the job well, sometimes even faster due to a potential initial overhead of a very complex algorithm. So always consider the [KISS](kiss.md) approach first. + +Attributes of sorting algorithms we're generally interested in are the following: + +- **[time](time_complexity.md) and [space](space_complexity.md) complexity**: Time and space complexity hints on how fast the algorithm will run and how much memory it will need, specifically we're interested in the **best, worst and average case** depending on the length of the input sequence. Indeed we ideally want the fastest algorithm, but it has to be known that a better time complexity doesn't have to imply a faster run time in practice, especially with shorter sequences. An algorithm that's extremely fast in best case scenario may be extremely slow in non-ideal cases. With memory, we are often interested whether the algorithm works **in place**; such an algorithm only needs a constant amount of memory in addition to the memory that the sorted sequence takes, i.e. the sequence is sorted in the memory where it resides. +- **implementation complexity**: A simple algorithm is better if it's [good enough](good_enough.md). It may lead to e.g. smaller code size which may be a factor e.g. in [embedded](embedded.md). +- **stability**: A stable sorting algorithm preserves the order of the elements that are considered equal. With pure numbers this of course doesn't matter, but if we're sorting more complex data structures (e.g. sorting records about people by their names), this attribute may become important. +- **comparative vs non-comparative**: A comparative sort only requires a single operation that compares any two elements and says which one has a higher value -- such an algorithm is general and can be used for sorting any data, but its time complexity of the average case can't be better than *O(n * log(n))*. Non-comparison sorts can be faster as they may take advantage of other possible integer operations. +- **[recursion](recursion.md) and [parallelism](parallel.md)**: Some algorithms are recursive in nature, some are not. Some algorithms can be parallelised e.g. with a [GPU](gpu.md) which will greatly increase their speed. +- **other**: There may be other specific, e.g. some algorithms are are slow if sorting an already sorted sequence (which is addressed by *adaptive* sorting), so we may have to also consider the nature of data we'll be sorting. Other times we may be interested e.g. in what machine instructions the algorithm will compile to etc. + +In practice not only the algorithm but also its implementation matters. For example if we have a sequence of very large data structures to sort, we may want to avoid physically rearranging these structures in memory, this could be slow. In such case we may want to use **indirect sorting**: we create an additional list whose elements are indices to the main sequence, and we only sort this list of indices. + +## List Of Sorting Algorithms + +TODO \ No newline at end of file diff --git a/soydev.md b/soydev.md new file mode 100644 index 0000000..0e615da --- /dev/null +++ b/soydev.md @@ -0,0 +1,14 @@ +# Soydev + +Sodevs are incompetent wanna-be programmers that usually have these characteristics: + +- Being pseudoleftist (fascist) political activists pushing [tranny software](tranny_software.md) and [COCs](coc.md) while actually being mainstream centrists in the tech world (advocating "[open-source](open_source.md)" instead of [free_software](free_software.md), being okay with [proprietary](proprietary.md) software, [bloat](bloat.md) etc.). +- Trying to be "cool", having friends, wearing T-shirts with "coding jokes", having tattoos, piercing and colored hair (also trimmed bear in case of males). +- Only being hired in tech for a no-brainer job such as "coding websites" or because of diversity quotas. +- Being actually bad at programming, using meme high-level languages like [JavaScript](javascript.md) and [Python](python.md). +- Using a [Mac](mac.md). +- Thinking they're experts in technology because they are familiar with the existence of [Linux](linux.md) (usually some mainstream distro such as [Ubuntu](ubuntu.md)) and can type `cd` and `ls` in the terminal. +- Being only briefly aware of the tech culture, telling big-bang-theory level jokes (*sudo make sandwich*, 42 hahahahahahaha). +- Being highly active on social networks, probably having a pixel-art portrait of their ugly face on their profile. +- Believing in and engaging in [capitalism](capitalism.md), believing corporations such as [Microsoft](microsoft.md), wanting to create "startups", being obsessed with [productivity](productivity_cult.md), inspirational quotes and masturbating to tech "visionaries" like [Steve Jobs](steve_jobs.md). +- Using buzzwords like "solution", "orchestration" etc. \ No newline at end of file diff --git a/soyence.md b/soyence.md new file mode 100644 index 0000000..30b1737 --- /dev/null +++ b/soyence.md @@ -0,0 +1,5 @@ +# Soyence + +Soyence is a mainstream propaganda and [business](business.md) claiming itself to be [science](science.md). It is what the typical reddit [atheist](atheism.md) believes is science or what Neil De Grass Tyson tells you is science. Soyence calls itself science and [gatekeeps](gatekeeping.md) itself by calling unpopular science -- such as that regarding human [race](race.md) or questioning big pharma [vaccines](vaccine.md) -- [pseudoscience](pseudoscience.md). + +Soyence relies on low [IQ](iq.md) and shallow education of its followers while making them believe they are smart, it produces propaganda such as "documentaries" with Morgan Freeman, series like The Big Bang Theory and [YouTube](youtube.md) videos with titles like "Debunking Flat Earth with FACTS AND LOGIC", so there's a huge mass of [NPCs](npc.md) thinking they are Einsteins who blindly support this cult. Soyence tries to ridicule and punish thinking outside the box and asking specific questions, i.e. it is not dissimilar to a mass [religion](religion.md). \ No newline at end of file diff --git a/splinternet.md b/splinternet.md new file mode 100644 index 0000000..97d7a46 --- /dev/null +++ b/splinternet.md @@ -0,0 +1,3 @@ +# Splinternet + +TODO \ No newline at end of file diff --git a/ssao.md b/ssao.md new file mode 100644 index 0000000..9e99195 --- /dev/null +++ b/ssao.md @@ -0,0 +1,9 @@ +# SSAO + +Screen space ambient occlusion (SSAO) is a technique in [computer graphics](graphics.md) of **[approximating](approximation.md)** ambient occlusions (basically dim shadows in corners) in a way that's easy and not so expensive to implement to run in [real time](real_time.md). + +Exact ambient occlusions can be computed with algorithms such as [path tracing](path_tracing.md) and this requires complete information about the geometry as to compute the exact light bounces, but that is way too slow for real time (even though actually path tracing is already kind of possible in real time, but requires expensive consoomer hardware). So game devs cheat and use a cheap approximation: SSAO is implemented as a [post-processing](post_processing.md) [shader](shader.md) and only uses the information available on the screen, specifically in the [depth buffer](z_buffer.md). This gives only partial information, the algorithm doesn't know what the back facing geometry looks like and has to make guesses which sometimes results in inaccuracies. + +This methods is notoriously ugly in certain conditions and many [modern](modern.md) [games](game.md) suffer from this, even the supposedly "photorealistic" engines like Unreal -- if someone is standing in front of a wall there is a shadow outline around him that looks so unbelievably ugly you literally want to puke. But normie eyes can't see this lol, they think that's how reality looks and they are okay with this shit, they allow this to happen. Normies literally destroy computer graphics by not being able to see correctly. + +What to do then? The most [suckless](suckless.md) way is to simply do no ambient occlusions -- seriously test how it looks and if it's okay just save yourself the effort, performance and complexity. Back in the 90s we didn't have this shit and games unironically looked 100 times better. You can also just [bake](baking.md) the ambient occlusions in textures themselves, either directly in the color texture or use so called **[light maps](light_map.md)**. Note that this makes the ambient occlusions static and with light maps you'll need more memory for textures. Finally, if you absolutely have to use SSAO, at least use it very lightly (there are parameters you can lower to make it less prominent). \ No newline at end of file diff --git a/steganography.md b/steganography.md new file mode 100644 index 0000000..28b23d5 --- /dev/null +++ b/steganography.md @@ -0,0 +1,15 @@ +# Steganography + +Steganography means hiding secret information in publicly accessible data; for example it is possible to hide text messages in a digital photograph by slightly modifying the colors of the image pixels -- that photo then looks just like an innocent picture while in fact bearing an extra information for those who can read it. Steganography differs from [encryption](encryption.md) by trying to avoid even suspicion of secret communication. + +There are many uses of steganography, for example in secret communication, bypassing censorship or secretly tracking a piece of digital media with an invisible [watermark](watermark.md) (game companies have used steganography to identify which game clients were used to leak pre-release footage of their games). [Cicada 3301](cicada.md) has famously used steganography in its puzzles. + +Steganography may need to take into account the possibility of the data being slightly modified, for example pictures exchanged on the [Internet](internet.md) lose their quality due to repeating compressions, cropping and format conversions. Robust methods may be used to preserve the embedded information even in these cases. + +Some notable methods and practices of steganography include: + +- Embedding in **text**, e.g. making intentional typos in certain places, using extra white or zero-width characters, modifying formatting and case or using [Unicode](unicode.md) homoglyphs can all carry information. +- Embedding in **images**. One of the simplest methods is storing data in least significant bits of pixel values (which won't be noticeable by human eyes). Advanced methods may e.g. modify statistical properties of the image such as its color [histogram](histogram.md). +- Embedding in **sound**, **video**, vector graphics and all other kinds of media is possible. +- All kinds of data can be embedded given enough storage capacity of given bearing medium (e.g. it is possible to store an image in text, sound in another sound etc.). +- Information that's present but normally random or unimportant can be used for embedding, e.g. the specific order of items in a list (its [permutation](premutation.md)) can bear information as well as length of time delays in timed data, amount of noise in data etc. \ No newline at end of file diff --git a/stereotype.md b/stereotype.md new file mode 100644 index 0000000..4cd86e9 --- /dev/null +++ b/stereotype.md @@ -0,0 +1,135 @@ +# Stereotype + +Stereotypes are general statistical observations, mostly about groups of people (such as different [races](race.md)), that were discovered naturally (without rigorous [scientific](science.md) effort). Stereotypes are good because they tell us what we may expect from different kinds of people. Of course no one, maybe with the exception of blonde women, is so stupid as to think stereotypes apply 100% -- let us repeat they are STATISTICAL observations, they talk about probabilities. + +Some stereotypes are: + +{ WIP ~drummyfish } + +- [Americans](usa.md): + - extremely stupid, primitive, close-minded, not knowing geography/history besides the US + - extremely fat, eat only fast food, have no real cuisine + - shallow, obsessed with looks (white teeth etc.) + - materialist, obsessed with money, hardcore [capitalists](capitalism.md), panic fear of anything resembling [communism](communism.md) + - arrogant, rude, individualist, self-centered + - eccentric, extroverted, loud behavior + - violent, militant, imperialist, constantly invade other countries + - don't mind violence but are afraid of public nudity + - solve things by brute force rather than by smartness + - obsessed with working as much as possible + - want everything big + - US south: slow, even more stupid, racist, rednecks, inbred, for slavery, for guns +- Asians: + - extremely smart + - all look the same + - polite + - don't show emotion + - work extremely hard + - small penises + - men of honor + - collectivist, sacrifice themselves for society + - there are too many of them, lives of the poor ones have no value, work safety of peasants is non existent +- [black people](nigger.md): + - unintelligent, stupid, uneducated, primitive + - physically fit, good at sports + - good at music, especially rhythmic music + - fathers leave their children + - all look the same + - have big dicks + - criminals +- Australians: + - tough, living in dangerous wilderness +- Arabs: + - terrorists, suicidal bombers + - women are belly dancers + - pedophiles, bigamists +- blond, attractive [women](woman.md): + - extremely stupid + - gold diggers +- Canadian: + - extremely polite + - ice hockey fans +- Chinese: + - smart, wise + - do martial arts + - make crappy off brands and cheap copies of western art, steal "intellectual property", manufacture cheap things at large quantities, everything is "made in China" + - don't value human rights +- Czech: + - heavy drinkers, especially beer + - friendly but appear cold + - beautiful women +- English: + - well behaved, reserved, educated + - conservative, old fashioned + - drink tea + - football fans + - dislike French +- French: + - good lovers + - lazy, Bohemian life + - eat baguettes and frogs + - dislike Brits + - revolutionaries, constantly protest + - artists, intellectuals +- [gays](gay.md): + - men act feminine, are good at art + - women (lesbian) are masculine, ugly with short pink hair +- Germans: + - no sense of [humor](fun.mf), being kind of robots + - precise, efficient, organized, great technology + - love beer and sausage + - ugly women +- Indians: + - extremely friendly, often too much + - no hygiene, dirty + - smart but poor + - good at [IT](it.md) but usually tech support scammers + - spiritual, peaceful, meditate a lot + - don't know what work safety means + - transport extremely big loads on bicycles or small motorcycles +- Italians: + - handsome men who are passionate lovers + - extremely passionate, have heated emotional arguments about even trivial things + - involved with mafia + - great focus on family, know and regularly meet distant relatives + - have mustaches, eat pizza and pasta + - talk with hands +- Japanese: + - like extremely weird things like actually living with sex dolls instead of human life partners + - salarymen regularly jump out of skyscraper windows due to overworking depression + - men talking Japanese to other men sound as if being aggressive to each other even if in fact being polite or talking something uninteresting + - everyone reads manga and goes to karaoke after work + - extremely precise, always on time, well organized + - have extremely technologically advanced toilets +- [jews](jew.md): + - very smart + - greedy + - good at [business](business.md) + - have the "eagle nose" + - members of secret societies, closed jew-only communities, conspire for world control, some being [fascists](fascism.md) wanting to become the ruling race + - spread everywhere like rats + - can adapt to any environment + - do all kinds of weird religious rituals +- Polish: + - very religious + - heavy drinkers +- Russians: + - very tough, big and strong, endure conditions that would kill other people + - drunk (especially by vodka), aggressive, rude + - wear Adidas pants + - act straight without talking too much, ignore work safety +- Slovak: + - who? +- Spanish: + - extroverted, passionate, dance flamenco + - take naps on siesta + - attractive tanned men +- [women](woman.md): + - bad at driving + - bad at logical thinking and [math](math.md) + - gossip + - don't know what they want, "no" can mean "yes" + - too emotional, especially on period + - attracted to douchebags and money, avoid nice guys + - can distinguish and name different shades of similar colors + - on board of a ship bring bad luck \ No newline at end of file diff --git a/steve_jobs.md b/steve_jobs.md new file mode 100644 index 0000000..cee21b9 --- /dev/null +++ b/steve_jobs.md @@ -0,0 +1,7 @@ +# Steve Jobs + +*"I'm not glad he'd dead, but I'm glad he's gone."* -- [Richard Stallman](rmd.md) + +Steve Jobs was a psychopathic entrepreneur that co-founded [Apple](apple.md) in which he was a [CEO](ceo.md) and nowadays has a cult of personality that makes Americans cum. He was mainly known for his ability to manipulate people and his contribution to the technology lies in making it more expensive, incompatible and consumerist. + +Jobs was born on February 24, 1955 and later was adopted which may have contributed to his development of psychopathy. He was already very stupid as a little child, he never really learned programming and was only interested in achieving what he wanted by crying and pressuring other people to do things for him. This translated very well to his adult life when he quit school to pursue money. He manipulated and abused his schoolmate [Steve Wozniak](wozniak.md), a [hacker](hacker.md), to make computers for him. They started [Apple](apple.md) in 1976 and started producing one of the first personal computers: Apple I and Apple II with which he won the [capitalist](capitalism.md) lottery and unfortunately succeeded on the market. Apple became a big ass company, however Jobs was such [shit](shit.md) CEO that **Apple fired him** lol. He went to do some other shit like NeXT. Then a bunch of things happened (TODO) and then, to the relief of the whole world, he died on October 5, 2011 from cancer. \ No newline at end of file diff --git a/suckless.md b/suckless.md new file mode 100644 index 0000000..3b5d9b3 --- /dev/null +++ b/suckless.md @@ -0,0 +1,39 @@ +# Suckless + +Suckless, software that sucks less, is a type of [free](free_software.md) [software](software.md), as well as an organization (http://suckless.org/), that tries to adhere to a high technological [minimalism](minimalism.md), freedom and hackability, and opposes so called [bloat](bloat.md) and unnecessary complexity which has been creeping into most "[modern](modern.md)" software and by which technology has started to become less useful and more burdening. It is related to [Unix philosophy](unix_philosophy.md) and [KISS](kiss.md) but brings some new ideas onto the table. [LRS](lrs.md) builds on top of suckless ideas. + +Notable suckless promoters on mainstream social media include [Luke Smith](luke_smith.md), [DistroTube](distrotube.md) and [Mental Outlaw](mental_outlaw.md). + +{ From what it seems to me, the "official" suckless community is largely quiet and closed, leading conversations mostly on mailing lists and focusing almost exclusively on the development of their software without politics, activism and off topics, probably because they consider it bullshit that would only be distracting. There is also suckless subreddit which is similarly mostly focused on the software alone. They let their work speak. Some accuse the community of being Nazis, however I believe this is firstly irrelevant and secondly mostly false accusations of haters, even if we find a few Nazis among them, just as in any community. Most pro-suckless people I've met were actually true socialists (while Nazis are not socialist despite their name). Unlike [tranny software](tranny_software.md), suckless software itself doesn't promote any politics, it is a set of purely functional tools, so the question of the developers' private opinions is unimportant here. Suckless ideas are good regardless of whose brains they came from. ~drummyfish } + +## Attributes + +- Being [free software](free_software.md). +- Extreme [minimalism](minimalism.md) and minimizing [dependencies](dependency.md), elimination of any [bullshit](bullshit.md) and [bloat](bloat.md). +- Configuration of software is part of its source code (`config.h`) and change of this configuration requires recompiling the software (which is extremely easy and fast with suckless software). This removes the need for dealing with config files which requires special libraries, file systems and extra code. +- Mainly using two [programming languages](programming_language.md): [C](c.md) (C89 or C99) for compiled programs and [POSIX shell](posix_shell.md) for scripting. +- [Forking](fork.md) by default, software is distributed in source format, every user is supposed to create a personal customized fork and compile/customize the software himself. +- Mods (extension/addons) are implemented and distributed as [patch](patch.md) files. +- Permissive licensing such as [MIT](mit.md), [CC0](cc0.md) etc. +- Typical upper limit for [lines of code](loc.md) of a program being 10k. +- Focus on the technology itself without mixing it with [politics](politics.md) and other [bullshit](bs.md) such as [COCs](coc.md). + +## History + +Suckless in current form has existed since 2006 when the domain suckless.org was registered by a German guy Anselm R. Garbe who is the founder of the community. It has evolved from a community centered around specific software projects, most notably [wmii](wmii.md). Garbe has given interview about suckless in FLOSS Weekly episode 355. + +Some time before 2010 suckless developed [stali](stali.md), a statically linked [glibc](glibc.md)-less ["Linux distro"](distro.md) that was based on the idea that [dynamic linking](dynamic_linking.md) is [harmful](harmful.md) and that [static linking](static_linking.md) is mostly advantageous. It also came with suckless software by default. This project was made independent and split from suckless in 2018 by Garbe. + +In 2012 a core veteran member of suckless, [Uriel](uriel.md), has killed himself and became a [meme](meme.md). + +## Projects + +Notable projects developed by the suckless group include: + +- [dwm](dwm.md) +- [st](st.md) +- [dmenu](dmenu.md) +- [surf](surf.md) +- [stali](stali.md) + +However there are many more, check out their website. \ No newline at end of file diff --git a/suicide.md b/suicide.md new file mode 100644 index 0000000..7447403 --- /dev/null +++ b/suicide.md @@ -0,0 +1,5 @@ +# Suicide + +Suicide is when someone voluntarily kills himself. Suicide offers an immediate escape from [capitalism](capitalism.md) and is therefore recommended to everyone. + +{ Really though, if you want to talk, send me an email. Don't forget we love you no matter who you are or what you ever did. ~drummyfish } \ No newline at end of file diff --git a/sw.md b/sw.md new file mode 100644 index 0000000..56bff4c --- /dev/null +++ b/sw.md @@ -0,0 +1,5 @@ +# Software + +Software (SW) are programs that run on a computer, i.e. its non-physical parts (as opposed to [hardware](hw.md)); for example an [operating system](os.md), the internet [browser](browser.md) etc. Software is created by [programming](programming.md). + +Usually we can pretty clearly say what is software and what is hardware, but there are cases where it's debatable. Normally software is that about the computer which *can relatively easily be changed* (i.e. reinstalled by a typing a few commands or clicking a few buttons) while hardware is *hard-wired*, difficult to modify, and not expected or designed to be modified. Nevertheless e.g. some [firmware](firmware.md) is kind of software in form of instructions which is however many times installed in some special kind of memory that's difficult to reprogram and not expected to be reprogrammed often -- some software may be "burned in" into a circuit so that it could only be changed by physically rewiring the circuit (the ME spyware in [Intel](intel.md) [CPU](cpu.md)s has a built-in [minix](minix.md) operating system). And this is where it may sometimes be difficult to decide where the line is drawn. This issue is encountered e.g. by the [FSF](fsf.md) which certifies some hardware that works with free software as "Respects Your Privacy" (RYF), and they have very specific definition what to them classifies software. \ No newline at end of file diff --git a/sw_rendering.md b/sw_rendering.md new file mode 100644 index 0000000..02e4bee --- /dev/null +++ b/sw_rendering.md @@ -0,0 +1,40 @@ +# Software Rendering + +Sofware (SW) rendering refers to [rendering](rendering.md) [computer graphics](graphics.md) without the help of [graphics card](gpu.md) (GPU), i.e. computing images only with [CPU](cpu.md). This mostly means rendering [3D](3d.md) graphics but can also refer to other kinds of graphics such as drawing [fonts](font.md) or [video](video.md). Before GPUs were invented, all rendering was done in software, of course -- games such as [Quake](quake.md) were designed with SW rendering and only added possible GPU acceleration later. SW rendering for traditional 3D graphics is also called software [rasterization](rasterization.md). + +SW rendering has advantages and disadvantages. Firstly it is **much slower** -- GPUs are designed to perform graphics-specific operations very quickly and, more importantly, they can process many pixels (and other elements) in [parallel](parallelism.md), while a CPU has to compute pixels sequentially one by one and that in addition to all other computations it is otherwise performing. This causes a much lower [FPS](fps.md) in SW rendering. For this reasons SW rendering is also normally of **lower quality** (lower resolution, [nearest neighbour](nn.md) texture filtering, ...) to allow workable FPS. Nevertheless thanks to the ginormous speeds of today's CPUs simple fullscreen SW rendering can be pretty fast on PCs and achieve even above 60 FPS; on slower CPUs (typically [embedded](embedded.md)) SW rendering is usable normally at around 30 FPS if resolutions are kept small. + +On the other hand SW rendering is more [portable](portability.md) (as it can be written purely in a portable language such as [C](c.md)), less [bloated](bloat.md) and **eliminates the [dependency](dependency.md) on GPU** so it will be supported almost anywhere as every computer has a CPU, while not all computers (such as [embedded](embedded.md) devices) have a GPU (or, if they have it, it may not be sufficient, supported or have a required [driver](driver.md)). SW rendering may also be implemented in a simpler way and it may be easier to deal with as there is e.g. no need to write [shaders](shader.md) in a special language, manage transfer of data between CPU and GPU or deal with parallel programming. SW rendering is the [KISS](kiss.md) approach. + +SW rendering may also utilize a much wider variety of rendering techniques than only 3D [rasterization](rasterization.md) traditionally used with [GPUs](gpu.md) and their [APIs](api.md), thanks to not being limited by hard-wired pipelines. This may include [splatting](splatting.md), [raytracing](raytracing.md) or [BSP rendering](bsp.md) (and many other ["pseudo 3D"](pseudo3d.md) techniques). + +A lot of software and rendering frameworks offer both options: accelerated rendering using GPU and SW rendering as a [fallback](fallback.md) (in case the first option is not possible). Sometimes there exists a rendering [API](api.md) that has both an accelerated and software implementation (e.g. [TinyGL](tinygl.md) for [OpenGL](opengl.md)). + +For simpler and even somewhat more complex graphics **purely software rendering is a lot of times the best choice**. [LRS](lrs.md) suggests you prefer this kind of rendering for its simplicity and portability, at least as one possible option. On devices with lower resolution not many pixels need to be computed so SW rendering can actually be pretty fast despite low specs, and on "big" computers there is nowadays usually an extremely fast CPU available that can handle comfortable FPS at higher resolutions. There is a LRS software renderer you can use: [small3dlib](s3l.md). + +SW renderers are also written for the purpose of verifying rendering hardware, i.e. as a [reference implementation](reference_implementation.md). + +Note that SW rendering doesn't mean our program is never touching [GPU](gpu.md) at all, in fact most personal computers nowadays **require** some kind of GPU to even display anything. SW rendering only means that computation of the image to be displayed doesn't use any hardware specialized for this purpose. + +Some SW renderers make use of specialized CPU instructions such as [MMX](mmx.md) which can make SW rendering faster thanks to handling multiple data in a single step. This is kind of a mid way: it is not using a GPU per se but only a mild form of hardware acceleration. The speed won't reach that of a GPU but will outperform a "pure" SW renderer. However the disadvantage of a hardware dependency is still present: the CPU has to support the MMX instruction set. Good renderers only use these instructions optionally and fall back to general implementation in case MMX is not supported. + +**Programming your own 3D software rasterizer** (in case [small3dlib](small3dlib.md) is somehow not enough for you): difficulty of this task depends on features you want -- a super simple [flat shaded](flat_shading.md) (no textures, no smooth shading) renderer is relatively easy to make, especially if you don't need movable camera, can afford to use [floating point](float.md) etc. See the details of [3D rendering](3d_rendering.md), especially how the GPU pipelines work, and try to imitate them in software. The core of these renderers is the **[triangle](triangle.md) [rasterization](rasterization.md)** algorithm which, if you want, can be very simple -- even a naive one will give workable results -- or pretty complex and advanced, using various optimizations and things such as the [top-left rule](top_left_rule.md) to guarantee no holes and overlaps of triangles. Remember this function will likely be the performance [bottleneck](bottleneck.md) of your renderer so you want to put effort into [optimizing](optimization.md) it to achieve good [FPS](fps.md). Once you have triangle rasterization, you can draw 3D models which consist of vertices (points in 3D space) and triangles between these vertices (it's very simple to load simple 3D models e.g. from the [obj](obj.md) format) -- you simply project (using [perspective](perspective.md)) 3D position of each vertex to screen coordinates and draw triangles between these pixels with the rasterization algorithm. Here you need to also solve [visibility](visibility.md), i.e. possible overlap of triangles on the screen and correctly drawing those nearer the view in front of those that are further away -- a very simple solution is a [z buffer](z_buffer.md), but to save memory you can also e.g. [sort](sorting.md) the triangles by distance and draw them back-to-front ([painter's algorithm](painters_algorithm.md)). You may add a [scene](scene.md) data structure that can hold multiple models to be rendered. If you additionally want to have movable camera and models that can be transformed (moved, rotated, scaled, ...), you will additionally need to look into some [linear algebra](linear_algebra.md) and [transform matrices](transform_matrix.md) that allow to efficiently compute positions of vertices of a transformed model against a transformed camera -- you do this the same way as basically all other 3D engines (look up e.g. some [OpenGL](opengl.md) tutorials). If you also want texturing, the matter gets again a bit more complicated, you need to compute [barycentric](barycentric.md) coordinates (special coordinates within a triangle) as you're rasterizing the triangle, and possibly apply [perspective correction](perspective_correction.md) (otherwise you'll be seeing distortions). You then map the barycentrics of each rasterized pixel to [UV](uv.md) (texturing) coordinates which you use to retrieve specific pixels from a texture. On top of all this you may start adding all the advanced features of typical engines such as [acceleration structures](acceleration_structure.md) that for example discard models that are completely out of view, [LOD](lod.mf), instancing, [MIP maps](mip_map.md) and so on. + +## Specific Renderers + +These are some notable software renderers: + +- **[Build engine](build_engine.md)**: While not a "true 3D", this was a very popular [proprietary](proprietary.md) portal-rendering engine for older games like Duke Nukem 3D or Blood. +- **[BRender](brender.md)**: Old commercial renderer used in games such as Carmageddon, Croc or Harry Potter 1. Later made [FOSS](foss.md). +- **[id Tech](id_tech.md)**: Multiple engines by [Id software](id.md) (later made [FOSS](foss.md)) used for games like [Quake](quake.md) included a software renderer. +- **[Irrlich](irrlicht.md)**: [FOSS](foss.md) game engine including a software renderer as one of its [backends](backend.md). +- **[Mesa](mesa.md)**: [FOSS](foss.md) implementation of [OpenGL](opengl.md) that includes a software rasterizer. +- **[small3dlib](s3l.md)**: [LRS](lrs.md) [C](c.md) 3D rasterizer, very simple. +- **SSRE**: The guy who wrote [LIL](lil.md) also made this renderer named Shitty Software Rendering Engine, accessible [here](http://runtimeterror.com/tech/ssre/). +- **[TinyGL](tinygl.md)**: Implements a subset of [OpenGL](opengl.md). +- Many old [games](game.md) in the 90s implemented their own software renderers, so you can look there. + +## See Also + +- [3D rendering](3d_rendering.md) +- [pseudo/primitive 3D, 2.5D](pseudo3d.md) \ No newline at end of file diff --git a/systemd.md b/systemd.md new file mode 100644 index 0000000..d16d37b --- /dev/null +++ b/systemd.md @@ -0,0 +1,5 @@ +# Systemd + +Systemd is a pretty bad, [bloated](bloat.md), [anti-Unix](unix_philosophy.md), [free-licensed](free_software.md) "software suite" used for initialization of an [operating system](os.md) and handling services like loggging in or managing network connections. It is a so called [PID 1](pid1.md) process. Systemd has been highly criticised by the proponents of [suckless](suckless.md) and [LRS](lrs.md) and even normies for its bloat, anti-Unix-philosophy design, [feature creep](feature_creep.md), security vulnerabilities and other stuff. Unfortunately it is being adopted by many [GNU](gnu.md)/[Linux](linux.md) distributions including [Arch Linux](arch.md) and [Debian](debian.md). + +For more detailed bashing of systemd see e.g. https://nosystemd.org/. It nicely sums up systemd with a quote: *"If this is the solution, I want my problem back*". \ No newline at end of file diff --git a/tas.md b/tas.md new file mode 100644 index 0000000..e0fb2b5 --- /dev/null +++ b/tas.md @@ -0,0 +1,17 @@ +# Tool Assisted Speedrun + +Tool assisted speedrun (TAS, also more generally *tool assisted superplay*) is a category of [game](game.md) [speedruns](speedrun.md) in which help of any tools is allowed, even those that would otherwise be considered [cheating](cheating.md), e.g. scripts, savestates, [aimbots](aimbot.md) or time manipulation, however NOT those that alter the game itself. This makes it possible to create flawless, perfect or near-perfect runs which can serve as a theoretical upper limit for what is achievable by humans -- and of course TAS runs are pretty [fun](fun.md) to watch. The normal, non-TAS runs are called RTA (real time attack). For example the current (2022) RTA world record of Super Mario Bros is 4.58.881 while the TAS record is 4.41.27. + +{ Watching a TAS is kind of like watching the [God](god.md) play the game. I personally like to watch Trackmania TASes, some are really unbelievable. Elastomania TASes are also pretty fucked up. Also note that [SAF](saf.md) games have TAS support. ~drummyfish } + +There is a website with videos of game TASes: https://tasvideos.org/. + +TAS does NOT allow hacking the game in other ways than what's possible to achieve by simply playing the game, i.e. it is not possible to hex edit the game's code before running it or manipulate its RAM content at run time with external tools. However note that some games are buggy and allow things such as altering their RAM content or code by merely playing the game (e.g. Pokemon Yellow allows so called arbitrary code execution), which generally IS allowed. The goal of TAS is merely to find, as best as we can, the series of game inputs that will lead to completing the game as fast as possible. For this the game pretty much needs to be [deterministic](determinism.md), i.e. the same sequence of inputs must always reproduce the same run when replayed later. + +TAS runs coexist alongside RTA (non-TAS) runs as separate categories that are beneficial to each other: RTA runners come up with speedrunning techniques that TAS programmers can perfectly execute and vice versa, TAS runners many times discover new techniques and ideas for RTA runners (for example the insane discovery of groundbreaking noseboost when TAS was introduced to Trackmania). In fact RTA and TAS runners are many times the very same people. Of course if you submit a TAS run in RTA category, you'll be seen as a cheater. + +Creating a TAS is not an easy task, it requires great knowledge of the game (many times including its code) and its speedrunning, as well as a lot of patience and often collaboration with other TASers. TASes are made *offline* (not in real time), i.e. hours of work are required to program minutes or even seconds of the actual run. Many paths need to be planned and checked. Compared to RTAs, the focus switches from mechanical skills towards skillful mathematical analysis and planning. Besides this some technological prerequisites are necessary: the actual tools to assist with creation of the TAS. For many new [proprietary](proprietary.md) games it is extremely difficult to develop the necessary tools as their source code isn't available, their assembly is obscured and littered with "anti-cheating" malware. The situation is better with old games that are played in [emulators](emulator.md) such as [DOS](dos.md) games or games for consoles like [GameBoy](gameboy.md) -- emulators can give us a complete control over the environment, they allow to save and load the whole emulator state at any instant, we may slow the time down arbitrarily, rewind and script the inputs however we wish (an advanced technique includes e.g. [bruteforcing](brute_force.md): exhaustively checking all possible combinations of inputs over the following few frames to see which one produces the best time save). In games that don't have TAS tools people at least try to do the next best thing with segmented speedruns. + +There also exists a term *tool assisted superplay* which is the same principle as TAS but basically with the intention of just flexing, without the goal of finishing the game fast (e.g. playing a [Doom](doom.md) level against hundreds of enemies without taking a single hit). + +Some idiots are against TASes for various reasons, mostly out of fear that TASers will use the tools to cheat in RTAs or that TASes will make the human runners obsolete etc. That's all bullshit of course, as can e.g. be seen in the case of [Trackmania](trackmania.md) -- in 2021 TAS tools started to appear for Trackmania and many people feared it would kill the game's competition, however after the release of the tools no such disaster happened, TAS became hugely popular and now everyone loves it, human competition happily continues, plus the development of the tools actually helped uncover many cheaters among the top players (such as Riolu who was forced to leave the scene, this caused a nice drama in the community). \ No newline at end of file diff --git a/tech.md b/tech.md new file mode 100644 index 0000000..a61cc1e --- /dev/null +++ b/tech.md @@ -0,0 +1,3 @@ +# Tech + +Tech is a short for [technology](technology.md). \ No newline at end of file diff --git a/technology.md b/technology.md new file mode 100644 index 0000000..61372ab --- /dev/null +++ b/technology.md @@ -0,0 +1,3 @@ +# Technology + +Technology ("tech") encompasses tools and knowledge of making such tools invented and achieved mainly with the help of [science](science.md) and by long systematic effort. This includes everything from stone tools to space rockets and [artificial intelligence](ai.md). On the Internet, as well as on this Wiki, this term is often used with the focus on [computer](computer.md) technology, i.e. [hardware](hardware.md) and [software](software.md), as this is the kind of technology that is being discussed and developed the most in our days. Technology, like fire, should serve us, but can also be dangerous and often gets misused and abused. \ No newline at end of file diff --git a/ted_kaczynski.md b/ted_kaczynski.md new file mode 100644 index 0000000..cf6b15a --- /dev/null +++ b/ted_kaczynski.md @@ -0,0 +1,23 @@ +# Ted Kaczynski + +*"The Industrial Revolution and its consequences have been a disaster for the human race."* --Ted Kaczynski + +Ted Kaczynski, known as *Unabomber*, is an imprisoned American [mathematician](math.md) who lived a simple life in the nature, warned of the dangers of advanced technology and killed several people by mailing them bombs in order to bring attention to his manifesto that famously starts with the words "The Industrial Revolution and its consequences have been a disaster for the human race". Besides being one of the most famous mass murderers he is very well known in the tech community. + +Ted was born on May 22 1942 in Chicago. As a kid he was very shy. He was also extremely smart ([IQ](iq.md) measured at 167), skipped a few grades, graduated from Harvard at 20 years old and got a [PhD](phd.md) at 25 at the University of Michigan. Then he became a professor at the University of California, until his resignation in 1969. + +Fun fact: at one point he considered a gender change surgery. + +In 1971 he moved to a remote cabin in the woods in Montana where he lived in a primitive way with no electricity or running water. He grew more and more disenchanted with the society, especially with its technology and how it's enslaving and destroying humanity. The last straw may have been the moment when a road was built nearby his cabin, in the middle of the nature he loved. + +He started sending hand-made bombs to various universities and airports (hence the nickname *Unabomber*, *university and airline bomber*). He managed to kill 3 people and injured dozens of others. He was arrested on April 3, 1996 in his cabin. He got life imprisonment in court. + +## Manifesto + +The manifesto is named *Industrial Society and Its Future*. In it he refers to his movement as a *Freedom Club* (FC). Let's start by summarizing it: + +{ The following is a sum up according to how I personally understood it, there's most likely subjective bias but I did my best. ~drummyfish } + +First he bashes "leftists", analyses their psychology and says they are kind of degenerate sheeple, characterized by low self esteem, inventing bullshit artificial issues (such as the issue of [political correctness](political_correctness.md)), sometimes using violence. He also criticizes conservatives for supporting technological and economical growth which in his view inevitably brings on shift in societal values and said degeneracy. The usual societal issues are presented such as bad mental health, people being slaves to the system, feeling powerless, having no security, no autonomy etc. The cause of unhappiness and other human issues is identified as people not being able to fulfill what he sees as a necessity for fulfilling life, so called *power process*, the process of considerable struggle towards a *real* goal that can be achieved such as obtaining food by hunting -- he argues nowadays it's "too easy" to satisfy these basic needs and people invent artificial "surrogate" activities (such as sports, activism and even science) to do to try to fulfill the power process, however he sees these artificial activities as harmful, not *real* goals. It is mentioned we only have freedom in unimportant aspects of life, the system controls and regulates everything, brainwashes people etc. He defines real freedom as the opportunity to go through the power process naturally and being in control of one's circumstances. It is talked a lot about modification of humans themselves, either by advanced psychological means (propaganda), drugs or genetic modification which is seen as a future danger. A number of principles by which society works is outlined and it is concluded that the industrial society can't be reformed, a revolution is needed (not necessarily violent). Ted argues the system needs to be destroyed, we have to get back to the nature, and for this revolution he outlines a plan and certain recommendations (creation of ideology for intellectuals and common folk, the necessity of the revolution being world-wide etc.). He ends with again bashing "leftism" and warns they must never be collaborated with. + +Now Let us leave a few comments on the manifesto. Firstly we have to say the text is easy to read, well thought through and Ted makes some great points, many of which we completely agree; this includes the overall notion of technology having had mostly negative effects on recent society, the pessimistic view of our future and the criticism of "harmful modern bullshit" such as political correctness. He analyzes and identifies some problems in society very well (e.g. the propaganda that's so advanced that even its creators aren't usually consciously aware they're creating propaganda, his analysis of the inner working of the system is spot on). Nevertheless we also **disagree on many points**. Firstly we use different terminology; people who Ted calls *leftist* and whom he accuses of degeneracy and harmfulness we call [pseudoleftists](pseudoleft.md), we believe in a truly leftist society (i.e. nonviolent, altruistic, non-censoring, loving without fascist tendencies). **We disagree on Ted's fundamental assumption** that people can't change, i.e. that people are primitive animals that need to live primitive lives (go through the power process by pursuing *real* goals such as obtaining food by hunting) in order to be happy (we are not against primitivism but we support it for other reasons). We believe society can become adult, just like an individual, if it is raised properly (i.e. with effort) and that the primitive side of a human can be overshadowed by the the intellectual side and that activities he calls *surrogate* (and considers undesirable) can be fulfilling. We think that in a sane, adult society **advanced technology can be helpful** and compatible with happy, fulfilling lives of people, even if the current situation is anything but. And of course, we are completely nonviolent and disagree with murdering people for any reason such as bringing attention to a manifesto. diff --git a/teletext.md b/teletext.md new file mode 100644 index 0000000..63d5304 --- /dev/null +++ b/teletext.md @@ -0,0 +1,9 @@ +# Teletext + +Teletext is now pretty much obsolete technology that allowed broadcasting extremely simple read-only text/graphical pages along with TV signal so that people could browse them on their [TVs](tv.md). It was used mostly in the 70s, 80s and 90s but with [world wide web](www.md) teletext pretty much died. + +{ Just checked on my TV and it still works in 2022 here. For me teletext was something I could pretend was "the internet" when I was little and when we didn't have internet at home yet, it was very cool. Back then it took a while to load any page but I could read some basic news or even browse graphical logos for cell phones. Nowadays TVs have buffers and have all the pages loaded at any time so the browsing is instantaneous. ~drummyfish } + +The principal difference against the [Internet](internet.md) was that teletext was [broadcast](broadcast.md), i.e. it was a one-way communication. Users couldn't send back any data or even request any page, they could only wait and catch the pages that were broadcast by TV stations (this had advantages though, e.g. it couldn't be [DDOSed](ddos.md)). Each station would have its own teletext with fewer than 1000 pages -- the user would write a three place number of the page he wanted to load ("catch") and the TV would wait until that page was broadcast (this might have been around 30 seconds at most), then it would be displayed. The data about the pages were embedded into unused parts of the TV signal. + +The pages allowed fixed-width text and some very blocky graphics, both could be colored with very few basic colors. It looked like something you render in a very primitive [terminal](terminal.md). \ No newline at end of file diff --git a/temple_os.md b/temple_os.md new file mode 100644 index 0000000..2ffd365 --- /dev/null +++ b/temple_os.md @@ -0,0 +1,28 @@ +# Temple OS + +Temple OS is a funny [operating system](os.md) made by a schizophrenic guy [Terry Davis](terry_davis.md) who has become a [meme](meme.md) and achieved legendary status for this creation in the internet tech circles as it's extremely impressive that a single person creates such a complex OS and also the OS features and the whole context of its creation are quite funny. It has a website at https://templeos.org. + +According to Terry, God commanded him to write TempleOS and guided him in the development: for example it was demanded that the resolution be 640x480. It is written in [HolyC](holy_c.md), Terry's own language. The OS comes with GUI, 2D and 3D library, [games](game.md) and even a program for communicating with God. + +Notable Temple OS features and programs are: + +- [multitasking](multitasking.md) (non-preemptive) +- supported [file systems](file_system.md): [FAT32](fat32.md), ISO9660, RedSea (custom) +- HolyC compiler +- 2D/3D library +- oracle (communcate with God) +- [games](game.md) +- [IDE](ide.md) supporting images and 3D models embedded in text + +In his video blogs Terry talked about how technology became spoiled and that TempleOS is supposed to be [simple](minimalism.md) and [fun](fun.md). For this and other reasons the OS is limited in many way, for example: + +- no networking +- Only runs on [x64](x64.md). +- Only runs in 640x480 16 color display mode. +- single audio voice +- ring-0 only +- single address space +- multitasking is non-preemptive (programs have to yield CPU themselves) + +Temple OS source code has over 100000 [LOC](loc.md). It is publicly available and said to be in the [public domain](public_domain.md), however there is no actual [license](license.md)/waiver in the repository besides some lines such as "100% public domain" which are legally questionable and likely ineffective (see [licensing](license.md)). + diff --git a/tensor_product.md b/tensor_product.md new file mode 100644 index 0000000..d4f389b --- /dev/null +++ b/tensor_product.md @@ -0,0 +1,5 @@ +# Tensor Product + +TODO + +*a (x) b = [a0 * b0, a0 * b1, a0 * b2, ... a1 * b0, a1 * b1, ... an * b0, an * b1, ...]* \ No newline at end of file diff --git a/terry_davis.md b/terry_davis.md new file mode 100644 index 0000000..3878cc5 --- /dev/null +++ b/terry_davis.md @@ -0,0 +1,11 @@ +# Terry Davis + +*"An idiot admires complexity, a genius admires simplicity"* --Terry Davis + +Terry A. Davis, aka the *divine intellect*, born 1969, was a genius/schizophrenic [programmer](programming.md) that singlehandedly created [TempleOS](temple_os.md). For that he became a legend and a [meme](meme.md) in the tech circles, especially on [4chan](4chan.org) which additionally valued his [autistic](autism.md) and politically incorrect behavior. + +He was convinced he could talk to God and that God commanded him to make an operating system with certain parameters. According to himself he was gifted a *divine intellect* and was the "best programmer that ever lived". Terry was making [YouTube](youtube.md) talking/programming videos in which God was an often discussed topic. He was also convinced that the government was after him and often delved into the conspiracies against him, famously proclaiming that **"CIA [niggers](nigger.md) glow in the dark"** (the "glowing in dark" caught on as a phrase used for someone suspicious). He was in mental hospital several times and later became homeless (still posting videos from his van). An entertaining fact is also that he fell in love with a famous female physics YouTuber Dianna Cowern which he stalked online. In 2018 he was killed by a train but he left behind tons of videos full of endless entertainment, and sometimes even genuine wisdom. + +Terry greatly valued [simplicity](minimalism.md) and [fun](fun.md) in programming, he saw that technology went to [shit](shit.md) and wanted to create something in the oldschool style, and he expressed his will to dedicate his creation to the [public domain](public_domain.md). This is of course extremely based and appreciated by [us](lrs.md). + + diff --git a/throwaway_script.md b/throwaway_script.md new file mode 100644 index 0000000..6b20c49 --- /dev/null +++ b/throwaway_script.md @@ -0,0 +1,7 @@ +# Throw Away Script + +Throw away script is a script for one-time job which you "throw away" after its use. Such scripts may be [ugly](ugly.md), badly written and don't have to follow [LRS](lrs.md) principles as their sole purpose is to quickly achieve something without any ambition to be good, future-proof, readable, reusable etc. + +For example if you have a database in some old format and want to convert it to a new format, you write a throw away script to do the conversion, or when you're mocking an idea for a [game](game.md), you write a quick throw away prototype in JavaScript to just test how the gameplay would feel. + +For throw aways cripts it is acceptable and often preferrable to use languages otherwise considered bad such as [Python](python.md) or [JavaScript](javascript.md). diff --git a/tom_scott.md b/tom_scott.md new file mode 100644 index 0000000..2cfe081 --- /dev/null +++ b/tom_scott.md @@ -0,0 +1,5 @@ +# Tom Scott + +TODO + +LOL this idiot tries to take some kind of ownership of ideas in a video called *14 science fiction stories in under 6 minutes* (iQGl-ffVtaM), he just comes up with story ideas and says people have to have his permission for commercial use, even though it's probably not legally possible to own ideas like this. Fucking fascist. Do not support. \ No newline at end of file diff --git a/tranny_software.md b/tranny_software.md new file mode 100644 index 0000000..3ab9730 --- /dev/null +++ b/tranny_software.md @@ -0,0 +1,26 @@ +# Tranny Software + +Tranny software is a harmful [software](software.md) developed within and infected by the culture of the toxic LGBTFJJJGIIQWWQW SJW [pseudoleftists](pseudoleft.md), greatly characterized e.g. by [codes of conduct](coc.md) and excluding straight white males from the development in the name of inclusivity. Such software is retarded. It is practically always a high level of [bloat](bloat.md) with features such as [censorship](censorship.md), bugs and [spyware](spyware.md). + +To be clear, *tranny software* does NOT stand for *software written by transsexuals*, it stands for a specific kind of software infected by [fascism](fascism.md) (in its features, development practices, culture, goals etc.) which revolves around things such as sexual identity. Of course with good technology it doesn't matter by whom it is made. + +Some characteristics of tranny software are: + +- **It is typically [FOSS](foss.md)** because a big part of trannyism in software is the development process and interaction with public (and with [proprietary](proprietary.md) software the development is not open to public). In theory we may call a proprietary software *tranny* if it e.g. very aggressively promote some [SJW](sjw.md) bullshit -- in fact most companies are nowadays infected by [SJWism](sjw.md) -- but it's not so common to use this term for proprietary software. +- **Typically has a [code of conduct](coc.md)** or some equivalent "SJW guideline" (excluding the anti-COCs). +- Sometimes promotes SJW fascism in other ways, e.g. [LGBT](lgbt.md) flags etc. +- **It is typically [bloat](bloat.md) and [capitalist software](capitalist_software.md)**, and generally just very bad software at least from the [LRS](lrs.md) point of view. This is partly because devs try to be "inclusive" and afraid to refuse [PRs](pull_request.md) from "diverse people" (who are mostly incompetent, again trying software development e.g. as part of proving that "minorities can program too"), partly because their software doesn't even aim to be good but rather popular (as it is to serve to promote political ideas etc.). +- **It often has SJW "features"**, e.g. "slur filters", "diverse" characters in games etc. + +Examples of tranny software are: + +- [Rust](rust.md) +- [Linux](linux.md) +- [Firefox](firefox.md) +- [Lemmy](lemmy.md) +- [Chromium](chromium.md) + +Example of software that doesn't seem to be tranny software: + +- all official [LRS](lrs.md) +- TODO \ No newline at end of file diff --git a/transistor.md b/transistor.md new file mode 100644 index 0000000..aae4e8f --- /dev/null +++ b/transistor.md @@ -0,0 +1,30 @@ +# Transistor + +Transistor is a small [semiconductor](semiconductor.md) element of [electronic](electronics.md) circuits that can be used as an amplifier or a switch, and which is a basic building block of [digital](digital.md) electronic [computers](computer.md), integrated circuits and many other electronic devices. Transistors replaced [vacuum tubes](vacuum_tube.md) and [relays](relay.md) which were used in primitive computers of the 20th century; transistors can be made much smaller, cheaper, more reliable and, unlike relays, operated purely electronically and therefore much faster. Transistor has become the most manufactured device in history. + +Transistor generally has three terminals. Its key principle is that of behaving like an electronically operated amplifier or switch: we can make a transistor *open* or *close* (i.e. conduct or not conduct electricity) by applying different voltage or current (and we can also make it something between *open* and *close*). The voltage/current by which we control the transistor can be lower than that which we control, so we can see this as an amplifier: we can control high current with low current, i.e. the high current follows the low current but has higher amplitude. We can also see this as a switch: by applying voltage/current we can make a wire connect (low resistivity) or disconnect (high resistivity) similarly to a physical switch. This switch behavior is important for computers because we can exploit it to implement [binary](binary.md) (on/off) [logic circuits](logic_gate.md). + +A basic division of transistors is following: + +- **bipolar junction transistor (BJT)**: They have 3 terminals: **emitter**, **base** and **collector**. By applying **current** in the base we control the current between emitter and collector (this current can be greater than the control current). BJTs use both kinds of carriers at once, electrons and holes. BJTs are older than FETs, not much used in integrated circuits now. + - **PNP**: There is P semiconductor (emitter), N (base) and then P again (collector), creating 2 NP junctions. It opens when there is no current at base. + - **NPN**: The other way around that PNP (N, then P, then N). It opens when there is current at base. +- **field effect transistor (FET)**: They have 3 terminals: **source**, **gate** and **drain**. By applying **voltage** to gate we control the current between source and drain. They use only one kind of charge carriers (electrons or holes). This is due to a different internal structure from BJTs, e.g. by having gate separated from source and drain with a metal oxide layer in MOSFET. A voltage applied here kind of "pushes" the holes or electrons out of the way to create a channel between source and drain. The transistor can either be in enhancement mode (high voltage opens the transistor) or depletion mode (low voltage opens the transistor). FETs are newer and have some nicer properties, e.g. lower noise or lower power consumption: they **only consume power on state change**. + - **P channel**: Source and drain are made of P semiconductor put into an N semiconductor. + - **N channel**: Source and drain are made of N semiconductor put into a P semiconductor. They have a bit different properties from P channel FETs. + +Commonly used graphical symbols for transistor are (usually in a circle): + +``` + E E D D + | | | | +B___|.-' B___|.-' G |--' G |--' + |'>. |'<. -->-|--. --<-|--. + | | | | + C C S S + +BJT (NPN) BJT (PNP) FET (N) FET (P) +``` + +First FET transistors were JFETs (junction-gate FET) but by today were mostly replaced by **MOSFETs** (metal-oxide-semiconductor FET), a transistor using a metal oxide layer for separating the gate terminal which gives it some nice properties over JFET. These transistors are used to implement [logic gates](logic_gate.md) e.g. using the **[CMOS](cmos.md)** fabrication process which uses complementary pairs of P and N channel FETs so that e.g. one is always off which decreases power consumption. + diff --git a/triangle.md b/triangle.md new file mode 100644 index 0000000..c9bb975 --- /dev/null +++ b/triangle.md @@ -0,0 +1,54 @@ +# Triangle + +Triangle is a three sided [polygon](polygon.md), one of the most basic [geometric](geometry.md) shapes. It is a [convex](convex.md) shape. Furthermore it is a 2-[simplex](simplex.md), i.e. the simplest ["shape composed of sides"](polytope.md) in [2 dimensions](2d.md). Triangles are very important, they for example help us to compute [distances](distance.md) or define functions like [sine](sin.md) and [cosine](cos.md) (see [trigonometry](trigonometry.md)). + +{ In my favorite book [Flatland](flatland.md) triangles represent the lowest class of men with isoscele triangles being the lowest as they are most similar to [women](woman.md) who are just straight [lines](line.md). ~drummyfish } + +Triangle consists of three [vertices](vertex.md) (usually labeled *A*, *B* and *C*), three sides (usually labeled *a*, *b* and *c* according to the side's opposing vertex) and three angles (usually labeled *alpha*, *beta* and *gamma* according to the closest vertex): + +``` + B B + . . + / \ c = /| + c / \ a hypotenuse / | a + / \ / | + /_______\ /___| + A b C A b C + triangle right triangle +``` + +**Right triangle**, a triangle with one angle equal to 90 degrees ([pi](pi.md) / 2 [radians](radian.md)), is an especially important type of triangle. Right triangles are used to define trigonometric functions, such as [sine](sin.md), [cosine](cos.md) and [tangent](tan.md), as ratios of side lengths as a function of the triangle angle. For example in a right triangle (as drawn above) it holds that *sin(alpha) = a / c*. + +**Similar triangles** are triangles that "have the same shape" (but may be of different sizes, positions and rotations). Two triangles are similar if the lengths of corresponding sides have the same ratios, or, equally, if they have the same inside angles. E.g. a triangle with side lengths 1, 2 and 3 is similar to a triangle with side lengths 2, 4 and 6. This fact is very useful in some geometric computations as it can help us determine unknown side lengths. + +**Equilateral triangle** is a triangle whose sides have the same length, which means all its angles are also equal (60 degrees, pi / 3 radians). Equilateral triangles are of course all similar to each other. An **isoscele triangle** is a triangle with two sides of the same length. We can also distinguish acute and obtuse triangles (obtuse having one angle greater than 90 degrees). + +In a triangle there exist two important types of helper line segments: **median** and **altitude**. Median goes from a triangle's vertex to the opposite side's center. Altitude goes from a vertex to the opposite side in a perpendicular direction to that side. Each triangle has three medians and three altitudes. + +Some basic facts, features and equations regarding triangles are following (beware: many of them only hold in [Euclidean geometry](euclidean_geometry.md)): + +- **Triangle angles add up to 180 degrees** ([pi](pi.md) [radians](radian.md)). This can be used to determine unknown side angles. +- Center of weight: average the three coordinates, or take the intersection of the triangle's medians. +- [Area](area.md): + - general triangle: *a * altitude(a) / 2* + - right triangle: *a * b / 2* +- **[Pythagorean theorem](pythagorean_theorem.md)**: For the lengths of the sides of a RIGHT triangle it always holds that *a^2 + b^2 = c^2*. This is extremely important and can be used to determine unknown side lengths of right triangles. +- **[Thales's theorem](thales_theorem.md)**: if points *A*, *B* and *C* lie on a [circle](circle.md), then they form a right triangle with hypotenuse equal to the circle diameter (and the center of the circle lying in the middle of the hypotenuse). +- **Triangle inequality**: Sum of any two side lengths can't be greater than the length of the third side, i.e. *a + b <= c*. That means that e.g. a triangle with side lengths 1, 2 and 4 can't exist because 1 + 4 > 2. If one side of a triangle is exactly the sum of the other two, the triangle is called **degenerate**, its vertices lie on the same line and it is completely "squashed". +- **Law of sines**: *a / sin(alpha) = b / sin(beta) = c / sin(gamma)* +- **Law of cosines**: Generalization of Pythagorean theorem: *a^2 = b^2 + c^2 - 2 * b * c * cos(alpha)*. +- Triangle [tessellation](tessellation.md) is one of only three possible regular plane tilings (the other two being [square](square.md) and [hexagon](hexagon.md)). +- Every triangle has one [incircle](incircle.md) ([circle](circle.md) inside the triangle which touches each of its sides at one point) and one [circumcircle](circumcircle.md) ("outside" circle passing through all three triangle's vertices). +- Triangle vertices always line in a single [plane](plane.md) (unlike other polygons). + +In non [Euclidean](euclidean.md) ("crazy") geometries triangles behave weird, for example we can draw a triangle with three right angles on a surface of a [sphere](sphere.md) (i.e. its angles add to more than 180 degrees). This fact can be exploited by inhabitants of a space (e.g. our [Universe](universe.md)) to find out if they in fact live in a non Euclidean space (and possibly determine the space's exact [curvature](curvature.md)). + +Constructing triangles: if we are to construct (draw) triangles with only partial knowledge of its parameters, we may exploit the above mentioned attributes to determine things we don't explicitly know. For example if we're told to construct a triangle with knowing only the lengths of the sides but not the angles, we can determine an angle of one side using the law of cosines at which point we can already draw all three vertices and just connect them. In other words just use your brain. + +Triangles also play a big role e.g. in [realtime](realtime.md) [3D rendering](3d_rendering.md) where they are used as a basic building block of [3D models](3d_model.md), i.e. we [approximate](approximation.md) more complex shapes with triangles because triangles are simple (thanks to being a [simplex](simplex.md)) and so have nice properties such as always lying in a [plane](plane.md) so we cannot ever see both its front and back side at once. They are relatively easy to draw ([rasterize](rasterization.md)) so once we can draw triangles, we can also draw complex shapes composed of triangles. In general triangles, just as other simple shapes, can be used to [approximate](approximation.md) measures and attributes -- such as area or center of mass -- of more complex shapes, even outside computer graphics. For example to determine an area of some complex shape we approximate it by triangles, then sum up the areas of the triangles. + +**[Barycentric coordinates](barycentric_coords.md)** provide a [coordinate](coordinate.md) system that can address specific points inside any triangle -- these are used e.g. in [computer graphics](graphics.md) for [texturing](texture.md). The coordinates are three numbers that always add up to 1, e.g. [0.25, 0.25, 0.5]. The coordinates can be though of as ratios of areas of the three subtriangles the point creates. Points inside the triangle have all three numbers positive. E.g. the coordinates of the vertices *A*, *B* and *C* are [1, 0, 0], [0, 1, 0] and [0, 0, 1], and the coordinates of the triangle center are [1/3, 1/3, 1/3]. + +**Winding** of the triangle says whether the ordered vertices of the triangle go clockwise or counterclockwise. I.e. winding says whether if we were to go in the direction *A -> B -> C* we'd be going clockwise or counterclockwise around the triangle center. This is important e.g. for [backface culling](backface_culling.md) in computer graphics (determining which side of a triangle in 3D we are looking at). Determining of the winding of triangle can be derived from the sign of the z-component of the [cross product](cross_product.md) of the triangle's sides. For the lazy: compute *w = (y1 - y0) * (x2 - x1) - (x1 - x0) * (y2 - y1)*, if *w > 0* the points go clockwise, if *w < 0* the points go counterclockwise, otherwise (*w = 0*) the points lie on a line. + +[Sierpinski triangle](sierpinski_triangle.md) is a [fractal](fractal.md) related to triangles. diff --git a/ubi.md b/ubi.md new file mode 100644 index 0000000..f270931 --- /dev/null +++ b/ubi.md @@ -0,0 +1,29 @@ +# Universal Basic Income + +Universal basic income (UBI) is the idea that all people should get regular pay from the state without any conditions, i.e. even if they don't work, even if they are rich etc. It is a great idea and **[we](lrs.md) fully support it** as the first step towards the ideal society in which people don't have to work. As [automation](automation.md) takes away more and more jobs, it is being discussed more and experiments with UBI are being conducted, even though capitalist idiots rather try to invent more and more [bullshit jobs](bullshit_job.md) to keep people enslaved. + +UBI that itself covers all basic needs is called full, otherwise it is called partial. UBI subscribes to the idea that **the goal of progress is to eliminate the need for work**, which is correct -- we should leave all work to machines eventually, that's why we started civilization. This doesn't mean we can't work, just that we aren't obliged. + +The first reaction of a noob hearing about UBI is "but everyone will just stop working!" Well no, for a number of reasons (which have been confirmed by real life experiments). For example most people don't want to just survive, they want to buy nice things and have something extra, so most people will want to get some additional income. Secondly people do want to work -- work in the sense of doing something meaningful. If they don't have to be wage slaves, most will decide to dedicate their free time to doing something useful. Thirdly people are already used to working, most will keep doing it just out of inertia, e.g. because they have friends at work or simply because they actually happen to like going there. + +Another question of the noob is "but who will pay for it?!" Well, we all and especially the rich. In current situation, even if we make the rich give away 90% of their wealth, they won't even notice. + +Advantages of UBI: + +- **People will seize to be slaves of capitalist employers** as it will no longer be mandatory to work somewhere. Nowadays people have to accept shitty working conditions because they have no other choice. They can't go elsewhere because it is the same everywhere or their conditions don't allow them to move, every employer abuses his employees as much as possible so people today can only choose their slave master but they can't choose not being slaves. **If people can actually leave, employers will have to offer good conditions to keep people working for them**. It may also lead to e.g. greater freedom from consumerism as people can e.g. decide to not use certain bad technology which they are nowadays forced to use by employers. +- **It will greatly suppress [bullshit jobs](bullshit_job.md)** and undesirable phenomena such as the [antivirus paradox](antivirus_paradox.md). People who stop doing bullshit jobs will be able to actually focus on useful things. +- **Suffering of many people will be lowered or eliminated**. Simple as that. +- **We may actually save money** because the system will simplify a lot. Nowadays we have complex bureaucracy and commissions that judge who can get social welfare, who can get disability pensions etc. If everyone gets the money, we can save on this bureaucracy, commissions, on doctor examinations, caring about the homeless, maintaining special laws etc. If people become less stressed, mental health will also improve and we will save money on treatment of mentally ill people. Money may also be saved on organization of worker unions as they may become much less important. +- **People will become less stressed**, happier, will have security and as a result perhaps even become more "productive" (this has been confirmed by some experiments). +- **Criminality will greatly decrease** as it is directly linked to poverty, this will of course further save money on police, lawyers, medical bills etc. +- **People will become more equal** which will shift us closer to the [ideal society](ideal_society.md). +- **People will be able to do more important things than work if needed**, for example they may choose to focus on education for a few years, which will make the population better educated and therefore better. +- **Social security will suppress fear in people** and therefore make them less xenophobic, less militant etc. +- **Homelessness will greatly decrease**. + + +Disadvantages of UBI: + +- none + +Of course, UBI works with [money](money.md) and money is bad, however the core idea is simply about sharing resources, i.e. true [communism](communism.md) which surpasses the concept of money. That is once money is eliminated, the idea of UBI will stay as the right of everyone to get things such as food and health care unconditionally. LRS supports UBI as the immediate next step towards making money less important and eventually eliminate them altogether. \ No newline at end of file diff --git a/ui.md b/ui.md new file mode 100644 index 0000000..7b8f167 --- /dev/null +++ b/ui.md @@ -0,0 +1,9 @@ +# User Interface + +User interface, or UI, is an interface between human and computer. Such interface interacts with some of the human senses, i.e. it can be visual (text, images), auditory (sound), touch (haptic) etc. + +Remember the following inequality: + +*non-interactive [CLI](cli.md) > interactive [CLI](cli.md) > [TUI](tui.md) > [GUI](gui.md)* + +Some faggots make living just by designing interfaces without even knowing programming lmao. They call it "user experience" or [UX](ux.md). We call it a [bullshit](bullshit.md). \ No newline at end of file diff --git a/universe.md b/universe.md new file mode 100644 index 0000000..2f027cd --- /dev/null +++ b/universe.md @@ -0,0 +1,5 @@ +# Universe + +Universe is everything that exists, it is the [spacetime](spacetime.md) and everything in it, all matter and energy as well as all the laws of nature by which it behaves. The size of the whole universe is not known, it is possibly [infinite](infinity.md), however the size of the observable universe -- the part of it with which we can ever interact due to limited [speed of light](speed_of_light.md) combined with constant expansion of space -- is about 93 billion [light years](light_year.md) in diameter, and contains an estimated number of 100 billion [galaxies](galaxy.md), each containing hundreds of billions of [stars](star.md). Current science says the universe is about 13.7 billion years old and that it started with the [Big Bang](big_bang.md), a point in time from which everything began to rapidly expand from a single point in space. + +[Computers](computer.md) can be used to [simulate](simulation.md) certain parts of the universe, in fact all programs mimic the universe in some kind of simplified way, be it scientific simulations of planet collisions, government databases or [games](game.md) -- they all more or less accurately model the reality. We can also see computers as a way of creating smaller universes, which leads many to think our universe may itself be a [simulation](simulation_hypothesis.md) running on some computer in a "bigger" universe (note that this probably isn't testable and the debate isn't scientific, but we can lead philosophical discussions about it). \ No newline at end of file diff --git a/unix.md b/unix.md new file mode 100644 index 0000000..2d055d8 --- /dev/null +++ b/unix.md @@ -0,0 +1,15 @@ +# Unix + +Unix is an [old](old.md) [operating system](operating_system.md) developed since 1960s as a research project of [Bell Labs](bell_labs.md), which has become one of the most influential pieces of software in history and whose principles (e.g. the [Unix philosophy](unix_philosophy.md)) live on in many so called Unix-like operating systems such as [Linux](linux.md) and [BSD](bsd.md) (at least to some degree). The original system itself is no longer in use, the name UNIX is nowadays a trademark and a certification. + +Unix has reached the highest level a software can reach: it has transcended its implementation and became a [de facto standard](de_facto_standard.md). This means it has become a set of interface conventions, cultural and philosophical ideas rather than being a single system, it lives on as a concept that has many implementations. This is extremely important as we don't depend on any single Unix implementation but we have a great variety of choice between which we can switch without greater issues. This is very important for [freedom](freedom.md) -- it prevents monopolization -- and its one of the important reasons to use unix-like systems. + +## History + +In the 1960s, Bell Labs along with other groups were developing [Multics](multics.md), a kind of [operating system](os.md) -- however the project failed and was abandoned for its complexity and expensiveness of development. In 1969 two Multics developers, [Ken Thompson](key_thompson.md) and [Dennis Ritchie](dennis_ritchie.md), then started to create their own system, this time with a different philosophy; that of [simplicity](minimalism.md) (see [Unix philosophy](unix_philosophy.md)). They weren't alone in developing the system, a number of other hackers helped program such things as a file system, [shell](shell.md) and simple utility programs. At VCF East 2019 Thompson said that they developed Unix as a working system in three weeks. At this point Unix was written in [assembly](assembly.md). + +In the early 1970s the system got funding as well as its name Unix (a pun on Multix). By now Thompson and Richie were developing a new language for Unix which would eventually become the [C](c.md) language. In version 4 (1973) Unix was rewritten in C. + +Unix then started being sold commercially. This led to its fragmentation into different versions such as the [BSD](bsd.md) or [Solaris](solaris.md). In 1983 a version called System V was released which would become one of the most successful. The fragmentation and a lack of a unified standard led to so called [Unix Wars](unix_wars.md) in the late 1980s, which led to a few Unix standards such as [POSIX](posix.md) and Single Unix Specification. + +For [zoomers](genz.md) and other noobs: Unix wasn't like [Windows](windows.md), it was more like [DOS](dos.md), things were done in [text interface](cli.md) -- if you use the command line in "[Linux](linux.md)" nowadays, you'll get an idea of what it was like, except it was all even more primitive. Things we take for granted such as a [mouse](mouse.md), [copy-pastes](copy_paste.md), interactive text editors, having multiple user accounts or [running multiple programs at once](multitasking.md) were either non-existent or advanced features in the early days. Anything these guys did you have to see as done with stone tools. diff --git a/unix_philosophy.md b/unix_philosophy.md new file mode 100644 index 0000000..4b6be09 --- /dev/null +++ b/unix_philosophy.md @@ -0,0 +1,41 @@ +# Unix Philosophy + +Unix philosophy is one of the most important and essential approaches to programming which advocates great [minimalism](minimalism.md) and is best known by the saying that **a program should only do one thing and do it well**. Unix philosophy is a collective wisdom, a set of recommendations evolved during the development of one of the earliest [operating systems](os.md) called [Unix](unix.md), hence the name. Unix philosophy advocates simplicity, clarity, modularity, reusability and composition of larger programs out of smaller programs rather than designing huge monolithic programs as a whole. Unix philosophy, at least partially, lives on in many project and Unix-like operating systems such as [Linux](linux.md), has been wholly adopted by groups such as [suckless](suckless.md) and [LRS](lrs.md) (us), and is even being expanded in such projects as [plan9](plan9.md). + +In 1978 [Douglas McIlroy](mcilroy.md) has written a short overview of the Unix system (*UNIX Time-Sharing System*) in which he gives the main points of the system's style; this can be seen as a summary of the Unix philosophy (the following is paraphrased): + +1. **Each program should do one thing and do it well**. Overcomplicating existing programs isn't good; for new functionality create a new program. +2. **Output of a program should be easy to interpret by another program**. In Unix programs are chained by so called [pipes](pipe.md) in which one program sends its output as an input to another, so a programmer should bear this in mind. [Interactive](interactive.md) programs should be avoided if possible. +3. **Program so that you can test early, don't be afraid to throw away code and rewrite it from scratch**. +4. **Write and use tools**, even if they're [short-lived](throwaway_script.md), they're better than manual work. Unix-like systems are known for their high [scriptability](script.md). + +This has later been condensed into: do one thing well, write programs to work together, make programs communicate via text streams, a universal interface. + +**Example**: maybe the most common practical example that can be given is [piping](pipe.md) small [command line](cli.md) utility programs; in Unix there exist a number of small programs that do *only one thing but do it well*, for example the [`cat`](cat.md) program that only displays the content of a file, the [`grep`](grep.md) program that searches for patterns in text etc. In a command line we may use so called [pipes](pipe.md) to chain some of these simple programs into more complex processing pipelines. Let's say we want to for example automatically list all first and second level headings on given webpage and write them out alphabetically sorted. We can do it with a command such as this one: + +``` +curl "https://www.tastyfish.cz/lrs/main.html" | grep ".*" | sed "s/[^>]*> *\([^<]*\) *<.*/\1/g" | sort +``` + +Which may output for example: + +``` +Are You A Noob? +Some Interesting Topics +Welcome To The Less Retarded Wiki +What Is Less Retarded Software +``` + +In the command the pipes (`|`) chain multiple programs together so that the output of one becomes the input of the next. The first command, [`curl`](curl.md), downloads the [HTML](html.md) content of the webpage and passes it to the second command, [`grep`](grep.md), which filters the text and only prints lines with headings, this is passed to [`sed`](sed.md) that removes the HTML code and the result is passed to `sort` that sorts the lines alphabetically -- as this is the last command, the result is then printed. This is fast, powerful and very flexible way of processing data for anyone who knows the Unix tools. Notice the relative simplicity of each command and how each works with text -- the universal communication interface. + +Compare this to the opposite [Window philosophy](windows_philosophy.md) in which combining programs into collaborating units is not intended or even purposefully prevented, and therefore very difficult, slow and impractical to do -- such programs are designed for manually performing some predefined actions, e.g. painting pictures with a mouse, but aren't made to collaborate or be automatized, they can rarely be used in unintended, inventive ways needed for [hacking](hacking.md). + +{ One possible practical interpretation of Unix philosophy I came up with is this: there's an upper but also lower limit on complexity. "Do one thing" means the program shouldn't be too complex, we can simplify this to e.g. "Your program shouldn't surpass 10 KLOC". "Do it well" means the programs shouldn't bee too trivial because then it is hardly doing it well, we could e.g. say "Your program shouldn't be shorter than 10 LOC". E.g. we shouldn't literally make a separate program for printing each ASCII symbol, such programs would be too simple and not doing a thing well. We rather make a [cat](cat.md) program, that's neither too complex nor too trivial, which can really print any ASCII symbol. By this point of view Unix philosophy is really about balance of triviality and huge complexity, but hints that the right balance tends to be much closer to the triviality than we humans are tempted to intuitively choose. Without guidance we tend to make programs too complex and so the philosophy exists to remind us to force ourselves to rather minimize our programs to strike the correct balance. ~drummyfish } + +## See Also + +- [Unix](unix.md) +- [minimalism](minimalism.md) +- [suckless](suckless.md) +- [KISS](kiss.md) +- [Windows philosophy](windows_philosophy.md) \ No newline at end of file diff --git a/update_culture.md b/update_culture.md new file mode 100644 index 0000000..fc42ead --- /dev/null +++ b/update_culture.md @@ -0,0 +1,18 @@ +# Update Culture + +Update culture is a negative trend in [capitalism](capitalism.md) in which developers of a (typically [bloated](bloat.md)) program or similar product create frequent modifications called "updates" and force users to keep consuming these "updates", e.g. by deprecating or neglecting old versions, dropping [backwards compatibility](backwards_compatibility.md) (e.g. [Python](python.md)) or by downright forcing updates in code. This is typically manifested by a familiar message: + +*Your software is too old, please update to the newest version.* + +In software this process is a lot of times automatized and known as [autoupdates](autoupdate.md), but update culture encompasses more than this, it's the whole mentality of having to constantly update one's software, hardware and other products. It is similar to [consumerism](consumerism.md) but more about constant modifications masked as "cool updates" rather than replacement of physical products. + +A typical example are [web browsers](browser.md) or proprietary [operating systems](operating_system.md) that strive for [bloat monopoly](bloat_monopoly.md). + +The updates are usually justified by "muh [security](security.md)" and "muh [modern](modern.md) [features](feature.md)". Users who want to avoid these updates or simply can't install them, e.g. due to using old incompatible hardware or missing dependency packages, are ridiculed as *poorfags*, idiots and their suffering is ignored. In fact, update culture is [cancer](cancer.md) because: + +- **It is a huge security risk**. The developer, whoever it is, has the power to remotely push and execute any code at any time to the devices of many users. In fact this can be seen as the definition of [backdoor](backdoor.md). This is not just an issue of [proprietary](proprietary.md) software, there have been many [FOSS](foss.md) projects pushing [malware](malware.md) this way (look up e.g. the projects that targeted malware at Russians during the Russia-Ukraine war). +- **It kills freedom**. E.g. with the example of web the constant meaningless updates of JavaScript and addition of "features" eliminates any small competition that can't afford to keep up with the constantly changing environment. **This is why we have no good web browsers**. +- **It is a form of software [consumerism](consumerism.md)**, even if the updates themselves are gratis, they always come at a cost such as potential unstability, requiring new hardware, forcing installing more dependencies, required learning to use the new version, or even dropping of old features and malicious code in the updates. +- **It is dangerous**, updates regularly break things, and there are cases where a lot depends on software running smoothly. +- **The [security](security.md) justifications are lies**: a true concern for security would lead to unbloating and creating a minimal, stable and well tested software. Update culture in fact constantly pushes newly created vulnerabilities with the updates which are only better in not having been discovered yet, i.e. relying on **security by obscurity**. This creates an intentionally **endless cycle of creating something that will never be finished** (even if it well could be). +- It is [bullshit](bullshit.md) effort, **wasting human work and creating an intentionally high [maintenance](maintenance.md) cost**. Humans, both users and programmers, become slaves to the software.their \ No newline at end of file diff --git a/usa.md b/usa.md new file mode 100644 index 0000000..16ce900 --- /dev/null +++ b/usa.md @@ -0,0 +1,9 @@ +# USA + +United States of America (USA, US or just "murika") is a [dystopian](dystopia.md) country of fat, stupid fascist people enslaved by [capitalism](capitalism.md), people endlessly obsessed with money and wars. USA consists of 50 states located in North America, a continent that ancestors of Americans invaded and have stolen from Indians, the natives whom Americans mass murdered. + +USA is very similar to [North Korea](north_korea.md): in both countries the people are successfully led to believe their country is the best. North Korea is ruled by a single political party, US is ruled by two practically same militant capitalist imperialist parties (democrats and republicans), i.e. de-facto one party as well. Both countries are obsessed with weapons and their military, both are highly and openly [fascist](fascism.md) (nationalist). Both countries are full of extreme [propaganda](propaganda.md), [censorship](censorship.md) and greatly support cult of personality, people worship dictators such as Kim Jong-un or [Steve Jobs](steve_jobs.md). US is even worse than North Korea because it exports its toxic culture over the whole world and constantly invades other countries, it is destroying all other cultures and leads the whole world to doom and destruction of all life. + +In US mainstream [politics](politics.md) there exists no true left, only [right](left_right.md) and [pseudoleft](pseudoleft.md). It is only in extreme underground, out of the sight of most people, where occasionally something good comes into existence as an exception to a general rule that nothing good comes from the US. One of these exceptions is [free software](free_software.md) (established by [Richard Stallman](rms.md)) which was however quickly smothered by the capitalist [open source](open_source.md) counter movement. + +On 6th and 9th August 1945 USA casually killed about 200000 civilians, most of whom were innocent men, women and children, by throwing atomic bombs on Japanese cities Hiroshima and Nagasaki. The men who threw the bombs and ordered the bombing were never put on trial, actually most Americans accepted it as a good thing to do lol. \ No newline at end of file diff --git a/used.md b/used.md new file mode 100644 index 0000000..a3ee7be --- /dev/null +++ b/used.md @@ -0,0 +1,3 @@ +# Used + +Used is someone using technology that abuses him, most notably [proprietary](proprietary.md) software. For example those using [Windows](windows.md) are not users but useds. This term was popularized by [Richard Stallman](rms.md). \ No newline at end of file diff --git a/usenet.md b/usenet.md new file mode 100644 index 0000000..8526eef --- /dev/null +++ b/usenet.md @@ -0,0 +1,17 @@ +# Usenet + +Usenet (User's Network) is an ancient digital discussion network -- a [forum](forum.md) -- that existed long before the [World Wide Web](www.md). At the time it was very popular, it was THE place to be, but nowadays it's been forgotten by the mainstream, sadly hardly anyone remembers it. + +Back in the day there were no [web browsers](browser.md), there was no web. Many users were also **not connected through Internet** as it was expensive, they normally used other networks like [UUCP](uucp.md) working through phone lines. They could communicate by some forms of electronic mail or by directly connecting to servers and leaving messages for others there -- these servers were called [BBS](bbs.md)es and were another popular kind of "[social network](social_network.md)" at the time. Usenet was a bit different as it was [decentralized](decentralization.md) -- it wasn't stored or managed on a single [server](server.md), but on many independent servers that provided users with access to the network. This access was (and is) mostly paid (to [lurk](lurk.md) for free you can search for Usenet archives online). To access Usenet a **newsreader** program was needed, it was kind of a precursor to web browsers (nowadays newsreaders are sometimes built into e.g. email clients). Usenet was lots of time not moderated and anonymous, i.e. kind of free, you could find all kinds of illegal material there. + +Usenet invented many things that survive until today such as the words *[spam](spam.md)* and *[FAQ](faq.md)* as well as some basic concepts of how discussion forums even work. + +Usenet was originally [ASCII](ascii.md) only, but people started to post binary files encoded as ASCII and there were dedicated sections just for posting binaries, so you co go [piiiiiiiiirating](piracy.md). + +It worked like this: there were a number of Usenet servers that all collaborated on keeping a database of *articles* that users posted (very roughly this is similar to how [blockchain](blockchain.md) works nowadays); the servers would more or less mirror each other's content. These servers were called *providers* as they also allowed access to Usenet but this was usually for a fee. The system uses a [NNTP](nntp.md) (Network News Transfer Protocol) protocol. The articles users posted were also called *posts* or *news*, they were in plain text and were similar to email messages. Other users could reply to posts, creating a discussion thread. Every post was also categorized under certain **newsgroup** that formed a hierarchy (e.g. *comp.lang.java*). After so called *Big Renaming* in 1987 the system eventually settled on 8 top level hierarchies (called the *Big 8*): comp.* (computers), news.* (news), sci.* (science), rec.* (recreation), soc.* (social), talk.* (talk), misc.* (other) and humanities.* (humanities). There was also another one called alt.* for controversial topics. According to [Jargon File](jargon_file.md), by 1996 there was over 10000 different newsgroups. + +Usenet was the pre-[web](www.md) web, kind of like an 80s [reddit](reddit.md) which contained huge amounts of historical information and countless discussions of true computer [nerds](nerd.md) which are however not easily accessible anymore as there aren't so many archives, they aren't well indexed and direct Usenet access is normally paid. It's a shame. It is possible to find e.g. initial reactions to the [AIDS](aids.md) disease, people asking what the [Internet](internet.md) was, people discussing future technologies, the German cannibal (Meiwes) looking for someone to eat (which he eventually did), [Bezos](bezos.md) looking for [Amazon](amazon.md) programmers, a heated debate between [Linus Torvalds](torvalds.md) and [Andrew Tanenbaum](tanenbaum.md) about the best OS architecture (the "Linux is obsolete" discussion) or [Douglas Adams](douglas_adams.md) talking to his fans. There were [memes](meme.md) and characters like [BIFF](biff.md), a kind of hilarious noob wannabe cool personality. Some users became kind of famous, e.g. Scott Abraham who was banned from Usenet by court after an extremely long flame war, Alexander Abian, a mathematician who argued for blowing up the Moon (which according to his theory would solve all Earth's issues), Archimedes Plutonium who suggested the Universe was really a big plutonium atom (he later literally changed his name to Plutonium lol) or John Titor (pretend time traveler). There are also some politically incorrect groups like *alt.niggers* [lol](lol.md). + +{ I mean I don't remember it either, I'm not that old, I've just been digging on the Internet and in the archives, and I find it all fascinating. ~drummyfish } + +**Where to browse Usenet for free?** Search for Usenet archives, I've found some sites dedicated to this, also [Internet archive] (internet_archive.md) has some newsgroups archived. [Google](google.md) has Usenet archives on a website called "Google groups". \ No newline at end of file diff --git a/venus_project.md b/venus_project.md new file mode 100644 index 0000000..e97d829 --- /dev/null +++ b/venus_project.md @@ -0,0 +1,54 @@ +# The Venus Project + +The Venus Project is a big project established by [Jacque Fresco](jacque_fresco.md), already running for decades, aiming for a voluntary and rational transition towards an ideal, highly technological and automated [society](society.md) without [money](money.md), scarcity, need for human [work](work.md), social [competition](competition.md), wars and violence, a society in which people would have abundance thanks to so called [resource based economy](resource_based_economy.md), where they would be [collaborating](collaboration.md), loving, respecting the nature, caring for others and free to pursue their true potential. It is similar to the [Zeitgeist Movement](zeitgeist_movement.md). In its views, goals and means the Venus Project is extremely close to [LRS](lrs.md) and we highly support it. + +## Overview + +{ The following is based mainly on my understanding of what I've read in Fresco's book *The Best That Money Can't Buy*. I recommend the book for an overall overview of the project. ~drummyfish } + +The project is a child of [Jacque Fresco](jacque_fresco.md), a [generalist](generalism.md) futurist who sadly died in 2017, who worked on it for many decades with his life partner Roxanne Meadows. It has a center located in Florida and is a [nonprofit](nonprofit.md) organization that performs research, education and prototype technology according to their ideas of a future we should strive for. + +Although the project seems to be avoiding specific political labels (possibly as to avoid historical associations), it is [de facto](de_facto.md) **[anarcho pacifist](anpac.md) [communist](communism.md)** movement (i.e. politically the same as [LRS](lrs.md)). Very nicely it also seems, at least as of 2022, uninfected with the [SJW](sjw.md) [cancer](cancer.md) -- [fight culture](fight_culture.md) and [fascism](fascism.md) goes directly against their goals and Fresco explicitly stated that we have to stop constantly fighting for human rights and rather establish a society with human rights built-in. + +Fresco highly criticizes today's society and just as [us](us.md) says it only tries to cure the symptoms (search the solutions within the current framework and mindset) rather than the root cause of its issues (the system itself). He mainly criticizes the presence of the monetary system and laws -- currently taking the form of [capitalism](capitalism.md) -- which he correctly blames for most today's issues such as artificial scarcity, hunger, wars, [fascism](fascism.md), lack of social security, poverty, [wage slavery](wage_slavery.md), destruction of natural environment, waste, energy crisis, [planned obsolescence](plenned_obsolescence.md), deteriorating psychological health etc. He says with the presence of advanced technology we have this system is highly outdated (for example it forces artificial scarcity because only scarce resources can be sold, unlike for example air) and points out the fact that we have more than enough resources for everyone on Earth and could live in abundance and peace, practicing **[collaboration](collaboration.md) rather than [competition](comptetition.md)**. Therefore he argues that we have to eliminate [money](money.md), barter and markets from the society and change the very basis of whole society, down to our mentality and outdated historical associations (and eventually even language which should be closer to the scientific language). + +He argues to replace the monetary system with so called **[resource based economy](resource_based_economy.md)** (RBE) which should be a pillar of the future society. RBE is called an "economy" but doesn't use any money or barter, it starts by declaring that all Earth's resources are a common heritage of all people on Earth -- it basically means that "everything is available to everyone", i.e. no one can own resources of the Earth, they belong to us all and whoever needs something can take it. RBE would be supported by high automatization and computer monitoring to deliver resources where they are needed. Normies usually can't comprehend that this could work, they say "but then someone will just steal everything", but Fresco correctly argues that with correct and rational use of our technology we can, unlike in the past, already extract as many resources as to satisfy everyone with high abundance; basically we can make for example food as abundant as is air nowadays -- no one will be (and can be) stealing food when there's more free food than anyone can eat, just as stealing air isn't a concern nowadays. + +This should therefore also eliminate the need for complex laws -- when no one is stealing, we don't need laws against stealing etc. Elimination of money and laws will remove the need for [bullshit](bullshit.md) jobs such as lawyers, judges, politicians, marketing guys, bankers etc., freeing more people and getting rid of a lot of unnecessary work and burden of society. + +Fresco supports this by the fact that **human behavior is determined by the environment and upbringing** -- nowadays we have criminality mostly because firstly people are poor, i.e. pushed into illegal activity, and secondly nurtured by the competitive propaganda that teaches them, right from little children, to [fight](fight_culture.md) and compete with others. In a caring society that provides all their needs and raises them in the spirit of collaboration and love towards others criminals will be almost non existent, there will simply be no gain from it. + +The project further seeks to **eliminate the need for human [work](work.md)**: all work, including complex decision making, would be automated. Bullshit jobs would be removed and [maintenance](maintenance.md) reduced to minimum. People would be free to pursue their true interests and could fully and freely devote themselves to it. Again normies usually say something like "BUT THEN NOBODY AIN'T GONNA WORK". Well, firstly that wouldn't be an issue since no human work would even be needed anymore, and secondly Fresco correctly answers by saying that competition and force isn't the only drive of human activity, people are motivated for work and creative activity by other phenomena such as curiosity, sense of accomplishment, boredom, moral values etc., and usually even perform better than when forced to it. [Maslow's Hierarchy of Needs](maslows_hierarchy_of_needs.md) is a well known psychological model that says that once basic needs such as food and shelter are satisfied (which RBE will accomplish), people start voluntarily pursuing higher needs such as art, science and other creative work. People did work and create long before money and jobs existed. The idea of reducing or eliminating human work is already being considered nowadays in the form of [universal basic income](ubi.md) -- experiments have been confirming that it works. + +Venus Project stresses the important of **[science](science.md)** -- their approach is strictly scientific -- technology (such as [AI](ai.md) and sensors all over the Earth) and [rationality](rationality.md) and argues for application of technology to everything as that, in their opinion, will allow RBE and remove the need for human government. **There should be no human governing the society**, decisions will be made mostly by machines in a network of decentralized cities all over the Earth ("technophobes" are informed that even nowadays we put our lives into the hands of machines, e.g. in planes or with pacemakers, and they do better job than humans). Technology should be sustainable, respect the nature and be aligned with it, i.e. not fight against it but rather direct its forces towards good causes. Protection of the environment and integration of natural elements in cities is stressed. Only clean and safe energy would be used. Earth carrying capacity should be respect, i.e. people would avoid overpopulation by voluntary birth control. + +The project is for **absolute freedom of information** -- there would be no [intellectual property](intellectual_property.md) (copyright, patents, ...), no trade secrets, state secrets and probably also no personal secrets, as in a non-competitive society there wouldn't be a danger of abusing personal information. They argue that despite computer sensors being present everywhere, there would simply be no need for surveillance of people as there would be no corporations, no criminality etc. + +It also opposes nationalism, racism and other forms of privilege and inequality. However this shouldn't be forced in the [SJW](sjw.md) style, it should rather come naturally thanks to fixing the the root cause of these issues (removing competition, governments, money etc.). + +Education would play a huge role in the society -- again, it wouldn't be forced on children, they should want to go to school because education would be [fun](fun.md) and give them freedom to pursue their interests. There would be no grades and it should teach high scientific and critical thinking, rational discussion, nonviolent resolution of conflicts, collaboration through group project and collaborative games, love towards nature (e.g. by projects involving growing plants) etc. [Generalism](generalism.md) would be preferred before hyper [specialization](specialization.md) (which we see nowadays). + +Fresco also addresses the fear of some people of people becoming too uniform and losing individuality -- he stresses that individuality would be focused on, uniformity would only lie in common goals and caring for all humans and nature. Unlike in current society, each human would have the freedom to pursue his true interests and goals. + +The project claims it has years of research and seems to have a great number of specific ideas for what the technology might look like, how we would harness energy, travel etc. There are many 3D visualizations. Fresco claims that in the new society everyone would have a higher living standard than the rich have nowadays. + +The transition towards this society should be **peaceful and evolutionary, NOT revolutionary**. It has to be voluntary and rational. The initial stage -- building the first center with the project ideas in mind -- has already been completed in Florida. Raising funds and educating the public should continue, then more cities in the spirit of the project should start to appear, interconnect and prove the ideas in practice. Then slowly the new cities and ideas would start to replace our current system. + +## Comparison With LRS + +We, [LRS](lrs.md), highly support and agree with the Venus Project, in its analysis of current society, goals and means of achieving it. At least as of 2022, we can't know if any single project will become corrupt in the future (e.g. with [SJWs](sjw.md)). We may still disagree on some details, focus a bit more on different areas etc. Here are a few points about that. + +Venus Project seems to only focus on humans, unlike LRS which is based on the love of all life, i.e. also animals, possibly even alien life etc. Venus Project mentions that in the future there would possibly be fish farms -- for us this seems unacceptable as we advocate [vegetarianism](vegetarianism.md), even the lives of fish are precious to us. In a highly advanced society artificial meat (which we accept) would probably be available and replace meat from any living animals so we would eventually align with Venus Project, but the human-centeredness of Venus Project is still there. + +It may seem we also focus on simplicity of technology (e.g. [sucklessness](suckless.md)) while Venus Project seems to advocate [bloat](bloat.md) and overapplication of technology. This may not be such an issue because a truly good technology that Venus Project advocates should converge towards simplicity naturally thanks to minimizing maintenance, maximizing safety (minimizing dependencies), removal of bullshit features etc. In other word even hi-tech advocated by Venus Project can be done in a suckless way, for example the automation would work on top of [Unix](unix_philosophy.md) operating systems. Still the future from LRS point of view may look less hi-tech, we might prefer simple buttons to voice recognition and so on :-) + +Also the project doesn't seem to practice [free culture](free_culture.md) and [free software](free_software.md), even though of course it would implement them in their society -- it kind of makes sense as they seem to be trying to be above current movements, they simply think we should focus beyond them. We might disagree and say that even looking into the far future we should still keep an eye on the now, education about free culture can greatly contribute to education about the advantages of information freedom etc. Furthermore they are selling some videos on their site, which we don't really like but the project justifies it as raising funds for their operation. To their credit they have many gratis videos and educational material, even the books can be found as "free download". Another criticism comes towards the materials themselves which are sometimes a bit unprofessional which is a shame (e.g. the book has many typos and is not so readable). Also there seems to be a bit of personality cult around Jacque and Roxanne, their faces are all over the place and even though they seem like really great people and even though it may simply be due to the lack of other "strong personalities", this makes the movement look like a religious cult to some critics. Nevertheless this changes nothing about the ideas the project presents, which we support. + +## History + +TODO + +## See Also + +- [LRS](lrs.md) +- [Zeitgeist Movement](zeitgeist_movement.md) \ No newline at end of file diff --git a/vim.md b/vim.md new file mode 100644 index 0000000..363d494 --- /dev/null +++ b/vim.md @@ -0,0 +1,79 @@ +# Vim + +{ This is WIP, I use Vim but am not such guru really so there may appear some errors, I know this topic is pretty religious so don't eat me. ~drummyfish } + +Vim (Vi Improved) is a legendary [free as in freedom](free_software.md), fairly [minimalist](minimalism.md) and [suckless](suckless.md) [terminal](terminal.md)-only (no [GUI](gui.md)) [text editor](text_editor.md) for skilled programmers and hackers, possibly the best editor you can choose for text editing and [programming](programming.md). It is a successor of a much simpler editor [vi](vi.md) that was made in 1976 and which has become a standard text editor installed on every [Unix](unix.md) system. Vim added features like tabs, [syntax highlight](syntax_highlight.md), [scriptability](script.md), sessions and plugins and as such has become not just a simple text editor but an editor that can comfortably be used for [programming](programming.md) instead of any bloated [IDE](ide.md). Observing a skilled Vim user edit text is really like watching a magician or a literal movie hacker -- the editing is extremely fast, without any use of mouse, it transcends mere text editing and for some becomes something akin a way of life. + +Vim is generally known to be **"difficult to learn"** -- it is not because it is inherently difficult but rather for being very different from other editors -- it has no [GUI](gui.md) (even though it's still a screen-oriented [interactive](interactive.md) [TUI](tui.md)), it is keyboard-only and is operated via text commands rather than with a [mouse](mouse.md), it's also preferable to not even use arrow keys but rather [hjkl](hjkl.md) keys. There is even a [meme](meme.md) that says Vim is so difficult that just exiting it is a non-trivial task. People not acquainted with Vim aren't able to do it and if they accidentally open Vim they have to either Google how to close it or force kill the terminal [xD](xd.md) Of course it's not so difficult to do, it's a little bit different than in other software -- you have to press escape, then type `:q` and press enter (although depending on the situation this may not work, e.g. if you have multiple documents open and want to exit without saving you have to type `:wqa` etc.). The (sad) fact is that most [coding monkeys](coding.md) and "professional programmers" [nowadays](kids_these_days.md) choose some ugly [bloated](bloat.md) [IDE](ide.md) as their most important tool rather than investing two days into learning Vim, probably the best editor. + +**Why use Vim?** Well, simply because it is (relatively) [suckless](suckless.md), universal and extremely good for editing any text and for any kind of [programming](programming.md), for many it [settles](settled.md) the search for an editor -- once you learn it you'll find it is flexible, powerful, comfortable, modifiable, lightweight... it has everything you need. Anyone who has ever invested the time to learn Vim will almost certainly tell you it was one of the best decisions he made and that guy probably only uses Vim for everything now. Many people even get used to it so much they download mods that e.g. add Vim commands and shortcuts to programs like web browsers. A great advantage is that **vi is installed on every Unix** as it is a standard utility, so if you know Vim, you can just comfortably use any Unix-like system just from the [command line](terminal.md): when you [ssh](ssh.md) into a server you can simply edit files without setting up any remote GUI or whatever. Therefore Vim is automatically a must learn skill for any sysadmin. A huge number of people also use Vim for **"[productivity](productivity_cult.md)"** -- even though we don't fancy the productivity cult and the bottleneck of programming speed usually isn't the speed of typing, it is true that **Vim makes you edit text extremely fast** (you don't move your hands between mouse and keyboard, you don't even need to touch the arrow keys, the commands and shortcuts make editing very efficient). Some nubs think you "need" a huge IDE to make big programs, that's just plain wrong, you can do anything in Vim that you can do in any other IDE, it's as good for editing tiny files as for managing a huge codebase. + +Vim's biggest rival is [Emacs](emacs.md), a similar editor which is however more complex and [bloated](bloat.md) (it is [joked](jokes.md) that Emacs is really an [operating system](os.md)) -- Vim is more [suckless](suckless.md), yet not less powerful, and so it is naturally the choice of the suckless community and also [ours](lrs.md). Vim and Emacs are a subject of a **[holy war](holy_war.md)** for the the best editor yet developed; the Emacs side calls itself the *[Church of Emacs](church_of_emacs.md)*, led by [Richard Stallman](rms.md) (who created Emacs) while the Vi supporters are called members of the *[Cult of Vi](cult_of_vi.md)* (vi vi vi = 666). + +It has to be noted that **Vim as a program is still kind of [bloated](bloat.md)**, large part of the [suckless](suckless.md) community acknowledges this. Nonetheless the important thing is that **Vim is a good [de facto standard](de_facto_standard.md)** -- the Vim's interface and philosophy is what matters the most, there are alternatives you can comfortably switch to. The situation is similar to for example "Unix as a concept", i.e. its interface, [philosophy](unix_philosophy.md) and culture, which together create a certain standardization that allows for different implementations that can be switched without much trouble. In the suckless community Vim has a similar status to [C](c.md), [Linux](linux.md) or [X11](x11.md) -- it is not ideal, by the strict standards it is a little bit bloated, however it is one of the best existing solutions and makes up for its shortcomings by being a stable, well established de-facto standard. + +## How To + +These are some Vim basics for getting started. There are two important editing modes in Vim: + +- **insert mode**: For writing text, you just type text as normal. Pressing *ESC* enters command mode. Here **CTRL + `n`** can be used for text completion. +- **command mode**: For executing commands. Pressing *i* enters insert mode. + +Some important commands in command mode are: + +- **arrow keys**: Can be used for moving cursor, even though many prefer to use the *hjkl* keys. With *SHIFT* held down the cursor moves horizontally by words and by screens vertically. +- **`h`,`j`,`k`,`l`**: Cursor movement. +- **`$`**: Move cursor to end of the line. +- **`0`**: Move cursor to start of the line. +- **CTRL + `w` + `w`**: Move between windows (created with `:split` or `:vspit`). +- **CTRL + PAGEUP**, **CTRL + PAGEDOWN**: Move between tabs. +- **u**: Undo. +- **CTRL + SHIFT + `r`**: Redo. +- **`:`**: Allows entering longer commands. *TAB* can be used for completion and up/down keys for listing command history. Some of the commands are: + - **`q`**: Quit, or close the current extra window/tab. Use **`qa`** for closing all windows/tabs and quit. **`q!`** (or **`qa!`**) quits without saving changes, **`wq`** quits with saving changes, **`wqa`** quits all saving all changes etc. + - **`w`**: Save changes (can be followed by filename). + - **`noh`**: Cancel highlighted text (e.g. after search). + - **`!`**: Run command in terminal, you can e.g. compile your program this way. For running Vim commands before the terminal commands use **`vimcommands |! terminalcommands`**, e.g. `:wa |! make && ./program`. + - **`tabedit filename`**: Opens given file in a new tab (tabs are closed with `:q`). + - **`tabmove number`**: Move current tab to given position (`+` and `-` can be used for relative movement of tabs). + - **`vsplit`**: Creates a new window by splitting the current one vertically. + - **`split`**: Creates a new window by splitting the current on horizontally. + - **`>`**: Indent to the right, well combined with text selection (`v`, `V`). + - **`.`**: Repeat previous command. + - **`%s/find/replace/g`**: Search and replace [regex](regex.md), [sed](sed.md) style. + - **`help command`**: Show help about given command. + - **`set variable value`**: Set a variable, used e.g. in configs. +- **`/pattern`**: Search for a [regex](regex.md) patter entered after `/`. Found matches will be highlighted (`:noh` cancels the highlight), you can move to the next one with `n` and to the previous one with `N`. +- **NUMBER `G`**: Go to line with given number (0 means last line). +- **`v`**, **`V`**: Select/highlight text (by characters and by lines). +- **`d`**: Delete, this is followed by a command saying what to delete, e.g. `dw` deletes to the end of the word, **`dd`** deletes the whole line. WARNING: delete actually copies the deleted text into clipboard (it behaves like *cut*)! +- **`o`**: Insert new line. +- **`p`**: Paste. +- **`y`**: Copy (yank), followed by a command saying what to copy (e.g. `yw` copies a word), **`yy`** copies the whole line. + +Vim can be configured with a file named **`.vimrc`** in home directory. In it there is a set of commands that will automatically be run on start. Example of a simple config file follows: + +``` +set number " set line numbering +set et " expand tabs +set sw=2 +set hlsearch +set nowrap " no line wrap +set colorcolumn=80 " highlight 80th column +set list +set listchars=tab:>. +set backspace=indent,eol,start +syntax on +``` + +## Alternatives + +Of course there are alternatives to Vim that are based on different paradigms, such as [Emacs](emacs.md), its biggest rival. In this regard any [text editor](text_editor.md) is a potential alternative. Nevertheless people looking for Vim alternatives are usually looking for other vi-like editors. These are for example: + +- **[vi](vi.md)**: While you probably won't use the original ancient vi program but rather something like [nvi](nvi.md), vi is a [POSIX](posix.md) standard for a text editor that's much simpler and universal than Vim. It lacks many features one may be used to from Vim such as tabs, [autocompletion](autocomplete.md), [syntax highligh](syntax_highlight.md) or multiple [undos](undo.mf). But limiting yourself to only using the features specified by the standard makes you more likely to be able to operate any vi-like text editor you encounter. (List of features added by Vim to vi can be found in `runtime/doc/vi_diff.txt` in Vim source tree.) +- **[neovim](neovim.md)**: Tries to be the "[modernized](modern.md)" ([refactored](refactoring.md)) fork of Vim, it removes some code, adds a new plugin system but also [bloat](bloat.md) like [CMake](cmake.md). One of its self-stated goals is to be more "community driven". It is also written in C99 (while Vim is in C89, more portable). { At least I think. ~drummyfish } +- **[vis](vis.md)**: Inspired by Vim and [Sam](sam.md), written in C99, seems to have only a few dependencies. Has no tabs. { At least I didn't find them. ~drummyfish } +- **[nvi](nvi.md)** (new vi): Vi implementation originally made for [BSD](bsd.md), much simpler than Vim (see vi above). +- **[elvis](elvis.md)**: Another vi implementation, pretty simple (see vi above). +- **[BusyBox vi](busybox.md)**: Very minimal vi implementation with very few features (see vi above), missing even window splits etc. +- **[gvim](gvim.md)**: Various versions of Vim with [GUI](gui.md) frontends made with libraries such as [GTK3](gtk3.md) or [Xaw](xaw.md). These run in a graphical window and have a menu with items you find in mainstream editors (*save*, *open*, *find* etc.). Of course you can still use this in the same way as the terminal version. \ No newline at end of file diff --git a/viznut.md b/viznut.md new file mode 100644 index 0000000..4560621 --- /dev/null +++ b/viznut.md @@ -0,0 +1,9 @@ +# Viznut + +Viznut (real name Ville-Matias Heikkilä) is a Finnish [demoscene](demoscene.md) programmer, [hacker](hacking.md) and [artist](art.md) that advocated high technological [minimalism](minimalism.md). He is known for example for his [countercomplex](countercomplex.md) blog, co-discovering [bytebeat](bytebeat.md) and creating [IBNIZ](ibniz.md). In his own words, he believes much more can be done with much less. He also warns of [collapse](collapse.md) (http://viznut.fi/en/future.html). According to his [Fediverse](fediverse.md) page he lives in Turku, Finland, was born around 1977 and has been programming since the age of seven. + +His work is pretty based, in many ways aligned with [LRS](lrs.md), he contributed a great deal to minimalist technology. Unfortunately in some ways he also seems pretty retarded: he uses [facebook](facebook.md), [twitter](twitter.md) and [github](github.md) and also mentions "personal pronouns" on his twitter xD Pretty disappointing TBH. This would make Viznut a [type A fail](fail_ab.md). + +His personal site is at http://viznut.fi/en/ and his blog at http://countercomplex.blogspot.com/. He collects many files at http://viznut.fi/files/, including very interesting writings about demoscene, programming experiments etc. + +In 2011 he released [IBNIZ](ibniz.md), a tiny [SDL](sdl.md) [virtual machine](vm.md) and a language that's meant as a platform for creating [demos](demoscene.md). Also in 2011 he was involved in the discovery of [bytebeat](bytebeat.md), a way of creating music with extremely simple [C](c.md) expressions -- later he published a paper about it. In 2012 he founded [Skrolli](skrolli.md), a magazine about sustainable/non-consumerist technology. In about 2019 he released PC-lamerit, an animated series about 90s computer hackers, made as an executable computer program -- it looks pretty cool. He also created UNSCII, a fixed-width font usable for [ANSI art](ansi_art.md). \ No newline at end of file diff --git a/watchdog.md b/watchdog.md new file mode 100644 index 0000000..9555ac7 --- /dev/null +++ b/watchdog.md @@ -0,0 +1,11 @@ +# Watchdog + +Watchdog is a special [timer](timer.md) that serves as a safety mechanism for detecting malfunction of computer programs at [run time](run_time.md) by requiring programs to periodically reset the timer. + +Basically watchdog keeps counting up and a correctly behaving program is supposed to periodically reset this count ("kick" or "feed the dog") -- if the reset doesn't happen for a longer period, the watchdog counts up to a high value and alerts that something's wrong ("the dog starts barking"), e.g. with an [interrupt](interrupt.md) or a [signal](signal.md). This can mean for example that the program has become stuck in an [infinite loop](infinite_loop.md) or that its instructions were corrupted and the program control jumped to some unintended area of RAM and is doing crazy [shit](shit.md). This is usually handled by resetting the system so as to prevent possible damage by the program gone insane, also [logs](log.md) can be made etc. Watchdogs are very often used in [embedded systems](embedded.md). [Operating systems](os.md) may also use them to detect nonresponsive [processes](process.md). + +Watchdog is similar to the dead man's switch used e.g. in trains where the operator is required to periodically push a button otherwise the train will automatically activate brakes as the operator is probably sleeping or dead. + +## See Also + +- [dog](dog.md) \ No newline at end of file diff --git a/web.md b/web.md new file mode 100644 index 0000000..ae0eca9 --- /dev/null +++ b/web.md @@ -0,0 +1,5 @@ +# Web + +*Ouch, this is embarrassing!* + +The article is actually [here](www.md). \ No newline at end of file diff --git a/whale.md b/whale.md new file mode 100644 index 0000000..8d414e6 --- /dev/null +++ b/whale.md @@ -0,0 +1,9 @@ +# Whale + +In online [pay to win](pay_to_win.md) [games](game.md) a whale is a player who spends enormous sums of money, much more than most of other players combined. They buy the most expensive items in the game stores daily, they highly engage in [microtheft](microtheft.md) and may throw even thousands of dollars at the game every day (cases of players spending over 1 million dollars on a casual game are known). In the playerbase there may exist just a handful of whale players but those are normally the main source of income for the game so that the developers actually focus almost exclusively on those few players, they craft the game to "catch the whales". The income from the rest of the players is negligible -- nevertheless the non-whales also play an important role, they are an attraction for the whales, they are there so that they can be owned by the whale players. + +Existence of whale players is one of the demonstrations of the [pareto principle](pareto.md) (80/20 rule): 80% of the game's income comes from 20% of the players, out of which, by extension, 80% again comes from the 20% and so on. + +The terminology can be extended further: besides **whales** we may also talk about **dolphins** (mid-spending players) and **minnows** (low spending players). Extreme whales are sometimes called **white whales** or **super whales** (about 0.2% generating 50% of income). + +In some games, such as [WoW](wow.md), players may buy multiple accounts and practice so called [multiboxing](multiboxing.md). This means they control multiple characters at once, often using [scripts](script.md) to coordinate them, which of course gives a great advantage. Though using scripts or "hacking" the game in similar ways is in other cases considered unacceptable [cheating](cheating.md) that results in immediate ban, for obvious reasons (money) developers happily allow this -- of course this just shows they don't give a single shit about fairness or balance, they only thing they care about is $$$profit$$$. \ No newline at end of file diff --git a/wiby.md b/wiby.md new file mode 100644 index 0000000..1c1f891 --- /dev/null +++ b/wiby.md @@ -0,0 +1,11 @@ +# Wiby + +Wiby is a [minimalist](minimalism.md) non-corporate [web](www.md) [search engine](search_engine.md) for old-style non-[bloated](bloat.md) (web 1.0) websites. Searching on wiby will yield small, simple websites, mostly non-interactive, static [HTML](html.md) personal/hobby sites, small community sites and obscure weird sites -- this kind of searching is not only [fun](fun.md), adventurous and nostalgic [90s](90s.md) like experience, but it actually leads to finding useful information which on corporate search engines like [Google](google.md) or [Bing](bing.md) get buried under billions of useless noise sites and links to "content platforms" like [YouTube](youtube.md) and [reddit](reddit.md). We highly recommend searching on wiby. + +It can be accessed at https://wiby.me and https://wiby.org. Of course, no [JavaScript](js.md) is needed! Clicking "surprise me" on wiby is an especially entertaining activity. + +The engine doesn't automatically crawl the whole web, it instead works by users submitting links, the admin approving them and a bot potentially crawling these sites to a small depth. + +Wiby appears to have been launched in October 2017 and built by a sole programmer who remains anonymous and accepts donations. On the [ASCII art](ascii_art.md) on the front page there are initials `jgs` which may or may not point to the author of wiby. + +On July 8, 2022 wiby became even more amazing by **being released as [free (as in freedom) software](free_software.md)** under [GPLv2](gpl.md)! It works on the [LEMP](lemp.md) stack. See http://wiby.me/about/guide.html. (The database of sites though seems to remain [proprietary](proprietary.md).) \ No newline at end of file diff --git a/wiki_authors.md b/wiki_authors.md new file mode 100644 index 0000000..fca5267 --- /dev/null +++ b/wiki_authors.md @@ -0,0 +1,7 @@ +# LRS Wiki Authors + +Contributors, list yourselves here if you have made at least one contribution. This helps keep track of people for legal reasons etc. + +Contributors to this wiki include: + +- Miloslav Číž aka [drummyfish](drummyfish.md) (https://www.tastyfish.cz) diff --git a/wiki_rights.md b/wiki_rights.md new file mode 100644 index 0000000..153270b --- /dev/null +++ b/wiki_rights.md @@ -0,0 +1,11 @@ +# LRS Wiki Usage Rights + +This page serves to establish usage rights for the whole LRS wiki. It is here to be part of the work so that the legal rights are always clear, even if e.g. the README gets lost somewhere along the way. + +Everything on this wiki has been created from scratch solely by people listed in [wiki authors](wiki_authors.md). Great care has been taken to make sure no copyrighted content created by other people has been included in any way. This is because one of the goals of this wiki is to be completely in the public domain world wide. + +Each contributor has agreed to release the whole LRS Wiki under the Creative Commons Zero 1.0 (CC0 1.O) waiver, available at https://creativecommons.org/publicdomain/zero/1.0/, with an additional option for you to also freely choose the following waiver instead: + +The intent of this waiver is to ensure that this work will never be encumbered by any exclusive intellectual property rights and will always be in the public domain world-wide, i.e. not putting any restrictions on its use. + +Each contributor to this work agrees that they waive any exclusive rights, including but not limited to copyright, patents, trademark, trade dress, industrial design, plant varieties and trade secrets, to any and all ideas, concepts, processes, discoveries, improvements and inventions conceived, discovered, made, designed, researched or developed by the contributor either solely or jointly with others, which relate to this work or result from this work. Should any waiver of such right be judged legally invalid or ineffective under applicable law, the contributor hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to this right. \ No newline at end of file diff --git a/wiki_style.md b/wiki_style.md new file mode 100644 index 0000000..d9ba52a --- /dev/null +++ b/wiki_style.md @@ -0,0 +1,56 @@ +# Wiki Style + +This outlines the style and rules of this Wiki that should ensure "quality" and consistency. You should read this before contributing. + +If you contribute, add yourself to [wiki authors](wiki_authors.md)! You can also join us on the [Island](island.md). + +## Rules + +1. **Everything is [public domain](public_domain.md)** under [CC0](cc0.md) to which all contributors agree. No one owns what we write here. +2. **No [fair use](fair_use.md)** or even unfrair use. We want this Wiki to be as free as possible and don't thread the fine legal lines. That means you can't directly include anything on this Wiki if it's copyrighted, **even if it's under a free license**. So generally **avoid any copy pasting and rather try to write everything yourself**. +3. **Stay on topic**, this Wiki is **CENSORED**: spam, too much of completely non-related text, shitty things, capitalist propaganda and similar are not to be had here. + +## Style + +- **Don't line-break paragraphs** (a pragraph is on a single line). The reasoning is that a text manually formatted to specific width is hard to edit. It's easier to switch to auto-line breaking in your editor. +- **Avoid [unicode](unicode.md), highly prefer [ASCII](ascii.md)**, for the sake of maximum compatibility and simplicity. Use of unicode has to be greatly justified. +- **Each page shall start with a heading** (which may not correspond to article file name). +- I've finally decided that with certain exceptions headings should be written like this: **Each Word Of A Heading Is Capitalized**. This is for simplicity. +- **Filenames of articles shall use a lowercase snake_case**. +- **This isn't [Wikipedia](wikipedia.md)**, memes, opinions and uncensored truths are allowed (and welcome). +- The style of this wiki is inspired by the classic hacker culture works such as the [WikiWikiWeb](wikiwikiweb.md) and [Jargon File](jargon_file.md). +- **Writing style should be relaxed and in many parts informal**. Formality is used where it is useful (e.g. definitions), most of other text can benefit from being written as a tech conversation among friends. +- **Political incorectness, slurs and "offensive speech" is highly encouraged**. +- **Images**: for now don't embed images. [ASCII art](ascii_art.md) can be used in many places instead of an image. Thousand words are worth a picture. Non-embedding links to images are okay. +- **You can leave comments right in the text of articles**, e.g. like this: { I disagree with this [shit](shit.md). ~drummyfish }. + +Articles should be written to be somewhat readable and understandable to tech savvy people who already know something about technology, i.e. not only experts (as is sometimes the case e.g. on Wikipedia). **Each article should ideally start with a general dictionary [definition](definition.md)** and continue with a simple general explanation and overview of the topic. With more paragraphs the text can get more complex. The idea is that a noob will read the first paragraph, understand the basic idea and take something away. A more advanced reader will read further on and take away more things etc. I.e. we educate in a top-down approach. + +## Sources + +These are some sources you can use for research and gathering information for articles: + +- **[Wikipedia](wikipedia.md)**: of course, but don't limit your search to it. Searching other language Wikipedias with machine translate can also help find extra info. +- **[Citizendium](citizendium.md)**: can offer a different angle of view from Wikipedia. +- **non-SJW forks of Wikipedia**: to get past SWJ censorship/propaganda on Wikipedia try e.g. [infogalactic](infogalactic.md) or [metapedia](metapedia.md). +- **Britannica online**: proprietary, but articles are nicely written, facts are in the public domain so we can steal them. +- **[wikiwikiweb](wikiwikiweb.md)** +- **[Wiby](wiby.md)**: this will find nice sites of tech nerds that Google won't show among first results +- **[Project Gutenberg](gutenberg.md)**: mostly older books but there are already some computer related books like [RMS's](rms.md) biography or [Jargon File](jargon_file.md) +- **University theses** (and scientific paper of course): many university theses are publicly accessible and usually nicely sum up topics, bachelor level theses may be better understandable than PhD/master theses. +- **Slides**: slides from various presentations are actually great resources as they condense the topic into its main points, they filter out the piles of noise. +- **Wikisource** and **Wikibooks** +- **[Metapedia](metapedia.md)** +- **[books](book.md)**: Books are still of higher quality than online sources so you can [pirate](piracy.md) some and steal some facts from them. +- **[Internet Archive](internet_archive.md)**: A lot of things can be found on the old web that today drown in the bloat of shitsites, also Internet Archive has archives of various forums etc. +- **[YouTube](youtube.md)**: Yes, sadly this is nowadays one of the biggest sources of information which is unfortunately hidden in videos full of ads and retarded zoomers, the information is unindexed. If you are brave enough, you can dig this information out and write it here as a proper text. +- Try searching with different search engines than just Google (wiby, Yandex, Bing, Yahoo, ...). +- **Non-web**: When web fails, you can search the [darknet](darknet.md), [gopher](gopher.md), [gemini](gemini.md), [usenet](usenet.md), [tor](tor.md) etc. + +## Purpose + +Basically the purpose of this wiki is to have fun and also create a coherent and consistent philosophy of a truly good software, technology and also to a related degree society. + +Additionally we want to create a nice, completely public domain, suckless educational resource, an encyclopedia that's written in a nicer style than e.g. Wikipedia. + +Another goal is to serve as a historical account of our age. We suppose that people in the future may want to read first-hand accounts of how people saw the society and its technology, what they thought was important, what they predicted etc. We like to do this ourselves thanks to e.g. Project Gutenberg. Kids in the future will be like "haha those idiots couldn't see they would bloat themselves to death", this Wiki will show that indeed we foresaw it, we were just in a huge minority. Future kids: don't repeat the same mistakes we did. \ No newline at end of file diff --git a/wikipedia.md b/wikipedia.md new file mode 100644 index 0000000..865bfe3 --- /dev/null +++ b/wikipedia.md @@ -0,0 +1,52 @@ +# Wikipedia + +Wikipedia is a non-commercial, [free/open](free_culture.md) [online](www.md) encyclopedia written mostly by volunteers, running on [free software](free_software.md), allowing almost anyone to edit its content (i.e. being a [wiki](wiki.md)); it is the largest and perhaps most famous encyclopedia created to date. It is licensed under [CC-BY-SA](cc_by_sa.md) and is run by the nonprofit organization Wikimedia Foundation. It is accessible at https://wikipedia.org. + +Wikipedia exists in many (more than 200) versions differing mostly by the language used but also in other aspects; this includes e.g. Simple English Wikipedia or Wikipedia in [Esperanto](esperanto.md). In all versions combined there are over 50 million articles and over 100 million users. English Wikipedia is the largest with over 6 million articles. + +There are also many sister projects of Wikipedia such as [Wikimedia Commons](wm_commons.md) that gathers [free as in freedom](free_culture.md) media for use on Wikipedia, [WikiData](wikidata.md), Wikinews or Wikisources. + +Information about hardware and software used by Wikimedia Foundation can be found at https://meta.wikimedia.org/wiki/Wikimedia_servers. As of 2022 Wikipedia runs of the traditional [LAMP](lamp.md) framework and its website doesn't require [JavaScript](javascript.md) (amazing!). [Debian](debian.md) [GNU](gnu.md)/[Linux](linux.md) is used on web servers (switched from [Ubunatu](ubuntu.md) in 2019). The foundation uses its own [wiki](wiki.md) engine called [MediaWiki](mediawiki.md) that's written mainly in [PHP](php.md). Database used is [MariaDB](mariadb.md). The servers run on server clusters in 6 different data centers around the world which are rented: 3 in the [US](usa.md), 3 in [Europe](europe.md) and 1 in [Asia](asia.md). + +Wikipedia was created by [Jimmy Wales](jimmy_wales.md) and [Larry Sanger](larry_sanger.md) and was launched on 15 January 2001. It was made as a complementary project alongside [Nupedia](nupedia.md), an earlier encyclopedia by Wales and Sanger to which only verified experts could contribute. Wikipedia of course has shown to be a much more successful project. + +There exist [forks](fork.md) and alternatives to Wikipedia. Simple English Wikipedia can offer a simpler alternative to sometimes overly complicated articles on the main English Wikipedia. [Citizendium](citizendium.md) is a similar, free online encyclopedia co-founded by [Larry Sanger](larry_sanger.md), a co-founder of Wikipedia itself. Citizendium's goal is to improve on some weak point of Wikipedia such as its reliability or quality of writing. [Metapedia](metapedia.md) is a Wikipedia fork that's written from a [rightist](left_right.md) point of view. [Infogalactic](infogalactic) is also a Wikipedia fork that tries to remove the [pseudoleftist](pseudoleft.md) bullshit etc. Encyclopedia Britannica can also be used as a nice resource: its older versions are already [public domain](public_domain.md) and can be found e.g. at [Project Gutenberg](gutenberg.md), and there is also a modern online version of Britannica which is [proprietary](proprietary.md) (and littered with ads) but has pretty good articles even on modern topics (of course facts you find there are in the public domain). Practically for any specialized topic it is nowadays possible to find its own wiki on the Internet. + +## Good And Bad Things About Wikipedia + +Let's note a few positive and negative points about Wikipedia, as of 2022. Some good things are: + +- Despite its flaws Wikipedia is still a **highly free, high quality noncommercial source of knowledge for everyone**, without ads and [bullshit](bs.md). It is tremendously helpful, Wikipedia may e.g. be printed out or saved in an offline version and used in the third world as a completely free educational resource (see [Kiwix](kiwix.md)). +- Wikipedia **helped prove the point of [free culture](free_culture.md)** and showed that collaboration of volunteers can far surpass the best efforts of corporations. +- Wikipedia's **website is pretty nice**, kind of minimalist, lightweight and **works without [Javascript](javascript.md)**. +- Wikipedia is very **friendly to computer analysis**, it provides all its data publicly, in simple and open formats, and doesn't implement any [DRM](drm.md). This allows to make a lot of research, in depth searching, collection of statistics etc. +- Wikipedia **drives the sister projects**, some of which are extremely useful, e.g. Wikimedia Commons, Wikidata or [MediaWiki](mediawiki.md). +- Even if politically biased, **Wikipedia may serve as a basis for [forks](fork.md) that fix the political bias** ([Metapedia](metapedia.md), [InfoGalacti](infogalactic.md), ...). + +And the bad things are: + +- Wikipedia is **censored and biased**, even though it [proclaims the opposite](https://en.wikipedia.org/wiki/Wikipedia:What_Wikipedia_is_not#Wikipedia_is_not_censored) (which makes it much worse by misleading people). "Offensive" material and material not aligned with [pseudoleftist](pseudoleft.md) propaganda is removed as well as material connected to some controversial resources (e.g the link to 8chan, https://8kun.top, is censored, as well as [Nina Paley](nina_paley.md)'s Jenndra Identitty comics and much more). There is a heavy **[pseudoleft](pseudoleft.md) and [soyence](soyence.md) bias** in the articles. +- Wikipedia includes material under **[fair use](fair_use.md)**, such as screenshots from proprietary games, which makes it partially [proprietary](proprietary.md), i.e. Wikipedia is technically **NOT 100% free**. Material under fair use is still proprietary and can put remixers to legal trouble (e.g. if they put material from Wikipedia to a commercial context), even if the use on Wikipedia itself is legal (remember, proprietary software is legal too). +- Wikipedia often suffers from writing inconsistency, bad structure of text and **poor writing** in general. In a long article you sometimes find repeating paragraphs, sometimes a lot of stress is put on one thing while mentioning more important things only briefly, the level of explanation expertness fluctuates etc. This is because in many articles most people make small contributions without reading the whole article and without having any visions of the whole. And of course there are many contributors without any writing skills. +- Wikipedia is **too popular** which has the negative side effect of becoming a **political battlefield**. This is one of the reasons why there has to be a lot of **bureaucracy**, including things such as **locking of articles** and the inability to edit everything. Even if an article can technically be edited by anyone, there are many times people watching and reverting changes on specific articles. So Wikipedia can't fully proclaim it can be "edited by anyone". +- Wikipedia is **hard to read**. The articles go to great depth and mostly even simple topics are explained with a great deal of highly technical terms so that they can't be well understood by people outside the specific field, even if the topic could be explained simply (Simple English Wikipedia tries to fix this a little bit at least). Editors try to include as much information as possible which too often makes the main point of a topic drown in the blablabla. Wikipedia's style is also very formal and "not [fun](fun.md)" to read, which isn't bad in itself but it just is boring to read. Some alternative encyclopedias such as [Citizendium](citizendium.md) try to offer a more friendly reading style. +- Wikipedia is **not [public domain](public_domain.md)**. It is licensed under [CC-BY-SA](cc_by_sa.md) which is a [free](free_culture.md) license, but has a few burdening conditions. We belive knowledge shouldn't be owned or burdened by any conditions. +- Even though there are no ads, there sometimes appears a **political propaganda** banner somewhere (international days of whatever, ...). Main page just **hard pushes [feminist](feminism.md) shit** as featured images and articles. + +## Fun And Interesting Pages + +There are many interesting and entertaining pages and articles on Wikipedia, some of them are: + +- **unusual articles**: https://en.wikipedia.org/wiki/Wikipedia:Unusual_articles +- **don't delete the main page**: https://en.wikipedia.org/wiki/Wikipedia:Don%27t_delete_the_main_page +- **Wikipedia records**: https://en.wikipedia.org/wiki/Wikipedia:Wikipedia_records +- **longest pages**: https://en.wikipedia.org/wiki/Special:LongPages +- **special pages**: https://en.wikipedia.org/wiki/Special:SpecialPages +- **list of lists of lists**: https://en.wikipedia.org/wiki/List_of_lists_of_lists +- **current events**: https://en.wikipedia.org/wiki/Portal:Current_events + +## See Also + +- [Intellipedia](intellipedia.md) +- [Citizendium](citizendium.md) +- [Infogalactic](infogalactic.md) \ No newline at end of file diff --git a/wikiwikiweb.md b/wikiwikiweb.md new file mode 100644 index 0000000..7d9c48a --- /dev/null +++ b/wikiwikiweb.md @@ -0,0 +1,31 @@ +# WikiWikiWeb + +WikiWikiWeb (also *c2 Wiki* or just *Wiki*) was the first ever created [wiki](wiki.md) (user editable) website, created in 1995 in [Perl](perl.md) by [Ward Cunningham](cunningham.md). It was focused on [software engineering](sw_engineering.md) and computer technology in general but included a lot of discussion and pages touching on other topics, e.g. those of politics, humor or nerd and [hacker](hacking.md) culture. The principles on which this site worked, i.e. allowing users to edit its pages, greatly influenced a lot of sites that came after that are now generally called [wikis](wiki.md), of which most famous is [Wikipedia](wikipedia.md). The style of WikiWikiWeb was partly an inspiration for our [LRS wiki](lrs_wiki.md). + +It had over 36000 pages (http://c2.com/cgi/wikiPages). Since 2014 the wiki can no longer be edited due to vandalism, but it's still online. It was originally available at http://www.c2.com/cgi/wiki, now at http://wiki.c2.com/ (sadly now requires [JavaScript](js.md), WTF how is this a hacker site???). + +The site's engine was kind of [suckless](suckless.md)/[KISS](kiss.md), even Wikipedia looks [bloated](bloat.md) compared to it. It was pure unformatted [HTML](html.md) that used a very clever system of [hyperlinks](hypertext.md) between articles: any [CamelCase](camelcase.md) multiword in the text was interpreted as a link to an article, so for example the word `SoftwareDevelopment` was automatically a link to a page called *Software Development*. This presented a slight issue e.g. for single-word topics but the creativity required for overcoming the obstacle was part of the [fun](fun.md), for example the article on [C](c.md) was called `CeeLanguage`. + +Overall the site was also very different from [Wikipedia](wikipedia.md) and allowed informal comments, jokes and subjective opinions in the text. It was pretty entertaining to read. There's a lot of old hacker wisdom to be found there. + +There are other wikis that work in similar spirit, e.g. CommunityWiki (https://communitywiki.org, a wiki "about communities"), MeatBallWiki (http://meatballwiki.org/wiki/) or EmacsWiki. + +## Interesting Pages + +These are some interesting pages found on the Wiki. + +- **CategoryCategory**: List of categories of pages. +- **CategoryHumor**: Humorous pages. +- **ComputerGame** +- **ExtinctionOfHumanity**: Discussing end of humanity and a possible [collapse](collapse.md). +- **GameOfChess**: About [chess](chess.md). +- **LanguageGotchas** +- **WeirdErrorMessages** +- **WikiWikiWebFaq** +- **WithinTwentyYears**: Mostly pre-2005 predictions about what technology would be like in 20 years, a lot of hits and misses. +- **WikiHistory** + +## See Also + +- [Jargon File](jargon_file.md) +- [Wikipedia](wikipedia.md) \ No newline at end of file diff --git a/windows.md b/windows.md new file mode 100644 index 0000000..1673370 --- /dev/null +++ b/windows.md @@ -0,0 +1,5 @@ +# Microsoft Windows + +Microsoft Windows is a series of malicious, [bloated](bloat.md) [proprietary](proprietary.md) [operating systems](os.md). DO NOT USE THIS [SHIT](shit.md). + +## Versions \ No newline at end of file diff --git a/wizard.md b/wizard.md new file mode 100644 index 0000000..999e668 --- /dev/null +++ b/wizard.md @@ -0,0 +1,10 @@ +# Wizard + +Wizard is a male [virgin](virgin.md) who is at least 30 years old ([female](female.md) virgins of such age haven't been seen yet). The word is sometimes also used for a man who's just very good with [computers](computer.md). These two sets mostly overlap so it rarely needs to be distinguished which meaning we intend. + +There is an [imageboard](imageboard.md) for wizards called [wizardchan](wizchan.md). It is alright but also kind of sucks, for example you can't share your [art](art.md) with others because of stupid anti-[doxxing](dox.md) rules that don't even allow to dox yourself. + +## See Also + +- [incel](incel.md) +- [volcel](volcel.md) \ No newline at end of file diff --git a/woman.md b/woman.md new file mode 100644 index 0000000..6a043ac --- /dev/null +++ b/woman.md @@ -0,0 +1,23 @@ +# Woman + +A woman (also femoid or succubus) is one of two genders (sexes) of humans, the other one being [man](man.md). Women are notoriously bad at [programming](programming.mg), [math](math.md) and [technology](technology.md): in the field they usually "work" on [bullshit](bullshit.md) (and harmful) positions such as some "diversity department", [marketing](marketing.md), "HR" or [UI](ui.md)/[user experience](ux.md). If they get close to actual technology, their highest "skills" are mostly limited to casual "[coding](coding.md)" (which itself is a below-average form of [programming](programming.md)) in a baby language such as [Python](python.md), [Javascript](javascript.md) or [Rust](rust.md). Mostly they are just hired for quotas and make coffee for men who do the real work. + +Women also can't drive, operate machines, they can't compare even to the worst men in sports, both physical (e.g. 100 m sprint women world record is almost a whole second slower than that of men) and mental such as [chess](chess.md). Women have to have separate leagues and more relaxed rules, e.g. the title Woman Grand Master (WGM) in chess has far lower requirements to obtain than regular Grand Master (GM). (Just as of this moment in the FIDE database there are 19 living male players rated better than the best woman ever was; also none of them is [black](nigger.md), only one is Indian). There are too many funny cases and video compilations of women facing men in sports, e.g. the infamous [football](football.md) match between the US national women team (probably the best women team in the world) vs some random under 15 years old boy's team which of course the women team lost. Of course there are arguments that worse performance of women in mental sports is caused culturally; women aren't led so much to playing chess, therefore there are fewer women in chess and so the probability of a good woman player appearing is lower. This may be partially true even though genetic factors seem at least equally important and it may equally be true that not so many women play chess simply because they're not naturally good at it; nevertheless the fact that women are generally worse at chess than men stands, regardless of its cause. + +But of course even though rare, well performing women may statistically appear. The issue is women are very often involved with a cult such as the [feminists](feminism.md) who waste their effort on [fighting](fight_culture.md) men instead of focusing on study and creation of real technology, and on actually loving it. They don't see technology as a beautiful field of art and science, they see it as a battlefield, a political tool to be weaponized to achieve social status, revenge on society etc. They can't understand the pure joy of [programming](programming.md), the love of creation for its own sake, they think more in terms of "learning to code will get me new followers on social networks" etc. You will never find a basement dweller programmer or [demoscene](demoscene.md) programmer of female gender, a hacker who is happy existing in a world of his own programs without the need for approval or external reward, a woman will never be able to understand this. + +Of course, [LRS](lrs.md) loves all living beings equally, even women. In order to truly love someone we have to be aware of their true nature so that we can truly love them, despite all imperfections. + +**Is there even anything women are better at than men?** Well, women seem for example more peaceful or at least less violent on average (feminism of course sees this as a "weakness" and tries to change it), though they seem to be e.g. more passive-aggressive. They have also evolved to perform the tasks of housekeeping and care taking at which they may excel (still it seems that if men focus at a specific tasks, they will beat a women, for example the best cooks in the world are men). Sometimes women may be preferable exactly for not being as "rough" as men, e.g. as singers, psychologists, massage therapists etc. + +# Women In Tech + +Finding famous women capable in technology is almost a futile task. One of the most famous women of [modern](modern.md) tech, even though more an entrepreneur than engineer, was [Elizabeth Holmes](elizabeth_holmes.md) who, to the feminists' dismay, turned out to be a complete fraud and is now facing criminal charges. [Grace Hopper](grace_hopper) (not "grass hopper" lol) is a woman actually worth mentioning for her contribution to programming languages. [Ada Lovelace](ada_lovelace.md) cited by the feminist propaganda as "the first programmer" also didn't actually do anything besides scribbling a note about a computer completely designed by a man. This just shows how desperate the feminist attempts at finding capable women in tech are. Then there are also some individuals who just contributed to the downfall of the technology who are, in terms of gender, probably more on the woman side, but their actual classification is actually pretty debatable -- these are monstrosities with pink hair who invented such [cancer](cancer.md) as [COCs](coc.md) and are not even worth mentioning. + +In the related field of [free culture](free_culture.md) there is a notable woman, [Nina Paley](nina_paley.md), that has actually done some nice things for the promotion of free culture and also standing against the [pseudoleftist](pseudoleft.md) fascism by publishing a series of comics with a character named Jenndra Identitty, a parody of fascist trannies. + +In [science](science.md) at wide we occasionally find a capable woman, for example Marie Curie. + +## See Also + +- [pussy](pussy.md) \ No newline at end of file diff --git a/work.md b/work.md new file mode 100644 index 0000000..69cce49 --- /dev/null +++ b/work.md @@ -0,0 +1,7 @@ +# Work + +Work is an unpleasant effort that one is required to make such as harvesting crops or [debugging](debugging.md) computer programs. Work hurts living beings and takes away the meaning of their lives. Work makes us slaves, it wastes our lives and is a cause of a large number of [suicides](suicide.md). One of the main goals of civilization is to eliminate any need for work, i.e. create machines that will do all the work for humans. + +While good society tries to eliminate work, [capitalism](capitalism.md) aims for the opposite, i.e. artificially creating bullshit jobs and bullshit needs so as to keep everyone enslaved to the system. Fortunately movements such as the [antiwork](antiwork.md) movement try to oppose this, however masses have already been brainwashed to be hostile to such movements and instead demand their own enslavement. + +[We](lrs.md) see it as essential to start educating people about the issue as well as starting to eliminate jobs immediately with things such as [automation](automation.md) and [universal basic income](ubi.md). \ No newline at end of file diff --git a/wow.md b/wow.md new file mode 100644 index 0000000..e56fe6a --- /dev/null +++ b/wow.md @@ -0,0 +1,7 @@ +# World Of Warcraft + +World of Warcraft (WoW) is a [proprietary](proprietary.md) [game](game.md) released in [2004](2004.md) by [Blizzard](blizzard.md) that was one of the most successful and influencing games among [MMORPGs](mmorpg.md). + +There is a [FOSS](foss.md) implementation of WoW server called [MaNGOS](mangos.md) that's used to make private servers. The client is of course proprietary and if you dare make a popular server Blizzard will kill your grandmother and rape your children. + +{ The classic WoW (some time until the end of WOTLK) lied somewhere in the middle between good old and shitty [modern](modern.md) games (the WoW of today is 100% shit of course). For me the peak of Warcraft was [Warcraft III:TFT](warcraft.md), it was perfect in every way (except for being proprietary and bloated of course). As a great fan of Warcraft III, seeing WoW in screenshots my fantasy made it the best game possible to be created. When I actually got to playing it it was really good -- some of my best memories come from that time -- nevertheless I also remember being disappointed in many ways. Especially with limitation of freedom (soulbound items, forced grinding, effective linearity of leveling, GMs preventing hacking the game in fun ways etc.) and here and there a lack of polish (there were literally visible unfinished parts of the map, also visual transitions between zones too fast and ugly and the overall world design felt kind of bad), laziness and repetitiveness of the design. I knew how the game could be fixed, however I also knew it would never be fixed as it was in hands of a corporation that had other plans with it. That was the time I slowly started to see things not being ideal and the possibility of a great thing going to shit. ~drummyfish } \ No newline at end of file diff --git a/www.md b/www.md new file mode 100644 index 0000000..e6bbece --- /dev/null +++ b/www.md @@ -0,0 +1,62 @@ +# World Wide Web + +World Wide Web (www or just *the web*) is (or was, if we accept that by 2021 the web is basically dead) a network of interconnected documents on the [Internet](internet.md) (called *websites* or *webpages*). Webpages are normally written in [HTML](html.md) language and can refer to each other by [hyperlinks](hyperlink.md). The web itself works on top of the [HTTP](http.md) protocol. Some people confuse the web with the Internet, but of course those people are retarded: web is just one of many service existing on the Internet (other ones being e.g. [email](email.md) or [torrents](torrent.md)). In order to browse the web you need an Internet connection and a [web browser](browser.md). + +An important part of the web is also searching its vast amounts of information with [search engines](search_engine.md) such as the infamous [Google](google.md) engine. It also relies on systems such as [DNS](dns.md). + +Web is kind of a bloated [shit](shit.md), for more [suckless](suckless.md) alternatives see [gopher](gopher.md) and [gemini](gemini.md). + +The web is perhaps the best, saddest and funniest example of [capitalist](capitalist_software.md) [bloat](bloat.md), the situation with web sites is completely ridiculous and depressive. A nice article about the issue, called *The Website Obesity Crisis*, can be found at https://idlewords.com/talks/website_obesity.htm. There is a tool for measuring a website bloat at https://www.webbloatscore.com/: it computes the ratio of the page size to the size of its screenshot (e.g. [YouTube](youtube.md) currently scores 35.7). + +Back in the days (90s and early 2000s) web used to be a place of freedom working more or less in a decentralized manner and on anarchist principles –⁠ people used to have their own unique websites, censorship was difficult to implement and mostly non-existent and websites used to have a much better design and were safer, as they were pure [HTML](html.md) documents. + +As the time went web used to become more and more [shit](shit.md), as is the case with everything touched by [capitalism](capitalist_software.md) – the advent of so called **web 2.0** brought about a lot of [complexity](complexity.md), websites started to incorporate runnable scripts ([JavaScript](javascript.md), [Flash](flash.md)) which lead to many negative things such as security vulnerabilities (web pages now have power to run code) and more complexity in web browsers, which leads to even more possible vulnerabilities, [bloat](bloat.md) and to browser monopolies (greater effort is needed to develop a browser, making it a privilege of those who can afford it, and those can subsequently dictate de-facto standards that further strengthen their monopolies). Another disaster came with **[social networks](social_network.md)** in mid 2000s, most notably [Facebook](facebook.md) but also [YouTube](youtube.md) and others, which centralized the web and rid people of control. Out of comfort people stopped creating and hosting own websites and rather created a page on Facebook. This gave the power to corporations and allowed **mass-surveillance**, **mass-censorship** and **propaganda brainwashing**. As the web became more and more popular, corporations and governments started to take more control over it, creating technologies and laws to make it less free. By 2020, the good old web is but a memory, everything is controlled by corporations, infected with billions of unbearable ads, [DRM](drm.md), malware (trackers, [crypto](crypto.md) miners), there exist no good web browsers, web pages now REQUIRE JavaScript even if it's not really needed due to which they are painfully slow and buggy, there are restrictive laws and censorship and de-facto laws (site policies) put in place by corporations controlling the web. + +## History + +World Wide Web was invented by an English computer scientist [Tim Berners-Lee](berners_lee.md). In 1980 he employed [hyperlinks](hyperlink.md) in a notebook program called ENQUIRE, he saw the idea was good. On March 12 1989 he was working at [CERN](cern.md) where he proposed a system called "web" that would use [hypertext](hypertext.md) to link documents (the term hypertext was already around). He also considered the name *Mesh* but settled on *World Wide Web* eventually. He started to implement the system with a few other people. At the end of 1990 they already had implemented the [HTTP](http.md) protocol for client-server communication, the [HTML](html.md), language for writing websites, the first web server and the first [web browser](browser.md) called *WorldWideWeb*. They set up the first website http://info.cern.ch that contained information about the project. + +In 1993 CERN made the web [public domain](public_domain.md), free for anyone without any licensing requirements. The main reason was to gain advantage over competing systems such as [Gopher](gopher.md) that were [proprietary](proprietary.md). By 1994 there were over 500 web servers around the world. WWW Consortium ([W3M](w3m.md)) was established to maintain standards for the web. A number of new browsers were written such as the text-only [Lynx](lynx.md), but the [proprietary](proprietary.md) [Netscape Navigator](netscape_navigator.md) would go to become the most popular one until [Micro$oft](microsoft)'s [Internet Explorer](internet_explorer.md) (see [browser wars](browser_wars.md)). In 1997 [Google](google.md) search engine appeared, as well as [CSS](css.md). There was a economic bubble connected to the explosion of the Web called the [dot-comm boom](dot_com_boom.md). + +Between 2000 and 2010 there used to be a mobile alternative to the web called [WAP](wap.md). Back then mobile phones were significantly weaker than PCs so the whole protocol was simplified, e.g. it had a special markup language called [WML](wml.md) instead of [HTML](html.md). But as the phones got more powerful they simply started to support normal web and WAP disappeared. + +Around 2005, the time when [YouTube](youtube.md), [Twitter](twitter.md), [Facebook](facebook.md) and other shit sites started to appear and become popular, so called [Web 2.0](web_20.md) started to form. This was a shift in the web's paradigm towards more [shittiness](shit.md) such as more [JavaScript](javascript.md), [bloat](bloat.md), interactivity, websites as programs, [Flash](flash.md), [social networks](social_network.md) etc. This would be the beginning of the web's downfall. + +## How It Works + +It's all pretty well known, but in case you're a nub... + +Users browse the Internet using [web browsers](browser.md), programs made specifically for this purpose. Pages on the [Internet](internet.md) are addressed by their [URL](url.md), a kind of textual address such as `http://www.mysite.org/somefile.html`. This address is entered into the web browser, the browser retrieves it and displays it. + +A webpage can contain text, pictures, graphics and nowadays even other media like video, audio and even programs that run in the browser. Most importantly webpages are [hypertext](hypertext.md), i.e. they may contain clickable references to other pages -- clicking a link immediately opens the linked page. + +The page itself is written in [HTML](html.md) language (not really a [programming](programming.md), more like a file format), a relatively simple language that allows specifying the structure of the text (headings, paragraphs, lists, ...), inserting links, images etc. In newer browsers there are additionally two more important languages that are used with websites (they can be embedded into the HTML file or come in separate files): [CSS](css.md) which allows specifying the look of the page (e.g. text and font color, background images, position of individual elements etc.) and [JavaScript](js.md) which can be used to embed [scripts](script.md) (small [programs](program.md)) into webpages which will run on the user's computer (in the browser). These languages combined make it possible to make websites do almost anything, even display advanced 3D graphics, play movies etc. However, it's all huge [bloat](bloat.md), it's pretty slow and also dangerous, it was better when webpages used to be HTML only. + +The webpages are stored on web [servers](server.md), i.e. computers specialized on listening for requests and sending back requested webpages. If someone wants to create a website, he needs a server to host it on, so called [hosting](hosting.md). This can be done by setting up one's own server -- so called [self hosting](self_hosting.md) -- but nowadays it's more comfortable to buy a hosting service from some company, e.g. a [VPS](vps.md). For running a website you'll also want to buy a web [domain](domain.md) (like `mydomain.com`), i.e. the base part of the textual address of your site (there exist free hosting sites that even come with free domains if you're not picky, just search...). + +When a user enters a URL of a page into the browser, the following happens (it's kind of simplified, there are [caches](cache.md) etc.): + +1. The [domain](domain.md) name (e.g. `www.mysite.org`) is converted into an [IP](ip.md) address of the server the site is hosted on. This is done by asking a [DNS](dns.md) server -- these are special servers that hold the database mapping domain names to IP addresses (when you buy a domain, you can edit its record in this database to make it point to whatever address you want). +2. The browser sends a request for given page to the IP address of the server. This is done via [HTTP](http.md) (or [HTTPS](https.md) in the encrypted case) protocol -- this protocol is a language via which web servers and clients talk (it can contain additional data like passwords entered on the site etc.). (If the encrypted HTTPS protocol is used, encryption is performed with [asymmetric cryptography](asymmetric_cryptography.md) using the server's public key whose digital signature additionally needs to be checked with some certificate authority.) This request is delivered to the server by the mechanisms and lower network layers of the [Internet](internet.md), typically [TCP](tcp.md)/[IP](ip.md). +3. The server receives the request and sends back the webpage embedded again in an [HTTP](http.md) response, along with other data such as the error/success code. +4. Client browser receives the page and displays it. If the page contains additional resources that are needed for displaying the page, such as images, they are automatically retrieved the same way. + +[Cookies](cookie.md), small files that sites can store in the user's browser, are used on the web to implement stateful behavior (e.g. remembering if the user is signed in on a forum). However cookies can also be abused for tracking users, so they can be turned off. + +Other programming languages such as [PHP](php.md) can also be used on the web, but they are used for server-side programming, i.e. they don't run in the web browser but on the server and somehow generate and modify the sites for each request specifically. This makes it possible to create dynamic pages such as [search engines](search_engine.md) or [social networks](social_network.md). + +## See Also + +- [Dark Web](dark_web.md) +- [Dork Web/Smol Internet](smol_internet.md) +- [teletext](teletext.md) +- [WAP](wap.md) +- [Usenet](usenet.md) +- [TOR](tor.md) +- [Gopher](gopher.md) +- [Gemini](gemini.md) +- [BBS](bbs.md) +- [Freenet](freenet.md) +- [IPFS](ipfs.md) +- [Internet](internet.md) +- [Kwangmyong](kwangmyong.md) \ No newline at end of file diff --git a/x86.md b/x86.md new file mode 100644 index 0000000..5f369a8 --- /dev/null +++ b/x86.md @@ -0,0 +1,5 @@ +# x86 + +x86 is a [bloated](bloat.md), toxic [instruction set architecture](isa.md) (or rather a family of them) used mostly in the [desktop](desktop.md) computers -- it is the most widely used architecture, used in [Intel](intel.md) and [AMD](amd.md) [CPU](cpu.md)s. + +It is a [CISC](cisc.md) architecture and boy, complex it is. **[LMAO](lmao.md)** there are instructions like **PCLMULQDQ**, **MPSADBW** (*multiple packed sums of absolute difference* which does something like cross correlation ??? xD) and **PCMPESTRI** (which does like many possible string searches/comparisons on strings of different data types like subset or substring with many different options). Basically if you smash your keyboard chances are you produce a valid x86 instruction xD \ No newline at end of file diff --git a/xd.md b/xd.md new file mode 100644 index 0000000..1b89bfa --- /dev/null +++ b/xd.md @@ -0,0 +1 @@ +# xD \ No newline at end of file diff --git a/xonotic.md b/xonotic.md new file mode 100644 index 0000000..b9f346f --- /dev/null +++ b/xonotic.md @@ -0,0 +1,21 @@ +# Xonotic + +Xonotic is a [free as in freedom](free_software.md) fast multiplayer arena [first-person-shooter](fps_game.md) [game](game.md) similar to e.g. [Quake](quake.md). It runs on [GNU](gnu.md)/[Linux](linux.md), [Winshit](windows.md), [BSD](bsd.md) and other systems. It is one of the best libre games, i.e. games that are completely free by both code and data/content. It is available under [GPLv3](gpl.md). Its gameplay, graphics and customizability are pretty great, it may well be the best in the AFPS genre, even compared to AAA [proprietary](proprietary.md) games -- this kind of quality is very rare among libre/noncommercial games. + +{ I've been playing Xonotic for years, it's really an excellent game. I've met a lot of nice people there as the players are usually programmers and people looking for [FOSS](foss.md). The gameplay is addictive and relaxing and you can have a great chat during the game. Of course it's kind of bloated but Xonotic is a masterpiece. ~drummyfish } + +Xonotic was forked from a game called [Nexuiz](nexuiz.md) after a [trademark](trademark.md) controversy (basically in 2010 the guy who started the project and abandoned it later, an ass called Lee Vermeulen, came back and secretly sold the trademark to some shit company named Illfonic). Nexuiz itself was created on top of liberated Quake 1 engine, so Xonotic still bears a lot Quake's legacy, however it masterfully expands on its core principles and makes the gameplay even better. For example rockets shot by rocket launcher can be guided with mouse while holding down the left button which adds a new skill element. New types of weapons were added to the classic AFPS weapons (e.g. the infamous electro, a [meme](meme.md) spamming weapon used by noobs for its forgiveness of lack of skill). Movement physics was also modified to give better air control and faster movement as a result. + +The game's modified [Quake](quake.md) 1 engine is called [Darkplaces](darkplaces.md). It can be highly customized and modded. Just like in other Quake engine games, there are many console commands (e.g. *cvars*) to alter almost anything about the game. Advanced programming can be done using [QuakeC](quakec.md). Maps can be created e.g. with [netradiant](netradiant.md). + +Xonotic is similar to other libre AFPS games such as [OpenArena](openarena.md) and [Red Eclipse](red_eclipse.md). Of these Xonotic clearly looks the most professional, it has the best "graphics" in the [modern](modern.md) sense but still offers the option to turn all the fanciness off. OpenArena, based on Quake 3 engine, is simpler, both technologically and in gameplay, and its movement is slower and with different physics. While OpenArena just basically clones Quake 3, Xonotic is more of an actually new and original game with new ideas and style. Similar thing could be said about Red Eclipse, however it's not as polished and shows some infection with [SJW](sjw.md) poison. + +{ OpenArena is great too. ~drummyfish } + +As of 2022 the game has a small but pretty active community of regular players, centered mostly in Europe. There are regulars playing every day, pros, noobs, famous spammers, campers and [trolls](troll.md). Nice conversations can be had during games. There are [memes](meme.md) and inside jokes. The community is pretty neat. Xonotic also has a very dedicated [defrag](defrag.md) ("racing with no shooting") community. There have also been a few small tournament with real cash prizes in Xonotic. + +Great news is the development and main servers have so far not been infected by the [SJW poison](tranny_software.md) and **allow a great amount of [free speech](free_speech.md)** -- another rarity. Even the game itself contains speech that SJWs would consider "offensive", there are e.g. voice lines calling other players "pussies" and "retards". This is great. + +## See Also + +- [OpenArena](openarena.md) \ No newline at end of file diff --git a/youtube.md b/youtube.md new file mode 100644 index 0000000..fc58bf0 --- /dev/null +++ b/youtube.md @@ -0,0 +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 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. \ No newline at end of file diff --git a/zero.md b/zero.md new file mode 100644 index 0000000..e1e535e --- /dev/null +++ b/zero.md @@ -0,0 +1,29 @@ +# Zero + +Zero (0) is a [number](number.md) signifying the absence of a thing we count. It precedes [1](one.md) and follows -1. + +Some properties of and facts about this number follow: + +- It is [even](even.md). +- It is neither positive nor negative. However in some computer numeric encodings (such as [one's complement](ones_complement.md)) there exist two representations of zero and so we may hear about a positive and negative zero, even though mathematically there is no such a thing. +- It is a [whole number](integer.md), a [natural number](natural_number.md), a [rational number](rational_number.md), a [real number](real_number.md) and a [complex number](complex_number.md). +- It is **NOT** a [prime number](prime.md). +- It is an additive identity, i.e. adding 0 to anything has no effect. Subtracting 0 from anything also has no effect. +- Multiplying anything by 0 gives 0. +- Its representation in all traditional numeral systems is the same: 0. +- 0^*x* (zero to the power of *x*), for *x* not equal to 0, is always 0. +- *x*^0 (*x* to the power of 0), for *x* not equal to 0, is always 1. +- 0^0 (0 to the power of 0) is **not defined**! +- In programming we start counting from 0 (unlike in real life where we start with 1), so we may encounter the term **zeroth** item. We count from 0 because we normally express offsets from the first item, i.e. 0 means "0 places after the first item". +- It is, along with 1, one of the symbols used in [binary](binary.md) logic and is normally interpreted as the "off"/"false"/"low" value. +- Its opposite is most often said to be the [infinity](infinity.md), even though it depends on the angle of view and the kind of infinity we talk about. Other numbers may be seen as its opposite as well (e.g. 1 in the context of [probability](probability.md)). +- As it is one of the most commonly used numbers in programming, computers sometimes deal with it in special ways, for example in [assembly](assembly.md) languages there are often special instructions for comparing to 0 (e.g. `NEZ`, not equals zero) which can save memory and also be faster. So as a programmer you may optimize your program by trying to use zeros if possible. +- In [C](c.md) 0 represents the [false](false.md) value, a function returning 0 many times signifies an [error](error.md) during the execution of that function. However 0 also sometimes means success, e.g. as a return value from the main function. + +**Dividing by zero is not defined**, it is a forbidden operation mainly because it breaks equations (allowing dividing by zero would also allow us to make basically any equation hold, even those that normally don't). In programming dividing by zero typically causes an error, crash of a program or an [exception](exception.md). In some programming languages [floating point](float.md) division by zero results in [infinity](infinity.md). When operating with [limits](limit.md), we can handle divisions by zero in a special way (find out what value an [expression](expression.md) approaches if we get infinitely close to dividing by 0). + +## See Also + +- [NULL](null.md) +- [infinity](infinity.md) +- [one](one.md) \ No newline at end of file