Compare commits

..

No commits in common. "6b6d109da725cb08671d523f6689dde52ebcf9dc" and "5434084a58391dd1f4fa48cae56b2e67b85b4232" have entirely different histories.

24 changed files with 22 additions and 326 deletions

View File

@ -80,7 +80,7 @@
"File Hashes": {
"algorithms/index.md": "1583c07edea4736db27c38fe2b6c4c31",
"algorithms/sorting/index.md": "2d5a18a3079d96fa9e3d4289181a8b6c",
"algorithms/sorting/insertion-sort.md": "d40da14992d8331a07cebe1c4cfa41d4",
"algorithms/sorting/insertion-sort.md": "e26909d0b4097e8e072d0b19667bf586",
"bash/index.md": "3b5296277f095acdf16655adcdf524af",
"bash/prompts.md": "61cb877e68da040a15b85af76b1f68ba",
"bash/quoting.md": "b1d8869a91001f8b22f0cdc54d806f61",
@ -88,8 +88,8 @@
"bash/shebang.md": "9006547710f9a079a3666169fbeda7aa",
"c/escape-sequences.md": "0d6219ebb51f6f21e026de67603e25b8",
"c/index.md": "aa8a34c62e7bc284ff589e28609222dc",
"gawk/index.md": "0a305a0477085fd2f4145536735ca94a",
"gawk/variables.md": "8c567c9e387f1bed8200cf28a7e28502",
"gawk/index.md": "b1e9209e0ab1f7837b004f51d72200c2",
"gawk/variables.md": "ba568df484571c8e0fa89d0005c827c0",
"index.md": "e48e895feeed7046425bb2ee15419770",
"journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
@ -103,9 +103,9 @@
"posix/index.md": "f7b1ae55f8f5e8f50f89738b1aca9111",
"posix/signals.md": "2120ddd933fc0d57abb93c33f639afd8",
"templates/daily.md": "7866014e730e85683155207a02e367d8",
"posix/regexp.md": "43825a1b9ed0dd7eeb1b6fe35c928bfe",
"posix/regexp.md": "e41bf86b770958316df1e20578d6020f",
"journal/2024-02-04.md": "e2b5678fc53d7284b71ed6820c02b954",
"gawk/regexp.md": "d9229f1eabe1b99e965eecaa03bee86c",
"gawk/regexp.md": "dbd5f9f85a2658b304a635a47379e871",
"_templates/daily.md": "7866014e730e85683155207a02e367d8",
"_journal/2024-02-05.md": "f8505abd415c50fd97c81fd6153a6d4f",
"_journal/2024-02-06.md": "1ea415f3c3f5be17f796b9a0d4df565f",
@ -114,36 +114,22 @@
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"logic/equiv-trans.md": "6554eae8e908f848059043299dfb51c6",
"logic/equiv-trans.md": "e8f25b1425d4dfc8c5dc01a3ff71d08f",
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "d883dfc997ee28a7a1e24b995377792b",
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
"algorithms/order-growth.md": "6e0f9e751eab24d74652851454264008",
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
"algorithms/sorting/selection-sort.md": "73a077a726afd376650d1bd9e2d0bed9",
"algorithms/sorting/selection-sort.md": "212140ad8bf70a56b73080bc7317f643",
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
"binary/hexadecimal.md": "531ebb4b1b10a0ac60899164bc1c3f07",
"binary/index.md": "a67b5d0c8ac53e076590f315cce22201",
"_journal/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
"binary/hexadecimal.md": "a9633bbc9b53cc8c16ce6e56022f62e0",
"binary/index.md": "d41d8cd98f00b204e9800998ecf8427e",
"_journal/2024-02-09.md": "4a9ecfac710160c2d8d11077a739a97b",
"c/types.md": "cf3e66e5aee58a94db3fdf0783908555",
"logic/quantification.md": "b7cf646a8c33aa83f48ddc37c733fafb",
"c/declarations.md": "6d80eca97506fae9a4a209a558d3aa84",
"algorithms/sorting/bubble-sort.md": "16dad1016dc6555163e42ba20f1d152d",
"_journal/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
"_journal/2024-01/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"_journal/2024-02/2024-02-09.md": "a798d35f0b2bd1da130f7ac766166109",
"_journal/2024-02/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
"_journal/2024-02/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"_journal/2024-02/2024-02-06.md": "1ea415f3c3f5be17f796b9a0d4df565f",
"_journal/2024-02/2024-02-05.md": "f8505abd415c50fd97c81fd6153a6d4f",
"_journal/2024-02/2024-02-04.md": "f77a3c5f3ce7969120f226738836dc92",
"_journal/2024-02/2024-02-03.md": "c6d411f0e2e964270399dd3a99f48382",
"_journal/2024-02/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-02/2024-02-10.md": "562b01f60ea36a3c78181e39b1c02b9f",
"_journal/2024-02-11.md": "438455de19ee8c76acce50a723612698",
"binary/endianness.md": "d73bf4e10385cdbc672d40a53f0fe868"
"c/declarations.md": "381bb6ddbecd369b78012112b3a8e5de",
"algorithms/sorting/bubble-sort.md": "6bffe3dabde3d6d4414ca3b5afdb1684"
},
"fields_dict": {
"Basic": [

View File

@ -1,5 +1,5 @@
---
title: "2024-02-11"
title: "2024-02-09"
---
- [x] Anki Flashcards
@ -10,4 +10,5 @@ title: "2024-02-11"
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* Notes on endianness.
* Logged information about prominent predefined `awk` variables.
* Created flashcards for C data type declarations.

View File

@ -1,16 +0,0 @@
---
title: "2024-02-09"
---
- [x] Anki Flashcards
- [x] KoL
- [x] Sheet Music (10 min.)
- [ ] OGS (1 Life & Death Problem)
- [x] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [x] Log Work Hours (Max 3 hours)
* Logged information about prominent predefined `awk` variables.
* Created flashcards for C data type declarations.
* Added notes on bubble sort.
* Added notes on existential/universal quantification.

View File

@ -1,13 +0,0 @@
---
title: "2024-02-10"
---
- [x] Anki Flashcards
- [x] KoL
- [x] Sheet Music (10 min.)
- [x] OGS (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* Some reading around how `awk` handles field separators.

View File

@ -20,14 +20,6 @@ Adaptive | Yes
![[bubble-sort.gif]]
%%ANKI
Basic
Describe bubble sort in a single sentence.
Back: Repeatedly swap the smaller of adjacent records downward.
Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1707589393196-->
END%%
%%ANKI
Basic
What is bubble sort's best case runtime?

View File

@ -20,14 +20,6 @@ Adaptive | Yes
![[insertion-sort.gif]]
%%ANKI
Basic
Describe insertion sort in a single sentence.
Back: Repeatedly put the next record into a sorted array from right to left.
Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1707589393194-->
END%%
%%ANKI
Basic
What is insertion sort's best case runtime?

View File

@ -20,15 +20,6 @@ Adaptive | No
![[selection-sort.gif]]
%%ANKI
Basic
Describe selection sort in a single sentence.
Back: Repeatedly put the smallest unsorted record at the end of a sorted array.
Reference: Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).
<!--ID: 1707589393190-->
END%%
%%ANKI
Basic
What is selection sort's best case runtime?

View File

@ -1,119 +0,0 @@
---
title: Endianness
TARGET DECK: Obsidian::STEM
FILE TAGS: binary::endian
tags:
- binary
- endian
---
## Overview
Platforms with multi-byte objects must establish the object's address and byte ordering. Objects are typically addressed by the smallest address of the bytes used. Bytes are ordered either in **big-endian** or **little-endian**. In big-endian, the most significant byte is listed first. In little-endian, the least significant byte is ordered first.
%%ANKI
Basic
Platforms with multi-byte objects must establish what two conventions?
Back: The object's address and byte ordering.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283766-->
END%%
%%ANKI
Basic
How are multi-byte objects typically addressed?
Back: By the smallest address of the bytes used.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283768-->
END%%
%%ANKI
Basic
How are bytes of multi-byte objects typically ordered?
Back: As big-endian or little-endian.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283770-->
END%%
%%ANKI
Basic
What is endianness?
Back: The ordering of bytes of a multibyte object.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283771-->
END%%
%%ANKI
Basic
What does it mean for a byte to be "most significant"?
Back: It contribute most to the byte's (decimal) value.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283773-->
END%%
%%ANKI
Basic
What does it mean for a byte to be "least significant"?
Back: It contribute least to the byte's (decimal) value.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283774-->
END%%
%%ANKI
Basic
What does it mean to be big-endian?
Back: The most significant byte is ordered first.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283776-->
END%%
%%ANKI
Basic
What does it mean to be little-endian?
Back: The least significant byte is ordered first.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283777-->
END%%
%%ANKI
Basic
How are bytes of `int32_t x = 0x01234567` written in big-endian?
Back: `0x01 0x23 0x45 0x67`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c
<!--ID: 1707661283779-->
END%%
%%ANKI
Basic
How are bytes of `int32_t x = 0x01234567` written in little-endian?
Back: `0x67 0x45 0x23 0x01`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: c
<!--ID: 1707661283780-->
END%%
%%ANKI
Cloze
Many microprocessors chips are {bi-endian} meaning they can be {configured as either big- or little-endian}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707661283782-->
END%%
```c
#include <stdint.h>
#include <stdio.h>
int main() {
int32_t x = 0x01234567;
for (int i = 0; i < 4; ++i) {
printf("%.2x ", ((unsigned char *)(&x))[i]);
}
}
```
The above snippet can be used to check endianness on the current machine. If big-endian, the output should be `01 23 45 67`. If little-endian, `67 45 23 01`.
## Reference
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.

View File

@ -224,4 +224,4 @@ END%%
## Reference
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
* Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.

View File

@ -36,22 +36,6 @@ Back: It can only represent nonnegative values.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
END%%
%%ANKI
Basic
How large is a word?
Back: This is a machine-dependent value.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707657889227-->
END%%
%%ANKI
Basic
What word sizes are typically nowadays?
Back: 32- and 64-bit word sizes.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1707657889230-->
END%%
%%ANKI
Cloze
`char` *typically* represents {1} byte(s) on a 64-bit platform.

View File

@ -293,36 +293,6 @@ Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 202
<!--ID: 1706883732944-->
END%%
%%ANKI
Basic
What is the output of the following?
```bash
$ echo ' abc' | awk '{ print }'
```
Back: ` abc` (with leading whitespace)
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833559-->
END%%
%%ANKI
Basic
What is the output of the following?
```bash
$ echo ' abc' | awk ' { $1 = $1; print }'
```
Back: `abc` (without leading whitespace)
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833561-->
END%%
%%ANKI
Basic
How is `$$0` rebuilt after assignment `$1 = $1`?
Back: By intercalating `OFS` between values of `$1` through `NF`.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833562-->
END%%
## Exit Status
On success, `gawk` exits with status code `EXIT_SUCCESS`. On failure, with status code `EXIT_FAILURE`. On fatal error, `gawk` exists with status code `2`. #c

View File

@ -72,8 +72,8 @@ END%%
%%ANKI
Basic
Why is it recommended to avoid using `^` and `$$` in `RS`?
Back: These anchors match the beginning and end of a string, not of a line.
Why is it recommended to avoid using `^`/`$` in `RS`?
Back: These anchors match the beginning/end of a string, not of a line.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707310981375-->
END%%

View File

@ -118,7 +118,7 @@ END%%
%%ANKI
Basic
What implementation detail inspires avoiding `RS = "\0"`?
Back: Most `awk` implementations store strings internally as C-style strings.
Back: Most `awk` implementations store strings internally as C-style strings?
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707310981392-->
END%%
@ -133,9 +133,6 @@ END%%
* `NF` (**N**umber of **F**ields)
* The 1-indexed number of fields found in the current record.
* `FS` (**F**ield **S**eparator)
* The separator used to distinguish fields from one another.
* Defaults to `" "` which is a special character for **runs** of spaces, tabs, and newlines.
%%ANKI
Basic
@ -168,51 +165,6 @@ Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 202
<!--ID: 1707405259930-->
END%%
%%ANKI
Cloze
The {`FS`} variable is used to change the {field separator}.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833549-->
END%%
%%ANKI
Cloze
{`FS`} is to `awk` as {`IFS`} is to Bash.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
/END%%
%%ANKI
Basic
What is the default value of `FS`?
Back: `" "`
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833552-->
END%%
%%ANKI
Basic
What value of `FS` is specially handled?
Back: `" "`
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833555-->
END%%
%%ANKI
Basic
How is `FS = " "` interpreted?
Back: As a contiguous sequence of spaces, tabs, and newlines.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833556-->
END%%
%%ANKI
Basic
What distinguishes `FS` value `" "` and `[ \t\n]+`?
Back: When set to the former, `awk` strips leading and trailing whitespace from each record.
Reference: Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)
<!--ID: 1707618833558-->
END%%
## References
* Robbins, Arnold D. “GAWK: Effective AWK Programming,” October 2023. [https://www.gnu.org/software/gawk/manual/gawk.pdf](https://www.gnu.org/software/gawk/manual/gawk.pdf)

View File

@ -582,7 +582,7 @@ END%%
%%ANKI
Basic
What is a "theorem" in the equivalence-transformation formal system?
Back: An equivalence derived from the axioms and inference rules.
Back: An equality derived from the axioms and inference rules.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707316178712-->
END%%
@ -668,7 +668,7 @@ END%%
%%ANKI
Basic
Where are $\land$ and $\lor$ found within a DNF proposition?
Where are $\land$ and $\lor$ found within a proposition in DNF?
Back: $\lor$ separates disjuncts containing $\land$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707311868998-->
@ -692,7 +692,7 @@ END%%
%%ANKI
Basic
Where are $\land$ and $\lor$ found within a CNF proposition?
Where are $\land$ and $\lor$ found within a proposition in CNF?
Back: $\land$ separates conjuncts containing $\lor$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707311869003-->

View File

@ -150,14 +150,6 @@ Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [ht
<!--ID: 1707050923650-->
END%%
%%ANKI
Basic
How is the `*` operator written equivalently as an interval expression?
Back: `{0,}`
Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions](https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions).
<!--ID: 1707654685031-->
END%%
%%ANKI
Basic
What does the `+` operator do?
@ -166,14 +158,6 @@ Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [ht
<!--ID: 1707050923656-->
END%%
%%ANKI
Basic
How is the `+` operator written equivalently as an interval expression?
Back: `{1,}`
Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions](https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions).
<!--ID: 1707654685034-->
END%%
%%ANKI
Basic
What does the `?` operator do?
@ -182,14 +166,6 @@ Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [ht
<!--ID: 1707050923662-->
END%%
%%ANKI
Basic
How is the `?` operator written equivalently as an interval expression?
Back: `{0,1}`
Reference: “POSIX Basic Regular Expressions,” accessed February 4, 2024, [https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions](https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions).
<!--ID: 1707654685036-->
END%%
* `{n}`, an **interval expression**, matches the preceding element `n` times.
* `{n,}` matches the preceding element at least `n` times.
* `{n,m}` matches the preceding element between `n` and `m` times.