yum install -y redhat-lsb
CentOS 8 使用 iptables firewalld 后端实现
CentOS8 中 firewalld 默认使用的是 nftables,如果不想使用 nftables,还想使用老的 iptables 作为防火墙的后端实现,可以通过修改 /etc/firewalld/firewalld.conf 配置文件,将 FirewallBackend 配置项修改为 iptables 即可
# FirewallBackend # Selects the firewall backend implementation. # Choices are: # - nftables (default) # - iptables (iptables, ip6tables, ebtables and ipset) FirewallBackend=iptables
macOS 管理 tftp 服务
启动 tftp 服务的步骤
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl start com.apple.tftpd
tftp 服务的根目录在 /private/tftpboot 下
停止 tftp 服务的步骤
sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl stop com.apple.tftpd
macOS 安装 DOSBox
SpringBoot 中引用 bootstrap 前端库
一种比较直接的方法是直接把 bootstrap 的 css/js 等资源文件手动拷贝到项目的 resources 目录下,这种方法的缺点是脱离了项目依赖包的版本管理,算不上好办法。
比较好的办法是通过 WebJars 的方式,将 bootstrap 以 pom 包的形式引用:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId
<version>5.3.2</version>
</dependency>
之后就可以通过 /webjars/bootstrap/5.3.2/css/bootstrap.min.css 这种路径访问到资源文件,但我们注意到这个路径下还存在 5.3.2 这样的版本号,如果升级 bootstrap 的版本,势必也要一同更新引用了这个资源的模板文件,此时我们还可以引入 webjars-locator 包:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.50</version>
</dependency>
然后我们就可以直接通过:/webjars/bootstrap/css/bootstrap.min.css 这样的路径访问了。
SpringBoot 集成 WebSocket
首先添加一下 pom 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
然后添加一个 WebSocketConfig 配置类
/**
* @author wuwx
*/
@EnableWebSocket
@Configuration
public class WebSocketConfig implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(new TextWebSocketHandler(), "/websocket");
}
}
启动这个 SpringBoot 项目就可以在 /websocket 进行 WebSocket 连接了
macOS 更新全部 cask 应用
默认 upgrade 是更新非 cask 的应用,如果想全部更新,需要增加 2 个参数
brew update brew upgrade --cask --greedy
pecl 安装特定版本的 PHP 扩展
默认使用 pecl 安装的 PHP 扩展是最新版本的,例如以下将安装 oci8-3.3.0
pecl install oci8
假如我们想安装 oci8-2.2.0 则需要需要使用以下的命令进行安装
pecl install oci8-2.2.0
Rocky 8 安装 php 8.2
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf module install php:remi-8.2
dnf install php
[root@rocky8 yum.repos.d]# php -v
PHP 8.2.11 (cli) (built: Sep 26 2023 11:11:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.11, Copyright (c) Zend Technologies
with Zend OPcache v8.2.11, Copyright (c), by Zend Technologies
Rocky 8 安装 conda 环境
yum install conda
source /etc/profile.d/conda.sh
conda create -n python311 python=3.11
conda activate python311
当前 python 就变成 3.11 的环境了