Skip to content

Commit 1dbc374

Browse files
committed
xml, split bc factor sudo etc.
1 parent b146ddb commit 1dbc374

26 files changed

+665
-296
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ Media video, games, etc.) file types, viewers, editors, capture, synthesizers:
4646
- [markup](markup/): Markdown, RST. Focus on command line interface and extensions.
4747
- [video.md](video.md): videos, films, subtitles.
4848

49+
Generic data formats:
50+
51+
- [json.md](json.md)
52+
- [unicode.md](unicode.md)
53+
- [xml/](xml/)
54+
4955
[virtual-machine.md/](virtual-machine): Vagrant, Docker.
5056

5157
Related subjects in other repositories:

bc.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
POSIX
2+
3+
Simple interpreted language, calculator focus.
4+
5+
Cute toy language that only exists because it is POSIX =),
6+
but is completely superseded by any modern interpreted language,
7+
and only golfs very slightly better than Python.
8+
9+
C like syntax.
10+
11+
Features: variable definition, function definition, arrays, strings
12+
13+
Non features: string concatenation:
14+
15+
[ `echo '1+1' | bc` = 2 ] || exit 1

desktop/README.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Get info:
329329
- `-d`: desktop info
330330
- `-m`: window manager info
331331

332-
###window choice
332+
###Window choice
333333

334334
In order to act on a window, one must first select it. The ways to do it are:
335335

@@ -801,7 +801,17 @@ GNOME and KDE rivalry started when KDE chose to use QT in 1998 which was not GPL
801801

802802
As of Qt 4, LGPL versions of Qt exist on all platforms, but the damage has been done: the open source community is divided and maintain duplicate versions for many desktop software, thus using up resources.
803803

804-
###applications
804+
###KDE command line options
805+
806+
KDE has a great level of uniformity across its programs, and all of them get standard KDE command line options.
807+
808+
Some useful options are:
809+
810+
- `--caption asdfqwer`: set the caption for the window.
811+
812+
E.g., if without this option you would get: `filename.pdf - Okular` on the window title, with the option it becomes `filename.pdf - asdfqwer`. This is useful to reference the application from another program like `wmctrl -a asdfqwer`.
813+
814+
###Applications
805815

806816
KDE offers both basic building blocks, and full applications.
807817

@@ -811,7 +821,7 @@ KDESC applications release at the same time as new KDE versions. For example, Ok
811821

812822
There are also projects which use KDE, but which are not part of the KDESC.
813823

814-
###libs
824+
###Libraries
815825

816826
A typical KDE application relies on the following shared libraries:
817827

@@ -1492,7 +1502,7 @@ Icons are needed at several places to help identify the application:
14921502
- when showing a program suggestion list
14931503
- when switching windows
14941504

1495-
The icon is identified by the `Icon` field, which corresponds to a file under `XDG_DATA_DIRS/icons`.
1505+
The icon is identified by the `Icon` field, which corresponds to a file under `$XDG_DATA_DIRS/icons`.
14961506

14971507
That directory may contain multiple versions of each icon, at various resolutions, color depths and styles, since icon themes can also change with DE settings. `hicolor/48x48` should contains lots of standard icons.
14981508

factor.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#factor
2+
3+
Coreutils.
4+
5+
Factor a number into prime constituents.
6+
7+
[ "`factor 30`" = "30: 2 3 5" ] || exit 1

file-permissions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In Linux, the file type is also stored in the same `struct` as it's permissions.
5959

6060
This also suggests why the symbolic notation also incorporates this information in a single word: because all that data is in the same place.
6161

62-
TODO: why the leading `0`?
62+
The leading `0` denotes octal notation.
6363

6464
##Symbolic
6565

image/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ Algorithm: removes high frequencies of the image's 2D Fourier transform.
4444

4545
##SVG
4646

47-
Vector, XML based, non compressed.
47+
Vector, XML based, non-compressed.
48+
49+
Standard developed by W3C, so the format is closely linked to the web and browsers. Latest version: <http://www.w3.org/TR/SVG/>. Can be styled by separate CSS style sheets.
4850

