--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)