--Docker--

Dockerfile for a Go project

```
FROM golang:1.15 AS builder
RUN apt update && apt upgrade -y && \
apt install -y git \
WORKDIR /app
# Get install script, run, and make binary
RUN curl -fLo install.sh https://raw.githubusercontent.com/cosmtrek/air/master/install.sh \
&& chmod +x install.sh && sh install.sh && cp ./bin/air /bin/air
```

- Always combine RUN apt-get update with apt-get install in the same RUN statement as suggested in the Dockerfile best practices under the 'apt-get' section here: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
- The
**WORKDIR command**is used to define the working directory of a Docker container. Any RUN, CMD, ADD, COPY, or ENTRYPOINT command will be executed in the specified working directory.

apt vs. apt-get

- apt is a subset of apt-get and apt is usually preferred
- apt provides all the necessary commands for package management so just go with that

apt update vs. apt upgrade

- apt update updates the list of available packages and their versions, but it does not install or upgrade any packages.
- apt upgrade actually installs newer versions of the packages you have. After updating the lists
- -y flag means "say yes to all"
- https://askubuntu.com/questions/94102/what-is-the-difference-between-apt-get-update-and-upgrade

**--C++ basics--**

Generics in C++

```
#include <iostream>
using namespace std;
template <class T>
T GetMax (T a, T b) {
T result;
result = (a>b)? a : b;
return (result);
}
int main () {
int i=5, j=6, k;
long l=10, m=5, n;
k=GetMax<int>(i,j);
n=GetMax<long>(l,m);
cout << k << endl;
cout << n << endl;
return 0;
}
```

- Templates in C++: https://www.cplusplus.com/doc/oldtutorial/templates/

Logical data structures—implemented using physical data structures: arrays or linked lists

- Stack (linear, LIFO)
- Queues (linear, FIFO)
- Trees (non-linear)
- Graph (non-linear)
- Hash Table (tabular)

Abstract Data Type (ADT)

- ADT is a type (or class) for objects whose behavior is defined by a set of value and a set of operations
- The definition of ADT only describes what operations are to be performed but not how these operations will be implemented, making it abstract
- List, Stack, & Queue ADTs: https://www.geeksforgeeks.org/abstract-data-types/

**--Discrete Math--**

Math Theorem Example: an even integer plus an odd integer is another odd integer

Proof:

- Suppose m is even and n is odd (1. State the assumptions)
- ∃k1 ∈ Z and ∃k2 ∈ Z so that m = 2k1 and n=2k2 + 1 (2. Formally define the assumptions)
- Then, m + n = (2k1) + (2k2+1) = 2(k1+k2) + 1. Let k3 = k1 + k2, and note it is an integer. (3. Manipulation)
- Hence ∃k3 ∈ Z so that m + n = 2k3 + 1 (4. Arrive at definition of conclusion)
- Thus m + n is odd (5. Conclusion)

Divisibility

- For n and d integers, d ≠ 0, d | n ↔ if ∃k ∈ Z such that n = dk
- When we say d | n, it means n is divisible by d

∀x ∈ D, P(x) → Q(x) where we quantify with specific x values, it uses a single arrow to show implication between two statements

P(x) ⇒ Q(x) with a double arrow is an implication between two predicates; it means the same thing as above

Other Proof Methods:

- Disproving with Counterexamples
- Proof by division into cases
- Proof by contradiction
- Proof by contrapositive

## Top comments (0)