需求
- 全屋Wifi
- 全屋Wifi-软路由(非必须)
- 存储中心(例如NAS、群晖)
- 存储中心-支持手机图片同步
- 存储中心-支持电视点播影视作品
- 存储中心-支持网盘备份
群晖
1、Git全局配置
如果之前设置过全局的user.name
和user.email
, 需要先删掉,删除命令如下
# 查看全局配置
git config --global --list
# 删除全局配置的用户名
git config --global --unset user.name
# 删除全局配置的邮箱
git config --global --unset user.email
一、磁盘分区
在Linux下,磁盘格式化、分区和挂载的详细步骤如下所示:
1.确定磁盘设备
使用以下命令来查看可用磁盘设备:
fdisk -l
# Disk /dev/mmcblk1: 7456 MB, 7818182656 bytes, 15269888 sectors
# 238592 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes
# Disk /dev/mmcblk1 doesn't contain a valid partition table
# Disk /dev/mmcblk1boot0: 4 MB, 4194304 bytes, 8192 sectors
# 128 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes
# Disk /dev/mmcblk1boot0 doesn't contain a valid partition table
# Disk /dev/mmcblk1boot1: 4 MB, 4194304 bytes, 8192 sectors
# 128 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes
# Disk /dev/mmcblk1boot1 doesn't contain a valid partition table
# Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors
# 486192 cylinders, 4 heads, 16 sectors/track
# Units: sectors of 1 * 512 = 512 bytes
# Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
# /dev/mmcblk0p1 * 0,32,33 8,73,1 2048 133119 131072 64.0M c Win95 FAT32 (LBA)
# /dev/mmcblk0p2 8,73,2 912,229,21 133120 31116287 30983168 14.7G 83 Linux
Centos的终端用起来太单一了。想着换成zsh终端,并配合oh my zsh的主题。从而打造不一样的终端吧。
解决方案
方案一,通过ast解析console 将变量名放在console后面,奈何esbuild不支持ast操作(不是我不会 哈哈哈哈), 故放弃。
方案二,既然vue能代理对象,那么console是不是也能被代理。
实践
第一步代理console,将原始的console,用全局变量originConsole保存起来,以便后续使用 withLogging 函数拦截console.log 重写log参数
js复制代码const originConsole = window.console;
var console = new Proxy(window.console, {
get(target, property) {
if(property === 'log') {
return withLogging(target[property])
}
return target[property] },
})
1、依赖拆分配置
只需要在项目pom.xml文件中添加下面的配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<layout>ZIP</layout>
<!-- 这里是填写需要包含进去的jar,
必须项目中的某些模块,会经常变动,那么就应该将其坐标写进来
如果没有则nothing ,表示不打包依赖 -->
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
<!-- 除了第三方依赖,会将子模块的引用加进来 -->
<!--
<include>
<groupId>com.example</groupId>
<artifactId>example-util</artifactId>
</include>
-->
</includes>
</configuration>
</plugin>
<!--拷贝依赖到jar外面的lib目录-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!--指定的依赖路径-->
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
一、Netty 简介
Netty是由Jboss提供的一个Java开源框架,现为 Github上的独立项目。Netty提供异步的、时间驱动的网络应用程序框架和工具,用以快速开发高性能、高可靠性的网络服务器和客户端程序。
也就是说,Netty 是一个基于NIO的客户、服务器端编程框架,使用Netty 可以确保你快速和简单的开发出一个网络应用,例如实现了某种协议的客户、服务端应用。Netty相当于简化和流线化了网络应用的编程开发过程,例如:基于TCP和UDP的socket服务开发。
二、Hello Netty
接下来我们就开始从一个简单地demo,进入netty的世界吧。
说明
宿主机需要安装Docker和Docker-compose
创建3个容器:
主机名分别为host1、host2和ansible2.11
host1和host2安装python3.7、openssh server
ansible安装openssh server、openssh client、ansible
步骤
按如下目录结构创建文件
.
├── alpine
│ └── Dockerfile
├── ansible
│ └── Dockerfile
└── docker-compose.yml
安装
yum install -y epel-release
## createrepo和httpd用于创建内网仓库和提供http协议访问
yum install -y createrepo httpd
## 创建本地 YUM 仓库目录 我定义的是repos 你也可以改成其他名称
mkdir -p /var/www/html/repos/{base,extras,updates}
## 上传centos镜像到服务器并挂载然后copy所有软件包到我刚才创建的仓库目录里
mount /dev/cdrom /mnt # 这个是vmware虚拟机时候用 下边是镜像时候用
# 挂磁盘镜像到/mnt的话执行 mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt
cp -R /mnt/Packages/* /var/www/html/repos/base
umount /mnt
## 创建本地 YUM 仓库 建立元数据
createrepo /var/www/html/repos/base
createrepo /var/www/html/repos/extras
createrepo /var/www/html/repos/updates
## 修改http配置访问yum仓库
vi /etc/httpd/conf.d/repos.conf
Alias /repos "/var/www/html/repos"
<Directory "/var/www/html/repos">
Options Indexes FollowSymLinks
Require all granted
</Directory>
## 启动并开启 httpd 服务
systemctl start httpd
systemctl enable httpd