Autosave: 2023-02-10 18:22:04
This commit is contained in:
parent
46f770d929
commit
ab1203f3ec
91 changed files with 124 additions and 110 deletions
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
categories:
|
||||
- Computer Architecture
|
||||
tags: [CPU, processors]
|
||||
|
||||
tags: [CPU]
|
||||
---
|
||||
|
||||
## The Little Man Computer
|
||||
|
||||
// TODO: Improve notes and learn how to use
|
||||
|
@ -16,19 +16,19 @@ On the left is the instruction set. Each number constitutes and execution routin
|
|||
|
||||
Each row of the RAM has a denary address, 1 through to 99. Each address can hold three digits.
|
||||
|
||||
* So the instruction `560` would mean *load the number at address 60.*
|
||||
* The instruction `340` would mean *store a datum at address 40*
|
||||
- So the instruction `560` would mean _load the number at address 60._
|
||||
- The instruction `340` would mean _store a datum at address 40_
|
||||
|
||||
### Working through a basic computation
|
||||
|
||||
We are going to add two numbers together as a basic example.
|
||||
|
||||
1. First we need to place the two numbers in RAM we are going to use `5` and `3`
|
||||
* At address `60` we will put the number `5` and at address `61` we will put the number `3`
|
||||
* We are going to start at address `0` in the top left of the RAM grid
|
||||
1. The first instruction will be *load address 60* which in the assembly will be `560` . We put this in address `0`, our starting point.
|
||||
- At address `60` we will put the number `5` and at address `61` we will put the number `3`
|
||||
- We are going to start at address `0` in the top left of the RAM grid
|
||||
1. The first instruction will be _load address 60_ which in the assembly will be `560` . We put this in address `0`, our starting point.
|
||||
1. This first instruction is now stored in the accumulator.
|
||||
1. Now we want to *add this number (in the accumulator) to the number in address 61*
|
||||
1. Now we want to _add this number (in the accumulator) to the number in address 61_
|
||||
1. This second instruction is `161` . We write this in address `1`
|
||||
1. Finally we want to store the output of the calculation in the RAM, let's say at address `62`
|
||||
1. So we store the command `362` at address `2`
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Computer Architecture
|
||||
- Hardware
|
||||
tags: [motherboard, chipset]
|
||||
tags: [motherboard]
|
||||
---
|
||||
|
||||
# Chipset and controllers
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Computer Architecture
|
||||
- Hardware
|
||||
tags: [HDL, nand-to-tetris]
|
||||
tags: [nand-to-tetris]
|
||||
---
|
||||
|
||||
# Hardware Description Language
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Computer Architecture
|
||||
- Hardware
|
||||
tags: [abstraction, modules, nand-to-tetris]
|
||||
tags: [nand-to-tetris]
|
||||
---
|
||||
|
||||
# Hardware abstraction and modularity
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Computer Architecture
|
||||
- Hardware
|
||||
tags: [HDL, nand-to-tetris]
|
||||
tags: [nand-to-tetris]
|
||||
---
|
||||
|
||||
# Hardware simulation
|
||||
|
|
|
@ -3,6 +3,7 @@ categories:
|
|||
- DSA
|
||||
tags:
|
||||
- algorithms
|
||||
- data-structures
|
||||
- recursion
|
||||
---
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Databases
|
||||
tags: [relational-database]
|
||||
tags: [relational-databases]
|
||||
---
|
||||
|
||||
# ACID principle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Databases
|
||||
tags: [mongodb, node-js, mongoose]
|
||||
tags: [mongo-db, mongoose, node-js]
|
||||
---
|
||||
|
||||
# Validating Mongoose schemas
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Networks
|
||||
tags: [http]
|
||||
tags: []
|
||||
---
|
||||
|
||||
## GET
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Databases
|
||||
tags: [apis, REST]
|
||||
tags: [APIs, REST]
|
||||
---
|
||||
|
||||
# RESTful APIs
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Databases
|
||||
tags: [relational-database]
|
||||
tags: [relational-databases]
|
||||
---
|
||||
|
||||
# Relational database architecture
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Autoincrement and `SERIAL`
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Create an SQL table
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Data types in MySQL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Deleting data in SQL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Creating views with foreign keys
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Insert data into table with SQL `INSERT` statement
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database, regex]
|
||||
tags: [SQL, relational-databases, regex]
|
||||
---
|
||||
|
||||
# Regular expressions in SQL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Retrieve data from table with SQL `SELECT` statement
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Updating an SQL table
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Update existing data with the SQL `UPDATE` command
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Useful operators in SQL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Databases
|
||||
- Programming Languages
|
||||
tags: [SQL, relational-database]
|
||||
tags: [SQL, relational-databases]
|
||||
---
|
||||
|
||||
# Wildcards in SQL
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Analogue and digital
|
||||
categories:
|
||||
- Hardware
|
||||
tags: [analogue, digital]
|
||||
tags: [analogue]
|
||||
---
|
||||
|
||||
# Analogue and digital
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Electronics
|
||||
tags: [electricity, electrical-circuits]
|
||||
tags: [electricity, circuits]
|
||||
---
|
||||
|
||||
# Circuits
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Electronics
|
||||
tags: [electricity, electrical-circuits]
|
||||
tags: [electricity, circuits]
|
||||
---
|
||||
|
||||
# LEDs
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Text encoding
|
||||
categories:
|
||||
- Computer Architecture
|
||||
tags: [binary, binary-encoding, ascii, unicode, utf-8]
|
||||
tags: [binary, binary-encoding]
|
||||
---
|
||||
|
||||
# Text encoding
|
||||
|
|
|
@ -3,7 +3,7 @@ title: Why computers use binary
|
|||
categories:
|
||||
- Mathematics
|
||||
- Computer Architecture
|
||||
tags: [binary, bits]
|
||||
tags: [binary]
|
||||
---
|
||||
|
||||
# Why computers use binary
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Electronics
|
||||
tags: [electrical-circuits]
|
||||
tags: [circuits]
|
||||
---
|
||||
|
||||
# Digital circuits
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Ohm's Law
|
||||
categories:
|
||||
- Electronics
|
||||
tags: [physics, electricity, electrical-resistance]
|
||||
tags: [physics, electricity]
|
||||
---
|
||||
|
||||
# Ohm's Law
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [compilers]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Compile package from source
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [systems-programming, systemd]
|
||||
tags: [systems-programming]
|
||||
---
|
||||
|
||||
# Create timed `systemd` job
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [package-management]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Pacman
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [user-management]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# User management
|
||||
|
||||
## Switch user
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [journaling, systemd, systems-programming]
|
||||
tags: [systems-programming]
|
||||
---
|
||||
|
||||
# `journald`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Linux
|
||||
tags: [systems-programming, systemd]
|
||||
tags: [systems-programming]
|
||||
---
|
||||
|
||||
# `systemd`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [logic, laws]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# DeMorgan's Laws
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Biconditional Elimination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Biconditional introduction
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Conditional elimination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Conditional Introduction
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Conditional Elimination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
If two conjuncts have each been independently derived then they can be conjoined. Also known more simply as _Conjunction_
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Disjunction Elimination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Disjunction Introduction
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Negation Elimination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Negation Introduction
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Logic
|
||||
tags: [derivation-rules]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Reiteration
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Logic
|
||||
- Computer Architecture
|
||||
tags: [logic, propositional-logic, nand-to-tetris]
|
||||
tags: [propositional-logic, nand-to-tetris]
|
||||
---
|
||||
|
||||
# Boolean function synthesis
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
categories:
|
||||
- Logic
|
||||
- Computer Architecture
|
||||
tags: [logic, propositional-logic, nand-to-tetris]
|
||||
tags: [propositional-logic, nand-to-tetris]
|
||||
---
|
||||
|
||||
# Boolean functions
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
categories:
|
||||
- Mathematics
|
||||
tags: [logic]
|
||||
- Logic
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Truth-tables
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Mathematics
|
||||
tags: [logic]
|
||||
tags: []
|
||||
---
|
||||
|
||||
## Rationale
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- division
|
||||
---
|
||||
|
||||
# Adding and subtracting fractions
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- division
|
||||
---
|
||||
|
||||
# Dividing fractions
|
||||
|
|
|
@ -3,8 +3,6 @@ categories:
|
|||
- Mathematics
|
||||
tags:
|
||||
- prealgebra
|
||||
- factors
|
||||
- divisors
|
||||
---
|
||||
|
||||
## Factors and divisors
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- divisors
|
||||
---
|
||||
|
||||
Given the equivalence between factors and divisors we can increase fractions to higher terms in a very similar way to when we reduce fractions. In the latter case we are dividing by divisors to reduce. In the former, we are multiplying by factors to increase.
|
||||
|
|
|
@ -3,7 +3,6 @@ categories:
|
|||
- Mathematics
|
||||
tags:
|
||||
- prealgebra
|
||||
- operators
|
||||
---
|
||||
|
||||
## Addition, subtraction
|
||||
|
|
|
@ -4,7 +4,7 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- multiplication
|
||||
- arithmetic
|
||||
---
|
||||
|
||||
# Multiplying fractions
|
||||
|
|
|
@ -3,8 +3,7 @@ categories:
|
|||
- Mathematics
|
||||
tags:
|
||||
- prealgebra
|
||||
- factors
|
||||
- primes
|
||||
- number-theory
|
||||
---
|
||||
|
||||
### Prime factorisation
|
||||
|
|
|
@ -3,7 +3,7 @@ categories:
|
|||
- Mathematics
|
||||
tags:
|
||||
- prealgebra
|
||||
- primes
|
||||
- number-theory
|
||||
---
|
||||
|
||||
## Prime and composite numbers
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- division
|
||||
- theorems
|
||||
---
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- prealgebra
|
||||
- fractions
|
||||
- divisors
|
||||
---
|
||||
|
||||
## Reducing fractions to their lowest terms
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
- Operating Systems
|
||||
tags:
|
||||
- disks
|
||||
- bootloader
|
||||
---
|
||||
|
||||
# The boot process
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
- Operating Systems
|
||||
tags:
|
||||
- disks
|
||||
- filesystems
|
||||
---
|
||||
|
||||
# Filesystems
|
||||
|
|
|
@ -5,7 +5,6 @@ categories:
|
|||
|
||||
tags:
|
||||
- disks
|
||||
- devices
|
||||
---
|
||||
|
||||
# Disk partitions
|
||||
|
|
|
@ -5,7 +5,6 @@ categories:
|
|||
tags:
|
||||
- memory
|
||||
- disks
|
||||
- devices
|
||||
---
|
||||
|
||||
# Swap space
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
- Operating Systems
|
||||
tags:
|
||||
- disks
|
||||
- devices
|
||||
---
|
||||
|
||||
# What are disks?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Operating Systems
|
||||
tags: [systems-programming, processes, memory]
|
||||
tags: [systems-programming, memory]
|
||||
---
|
||||
|
||||
# The Kernel
|
||||
|
|
|
@ -5,7 +5,6 @@ tags:
|
|||
- javascript
|
||||
- react
|
||||
- react-hooks
|
||||
- memoization
|
||||
---
|
||||
|
||||
# Memoization with `useCallback` and `useMemo`
|
||||
|
@ -49,7 +48,7 @@ const handleSubmit = useCallback(
|
|||
.finally(() => setPendSaveConfig(false))
|
||||
.catch((err) => console.error(err));
|
||||
},
|
||||
[blockId, project_id],
|
||||
[blockId, project_id]
|
||||
);
|
||||
```
|
||||
|
||||
|
@ -103,6 +102,6 @@ const List = React.useMemo(
|
|||
itemProp1: expensiveFunction(props.first),
|
||||
itemProp2: anotherPriceyFunction(props.second),
|
||||
})),
|
||||
[listOfItems],
|
||||
[listOfItems]
|
||||
);
|
||||
```
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- async
|
||||
---
|
||||
|
||||
# The Event Loop
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
## The Module Wrapper Function
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
# Ports
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
# Node.js `events` module
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
# `fs` module
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
# `http` module
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- node-modules
|
||||
---
|
||||
|
||||
# Modules
|
||||
|
@ -65,7 +64,7 @@ module.exports = function (...params) {
|
|||
Note the module is unnamed. We would name it when we import:
|
||||
|
||||
```js
|
||||
const myFunction = require('./filenme');
|
||||
const myFunction = require("./filenme");
|
||||
```
|
||||
|
||||
### Exporting sub-components from a module
|
||||
|
@ -85,7 +84,7 @@ var nonExportedVar = true;
|
|||
This time the exports are already name so we would import with the following:
|
||||
|
||||
```js
|
||||
const {myFunc, aVar} = require('./filename');
|
||||
const { myFunc, aVar } = require("./filename");
|
||||
```
|
||||
|
||||
We can also do the exporting at the bottom when the individual components are named:
|
||||
|
@ -104,13 +103,13 @@ exports.myNamedFunc = myNamedFunc;
|
|||
exports.differentName = anotherNamedFunc; // We can use different names
|
||||
|
||||
// Or we could export them together
|
||||
module.exports = {myNamedFunc, anotherNamedFunc};
|
||||
module.exports = { myNamedFunc, anotherNamedFunc };
|
||||
```
|
||||
|
||||
The import is the same:
|
||||
|
||||
```js
|
||||
const {myNamedFunc, anotherNamedFunc} = require('./modules/multiExports');
|
||||
const { myNamedFunc, anotherNamedFunc } = require("./modules/multiExports");
|
||||
```
|
||||
|
||||
## Structuring modules
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- npm
|
||||
---
|
||||
|
||||
# Package management
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Programming Languages
|
||||
tags: [backend, node-js, REST, APIs, validation]
|
||||
tags: [backend, node-js, REST, APIs]
|
||||
---
|
||||
|
||||
# Creating a RESTful API: Validation
|
||||
|
|
|
@ -4,7 +4,6 @@ categories:
|
|||
tags:
|
||||
- backend
|
||||
- node-js
|
||||
- streams
|
||||
---
|
||||
|
||||
# Handling streams with `fs`
|
||||
|
|
|
@ -5,7 +5,7 @@ tags:
|
|||
- shell
|
||||
---
|
||||
|
||||
# Quote marks
|
||||
# Quote marks in Bash
|
||||
|
||||
## Single-quotes (aka _strong_ quotes)
|
||||
|
|
@ -22,7 +22,11 @@ awk [program] file1, file2, file3
|
|||
awk -f [ref_to_script_file] file1, file2, file3
|
||||
```
|
||||
|
||||
We can also obviously pipe to it.
|
||||
We can also pipe to it. This piped command receives output from the `echo` command and prints the value in the last field for each record:
|
||||
|
||||
```bash
|
||||
echo -e "1 2 3 5\n2 2 3 8" | awk '{print $(NF)}'
|
||||
```
|
||||
|
||||
## Syntactic structure
|
||||
|
||||
|
@ -54,6 +58,8 @@ Alfred 65
|
|||
Kate 46
|
||||
```
|
||||
|
||||
> `awk` particularly lends itself to inputs that are structured by whitespace or in columns, like what you get from commands like `ls` and `grep`
|
||||
|
||||
### Patterns and actions
|
||||
|
||||
The basic structure of an `awk` script is as follows:
|
||||
|
@ -146,4 +152,38 @@ awk '$2 >= 90 { print $0 }' scores.txt
|
|||
|
||||
This returns the records where there is a secondary numerical field that is greater than 90.
|
||||
|
||||
**_Match a field against a regular expression_**
|
||||
|
||||
```bash
|
||||
awk '$1 ~ /^[b,c]/ {print $1}' words.txt
|
||||
```
|
||||
|
||||
This matches all the fields in the `$1` place that begin with 'b' or 'c'.
|
||||
|
||||
The tilde is the regex match operator. You must be passing a regex to use it, otherwise use `==`.
|
||||
|
||||
## Syntactic shorthands
|
||||
|
||||
- For a statement like `awk 'length($1) > 5 { print $0 }' list.txt`. We actually don't need to include the `{ print $0 }` action, as this is the default behaviour and it is implied. We could have just put `length($1) > 5 list.txt`.
|
||||
|
||||
https://zetcode.com/lang/awk/
|
||||
|
||||
## Built-in variables
|
||||
|
||||
### `NF`
|
||||
|
||||
The value of `NF` is the **number** of **fields** in the current record. `Awk` automatically updates the value of `NF` every time it reads a record.
|
||||
|
||||
No matter how many fields there are, the last value in a record can always be represented by `$NF`.
|
||||
|
||||
### `NR`
|
||||
|
||||
`NR` represents the **number** of **records**. It is set at the point at which the file is read.
|
||||
|
||||
### `FS`
|
||||
|
||||
`FS` represents the **field separator**. The default field separator is a space. We can specify a different separator with the `-F` flag. E.g to separate by comma:
|
||||
|
||||
```bash
|
||||
awk -F, '{print $1 }' list.txt
|
||||
```
|
||||
|
|
|
@ -3,7 +3,6 @@ categories:
|
|||
- Programming Languages
|
||||
tags:
|
||||
- shell
|
||||
- unix
|
||||
---
|
||||
|
||||
## Unix based systems
|
||||
|
|
|
@ -3,7 +3,6 @@ categories:
|
|||
- Programming Languages
|
||||
tags:
|
||||
- shell
|
||||
- processes
|
||||
---
|
||||
|
||||
# Processes (`ps`)
|
||||
|
|
|
@ -5,7 +5,7 @@ tags:
|
|||
- shell
|
||||
---
|
||||
|
||||
# Test in bash
|
||||
# Test values in Bash
|
||||
|
||||
`test` is a built-in command that is used to compare values or determine whether something is the case.
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
categories:
|
||||
- Mathematics
|
||||
tags:
|
||||
- logic
|
||||
- set-theory
|
||||
- theorems
|
||||
---
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
categories:
|
||||
- Mathematics
|
||||
- Logic
|
||||
tags:
|
||||
- logic
|
||||
- set-theory
|
||||
---
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Software Engineering
|
||||
tags:
|
||||
- callstack
|
||||
tags: []
|
||||
---
|
||||
|
||||
# The call-stack
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Software Engineering
|
||||
tags: [semver]
|
||||
tags: []
|
||||
---
|
||||
|
||||
# Semantic versioning
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
categories:
|
||||
- Software Engineering
|
||||
tags:
|
||||
- resources
|
||||
tags: []
|
||||
---
|
||||
|
||||
## General
|
||||
|
|
|
@ -3,9 +3,10 @@ categories:
|
|||
- Computer Architecture
|
||||
tags:
|
||||
- theory-of-computation
|
||||
- history
|
||||
---
|
||||
|
||||
# Defining a computer
|
||||
|
||||
> A general-purpose computer is one that, given the appropriate instructions and required time, should be able to perform most common computing tasks.
|
||||
|
||||
This sets a general purpose computer aside from a special-purpose computer, like the one you might find in your dishwasher which may have its instructions hardwired or coded into the machine. Special purpose computers only perform a single set of tasks according to prewritten instructions. We’ll take the term _computer_ to mean general purpose computer.
|
||||
|
|
|
@ -3,7 +3,6 @@ categories:
|
|||
- Computer Architecture
|
||||
tags:
|
||||
- theory-of-computation
|
||||
- turing
|
||||
---
|
||||
|
||||
## What is a Turing Machine?
|
||||
|
|
Loading…
Add table
Reference in a new issue