Skip to content

Commit

Permalink
[Multiple] Minor changes in many entries
Browse files Browse the repository at this point in the history
  • Loading branch information
komidawi committed Dec 5, 2024
1 parent 7002a62 commit 2ccc023
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 38 deletions.
5 changes: 0 additions & 5 deletions _posts/collections/2024-08-05-Articles.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ categories: [ engineering ]
tags: [ articles ] # TAG names should always be lowercase
---

## Links

- **https://learnxinyminutes.com/**
- Collection of Cheatsheets

## Articles

Here are articles I find interesting and useful
Expand Down
39 changes: 39 additions & 0 deletions _posts/collections/Software-Collection.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Tools

- **https://www.composerize.com/**
- Docker CLI <> Compose translator


- **https://learnxinyminutes.com/**
- Collection of Cheatsheets

## Programming Tools

- `.editorconfig`

- Code Analysis
- secret leak prevention
- gitsecrets / gitleaks
- Vulnerabilities in code
- Snyk / GitHub Code Scanning
- Secret management
- Vault by HashiCorp
- explainshell.com
- OpenRewrite
- SonarLint / SonarQube

### Node, Angular, JS

- `npm`
- `npx`
- `nvm` / `nvm-windows`
- `.nvmrc`

## Browser Extensions

1. Gesturefy
2. uBlockOrigin

## Programs

- PotPlayer
42 changes: 31 additions & 11 deletions _posts/learning/devops/2024-05-28-Docker.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,29 @@ categories: [ devops ]
tags: [ docker, containers, cloud ] # TAG names should always be lowercase
---