4951
Image is described by mathematical formulas, not bits, therefore it is potentially tiny if the image is mathematically simple and the description is perfect (to floating point precision), which allows for example for infinite zoom.
5052

image/svg.svg

+1-1
Loading

json.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
Very popular plain text data exchange format.
2+
3+
Currently specified in by two competing standards:
4+
5+
- IETF RFC4627: <http://www.ietf.org/rfc/rfc4627.txt> (2006)
6+
- ECMA-404: <http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf>
7+
18
JSON is based on EcmaScript 3 literal notation.
9+
For this reason it is specially popular amongst the Javascript community.
210

3-
It is however not a strict subset of Javascript object only because it can
11+
It is however *not* a strict subset of Javascript object only because it can
412
contain two characters that Javascript cannot: <http://timelessrepo.com/json-isnt-a-javascript-subset>
513
and JSON creator [said](https://mail.mozilla.org/pipermail/es-discuss/2009-June/009451.html):
614

kernel/README.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Most function definitions or declarations don't contain any comments, so you rea
8181

8282
##Payed sources
8383

84-
###Books on general operating systems
84+
###Books on operating systems in general
8585

8686
- [stallings11][]
8787

@@ -129,10 +129,14 @@ The kernel does the most fundamental operations such as:
129129

130130
The kernel schedules programs one after another quite quickly and in a smart way, so that even users with a single processor can have the impression that they are running multiple applications at the same time, while in reality all they are doing is switching very quickly between applications.
131131

132+
- **virtualization**
133+
134+
The kernel can make a single system look like multiple systems, e.g. to allow code to be run in a well determined environment. The subsystem that does this is called LXC: `Linux Containers`, and is exploited in applications such as Docker.
135+
132136
Therefore it reaches general goals such as:
133137

134138
- increasing code portability across different hardware and architectures
135-
- creating useful and simple abstractions which programs can rely on (contiguous RAM memory, files, processes, user permissions, etc)
139+
- creating useful and simple abstractions which programs can rely on (contiguous RAM memory, files, processes, user permissions, etc.)
136140

137141
#POSIX
138142

@@ -332,7 +336,7 @@ You cannot use floating point operations on kernel code because that would incur
332336

333337
#Rings
334338

335-
x86 implemented concept
339+
x86 implemented concept.
336340

337341
Programs can run in different rings.
338342

@@ -414,11 +418,11 @@ TODO how to go back to the old kernel image by default at startup? Going again i
414418

415419
TODO how to install the `/usr/src/linux-headers- headers`?
416420

417-
#test
421+
#Test the kernel
418422

419423
Tips on how to test with the kernel.
420424

421-
##kernel module
425+
##Kernel module
422426

423427
A kernel module can be inserted and removed while the kernel is running, so it may prevent a time costly rebooting.
424428

@@ -525,9 +529,9 @@ Each process has a representation on the file system under `/proc/\d+` which all
525529

526530
#Interruptions
527531

528-
- user space process can be interrupted by anything, including other user space processes.
532+
- user space process can be interrupted by anything, including other user space processes.
529533

530-
- kernel space processes can be interrupted by other kernel processes or interrupts handlers, but not by user space processes.
534+
- kernel space processes can be interrupted by other kernel processes or interrupts handlers, but not by user space processes.
531535

532536
Examples of things that generate kernel space processes:
533537

@@ -732,8 +736,14 @@ Never changes between processes.
732736

733737
Note that this is *virtual* memory, so it is independent of the actual size of the memory as the hardware and the kernel can give processes the illusion that they actually have amounts of memory larger than the hardware for instance.
734738

739+
##ASLR
740+
741+
##Address space layout randomization
742+
735743
##Random offset segments
736744

745+
<http://en.wikipedia.org/wiki/Address_space_layout_randomization#Linux>
746+
737747
Randomly generated for each process to avoid attacks.
738748

739749
Must be small not to take too much space.
@@ -1009,12 +1019,19 @@ It is managed by schedulers, and is a central part of how the scheduler chooses
10091019

10101020
There is one run queue per processor.
10111021

1022+
#LXC
1023+
1024+
##cgroups
1025+
1026+
##Namespaces
1027+
1028+
It seems that cgroups and namespaces are parts of the LXC subsystem. TODO confirm.
1029+
10121030
[bovet05]: http://www.amazon.com/books/dp/0596005652
10131031
[corbet05]: http://www.amazon.com/books/dp/0596005903
10141032
[free-electrons]: http://lxr.free-electrons.com/ident
10151033
[kernel-mail]: http://vger.kernel.org/vger-lists.html
10161034
[kernel-org]: https://www.kernel.org/doc/
1017-
[kernel-org]: https://www.kernel.org/doc/
10181035
[kernelnewbies]: http://kernelnewbies.org/
10191036
[love06]: http://www.amazon.com/books/dp/0596005652
10201037
[stallings11]: http://www.amazon.com/Operating-Systems-Internals-Principles-Edition/dp/013230998X

sandbox.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
This section discusses how to run untrusted code in a sandboxed environment.
2+
3+
It appears that safe and low overhead virtualization is not yet a well achieved goal, and there is a log of work being put into it today.
4+
5+
Every option has potential risks, even traditional Virtual Machines like VirtualBox have had vulnerabilities found.
6+
7+
Sample application: online C compiler service.
8+
9+
The following aspects must be either denied or give a quota to:
10+
11+
- disallow editing server files. Either lock user into a subdirectory, or create an entire virtual filesystem.
12+
- hard disk usage
13+
- RAM usage
14+
- network usage
15+
- CPU usage
16+
- other devices and associated system resources: file descriptors (hard disk device availability),
17+
18+
# Process limits
19+
20+
Linux and POSIX offer several per process limits. POSIX ones are documented with the `getrlimit` interface at <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html>
21+
22+
For those limits to be useful, you need limit the maximum number of processes an user can run, possibly to 1. It seems that this can be done through PAM limits.
23+
24+
# Per user limits
25+
26+
##PAM
27+
28+
##/etc/security/limits.conf
29+
30+
TODO confirm this section.
31+
32+
Module that sets per user resoruce quotas.
33+
34+
<http://www.cyberciti.biz/tips/linux-limiting-user-process.html>
35+
36+
Allows for several useful limits, e.g. `nproc` for the number or processes.
37+
38+
man limits.conf
39+
man pam_limits
40+
41+
# Docker
42+
43+
TODO
44+
45+
# Sources
46+
47+
There are tons of SO questions about this subject, each with a different requirement set:
48+
49+
- <http://stackoverflow.com/questions/437433/limit-in-the-memory-and-cpu-available-for-a-user-in-linux>
50+
- <http://stackoverflow.com/questions/9506596/what-harm-can-a-c-asm-program-do-to-linux-when-run-by-an-unprivileged-user>
51+
- <http://stackoverflow.com/questions/792764/secure-way-to-run-other-people-code-sandbox-on-my-server>
52+
- <http://stackoverflow.com/questions/3859710/what-is-the-safest-way-to-run-an-executable-on-linux>
53+
- <http://unix.stackexchange.com/questions/34334/how-to-create-a-user-with-limited-ram-usage>
54+
- <http://unix.stackexchange.com/questions/85411/how-to-prevent-fork-bomb>
55+
- <http://stackoverflow.com/questions/4249063/run-an-untrusted-c-program-in-a-sandbox-in-linux-that-prevents-it-from-opening-f>

scanner.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#simple-scan
2+
3+
GUI scanner interface.
4+
5+
Very simple to scan once you manage to install the scanner driver.
6+
7+
Usage:
8+
9+
simple-scan
10+
11+
Then click scan button. The image updates as the scan is made,
12+
and you can stop it when you are done before the scanner reached the bottom.
13+
14+
Make sure your scanner supports the definition preferences you set
15+
or you will get a connexion error.

0 commit comments

Comments
 (0)