main
haunt98 2020-07-23 15:14:13 +07:00
parent a626699ff9
commit d1322dbf59
18 changed files with 49 additions and 207 deletions

View File

@ -54,7 +54,7 @@ In macOS, Bash read `~/.bash_profile` not `~/.bashrc`, so edit `~/.bash_profile`
source ~/.bashrc source ~/.bashrc
``` ```
To use latest Bash, install `bash` from Homebrew. To use latest Bash, install `bash` with Homebrew.
Then append to `/etc/shells`: Then append to `/etc/shells`:
```txt ```txt

View File

@ -6,19 +6,12 @@
| Ubuntu | `neovim` | | Ubuntu | `neovim` |
| Homebrew | `neovim` | | Homebrew | `neovim` |
Add to `~/.bashrc`: | Shorcut | Description |
| --------------- | ------------------------- |
```bash | `CTRL-N` | Insert next matching word |
export EDITOR=nvim | `CTRL-X CTRL-F` | File completion |
| `CTRL-X CTRL-L` | Line completion |
# Arch Linux, Ubuntu | `CTRL-X CTRL-Q` | Vim completion |
[[ -f /usr/bin/nvim ]] && \
alias vim="nvim"
# Homebrew
[[ -f /usr/local/bin/nvim ]] && \
alias vim="nvim"
```
## Packages ## Packages
@ -33,14 +26,3 @@ To load package manully:
```vim ```vim
packadd bar packadd bar
``` ```
## Usage
Completion:
| Command | Description |
| --------------- | ------------------------- |
| `CTRL-N` | Insert next matching word |
| `CTRL-X CTRL-F` | File completion |
| `CTRL-X CTRL-L` | Line completion |
| `CTRL-X CTRL-Q` | Vim completion |

View File

@ -0,0 +1,16 @@
# zsh
## macOS
To use latest zsh, install `zsh` with Homebrew.
Then append to `/etc/shells`:
```txt
/usr/local/bin/zsh
```
Set default shell
```
chsh -s /usr/local/bin/zsh
```

View File

@ -0,0 +1,5 @@
# [lazydocker](https://github.com/jesseduffield/lazydocker)
| Distribution | Package |
| ------------ | ------------ |
| Homebrew | `lazydocker` |

View File

@ -0,0 +1,7 @@
# [redli](https://github.com/IBM-Cloud/redli)
Usage:
```sh
redli -h localhost -p 6379 -a password
```

View File

@ -1,7 +0,0 @@
# [Mosh](https://github.com/mobile-shell/mosh)
| Distribution | Package |
| ------------ | ------- |
| Arch Linux | `mosh` |
| Ubuntu | `mosh` |
| Homebrew | `mosh` |

View File

@ -1,13 +0,0 @@
# [Ncat](https://nmap.org/ncat/)
| Distribution | Package |
| ------------ | ------- |
| Arch Linux | `nmap` |
| Ubuntu | `ncat` |
| Homebrew | `nmap` |
Check connectivity:
```sh
ncat -zv google.com 80
```

View File

@ -17,7 +17,7 @@ Add your user to `docker` group:
sudo usermod -aG docker $USER sudo usermod -aG docker $USER
``` ```
## Command-line ## Commands
Remove unused data: Remove unused data:
@ -27,6 +27,12 @@ docker system prune --volumes
docker system prune --volumes -a docker system prune --volumes -a
``` ```
Inside container:
```sh
docker exec -it container_name /bin/bash
```
Docker run options: Docker run options:
| option | example | explain | | option | example | explain |

View File

@ -1,13 +0,0 @@
# [Consul](https://www.consul.io/)
Docker:
```sh
docker run --rm -p 8500:8500 -p 8600:8600/udp --name=consul consul agent -server -ui -bootstrap-expect=1 -client=0.0.0.0
```
UI endpoint:
```txt
localhost:8500
```

View File

@ -1,13 +0,0 @@
# [Grafana](https://grafana.com/)
Docker:
```sh
docker run --rm -p 3000:3000 --name grafana grafana/grafana
```
UI endpoint, with default credentials `admin:admin`:
```
localhost:3000
```

View File

@ -1,16 +0,0 @@
# [MinIO](https://min.io/)
Docker:
```sh
docker run --rm -p 9000:9000 --name minio minio/minio server /data
# Persistent storage
docker run --rm -p 9000:9000 -v "$(pwd)"/minio/data:/data --name minio minio/minio server /data
```
UI endpoint, with default credentials `minioadmin:minioadmin`:
```txt
localhost:9000
```

View File

