diff --git a/mongodb/auth.md b/database/mongodb/auth.md similarity index 100% rename from mongodb/auth.md rename to database/mongodb/auth.md diff --git a/mongodb/install.md b/database/mongodb/install.md similarity index 100% rename from mongodb/install.md rename to database/mongodb/install.md diff --git a/mongodb/use.md b/database/mongodb/use.md similarity index 100% rename from mongodb/use.md rename to database/mongodb/use.md diff --git a/database/postgres/docker-compose.yml b/database/postgres/docker-compose.yml new file mode 100644 index 0000000..86ba9f5 --- /dev/null +++ b/database/postgres/docker-compose.yml @@ -0,0 +1,35 @@ +services: + postgres: + container_name: postgres_container + image: postgres + environment: + POSTGRES_USER: ${POSTGRES_USER:-root} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-123456} + PGDATA: /data/postgres + volumes: + - postgres:/data/postgres + ports: + - "5432:5432" + networks: + - postgres + restart: unless-stopped + + pgadmin: + container_name: pgadmin_container + image: dpage/pgadmin4 + environment: + PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-root@test.com} + PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-123456} + PGADMIN_CONFIG_SERVER_MODE: "False" + ports: + - "${PGADMIN_PORT:-8091}:80" + networks: + - postgres + restart: unless-stopped + +networks: + postgres: + driver: bridge + +volumes: + postgres: diff --git a/go/gocode.md b/go/gocode.md index 3fef00a..42d3ebe 100644 --- a/go/gocode.md +++ b/go/gocode.md @@ -4,3 +4,16 @@ # 退出gocode 服务 gocode exit ``` + +## error + +slice append 会引用到原slice + +```golang + a := make([]any, 0, 20) + a = append(a, 1, 2, 3) + b := append(a, 4) + c := append(a, 5) + b[0] = 0 + logv.Warn().Msgf("%v %v %v", a, b, c) +``` diff --git a/linux/caddy.md b/linux/caddy.md index fb08e79..9cf4865 100644 --- a/linux/caddy.md +++ b/linux/caddy.md @@ -2,6 +2,8 @@ ## caddyfile + docker run -d -p 80:80 --name caddy -v ~/.config/www:/data -v ~/.config/caddy:/etc/caddy caddy + ```bash *.nps.veypi.com:80 { reverse_proxy 127.0.0.1:800 diff --git a/linux/ssh.md b/linux/ssh.md index 8731b9e..8ca170e 100644 --- a/linux/ssh.md +++ b/linux/ssh.md @@ -8,4 +8,31 @@ ssh -R 8022:localhost:2017 user@ip -N # 将远程服务器的 8022 端口映射到本地的 2017 端口 ssh -L 2017:localhost:8022 user@ip -N + + + ``` + +# auto ssh proxy + +ssh -C -N -R remote_port:localhost:local_port username@remote_server + +vim /etc/systemd/system/vautossh.service + +``` +[Unit] +Description=AutoSSH tunnel service for reverse port forwarding +After=network.target + +[Service] +Environment="AUTOSSH_GATETIME=0" +ExecStart=/usr/bin/ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -C -N -R remote_port:localhost:local_port username@remote_server +Restart=always +User=your_username + +[Install] +WantedBy=multi-user.target +``` + +systemctl daemon-reload +systemctl enable vautossh.service diff --git a/linux/tmux.md b/linux/tmux.md index 7ada03e..b310a5f 100644 --- a/linux/tmux.md +++ b/linux/tmux.md @@ -33,7 +33,6 @@ tmux attach -t $1 ``` ## .tmux.conf - ```bash # ln -s $(pwd)/tmux.conf ~/.tmux.conf @@ -47,20 +46,14 @@ bind r source-file ~/.tmux.conf \; display-message "Config reloaded.." # 打开鼠标 调整面板 切换面板 set-option -g mouse on - - set -g base-index 1 # 设置窗口的起始下标为1 set -g pane-base-index 1 # 设置面板的起始下标为1 - unbind '"' bind - splitw -v -c '#{pane_current_path}' # 垂直方向新增面板,默认进入当前目录 unbind % bind = splitw -h -c '#{pane_current_path}' # 水平方向新增面板,默认进入当前目录 - - - set -g status-interval 1 # 状态栏刷新时间 set -g status-justify left # 状态栏列表左对齐 setw -g monitor-activity on # 非当前窗口有内容更新时在状态栏通知