* [Containers](#containers)
* [Basics](#basics)
* [Images](#images)
* [Commands](#commands)
* [`COMMAND`s and `ENTRYPOINT`s](#commands-and-entrypoints)
* [Networking](#networking)
* [Network: Bridge](#network-bridge)
* [Network: Host](#network-host)
* [Network: None](#network-none)
* [Commands](#commands-1)
* [Volumes](#volumes)
* [docker compose](#docker-compose)
* [Practices](#practices)

## Containers

### Basics

1. Run container (e.g. nginx)
- `docker run nginx`
2. Run container with specific version (tag)
- `docker run <container_name>:<tag>`
- `docker run redis:4.0`
- `docker run <container_name>:<tag>`
3. List containers
- Running
- `docker ps`
Expand All @@ -30,24 +44,24 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
- `docker run -p 80:5000 my_container`
7. Map Volumes
- Map Docker Host Volume to Docker Container Volume
- `docker run -v <host_path>:<container_path> <container_id/name>`
- `docker run -v /opt/datadir:/var/lib/mysql mysql`
- `docker run -v <host_path>:<container_path> <container_id/name>`
8. Get more detailed info of container
- `docker inspect <container_id/name>`
9. Show Container logs
- `docker logs <container_id/name>`
10. Set Environmental Variables
- `docker run --env <variable>=<value> <container_id/name>`
- `docker run --env JAVA_VERSION=11 my_container`
- `docker run --env <variable>=<value> <container_id/name>`
- `--env` ~ `-e`
11. Display Environmental Variables
- Use `docker inspect` command

### Images

1. Build docker image
- `docker build <path_of_Dockerfile>`
- `docker build .`
- `docker build <path_of_Dockerfile>`
2. Tag docker image you are building
- `docker build . -t <repository>/<image_name>`
3. Don't use cache
Expand All @@ -70,15 +84,15 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
### Commands

1. Run container with command
- `docker run ubuntu <command>`
- `docker run ubuntu sleep 5`
- `docker run ubuntu <command>`
2. Run command on a running container
- `docker exec cat /etc/hosts`
- `docker exec -it mydb mysql --user=root --password=$MYSQL_ROOT_PASSWORD --version`
- `docker exec <container_id/name> <command>`
- `docker exec cat /etc/hosts`
- `docker exec -it mydb mysql --user=root --password=$MYSQL_ROOT_PASSWORD --version`
3. Run container in detached mode
- `docker run -d <container_id/name>`
- `--detach` ~ -`d`
- `--detach` ~ `-d`
4. Attach to running container
- `docker attach <container_id/name>`
5. Enable interactive mode to make container receive input
Expand Down Expand Up @@ -120,8 +134,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
CMD ["5"]
```
4. Override `ENTRYPOINT`
- `docker run --entrypoint <command> <image> <args>`
- `docker run --entrypoint sleep2 ubuntu-sleeper 10`
- `docker run --entrypoint <command> <image> <args>`

## Networking

Expand Down Expand Up @@ -151,8 +165,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
### Commands

1. Create new Network
- `docker network create --driver <driver> --subnet <a.b.c.d/n> <network_name>`
- `docker network create --driver bridge --subnet 182.18.0.0/16 my_network`
- `docker network create --driver <driver> --subnet <a.b.c.d/n> <network_name>`
2. Embedded DNS
- All Docker containers are accessible by their names
- This DNS runs at `127.0.0.11`
Expand All @@ -165,8 +179,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
- `docker volume create <volume_name>`
- creates `/var/lib/docker/volumes/volume_name`
2. Assign volume on run (mount volume)
- `docker run --volume <volume_name>:<container_path> <image>`
- `docker run -v data_volume:/var/lib/mysql mysql`
- `docker run --volume <volume_name>:<container_path> <image>`
3. Bind Mount
- File or directory on the host machine is mounted directly into a container
- Bind mount means that any changes to the local file system are immediately reflected in running container
Expand All @@ -175,6 +189,12 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase
5. Bind mount volume on run
- `docker run --mount type=bind,source=/data/mysql,target=/var/lib/mysql mysql`

## docker compose

1. Run only certain service
- `docker compose up mysql`
- `docker compose up <service>`

## Practices

1. For `apt-get` add `--no-install-recommends` to reduce image build time and size
Expand Down
8 changes: 8 additions & 0 deletions _posts/learning/engineering/Experiences.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## When debugging

1. **Always** try to **restart** things
- PC
- K8s target pod
- **All** K8s pods, not only target pod


2 changes: 2 additions & 0 deletions _posts/learning/frontend/jekyll.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1. Themes
- https://jekyllrb.com/docs/themes/#overriding-theme-defaults
56 changes: 36 additions & 20 deletions _posts/learning/shell/2024-03-26-LinuxShell.MD
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
---
title: Linux/Shell
date: 2024-03-26 00:00:00 +0100
categories: [ linux ]
tags: [ linux, shell, zsh, bash ] # TAG names should always be lowercase
categories: [ linux, shell ]
tags: [ linux, zsh, bash ] # TAG names should always be lowercase
---

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Zsh + Oh-my-zsh + Powerlevel10k](#zsh--oh-my-zsh--powerlevel10k)
- [All Terminals](#all-terminals)
- [Nano](#nano)
- [Top](#top)
- [Man pages](#man-pages)
* [Table of Contents](#table-of-contents)
* [Bash](#bash)
* [Zsh + Oh-my-zsh + Powerlevel10k](#zsh--oh-my-zsh--powerlevel10k)
* [All Terminals](#all-terminals)
* [Nano](#nano)
* [Top](#top)
* [Man pages](#man-pages)

## Interesting threads

- https://stackoverflow.com/a/42082956/10699128
- "Difference between single and double quotes in Bash"
- Comprehensive explanation of variable evaluation
- `""`, `''`, `$`, `\`


- https://unix.stackexchange.com/a/444949/379903
- "How can we run a command stored in a variable?"
- Comprehensive explanation of functions
- definition, evaluation, arguments

## Bash

Expand Down Expand Up @@ -77,10 +91,12 @@ tags: [ linux, shell, zsh, bash ] # TAG names should always be lowercase
```bash
nano /home/komidawi/.ssh/known_hosts
```
3. Expand envs
3. Show `n` last history entries (`0` shows all)
- `history n`
4. Expand envs
- `$USER<TAB>`\
-> `komidawi`
4. Print parameters help
5. Print parameters help
`cat -<TAB>`\
```
--help -- display help and exit
Expand All @@ -89,29 +105,29 @@ tags: [ linux, shell, zsh, bash ] # TAG names should always be lowercase
--show-all -A -- equivalent to -vET
--show-ends -E -- display $ at end of each line
```
5. Use `take` to `mkdir` and `cd` into it
6. Use `take` to `mkdir` and `cd` into it
- `take folder/subfolder/finish`
- it also works with zip archives, git repos and url downloads
6. Command history
7. Command history
- `Ctrl + R`
- Press again for next occurrence
7. Quick `cd`
8. Quick `cd`
- You can move into folders by name of the folder without `cd`
8. List last visited dirs
9. List last visited dirs
1. `d` (shortcut for `dirs -v`)
9. Command parking
10. Command parking
- Press `Ctrl + Q` to hide current command
- After invoking another command, the first one comes back
10. Open command in editor
11. Open command in editor
- `Ctrl + X`, `Ctrl + E`
- Opens in default editor (`$EDITOR`)
- Useful for long commands
11. cd shortcuts
12. cd shortcuts
- `cd ....` \
-> moves 4 levels up
- `cd -`\
-> jumps to previous path
12. Extensive search
13. Extensive search
- `ls *.txt`\
-> text files
- `ls **/*.txt`\
Expand All @@ -126,9 +142,9 @@ tags: [ linux, shell, zsh, bash ] # TAG names should always be lowercase
-> search only files
- `ls **/*(/)`
-> search only folders
13. List recently open directories
14. List recently open directories
1. `d`
14. Copy to clipboard (WSL2)
15. Copy to clipboard (WSL2)
1. `command | clip.exe`

## All Terminals
Expand Down
4 changes: 2 additions & 2 deletions _posts/learning/shell/2024-06-11-Windows.MD
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Windows
date: 2024-06-19 00:00:00 +0100
categories: [ windows ]
tags: [ Windows ] # TAG names should always be lowercase
categories: [ windows, shell ]
tags: [ windows ] # TAG names should always be lowercase
---

1. Get rid of app which occupies given port
Expand Down
File renamed without changes.

0 comments on commit 2ccc023

Please sign in to comment.