@ -1,43 +0,0 @@
# [Prometheus](https://prometheus.io/)
Docker:
```sh
docker run --rm -p 9090:9090 --name prometheus prom/prometheus
# Custom configuration
docker run --rm -p 9090:9090 -v "$(pwd)"/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml --name prometheus prom/prometheus
```
UI endpoint:
```txt
localhost:9090
localhost:9090/metrics
```
## Pushing metrics
Docker:
```sh
docker run --rm -p 9091:9091 --name pushgateway prom/pushgateway
```
UI endpoint:
```txt
localhost:9091
localhost:9091/metrics
```
To configure the Pushgateway as a target to scrape by Prometheus,
add to Prometheus configuration file:
```yaml
scrape_configs:
- job_name: "pushgateway"
honor_labels: true
static_configs:
- targets: ["localhost:9091"]
```

View File

@ -1 +0,0 @@
# Services

View File

@ -1,13 +0,0 @@
# [RabbitMQ](https://www.rabbitmq.com/)
Docker:
```sh
docker run --rm -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management-alpine
```
UI endpoint, with default credentials `guest:guest`:
```txt
localhost:15672
```

View File

@ -1,53 +0,0 @@
# [Redis](https://redis.io/)
Docker:
```sh
docker run --rm -p 6379:6379 --name redis redis:alpine
```
## Command-line interface
### redis-cli
| Distribution | Package |
| ------------ | ------------- |
| Arch Linux | `redis` |
| Ubuntu | `redis-tools` |
| Homebrew | `redis` |
Connect:
```sh
redis-cli -h localhost -p 6379
```
### [Redli](https://github.com/IBM-Cloud/redli)
Connect:
```sh
redli -h localhost -p 6379
```
### Commands
Get all keys:
```redis
keys *
```
Delete all keys:
```redis
flushall
```
Get/Set/Delete key:
```redis
get mykey
set mykey myvalue
del mykey
```

View File

@ -12,6 +12,7 @@
- [rsync](Applications/Essential/rsync.md) - [rsync](Applications/Essential/rsync.md)
- [tldr](Applications/Essential/tldr.md) - [tldr](Applications/Essential/tldr.md)
- [tmux](Applications/Essential/tmux.md) - [tmux](Applications/Essential/tmux.md)
- [zsh](Applications/Essential/zsh.md)
- [Misc](Applications/Misc/README.md) - [Misc](Applications/Misc/README.md)
- [ncdu](Applications/Misc/ncdu.md) - [ncdu](Applications/Misc/ncdu.md)
- [Cheat](Applications/Misc/Cheat.md) - [Cheat](Applications/Misc/Cheat.md)
@ -20,12 +21,12 @@
- [Steam](Applications/Misc/Steam.md) - [Steam](Applications/Misc/Steam.md)
- [Ventoy](Applications/Misc/Ventoy.md) - [Ventoy](Applications/Misc/Ventoy.md)
- [mdBook](Applications/Misc/mdBook.md) - [mdBook](Applications/Misc/mdBook.md)
- [lazydocker](Applications/Misc/lazydocker.md)
- [redli](Applications/Misc/redli.md)
- [mpv](Applications/Misc/mpv.md) - [mpv](Applications/Misc/mpv.md)
- [Network](Applications/Network/README.md) - [Network](Applications/Network/README.md)
- [EasySSH](Applications/Network/EasySSH.md) - [EasySSH](Applications/Network/EasySSH.md)
- [HTTPie](Applications/Network/HTTPie.md) - [HTTPie](Applications/Network/HTTPie.md)
- [Mosh](Applications/Network/Mosh.md)
- [Ncat](Applications/Network/Ncat.md)
- [OpenSSH](Applications/Network/OpenSSH.md) - [OpenSSH](Applications/Network/OpenSSH.md)
- [OpenVPN](Applications/Network/OpenVPN.md) - [OpenVPN](Applications/Network/OpenVPN.md)
- [Telnet](Applications/Network/Telnet.md) - [Telnet](Applications/Network/Telnet.md)
@ -53,13 +54,6 @@
- [subprocess](Development/Python/subprocess.md) - [subprocess](Development/Python/subprocess.md)
- [tarfile](Development/Python/tarfile.md) - [tarfile](Development/Python/tarfile.md)
- [venv](Development/Python/venv.md) - [venv](Development/Python/venv.md)
- [Services](Development/Services/README.md)
- [Consul](Development/Services/Consul.md)
- [Grafana](Development/Services/Grafana.md)
- [MinIO](Development/Services/MinIO.md)
- [Prometheus](Development/Services/Prometheus.md)
- [RabbitMQ](Development/Services/RabbitMQ.md)
- [Redis](Development/Services/Redis.md)
- [Docker](Development/Docker.md) - [Docker](Development/Docker.md)
- [Knowledge](Knowledge/README.md) - [Knowledge](Knowledge/README.md)
- [Regular expression](Knowledge/regex.md) - [Regular expression](Knowledge/regex.md)

3
src/src/SUMMARY.md Normal file
View File

@ -0,0 +1,3 @@
# Summary
- [Chapter 1](./chapter_1.md)

1
src/src/chapter_1.md Normal file
View File

@ -0,0 +1 @@
# Chapter 1