├── LICENSE
├── README.md
├── ansible
└── README.md
├── docker
├── README.md
├── Swarm
│ └── README.md
├── build
│ └── README.md
└── compose
│ └── README.md
├── fio
└── README.md
├── gcc
└── README.md
├── git
├── README.md
└── commit_misconfig_fix.md
├── gitlab
├── README.md
├── gitlabctl.md
└── postres.md
├── go
└── README.md
├── gpg
└── README.md
├── kestra
└── README.md
├── kubectl
└── README.md
├── linux
├── debian
│ └── README.md
├── iptables
│ └── README.md
├── logrorate
│ └── config.md
├── rocky
│ └── README.md
└── systemd
│ └── cache_service.md
├── nmap
└── README.md
├── phoronix
├── README.md
└── source_build.md
├── powershell
└── README.md
├── proxmox
└── README.md
├── python
├── README.md
└── pycharm_install_steps.md
├── scripts
├── battery_monitor.sh
├── clean_keychain.sh
├── clean_memory.sh
├── clear_mem_cache.sh
├── discharge_monitor.sh
└── update_keychain.sh
├── ssh
└── README.md
├── ssl
└── README.md
├── terraform
└── README.md
├── wazuh
└── README.md
└── wsl
└── README.md
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Alprojects
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | 🄲🄷🄴🄰🅃-🅂🄷🄴🄴🅃
3 |
4 |
--------------------------------------------------------------------------------
/ansible/README.md:
--------------------------------------------------------------------------------
1 | ## **Ansible**
2 |
3 | | Command | Description |
4 | |------------------------------------------------|------------------------------------------------------------|
5 | | `ansible --version` | Show the Ansible version and installation details |
6 | | `ansible-inventory --list` | List the hosts and groups in the inventory |
7 | | `ansible -m ping` | Test the connection to a host using the ping module |
8 | | `ansible all -m setup` | Gather facts from all hosts in the inventory |
9 | | `ansible all -m copy -a "src=/local/path dest=/remote/path"` | Copy a file from local to remote hosts |
10 | | `ansible-playbook ` | Run a playbook |
11 | | `ansible-vault encrypt ` | Encrypt a file using Ansible Vault |
12 | | `ansible-vault decrypt ` | Decrypt a previously encrypted file |
13 | | `ansible-vault edit ` | Edit an encrypted file |
14 | | `ansible-doc ` | Display documentation for a specific module |
15 |
16 |
17 | ## **Playbook Management**
18 |
19 | | Command | Description |
20 | |------------------------------------------------|------------------------------------------------------------|
21 | | `ansible-playbook --check` | Perform a dry run of the playbook without making changes |
22 | | `ansible-playbook --syntax-check` | Perform a syntax check of the playbook |
23 | | `ansible-playbook --tags ` | Run only tasks tagged with a specific tag |
24 | | `ansible-playbook --list-tasks` | List all tasks in the playbook |
25 |
26 |
27 | ## **Ad-hoc Commands**
28 |
29 | | Command | Description |
30 | |------------------------------------------------|------------------------------------------------------------|
31 | | `ansible all -a "/bin/echo hello"` | Run a command on all hosts in the inventory |
32 | | `ansible all -m yum -a "name=httpd state=present"` | Install Apache on all hosts using the yum module |
33 | | `ansible all -m service -a "name=httpd state=started"` | Start the Apache service on all hosts |
34 |
35 |
36 | ## **Inventory Management**
37 |
38 | | Command | Description |
39 | |------------------------------------------------|------------------------------------------------------------|
40 | | `ansible-inventory --graph` | Display the inventory graph |
41 | | `ansible-inventory --list -i ` | List the inventory in JSON format from a specific file |
42 | | `ansible-inventory --host ` | Show the inventory details for a specific host |
43 |
44 |
45 | ## **Ansible Vault**
46 |
47 | | Command | Description |
48 | |------------------------------------------------|------------------------------------------------------------|
49 | | `ansible-vault create ` | Create a new encrypted file |
50 | | `ansible-vault encrypt ` | Encrypt an existing file |
51 | | `ansible-vault decrypt ` | Decrypt a file |
52 | | `ansible-vault rekey ` | Change the password for an encrypted file |
53 |
54 |
55 | ## **Roles and Galaxy**
56 |
57 | | Command | Description |
58 | |------------------------------------------------|------------------------------------------------------------|
59 | | `ansible-galaxy init ` | Create a new role skeleton |
60 | | `ansible-galaxy install ` | Install a role from Ansible Galaxy |
61 | | `ansible-galaxy list` | List all installed roles |
62 | | `ansible-galaxy remove ` | Remove an installed role |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/docker/README.md:
--------------------------------------------------------------------------------
1 | ## ***Networking***
2 | | Command | Description |
3 | | ----------------------------------------------------- | ----------------------------------------------- |
4 | | `docker network ls` | List all Docker networks |
5 | | `docker network create ` | Create a new Docker network |
6 | | `docker network connect ` | Connect a container to a network |
7 | | `docker network disconnect ` | Disconnect a container from a network |
8 | | `docker network inspect ` | Display detailed information on a specific network |
9 | | `docker network rm ` | Remove a Docker network |
10 | | `docker network prune` | Remove all unused networks |
11 | | `docker run --network ` | Run a container on a specific network |
12 | | `docker network create --driver bridge ` | Create a bridge network |
13 |
14 |
15 | ## ***Volumes***
16 | | Command | Description |
17 | | -------------------------------------------- | ---------------------------------------------------- |
18 | | `docker volume ls` | List all Docker volumes |
19 | | `docker volume create ` | Create a new Docker volume |
20 | | `docker volume rm ` | Remove a Docker volume |
21 | | `docker volume prune` | Remove all unused volumes |
22 | | `docker run -v :/path ` | Attach a volume to a container |
23 | | `docker inspect ` | Show details of a Docker volume |
24 | | `docker volume inspect ` | Inspect volume details (mountpoint, usage, etc.) |
25 | | `docker volume create --driver ` | Create a volume with a specific driver|
26 |
27 |
28 | ## ***Executing Commands in Containers***
29 | | Command | Description |
30 | | -------------------------------------------- | ---------------------------------------------------- |
31 | | `docker exec -it ` | Execute a command inside a running container |
32 | | `docker exec -it /bin/bash` | Open a bash shell in a running container |
33 | | `docker exec -it /bin/sh` | Open a shell in a running container (if bash not available)|
34 | | `docker run -it /bin/bash` | Run a container and immediately access its shell |
35 | | `docker run -d ` | Run a container in detached mode |
36 |
37 |
38 | ## ***Image***
39 | | Command | Description |
40 | | -------------------------------------------- | ---------------------------------------------------- |
41 | | `docker rmi ` | Remove a specific Docker image |
42 | | `docker image prune` | Remove all unused images |
43 | | `docker build -t ` | Build a Docker image from a Dockerfile |
44 | | `docker tag ` | Tag an image with a new name |
45 | | `docker save -o .tar `| Save an image to a tar archive |
46 | | `docker load -i .tar` | Load an image from a tar archive |
47 | | `docker push ` | Push an image to a Docker registry |
48 | | `docker commit ` | Create an image from a container's changes |
49 | | `docker export > .tar` | Export a container’s filesystem as a tar archive |
50 |
51 |
52 | ## ***Container***
53 | | Command | Description |
54 | | -------------------------------------------- | ---------------------------------------------------- |
55 | | `docker start $(docker ps -a -q)` | Start all stopped containers |
56 | | `docker start ` | Start a specific container |
57 | | `docker stop ` | Stop a specific running container |
58 | | `docker restart ` | Restart a specific container |
59 | | `docker rm ` | Remove a specific container |
60 | | `docker container prune` | Remove all stopped containers |
61 | | `docker pause ` | Pause a running container |
62 | | `docker unpause ` | Unpause a paused container |
63 | | `docker update ` | Update resource limits of a running container |
64 | | `docker wait ` | Block until a container stops and then print its exit code |
65 | | `docker kill ` | Kill a running container |
66 |
67 |
68 | ## ***Inspecting & Debugging***
69 | | Command | Description |
70 | | -------------------------------------------- | ---------------------------------------------------- |
71 | | `docker logs ` | Show logs of a specific container |
72 | | `docker inspect ` | Inspect detailed information about a container |
73 | | `docker stats ` | Show real-time statistics for a container |
74 | | `docker attach ` | Attach to a running container's input/output |
75 | | `docker events` | Get real-time events from the Docker daemon |
76 | | `docker diff ` | Inspect changes made to a container’s filesystem |
77 | | `docker top ` | Display the processes running inside a container |
78 | | `docker system df` | Show Docker disk usage (images, containers, etc.) |
79 |
80 |
81 | ## ***Basic***
82 | | Command | Description |
83 | | -------------------------------------------- | ---------------------------------------------------- |
84 | | `docker --version` | Show Docker version |
85 | | `docker pull ` | Pull an image from a Docker registry |
86 | | `docker run ` | Run a container from an image |
87 | | `docker ps` | List all running containers |
88 | | `docker ps -a` | List all containers (running and stopped) |
89 | | `docker images` | List all Docker images on the system |
90 | | `docker search ` | Search Docker Hub for images |
91 | | `docker rename ` | Rename an existing container |
92 | | `docker history ` | Show history of an image (layers) |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/docker/Swarm/README.md:
--------------------------------------------------------------------------------
1 | ## ***Swarm Management***
2 | | Command | Description |
3 | | -------------------------------------------- | ---------------------------------------------------- |
4 | | `docker swarm init` | Initialize a new Swarm |
5 | | `docker swarm join --token :` | Join a node to an existing Swarm |
6 | | `docker swarm leave --force` | Forcefully leave the Swarm (for managers) |
7 | | `docker swarm update --autolock=true` | Enable autolocking for Swarm cluster |
8 | | `docker swarm unlock` | Unlock a locked Swarm |
9 | | `docker swarm unlock-key` | Manage the unlock key for autolocking |
10 | | `docker swarm update --dispatcher-heartbeat ` | Adjust heartbeat intervals between Swarm managers and workers |
11 |
12 |
13 | ## ***Service Networking***
14 | | Command | Description |
15 | | -------------------------------------------- | ---------------------------------------------------- |
16 | | `docker network create --driver overlay ` | Create an overlay network for Swarm services|
17 | | `docker network ls` | List all networks in the Swarm |
18 | | `docker service update --network-add ` | Attach a service to a network |
19 | | `docker network inspect ` | Inspect an overlay network |
20 | | `docker network rm ` | Remove a network |
21 | | `docker service create --network ` | Create a service attached to a network |
22 |
23 |
24 | ## ***Basic Commands***
25 | | Command | Description |
26 | | -------------------------------------------- | ---------------------------------------------------- |
27 | | `docker swarm init` | Initialize a new Swarm cluster |
28 | | `docker swarm join --token :` | Join a Swarm as a worker or manager using the token |
29 | | `docker swarm leave` | Leave the Swarm (for a worker node) |
30 | | `docker swarm leave --force` | Force a manager to leave the Swarm |
31 | | `docker node ls` | List all nodes in the Swarm |
32 | | `docker node inspect ` | Inspect a specific node |
33 | | `docker node rm ` | Remove a node from the Swarm |
34 | | `docker swarm update --task-history-limit ` | Update Swarm settings like task history |
35 |
36 |
37 | ## ***Service Management***
38 | | Command | Description |
39 | | -------------------------------------------- | ---------------------------------------------------- |
40 | | `docker service create --name ` | Create a new service in the Swarm |
41 | | `docker service ls` | List all services running in the Swarm |
42 | | `docker service inspect ` | Inspect a specific service in the Swarm |
43 | | `docker service scale =` | Scale a service to a specified number of replicas |
44 | | `docker service ps ` | List tasks associated with a service |
45 | | `docker service rm ` | Remove a service from the Swarm |
46 | | `docker service logs ` | View logs of a specific service |
47 | | `docker service update --image ` | Update a service to use a new image |
48 |
49 |
50 | ## ***Backup & Restore***
51 | | Command | Description |
52 | | -------------------------------------------- | ---------------------------------------------------- |
53 | | `docker swarm unlock-key --rotate` | Rotate the unlock key for the Swarm |
54 | | `docker node update --availability drain ` | Drain a node before backing up |
55 | | `docker service update --force ` | Force update a service to refresh its configuration |
56 | | `docker node demote ` | Demote a manager to worker for cluster safety |
57 | | `docker service rollback ` | Rollback a service to its previous version |
58 |
59 |
60 | ## ***Node Management***
61 | | Command | Description |
62 | | -------------------------------------------- | ---------------------------------------------------- |
63 | | `docker node promote ` | Promote a worker node to manager |
64 | | `docker node demote ` | Demote a manager node to worker |
65 | | `docker node ls` | List all nodes in the Swarm |
66 | | `docker node update --availability drain ` | Set a node to "drain" mode (won't run new tasks)|
67 | | `docker node update --availability active ` | Set a node to "active" mode |
68 | | `docker node update --label-add key=value ` | Add or update a label on a node |
69 | | `docker node rm ` | Remove a node from the Swarm |
70 |
71 |
72 | ## ***Task Management***
73 | | Command | Description |
74 | | -------------------------------------------- | ---------------------------------------------------- |
75 | | `docker service ps ` | List tasks running in a specific service |
76 | | `docker inspect ` | Inspect a specific task |
77 | | `docker node ps ` | List tasks running on a specific node |
78 | | `docker service scale =` | Scale a service up or down by number of replicas |
79 | | `docker service update --force ` | Force update of a running service |
80 | | `docker service rollback ` | Roll back to the previous version of a service |
81 |
82 |
83 | ## ***Troubleshooting & Logs***
84 | | Command | Description |
85 | | -------------------------------------------- | ---------------------------------------------------- |
86 | | `docker service logs ` | View logs for a specific service |
87 | | `docker node inspect ` | Inspect detailed information about a node |
88 | | `docker service ps ` | List the running tasks for a service |
89 | | `docker inspect ` | Inspect a specific task within a service |
90 | | `docker events` | Get real-time events from the Docker daemon |
91 | | `docker node ls` | List all nodes in the Swarm |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/docker/build/README.md:
--------------------------------------------------------------------------------
1 | | Base Image | Size | Command | Description |
2 | |-----------------------|-------|-------------------------------|-----------------------------------------------------------|
3 | | Alpine (arm64) | ~5MB | `FROM alpine:latest` | Arm based, optimized for security & resource efficiency. |
4 | | Debian Slim (amd64) | ~22MB | `FROM debian:bullseye-slim` | minimal, stripped down to the essentials |
5 | | Ubuntu Minimal (amd64)| ~29MB | `FROM ubuntu:20.04` | A lightweight, official Ubuntu image with minimal |
6 |
7 |
--------------------------------------------------------------------------------
/docker/compose/README.md:
--------------------------------------------------------------------------------
1 | ## ***Environment Management***
2 | | Command | Description |
3 | | -------------------------------------------- | ---------------------------------------------------- |
4 | | `docker-compose config` | Validate and view Compose configuration |
5 | | `docker-compose --env-file ` | Specify an environment file to use |
6 | | `docker-compose run -e =` | Set environment variables for a one-time command |
7 | | `docker-compose exec -e =` | Set environment variables for an exec command |
8 | | `docker-compose config --resolve-image-digests` | Resolve image digests instead of using tag-based references
9 |
10 |
11 | ## ***Networking***
12 | | Command | Description |
13 | | -------------------------------------------- | ---------------------------------------------------- |
14 | | `docker-compose up --scale =` | Scale up/down a service |
15 | | `docker-compose ps` | List containers defined in the Compose file |
16 | | `docker-compose port ` | Display the public-facing port of a specific service |
17 | | `docker-compose down --volumes` | Remove networks created by `docker-compose up` |
18 | | `docker-compose config --services` | List all services in the Compose configuration file |
19 | | `docker-compose config --volumes` | List all volumes in the Compose configuration file |
20 |
21 |
22 | ## ***Service Management***
23 | | Command | Description |
24 | | -------------------------------------------- | ---------------------------------------------------- |
25 | | `docker-compose scale =` | Scale a service to a specified number of containers|
26 | | `docker-compose logs ` | View logs for a specific service |
27 | | `docker-compose logs -f` | Tail logs of all services defined in the Compose file|
28 | | `docker-compose run ` | Run a one-time command on a service |
29 | | `docker-compose kill ` | Force stop a specific service |
30 | | `docker-compose rm ` | Remove a stopped service container |
31 | | `docker-compose exec ` | Execute a command inside a running service container|
32 |
33 |
34 | ## ***Volumes***
35 | | Command | Description |
36 | | -------------------------------------------- | ---------------------------------------------------- |
37 | | `docker-compose up -d ` | Start a service with a mounted volume in detached mode |
38 | | `docker-compose down --volumes` | Remove all volumes used by the services |
39 | | `docker-compose run --rm -v :` | Run a one-time container with a specified volume |
40 | | `docker-compose up -v` | Recreate containers with attached volumes |
41 | | `docker-compose logs -f --tail=100` | View the last 100 logs with real-time updates |
42 |
43 |
44 |
45 | ## ***Inspecting & Debugging***
46 | | Command | Description |
47 | | -------------------------------------------- | ---------------------------------------------------- |
48 | | `docker-compose ps` | List all containers with their status |
49 | | `docker-compose logs ` | View logs for a specific service |
50 | | `docker-compose logs -f` | Tail logs for all services |
51 | | `docker-compose top` | Display processes running inside the containers |
52 | | `docker-compose config` | Validate and view the Compose file configuration |
53 | | `docker-compose config --services` | List all services in the Compose file |
54 | | `docker-compose config --volumes` | List all volumes in the Compose file |
55 | | `docker-compose config -q` | Check if the Compose file is valid |
56 | | `docker-compose exec /bin/bash` | Open a bash shell in a running container |
57 |
58 |
59 |
60 | ## ***Basic***
61 | | Command | Description |
62 | | -------------------------------------------- | ---------------------------------------------------- |
63 | | `docker-compose --version` | Display Docker Compose version |
64 | | `docker-compose up` | Create and start containers from a Compose file |
65 | | `docker-compose up -d` | Start containers in detached mode |
66 | | `docker-compose down` | Stop and remove containers, networks, images, and volumes |
67 | | `docker-compose start` | Start existing services defined in the Compose file |
68 | | `docker-compose stop` | Stop running services without removing them |
69 | | `docker-compose restart` | Restart services |
70 |
71 |
72 |
73 |
74 | ## ***Building & Images***
75 | | Command | Description |
76 | | -------------------------------------------- | ---------------------------------------------------- |
77 | | `docker-compose build` | Build or rebuild services |
78 | | `docker-compose build --no-cache` | Build without using cache |
79 | | `docker-compose up --build` | Build and start the services |
80 | | `docker-compose pull` | Pull service images defined in the Compose file |
81 | | `docker-compose push` | Push service images to a registry |
82 | | `docker-compose images` | List all images used by the services |
83 |
84 |
85 |
86 | ## ***System Management***
87 | | Command | Description |
88 | | -------------------------------------------- | ---------------------------------------------------- |
89 | | `docker-compose pause` | Pause all running services |
90 | | `docker-compose unpause` | Unpause paused services |
91 | | `docker-compose stop` | Stop all services |
92 | | `docker-compose start` | Start all services |
93 | | `docker-compose restart` | Restart all services |
94 | | `docker-compose down --rmi all` | Remove all services and their images |
95 | | `docker-compose version` | Show Docker Compose version information |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/fio/README.md:
--------------------------------------------------------------------------------
1 | ## fio (flexible I/O Tester)
2 |
3 | - ***what this test is doing: reads/writes for 60 seconds and then outputting the amount of data read/wrote***
4 | - ***what this test is not doing: testing a single read/write cycle for the size of the file***
5 | - ***Wiki: https://fio.readthedocs.io/en/latest/fio_doc.html***
6 |
7 | ## ***Benchmarks:***
8 |
9 | | Command | Description |
10 | | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
11 | | `fio --name=rand_read --directory=/mnt --ioengine=libaio --rw=randread --bs=4k --direct=1 --size=1G --numjobs=4 --time_based --runtime=60 --group_reporting` | 4K Random Read |
12 | | `fio --name=rand_write --directory=/mnt --ioengine=libaio --rw=randwrite --bs=4k --direct=1 --size=1G --numjobs=4 --time_based --runtime=60 --group_reporting` | 4K Random Write |
13 | | `fio --name=concurrent_read --directory=/mnt --ioengine=libaio --rw=read --bs=4k --direct=1 --size=1G --numjobs=4 --iodepth=32 --time_based --runtime=60 --group_reporting` | Concurrent I/O Depth Read |
14 | | `fio --name=concurrent_write --directory=/mnt --ioengine=libaio --rw=write --bs=4k --direct=1 --size=1G --numjobs=4 --iodepth=32 --time_based --runtime=60 --group_reporting` | Concurrent I/O Depth Write |
15 | | `fio --name=seq_read --directory=/mnt --ioengine=libaio --rw=read --bs=128k --direct=1 --size=1G --numjobs=1 --time_based --runtime=60 --group_reporting` | Sequential Read (128KB Block) |
16 | | `fio --name=seq_write --directory=/mnt --ioengine=libaio --rw=write --bs=128k --direct=1 --size=1G --numjobs=1 --time_based --runtime=60 --group_reporting` | Sequential Write (128KB Block) |
17 | | `fio --name=seq_read_write --ioengine=libaio --rw=readwrite --bs=1m --direct=1 --size=10G --numjobs=1 --time_based --runtime=60 --group_reporting` | Large Sequential Read/Write (1M) |
18 | | `fio --name=rand_read_write --ioengine=libaio --rw=randrw --bs=4k --direct=1 --size=10G --numjobs=4 --time_based --runtime=60 --group_reporting` | Large Random Read/Write (4K) |
19 | | `fio --name=vm_clone_sim --ioengine=libaio --rw=write --bs=4k --direct=1 --size=10G --numjobs=4 --time_based --runtime=60 --group_reporting` | Proxmox VM Clone (10GB) |
20 | | `fio --name=random_rw --ioengine=libaio --rw=randrw --bs=4k --direct=1 --size=1G --numjobs=4 --runtime=60 --group_reporting --directory=/mnt/nfs` | VM Simulation Random Read/Write |
21 | | `fio --name=seq_read --ioengine=libaio --rw=read --bs=1M --direct=1 --size=2G --numjobs=4 --runtime=60 --group_reporting --directory=/mnt/nfs` | VM Simulation Large Sequential Read|
22 | | `fio --name=seq_write --ioengine=libaio --rw=write --bs=1M --direct=1 --size=2G --numjobs=4 --runtime=60 --group_reporting --directory=/mnt/nfs` | VM Simulation Large Sequential Write |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/gcc/README.md:
--------------------------------------------------------------------------------
1 | ## **GCC**
2 |
3 |
4 | ### **Linking Options**
5 | | Command | Description |
6 | |------------------------------------------------|------------------------------------------------------------|
7 | | `gcc .c -L -l`| Link with a specific library located in a directory |
8 | | `gcc .c -lm` | Link with the math library (`libm`) |
9 | | `gcc .c -static` | Create a statically linked executable |
10 | | `gcc .c -shared` | Create a shared library (dynamic library, `.so` file) |
11 | | `gcc -o -l` | Link with a specified library while generating an output executable|
12 |
13 |
14 | ### **Error Handling**
15 | | Command | Description |
16 | |------------------------------------------------|------------------------------------------------------------|
17 | | `gcc -fsyntax-only .c` | Check the code for syntax errors without generating an object or binary file |
18 | | `gcc -Wall .c` | Enable all common warnings |
19 | | `gcc -Werror .c` | Treat warnings as errors (stop compilation) |
20 |
21 | ### **Cross-Compiling**
22 | | Command | Description |
23 | |------------------------------------------------|------------------------------------------------------------|
24 | | `gcc -target= .c` | Cross-compile for a specific target architecture (e.g., ARM, x86_64) |
25 | | `gcc --sysroot=` | Specify the system root when cross-compiling |
26 |
27 |
28 |
29 | ### **Miscellaneous**
30 | | Command | Description |
31 | |------------------------------------------------|------------------------------------------------------------|
32 | | `gcc -v` | Show detailed version and compilation steps |
33 | | `gcc --help` | Show help for GCC commands |
34 | | `gcc -o .c -pipe` | Use pipes rather than temporary files for intermediate steps|
35 | | `gcc -x ` | Treat input file as the specified language (e.g., `c`, `c++`)|
36 |
37 |
38 |
39 |
40 | ### **Basic GCC Commands**
41 | | Command | Description |
42 | |------------------------------------------------|------------------------------------------------------------|
43 | | `gcc .c` | Compile a C source file into an executable (default `a.out`)|
44 | | `gcc -o .c` | Compile and specify the output file name |
45 | | `gcc -c .c` | Compile the source code to an object file (no linking) |
46 | | `gcc .c .c` | Compile multiple C files and link them together |
47 | | `gcc .c -o ` | Compile and specify output executable |
48 | | `g++ .cpp` | Compile a C++ source file |
49 | | `g++ -o .cpp` | Compile C++ and specify the output executable |
50 |
51 |
52 | ### **Debugging Options**
53 | | Command | Description |
54 | |------------------------------------------------|------------------------------------------------------------|
55 | | `gcc -g .c` | Compile with debugging information (for use with GDB) |
56 | | `gcc -ggdb .c` | Include additional debug information for GDB |
57 | | `gcc -Wall .c` | Enable most common warnings |
58 | | `gcc -Werror .c` | Treat warnings as errors (stop compilation if warnings are present) |
59 | | `gcc -pedantic .c` | Issue all warnings required by strict ISO C/C++ standard |
60 |
61 |
62 |
63 | ### **Compiling and Linking Separately**
64 | | Command | Description |
65 | |------------------------------------------------|------------------------------------------------------------|
66 | | `gcc -c .c -o .o` | Compile source code into object file without linking |
67 | | `gcc -c .c -o .o` | Compile another source file |
68 | | `gcc .o .o -o ` | Link object files to create an executable |
69 |
70 |
71 |
72 | ### **Optimization Options**
73 | | Command | Description |
74 | |------------------------------------------------|------------------------------------------------------------|
75 | | `gcc -O0 .c` | No optimization (default) |
76 | | `gcc -O1 .c` | Optimize for performance without increasing compilation time |
77 | | `gcc -O2 .c` | Optimize more, including costly optimizations |
78 | | `gcc -O3 .c` | Maximum optimization, including aggressive performance tuning |
79 | | `gcc -Os .c` | Optimize for size (minimize code size) |
80 |
81 |
82 |
83 |
84 | ### **Preprocessing Options**
85 | | Command | Description |
86 | |------------------------------------------------|------------------------------------------------------------|
87 | | `gcc -E .c` | Run the preprocessor only, without compiling |
88 | | `gcc -I ` | Add a directory to the list of paths to search for header files |
89 | | `gcc -D` | Define a macro in the code being compiled |
90 | | `gcc -U` | Undefine a macro |
91 | | `gcc -include ` | Include a header file before all others |
92 |
93 |
94 |
95 | ### **C++ Specific Options (g++)**
96 | | Command | Description |
97 | |------------------------------------------------|------------------------------------------------------------|
98 | | `g++ -std=c++11 .cpp` | Compile C++ code with C++11 standard support |
99 | | `g++ -std=c++17 .cpp` | Compile C++ code with C++17 standard support |
100 | | `g++ -fno-exceptions .cpp` | Disable exception handling |
101 | | `g++ -fno-rtti .cpp` | Disable runtime type identification |
102 |
103 |
104 | ### **Multithreading Options**
105 | | Command | Description |
106 | |------------------------------------------------|------------------------------------------------------------|
107 | | `gcc -pthread .c` | Compile with POSIX threads support (for multithreading) |
108 | | `gcc -fopenmp .c` | Compile with OpenMP support for parallel processing |
109 |
110 |
111 |
112 |
113 | ### **Compiling Large Projects**
114 | | Command | Description |
115 | |------------------------------------------------|------------------------------------------------------------|
116 | | `gcc @options_file` | Read additional command-line options from a file |
117 | | `gcc -M .c` | Output a makefile-style dependency list |
118 |
119 |
120 | ### **Profiling and Performance Analysis**
121 | | Command | Description |
122 | |------------------------------------------------|------------------------------------------------------------|
123 | | `gcc -pg .c` | Enable profiling with `gprof` |
124 | | `gprof gmon.out` | Generate profiling report using `gprof` |
125 |
126 |
127 |
128 |
129 |
130 |
131 | ### **Common File Extensions**
132 | - **`.c`**: C source file
133 | - **`.cpp`**: C++ source file
134 | - **`.h`**: C/C++ header file
135 | - **`.o`**: Object file (output of compilation but not yet linked)
136 | - **`.a`**: Static library
137 | - **`.so`**: Shared library (for dynamic linking)
138 |
139 |
140 | ### **Makefile Integration**
141 |
142 | - GCC is often used in conjunction with **Makefiles** to automate the compilation process, especially for larger projects. Makefiles allow you to specify dependencies, compilation flags, and multiple steps to manage complex projects.
143 |
144 | A simple **Makefile** example:
145 | ```makefile
146 | CC=gcc
147 | CFLAGS=-Wall -g
148 |
149 | all: myprogram
150 |
151 | myprogram: main.o lib.o
152 | $(CC) -o myprogram main.o lib.o
153 |
154 | main.o: main.c
155 | $(CC) $(CFLAGS) -c main.c
156 |
157 | lib.o: lib.c
158 | $(CC) $(CFLAGS) -c lib.c
159 |
160 | clean:
161 | rm -f *.o myprogram
162 |
--------------------------------------------------------------------------------
/git/README.md:
--------------------------------------------------------------------------------
1 | ## **Git**
2 |
3 | ### **Project and Repository Management**
4 | | Command | Description |
5 | |------------------------------------------------|------------------------------------------------------------|
6 | | `git clone ` | Clone a GitLab repository to your local machine |
7 | | `git init` | Initialize a new local repository |
8 | | `git remote add origin ` | Add a remote repository for your project |
9 | | `git push -u origin ` | Push a local branch to GitLab and set upstream tracking |
10 | | `git pull` | Fetch changes from the remote repository and merge them |
11 | | `git fetch` | Fetch changes from the remote repository without merging |
12 | | `git branch` | List all branches |
13 | | `git branch ` | Create a new branch |
14 | | `git checkout ` | Switch to a specific branch |
15 | | `git checkout -b ` | Create and switch to a new branch |
16 | | `git merge ` | Merge a branch into the current branch |
17 | | `git rebase ` | Rebase the current branch onto another branch |
18 | | `git push origin --delete ` | Delete a branch in the remote repository |
19 | | `git tag ` | Create a new tag |
20 | | `git push origin ` | Push a tag to the remote repository |
21 | | `git tag -d ` | Delete a local tag |
22 | | `git push origin :refs/tags/` | Delete a remote tag |
23 | | `git log` | Show the commit history |
24 | | `git show ` | Show the details of a specific commit |
25 | | `git diff` | Show changes between commits or working directory changes |
26 | | `git status` | Show the current status of the working directory |
27 |
--------------------------------------------------------------------------------
/git/commit_misconfig_fix.md:
--------------------------------------------------------------------------------
1 | ## **user filter branch to fix**
2 |
3 | ```sh
4 | git filter-branch --env-filter '
5 | WRONG_EMAIL="alporjects1@proton.me"
6 | NEW_NAME="alprojects1"
7 | NEW_EMAIL="alprojects1@proton.me"
8 |
9 | if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
10 | then
11 | export GIT_COMMITTER_NAME="$NEW_NAME"
12 | export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
13 | fi
14 | if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
15 | then
16 | export GIT_AUTHOR_NAME="$NEW_NAME"
17 | export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
18 | fi
19 | ' -- --all
20 | ```
21 | ## **force push to all branches & tags**
22 |
23 | ```sh
24 | git push --force --tags origin 'refs/heads/*'
25 | ```
26 |
--------------------------------------------------------------------------------
/gitlab/README.md:
--------------------------------------------------------------------------------
1 | ## **GitLab**
2 |
3 | ### **User and Access Management**
4 | | Command | Description |
5 | |------------------------------------------------|------------------------------------------------------------|
6 | | `Add SSH Key in GitLab UI` | Add your SSH key in GitLab for authentication |
7 | | `git remote set-url origin git@:/.git` | Set SSH-based GitLab remote URL|
8 | | `Invite Collaborators` | Invite users to collaborate on a project via GitLab UI |
9 | | `Set Permissions` | Set user permissions (Guest, Reporter, Developer, Maintainer) in GitLab UI |
10 | | `Remove Users` | Remove users from a project or group via GitLab UI|
11 |
12 |
13 |
14 | ### **GitLab Container Registry**
15 | | Command | Description |
16 | |------------------------------------------------|------------------------------------------------------------|
17 | | `docker login registry.gitlab.com` | Log in to GitLab Container Registry |
18 | | `docker push registry.gitlab.com///:` | Push Docker image to GitLab Container Registry |
19 | | `docker pull registry.gitlab.com///:` | Pull Docker image from GitLab Container Registry |
20 | | `View Container Registry in GitLab UI` | View and manage container images in the GitLab UI |
21 |
22 |
23 |
24 | ### **Merge Requests and Code Review**
25 | | Command | Description |
26 | |------------------------------------------------|------------------------------------------------------------|
27 | | `git checkout -b ` | Create a new feature branch for the merge request |
28 | | `git push origin ` | Push the feature branch to GitLab |
29 | | `Create Merge Request in GitLab UI` | Create a new merge request from the feature branch |
30 | | `Assign Reviewers` | Assign reviewers for code review |
31 | | `Resolve Merge Conflicts` | Resolve conflicts in a merge request |
32 | | `Approve Merge Request` | Approve the merge request after reviewing |
33 | | `git fetch origin merge-requests//head:` | Check out a merge request locally |
34 | | `git merge --no-ff ` | Merge with no fast-forwarding, preserving history |
35 |
36 |
37 |
38 | ### **GitLab Environment Variables**
39 | | Command | Description |
40 | |------------------------------------------------|------------------------------------------------------------|
41 | | `Set Environment Variables in GitLab UI` | Set environment variables for use in CI/CD pipelines |
42 | | `Use CI/CD Variables in .gitlab-ci.yml` | Reference environment variables in the `.gitlab-ci.yml` file |
43 | | `Use Protected Variables` | Use protected variables that are only available in protected branches |
44 | | `gitlab-ci-token` | CI token used to authenticate and trigger pipelines |
45 |
46 |
47 | ### **GitLab Security and Compliance**
48 | | Command | Description |
49 | |------------------------------------------------|------------------------------------------------------------|
50 | | `Configure SAST in .gitlab-ci.yml` | Set up Static Application Security Testing (SAST) |
51 | | `Configure DAST in .gitlab-ci.yml` | Set up Dynamic Application Security Testing (DAST) |
52 | | `Configure Dependency Scanning in .gitlab-ci.yml` | Set up Dependency Scanning for your project |
53 | | `View Vulnerability Report in GitLab UI` | View vulnerabilities found during security scans |
54 | | `Resolve Vulnerabilities` | Address and resolve security vulnerabilities |
55 |
56 |
57 | ### **GitLab Pages**
58 | | Command | Description |
59 | |------------------------------------------------|------------------------------------------------------------|
60 | | `Configure GitLab Pages` | Configure GitLab Pages in `.gitlab-ci.yml` to deploy static sites|
61 | | `Custom Domain for GitLab Pages` | Set up a custom domain for GitLab Pages |
62 | | `TLS Certificates for GitLab Pages` | Set up TLS certificates for secure GitLab Pages |
63 | | `Deploy GitLab Pages` | Automatically deploy GitLab Pages using the CI/CD pipeline |
64 |
65 |
66 |
67 | ### **GitLab CI/CD Pipelines**
68 | | Command | Description |
69 | |------------------------------------------------|------------------------------------------------------------|
70 | | `.gitlab-ci.yml` | Define CI/CD pipeline stages and jobs in this file |
71 | | `gitlab-runner register` | Register a new GitLab Runner |
72 | | `gitlab-runner start` | Start the GitLab Runner |
73 | | `gitlab-runner stop` | Stop the GitLab Runner |
74 | | `gitlab-runner verify` | Verify the GitLab Runner |
75 | | `gitlab-runner unregister` | Unregister a GitLab Runner |
76 | | `gitlab-runner list` | List all registered GitLab Runners |
77 | | `gitlab-runner exec ` | Execute a CI job locally with a specific executor |
78 | | `gitlab-runner --help` | Show help for GitLab Runner commands |
79 |
80 |
81 | ### **GitLab Group and Project Management**
82 | | Command | Description |
83 | |------------------------------------------------|------------------------------------------------------------|
84 | | `Create Group in GitLab UI` | Create a new group in GitLab |
85 | | `Create Project in GitLab UI` | Create a new project in GitLab under a group or user |
86 | | `Add Project to Group` | Add a project to a specific group |
87 | | `Transfer Project` | Transfer a project to another group or user |
88 | | `Archive Project` | Archive a project that is no longer active |
89 | | `Fork Project` | Fork an existing project to make independent changes |
90 | | `Delete Project` | Permanently delete a project from GitLab |
91 |
92 |
93 |
94 | ### **Backup and Restore**
95 | | Command | Description |
96 | |------------------------------------------------|------------------------------------------------------------|
97 | | `gitlab-backup create` | Create a backup of the GitLab instance |
98 | | `gitlab-backup restore BACKUP=timestamp` | Restore a GitLab instance from a backup |
99 | | `gitlab-rake gitlab:check` | Check the health of the GitLab instance |
100 |
101 |
102 |
103 | ### **GitLab Issues and Boards**
104 | | Command | Description |
105 | |------------------------------------------------|------------------------------------------------------------|
106 | | `Create Issue in GitLab UI` | Create a new issue for your project |
107 | | `Assign Issue` | Assign an issue to a specific user |
108 | | `Set Due Date` | Set a due date for an issue |
109 | | `Use Labels` | Use labels to categorize issues |
110 | | `Move Issue to Another Board` | Move an issue to a different board |
111 | | `Close Issue` | Close an issue when it is resolved |
112 |
113 |
--------------------------------------------------------------------------------
/gitlab/gitlabctl.md:
--------------------------------------------------------------------------------
1 | ## GitLab-ctl
2 |
3 | | Command | Description |
4 | |-----------------------------------------|-------------|
5 | | `gitlab-ctl status` | Display the current status of all GitLab services. |
6 | | `gitlab-ctl start` | Start all GitLab services. |
7 | | `gitlab-ctl stop` | Stop all GitLab services. |
8 | | `gitlab-ctl restart` | Restart all GitLab services. |
9 | | `gitlab-ctl reconfigure` | Rebuild GitLab configuration files and restart services as necessary. |
10 | | `gitlab-ctl tail` | Tail logs for all GitLab services. |
11 | | `gitlab-ctl hup puma` | Reload Puma to apply configuration changes with minimal downtime. |
12 | | `gitlab-ctl deploy-page up` | Display a "Deploy in progress" page to restrict user access during maintenance. |
13 | | `gitlab-ctl deploy-page down` | Remove the "Deploy in progress" page to restore user access after maintenance. |
14 | | `gitlab-ctl show-config` | Display the configuration that would be generated by `reconfigure`. |
15 | | `gitlab-ctl cleanse` | Delete all GitLab data and start from scratch. |
16 | | `gitlab-ctl uninstall` | Uninstall GitLab services while preserving data. |
17 | | `gitlab-ctl pg-upgrade` | Upgrade the PostgreSQL database to the latest supported version. |
18 | | `gitlab-ctl revert-pg-upgrade` | Revert to the previous version of the PostgreSQL database. |
19 | | `gitlab-ctl set-replication-password` | Set the database replication password. |
20 | | `gitlab-ctl registry-garbage-collect` | Run garbage collection for the Container Registry. |
21 | | `gitlab-ctl backup-etc` | Backup GitLab configuration files. |
22 | | `gitlab-ctl renew-le-certs` | Renew existing Let's Encrypt certificates. |
23 | | `gitlab-ctl geo-replication-pause` | Pause Geo replication processes. |
24 | | `gitlab-ctl geo-replication-resume` | Resume Geo replication processes. |
25 | | `gitlab-ctl set-geo-primary-node` | Designate the current node as the Geo primary. |
26 | | `gitlab-ctl replicate-geo-database` | Replicate the Geo database. |
27 | | `gitlab-ctl pgb-console` | Connect to the PgBouncer console. |
28 | | `gitlab-ctl pgb-resume` | Send the "resume" command to PgBouncer. |
29 | | `gitlab-ctl pgb-suspend` | Send the "suspend" command to PgBouncer. |
30 | | `gitlab-ctl pgb-notify` | Notify PgBouncer of an update to its database. |
31 | | `gitlab-ctl pgb-kill` | Send the "kill" command to PgBouncer. |
32 | | `gitlab-ctl consul` | Interact with the GitLab Consul cluster. |
33 | | `gitlab-ctl praefect` | Interact with the Gitaly cluster. |
34 | | `gitlab-ctl patroni` | Interact with Patroni for PostgreSQL high availability. |
35 | | `gitlab-ctl get-postgresql-primary` | Get connection details to the PostgreSQL primary node. |
36 | | `gitlab-ctl remove-accounts` | Delete all users and groups used by the GitLab package. |
37 | | `gitlab-ctl reset-grafana` | Reset Grafana to its initial state by removing the data directory. |
38 | | `gitlab-ctl set-grafana-password` | Reset the admin password for Grafana. |
39 | | `gitlab-ctl upgrade` | Run migrations after a package upgrade. |
40 | | `gitlab-ctl upgrade-check` | Check if the upgrade is acceptable. |
41 | | `gitlab-ctl check-config` | Check for any deprecated configurations in `gitlab.rb`. |
42 | | `gitlab-ctl diff-config` | Compare the user configuration with the package's available configuration. |
43 | | `gitlab-ctl get-redis-master` | Get connection details to the Redis master node. |
44 | | `gitlab-ctl rotate-secrets` | Rotate the secrets file (`gitlab-secrets.json`). |
45 |
--------------------------------------------------------------------------------
/gitlab/postres.md:
--------------------------------------------------------------------------------
1 | ## PostgreSQL Commands and Configurations
2 |
3 | | Command/Configuration | Description |
4 | |---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------- |
5 | | `sudo gitlab-psql -d gitlabhq_production` | Access the GitLab PostgreSQL database as a superuser. |
6 | | `sudo gitlab-rails dbconsole` | Access the GitLab PostgreSQL database as the application user. |
7 | | `gitlab-ctl pg-upgrade` | Upgrade the packaged PostgreSQL server to a later version. |
8 | | `/opt/gitlab/embedded/bin/postgres --single -D /var/opt/gitlab/postgresql/data gitlabhq_production` | Place the database in single-user mode for maintenance tasks. |
9 | | `gitlab-ctl stop` | Stop GitLab services, often used before performing database maintenance. |
10 | | `gitlab-ctl start` | Start GitLab services after maintenance or configuration changes. |
11 | | `gitlab-ctl reconfigure` | Apply configuration changes, including those related to the PostgreSQL database. |
12 | | `gitlab-ctl restart postgresql` | Restart the PostgreSQL service within GitLab. |
13 | | `gitlab-ctl pg-upgrade -V ` | Upgrade to a specific PostgreSQL version (e.g., `gitlab-ctl pg-upgrade -V 14` for PostgreSQL 14). |
14 | | `gitlab-ctl revert-pg-upgrade -V ` | Revert to a previous PostgreSQL version if needed. |
15 | | `gitlab-ctl deploy-page up` | Display a "Deploy in progress" page to restrict user access during maintenance. |
16 | | `gitlab-ctl deploy-page down` | Remove the "Deploy in progress" page to restore user access after maintenance. |
17 | | `gitlab-ctl deploy-page status` | Check the status of the deploy page. |
18 | | `gitlab-ctl reconfigure` | Apply configuration changes after modifying `/etc/gitlab/gitlab.rb`. |
19 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL to apply configuration changes. |
20 | | `gitlab-ctl pg-upgrade -V ` | Upgrade PostgreSQL to a specific version. |
21 | | `gitlab-ctl revert-pg-upgrade -V ` | Revert PostgreSQL to a previous version if needed. |
22 | | `gitlab-ctl repmgr standby setup MASTER_NODE_NAME` | Recreate secondary nodes in a PostgreSQL HA cluster after an upgrade. |
23 | | `gitlab-ctl repmgr cluster show` | Display the status of the PostgreSQL HA cluster. |
24 | | `gitlab-ctl replicate-geo-database --slot-name=SECONDARY_SLOT_NAME --host=PRIMARY_HOST_NAME --sslmode=verify-ca` | Restart database replication on a Geo secondary database after an upgrade.|
25 | | `gitlab-ctl reconfigure` | Reconfigure GitLab to update the `pg_hba.conf` file after replicating the Geo database. |
26 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL after reconfiguring GitLab. |
27 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo primary database. |
28 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo secondary database and tracking database. |
29 | | `gitlab-ctl reconfigure` | Reconfigure GitLab on the Geo secondary database to update the `pg_hba.conf` file. |
30 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL on the Geo secondary database after reconfiguring GitLab. |
31 | | `gitlab-ctl reconfigure` | Reconfigure GitLab after modifying the `postgresql['version']` setting in `/etc/gitlab/gitlab.rb`. |
32 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL after reconfiguring GitLab. |
33 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the primary node in a PostgreSQL HA cluster. |
34 | | `gitlab-ctl repmgr standby setup MASTER_NODE_NAME` | Recreate secondary nodes in a PostgreSQL HA cluster after upgrading the primary node. |
35 | | `gitlab-ctl repmgr cluster show` | Display the status of the PostgreSQL HA cluster after upgrading. |
36 | | `gitlab-ctl reconfigure` | Reconfigure GitLab after modifying the `postgresql['max_replication_slots']` setting in `/etc/gitlab/gitlab.rb`.|
37 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL after reconfiguring GitLab. |
38 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo primary database. |
39 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo secondary database and tracking database. |
40 | | `gitlab-ctl replicate-geo-database --slot-name=SECONDARY_SLOT_NAME --host=PRIMARY_HOST_NAME --sslmode=verify-ca` | Restart database replication on the Geo secondary database after upgrading PostgreSQL.|
41 | | `gitlab-ctl reconfigure` | Reconfigure GitLab on the Geo secondary database to update the `pg_hba.conf` file after replicating the Geo database. |
42 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL on the Geo secondary database after reconfiguring GitLab. |
43 | | `gitlab-ctl reconfigure` | Reconfigure GitLab after modifying the `postgresql['version']` setting in `/etc/gitlab/gitlab.rb`. |
44 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL after reconfiguring GitLab. |
45 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the primary node in a PostgreSQL HA cluster. |
46 | | `gitlab-ctl repmgr standby setup MASTER_NODE_NAME` | Recreate secondary nodes in a PostgreSQL HA cluster after upgrading the primary node. |
47 | | `gitlab-ctl repmgr cluster show` | Display the status of the PostgreSQL HA cluster after upgrading. |
48 | | `gitlab-ctl reconfigure` | Reconfigure GitLab after modifying the `postgresql['max_replication_slots']` setting in `/etc/gitlab/gitlab.rb`. |
49 | | `gitlab-ctl restart postgresql` | Restart PostgreSQL after reconfiguring GitLab. |
50 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo primary database. |
51 | | `gitlab-ctl pg-upgrade` | Upgrade PostgreSQL on the Geo secondary database and tracking database. |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/go/README.md:
--------------------------------------------------------------------------------
1 | ### **Cross Compilation**
2 | | Command | Description |
3 | |---------------------------------------------|---------------------------------------------------------------|
4 | | `GOOS=linux GOARCH=amd64 go build` | Compile for Linux on AMD64 architecture |
5 | | `GOOS=windows GOARCH=amd64 go build` | Compile for Windows on AMD64 architecture |
6 | | `GOOS=darwin GOARCH=arm64 go build` | Compile for macOS on ARM64 architecture |
7 | | `GOARCH=arm64 go build` | Compile for ARM64 architecture (general use) |
8 | | `GOOS=linux GOARCH=arm GOARM=7 go build` | Cross-compile for ARMv7 architecture (Raspberry Pi) |
9 |
10 |
11 | ### **Running and Debugging**
12 | | Command | Description |
13 | |---------------------------------------------|---------------------------------------------------------------|
14 | | `go run -race example.go` | Run the program with race detection |
15 | | `go run -gcflags "-N -l" example.go` | Run the program without optimizations for debugging |
16 | | `dlv debug example.go` | Run the Go program in the Delve debugger |
17 |
18 |
19 |
20 |
21 | ### **Compilation and Build Options**
22 | | Command | Description |
23 | |---------------------------------------------|---------------------------------------------------------------|
24 | | `go build` | Compile the current project |
25 | | `go build -o example` | Build the current project and name the output binary |
26 | | `go build -v` | Enable verbose output during the build |
27 | | `go build -x` | Show all the commands executed during the build |
28 | | `go build -race` | Enable race detection (useful for concurrent programs) |
29 | | `go build -ldflags "-s -w"` | Compile with optimizations for smaller binary size |
30 |
31 |
32 | ### **Go Basic**
33 | | Command | Description |
34 | |---------------------------------------------|---------------------------------------------------------------|
35 | | `go run example.go` | Compile and run a Go program without creating a binary |
36 | | `go build example.go` | Compile a Go program into a binary |
37 | | `go install example.go` | Compile and install the program into `$GOPATH/bin` |
38 | | `./example` | Run the compiled binary program |
39 | | `go fmt example.go` | Format the code according to Go standards |
40 | | `go test` | Run tests in the current Go project |
41 |
42 | ### **Go Clean Up**
43 | | Command | Description |
44 | |---------------------------------------------|---------------------------------------------------------------|
45 | | `go clean` | Remove object files, binaries, and cached build information |
46 | | `go clean -cache` | Clear the build cache |
47 | | `go clean -modcache` | Clear the module download cache |
48 | | `go clean -testcache` | Clear the test result cache |
49 |
50 |
51 | ### **Go Module Management**
52 | | Command | Description |
53 | |---------------------------------------------|---------------------------------------------------------------|
54 | | `go mod init example` | Initialize a new Go module in the current directory |
55 | | `go mod tidy` | Clean up unused modules and add missing dependencies |
56 | | `go mod download` | Download all dependencies specified in `go.mod` |
57 | | `go mod vendor` | Copy dependencies to the `vendor` directory |
58 | | `go get ` | Add or update a dependency |
59 | | `go list -m all` | List all modules in the current project |
60 |
61 |
62 | ### **Testing and Benchmarking**
63 | | Command | Description |
64 | |---------------------------------------------|---------------------------------------------------------------|
65 | | `go test` | Run unit tests in the current package |
66 | | `go test -v` | Run tests in verbose mode |
67 | | `go test -cover` | Run tests and display code coverage |
68 | | `go test -bench .` | Run benchmark tests |
69 | | `go test -race` | Run tests with race condition detection |
70 | | `go test -run ` | Run only the specified test function |
71 | | `go test -coverprofile=coverage.out` | Generate coverage report in a file |
72 | | `go tool cover -html=coverage.out` | View coverage report in HTML |
73 |
74 |
75 |
76 |
77 | ### **Go Code Management**
78 | | Command | Description |
79 | |---------------------------------------------|---------------------------------------------------------------|
80 | | `go fmt ./...` | Format all Go files in the current module and submodules |
81 | | `go vet ./...` | Check for suspicious constructs or potential issues |
82 | | `go generate` | Execute `go:generate` directives in the code |
83 | | `golangci-lint run` | Run a linting tool like `golangci-lint` on the project |
84 |
85 |
86 |
87 | ### **Package Management**
88 | | Command | Description |
89 | |---------------------------------------------|---------------------------------------------------------------|
90 | | `go get github.com/pkg/errors` | Download and install a package or module |
91 | | `go list` | List available packages and dependencies |
92 | | `go mod graph` | Display the module dependency graph |
93 |
94 |
95 |
96 | ### **Go Documentation and Tools**
97 | | Command | Description |
98 | |---------------------------------------------|---------------------------------------------------------------|
99 | | `go doc fmt` | View documentation for a Go package |
100 | | `go doc -all` | View all documentation in the current package |
101 | | `go env` | Print Go environment variables |
102 | | `go tool pprof cpu.prof` | Run pprof to analyze CPU profiling data |
103 | | `go tool trace trace.out` | Analyze and view a trace of program execution |
104 |
105 |
106 |
107 |
108 | ### **Miscellaneous**
109 | | Command | Description |
110 | |---------------------------------------------|---------------------------------------------------------------|
111 | | `go version` | Print the installed Go version |
112 | | `go env GOPATH` | Display the current `GOPATH` |
113 | | `go env GOROOT` | Display the location of the Go installation |
114 | | `go help` | Display help information for Go commands |
115 |
116 |
--------------------------------------------------------------------------------
/gpg/README.md:
--------------------------------------------------------------------------------
1 | ## **GPG**
2 |
3 | ### **Managing Trust and Expiration**
4 | | Command | Description |
5 | |---------------------------------------------------------------|---------------------------------------------------------|
6 | | `gpg --edit-key ` | Open a key for editing (change trust level, etc.) |
7 | | `gpg --edit-key expire` | Change the expiration date of a key |
8 | | `gpg --trust-model always -r -e file.txt` | Encrypt a file with a trusted recipient without prompts |
9 |
10 |
11 | ### **Encrypting and Decrypting Files**
12 | | Command | Description |
13 | |---------------------------------------------------------------|---------------------------------------------------------|
14 | | `gpg -e -r file.txt` | Encrypt a file for a specified recipient |
15 | | `gpg -d file.txt.gpg` | Decrypt an encrypted file |
16 | | `gpg -c file.txt` | Encrypt a file with a symmetric cipher (password-based) |
17 | | `gpg -d file.txt.gpg -o decrypted_file.txt` | Decrypt a file and output to a specified file |
18 |
19 |
20 | ### **Key Management**
21 | | Command | Description |
22 | |---------------------------------------------------------------|---------------------------------------------------------|
23 | | `gpg --gen-key` | Generate a new GPG key pair |
24 | | `gpg --list-keys` | List all public keys in the keyring |
25 | | `gpg --list-secret-keys` | List all private keys in the keyring |
26 | | `gpg --delete-key