call plug#begin('~/.vim/plugged')
Plug 'tomasiser/vim-code-dark'
Plug 'pangloss/vim-javascript'
Plug 'scrooloose/nerdtree'
Plug 'morhetz/gruvbox'
Plug 'leafgarland/typescript-vim'
services: | |
db: | |
image: postgres:latest | |
container_name: db | |
restart: always | |
environment: | |
- POSTGRES_USER=postgres | |
- POSTGRES_PASSWORD=postgres | |
- POSTGRES_DB=postgres | |
ports: |
/* Box sizing rules */ | |
*, | |
*::before, | |
*::after { | |
box-sizing: border-box; | |
} | |
/* Remove default margin */ | |
* { | |
margin: 0; |
# Create ssh server | |
sudo apt install openssh-server | |
sudo ufw allow ssh | |
# Connect | |
ssh username@host --> give password | |
ssh-copy-id user@host | |
ssh user@host |
Configuration files: /etc/nginx | |
Binary / executable files: /usr/sbin | |
Log directory of files: /var/log/nginx | |
Data or Document directory files: /usr/share/nginx |
# Run using docker image | |
docker run --name db --rm -e POSTGRES_PASSWORD="mypasswd" -d postgres:alpine | |
docker exec -it db bash --> get inside container | |
# Copy file to docker container | |
docker cp foo.txt container_id:/foo.txt | |
docker run | |
--name postgresql | |
-e POSTGRES_USER=myusername |
# static code analysis (mypy) | |
# mypy main.py [check miss match] | |
from typing import List, Dict, Set, Optional, Any, Sequence, TypeVar | |
def add_numbers(a: int, b: int, c: int) -> None: | |
print(a + b + c) | |
add_numbers(1, 2, 3) | |
x: List[List[int]] = [[1, 2, 3], [1, 2, 3]] # nested list |
docker --version [list docker version] | |
docker run hello-world | |
docker container ls | |
docker container ls -a | |
docker contianer rm -f $(docker container ls -aq) [remove all container] | |
docker image ls | |
docker images | |
docker image rm <image-name> [remove docker image] |
from functools import wraps | |
def my_logger(orig_func): | |
import logging | |
logging.basicConfig( | |
filename="{}.log".format(orig_func.__name__), level=logging.INFO | |
) | |
@wraps(orig_func) |
import memory_profiler as mem_profile | |
import random | |
import time | |
names = ["John", "Corey", "Adam", "Steve", "Rick", "Thomas"] | |
majors = ["Math", "Engineering", "CompSci", "Arts", "Business"] | |
print(f"Memory (Before): {mem_profile.memory_usage()}Mb") | |