宇宙湾

厚积薄发

本文主要介绍 Python 的概念与特性、环境部署、基本语法、标准库、第三方库、科学分析工具、Python 工程工具、实战技巧和踩过的一些坑。

阅读全文 »

什么是 Docker?

Docker™ provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries.

环境搭建

下载

CentOS

1
2
3
$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
$ systemctl start docker
$ systemctl status docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2023-03-25 14:22:34 CST; 18s ago
Docs: https://docs.docker.com
Main PID: 1971 (dockerd)
Tasks: 7
Memory: 108.2M
CGroup: /system.slice/docker.service
└─1971 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Mar 25 14:22:33 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:33.594962610+08:00" level=info msg="Loading containers: start."
Mar 25 14:22:33 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:33.907783608+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be us...red IP address"
Mar 25 14:22:33 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:33.998627114+08:00" level=info msg="Loading containers: done."
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.077496453+08:00" level=warning msg="WARNING: bridge-nf-call-iptables is disabled"
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.077526272+08:00" level=warning msg="WARNING: bridge-nf-call-ip6tables is disabled"
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.077573836+08:00" level=info msg="Docker daemon" commit=bc3805a graphdriver=overlay2 version=23.0.1
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.077678364+08:00" level=info msg="Daemon has completed initialization"
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z systemd[1]: Started Docker Application Container Engine.
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.128839102+08:00" level=info msg="[core] [Server #7] Server created" module=grpc
Mar 25 14:22:34 iZt4n6q3i85nj90kbsfqz5Z dockerd[1971]: time="2023-03-25T14:22:34.162907755+08:00" level=info msg="API listen on /run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
1
$ docker version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Client: Docker Engine - Community
Version: 23.0.1
API version: 1.42
Go version: go1.19.5
Git commit: a5ee5b1
Built: Thu Feb 9 19:51:00 2023
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 23.0.1
API version: 1.42 (minimum version 1.12)
Go version: go1.19.5
Git commit: bc3805a
Built: Thu Feb 9 19:48:42 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.19
GitCommit: 1e1ea6e986c6c86565bc33d52e34b81b3e2bc71f
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0

MacOS

1
2
# https://docs.docker.com/desktop/mac/install/
# 根据芯片类型,下载并安装

Windows

 从 Toolbox 的 Archive 页面找到 DockerToolbox-19.03.1.exe 并下载

Toolbox 项目已经于 2021 年停止了维护

安装

 注意安装组件的时候,选择 Full installation,其他的均使用默认的选项,即可

配置

代理

1
$ vim ~/.docker/config.json
1
2
3
4
5
6
7
8
9
{
"proxies": {
"default": {
"httpProxy": "socks5://127.0.0.1:1080",
"httpsProxy": "socks5://127.0.0.1:1080",
"noProxy": "*.yuzhouwan.com"
}
}
}
阅读全文 »

介绍 Maven 工具的实用技巧,以及如何解决一些常见的问题,包括本地缓存、下载、编译、语法、依赖和相关插件等问题。

阅读全文 »

Gradle 是什么?

 Gradle™ 是一个基于 Apache Ant 和 Apache Maven 概念的项目自动化建构工具。它使用一种基于 Groovy 的特定领域语言来声明项目设置,而不是传统的 XML。当前其支持的语言限于 Java、Groovy 和 Scala,计划未来将支持更多的语言。 — wikipedia.org

特性

  • DSL 声明项目的配置,更加直观
  • 细粒度的传递依赖管理
  • 增量编译
  • 高效的内存执行
阅读全文 »

Netty 是什么?

Netty™ is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

基本概念

Channel

 代表一个到实体(硬件设备、文件、网络 Socket 等)的开放连接,如读操作或写操作

Callback

 代表一个在处理完某个事件之后,被调用的方法

Future

 代表一个异步操作结果的占位符

Event

 代表一个可能会触发相应动作的事件连接被激活、用户事件等

ChannelHandler

 代表一个响应特定事件而被执行的回调

阅读全文 »