From 2ccc0230a22ddd9791c2b01310b09ed632a905f6 Mon Sep 17 00:00:00 2001 From: Dawid Komisarczuk Date: Thu, 5 Dec 2024 18:39:12 +0100 Subject: [PATCH] [Multiple] Minor changes in many entries --- _posts/collections/2024-08-05-Articles.MD | 5 -- _posts/collections/Software-Collection.MD | 39 +++++++++++++ _posts/learning/devops/2024-05-28-Docker.MD | 42 ++++++++++---- _posts/learning/engineering/Experiences.MD | 8 +++ _posts/learning/frontend/jekyll.MD | 2 + .../learning/shell/2024-03-26-LinuxShell.MD | 56 ++++++++++++------- _posts/learning/shell/2024-06-11-Windows.MD | 4 +- .../2024-10-22-Certificates-TLS-etc.MD | 0 8 files changed, 118 insertions(+), 38 deletions(-) create mode 100644 _posts/collections/Software-Collection.MD create mode 100644 _posts/learning/engineering/Experiences.MD create mode 100644 _posts/learning/frontend/jekyll.MD rename _posts/{ => learning/various}/2024-10-22-Certificates-TLS-etc.MD (100%) diff --git a/_posts/collections/2024-08-05-Articles.MD b/_posts/collections/2024-08-05-Articles.MD index e28f8fb..34329b5 100644 --- a/_posts/collections/2024-08-05-Articles.MD +++ b/_posts/collections/2024-08-05-Articles.MD @@ -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 diff --git a/_posts/collections/Software-Collection.MD b/_posts/collections/Software-Collection.MD new file mode 100644 index 0000000..3f48cb3 --- /dev/null +++ b/_posts/collections/Software-Collection.MD @@ -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 diff --git a/_posts/learning/devops/2024-05-28-Docker.MD b/_posts/learning/devops/2024-05-28-Docker.MD index 9387f32..684cd94 100644 --- a/_posts/learning/devops/2024-05-28-Docker.MD +++ b/_posts/learning/devops/2024-05-28-Docker.MD @@ -5,6 +5,20 @@ 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 @@ -12,8 +26,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase 1. Run container (e.g. nginx) - `docker run nginx` 2. Run container with specific version (tag) - - `docker run :` - `docker run redis:4.0` + - `docker run :` 3. List containers - Running - `docker ps` @@ -30,15 +44,15 @@ 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 : ` - `docker run -v /opt/datadir:/var/lib/mysql mysql` + - `docker run -v : ` 8. Get more detailed info of container - `docker inspect ` 9. Show Container logs - `docker logs ` 10. Set Environmental Variables - - `docker run --env = ` - `docker run --env JAVA_VERSION=11 my_container` + - `docker run --env = ` - `--env` ~ `-e` 11. Display Environmental Variables - Use `docker inspect` command @@ -46,8 +60,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase ### Images 1. Build docker image - - `docker build ` - `docker build .` + - `docker build ` 2. Tag docker image you are building - `docker build . -t /` 3. Don't use cache @@ -70,15 +84,15 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase ### Commands 1. Run container with command - - `docker run ubuntu ` - `docker run ubuntu sleep 5` + - `docker run ubuntu ` 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 ` - - `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 ` - - `--detach` ~ -`d` + - `--detach` ~ `-d` 4. Attach to running container - `docker attach ` 5. Enable interactive mode to make container receive input @@ -120,8 +134,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase CMD ["5"] ``` 4. Override `ENTRYPOINT` - - `docker run --entrypoint ` - `docker run --entrypoint sleep2 ubuntu-sleeper 10` + - `docker run --entrypoint ` ## Networking @@ -151,8 +165,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase ### Commands 1. Create new Network - - `docker network create --driver --subnet ` - `docker network create --driver bridge --subnet 182.18.0.0/16 my_network` + - `docker network create --driver --subnet ` 2. Embedded DNS - All Docker containers are accessible by their names - This DNS runs at `127.0.0.11` @@ -165,8 +179,8 @@ tags: [ docker, containers, cloud ] # TAG names should always be lowercase - `docker volume create ` - creates `/var/lib/docker/volumes/volume_name` 2. Assign volume on run (mount volume) - - `docker run --volume : ` - `docker run -v data_volume:/var/lib/mysql mysql` + - `docker run --volume : ` 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 @@ -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 ` + ## Practices 1. For `apt-get` add `--no-install-recommends` to reduce image build time and size diff --git a/_posts/learning/engineering/Experiences.MD b/_posts/learning/engineering/Experiences.MD new file mode 100644 index 0000000..0d37b85 --- /dev/null +++ b/_posts/learning/engineering/Experiences.MD @@ -0,0 +1,8 @@ +## When debugging + +1. **Always** try to **restart** things + - PC + - K8s target pod + - **All** K8s pods, not only target pod + + diff --git a/_posts/learning/frontend/jekyll.MD b/_posts/learning/frontend/jekyll.MD new file mode 100644 index 0000000..fd6d9d6 --- /dev/null +++ b/_posts/learning/frontend/jekyll.MD @@ -0,0 +1,2 @@ +1. Themes + - https://jekyllrb.com/docs/themes/#overriding-theme-defaults diff --git a/_posts/learning/shell/2024-03-26-LinuxShell.MD b/_posts/learning/shell/2024-03-26-LinuxShell.MD index 5dc0743..705dad5 100644 --- a/_posts/learning/shell/2024-03-26-LinuxShell.MD +++ b/_posts/learning/shell/2024-03-26-LinuxShell.MD @@ -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 @@ -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`\ -> `komidawi` -4. Print parameters help +5. Print parameters help `cat -`\ ``` --help -- display help and exit @@ -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`\ @@ -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 diff --git a/_posts/learning/shell/2024-06-11-Windows.MD b/_posts/learning/shell/2024-06-11-Windows.MD index fe0302a..fc08a51 100644 --- a/_posts/learning/shell/2024-06-11-Windows.MD +++ b/_posts/learning/shell/2024-06-11-Windows.MD @@ -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 diff --git a/_posts/2024-10-22-Certificates-TLS-etc.MD b/_posts/learning/various/2024-10-22-Certificates-TLS-etc.MD similarity index 100% rename from _posts/2024-10-22-Certificates-TLS-etc.MD rename to _posts/learning/various/2024-10-22-Certificates-TLS-etc.MD