Windows 11 激活
irm https://massgrave.dev/get | iex
https://github.com/RedisJSON/RedisJSON/releases
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rutsc --version
cargo build --release
loadmodule /usr/local/redis/module/librejson.dylib
重新启动 redis 后显示如下信息即可:
127.0.0.1:6379> module list
1) 1) "name"
2) "ReJSON"
3) "ver"
4) (integer) 20407
yum install php
yum install php-fpm
yum install php-mysqlnd.x86_64
yum install php-json
yum install nginx
yum install mariadb
yum install mariadb-server
vi /etc/php-fpm.d/www.conf
linsten = 127.0.0.1:9000
systemctl start nginx
systemctl enable nginx
systemctl start php-fpm
systemctl enable php-fpm
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation 修改密码
grant all privileges on . to ‘root’@’1.1.1.1’ identified by ‘password’ with grant option;
flush privileges;
安装 python3 运行环境
yum install -y zlib zlib-devel libaio net-tools bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel python3-devel tk-devel gcc cmake gcc-c++ make libffi-devel mesa-libGL.x86_64 wget git
安装 pip3 运行环境
yum install zlib*
下载 Python3 安装包
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tar.xz
<em>tar </em>-xxf Python-3.7.9.tar.xz
cd Python-3.7.9
vi Modules/Setup.dist
将
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
前面的 # 符号去掉
:wq
安装新版 openssh
wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz<br>tar -xxf openssl-1.1.1a.tar.gz<br>cd openssl-1.1.1a/<br>./config --prefix=/usr/local/openssl<br>make & make install
安装 python3
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
<em>make </em>&& make install
创建 python3 软链接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
下载 pip3 安装脚本
wget https://bootstrap.pypa.io/get-pip.py
安装 pip3
python3 get-pip.py
创建 pip3 软链接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
ffmpeg -c:a g729 -ac 1 -i /Users/wizzer/temp/9_729.wav /Users/wizzer/temp/9_729.mp3
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw</artifactId>
<version>1.0.5</version>
<scope>import</scope>
</dependency>
public void generate() throws Exception {
//数据源
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/xx?useUnicode=true&characterEncoding=utf8&useSSL=false" +
"&serverTimezone=Asia/Shanghai");
hikariConfig.setUsername("root");
hikariConfig.setPassword("root");
//设置可以获取tables remarks信息
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
//生成配置
String fileOutputDir = "./";
EngineConfig engineConfig = EngineConfig.builder()
//生成文件路径
.fileOutputDir(fileOutputDir)
//打开目录
.openOutputDir(true)
//文件类型
.fileType(EngineFileType.WORD)
//生成模板实现
.produceType(EngineTemplateType.velocity)
//自定义文件名称
.fileName("xx数据库说明").build();
//忽略表
ArrayList<String> ignoreTableName = new ArrayList<>();
//忽略表前缀
ArrayList<String> ignorePrefix = new ArrayList<>();
ignorePrefix.add("sys_qrtz_");
//忽略表后缀
ArrayList<String> ignoreSuffix = new ArrayList<>();
// ignoreSuffix.add("_");
ProcessConfig processConfig = ProcessConfig.builder()
//指定生成逻辑、当存在指定表、指定表前缀、指定表后缀时,将生成指定表,其余表不生成、并跳过忽略表配置
//根据名称指定表生成
.designatedTableName(null)
//根据表前缀生成
.designatedTablePrefix(null)
//根据表后缀生成
.designatedTableSuffix(null)
//忽略表名
.ignoreTableName(ignoreTableName)
//忽略表前缀
.ignoreTablePrefix(ignorePrefix)
//忽略表后缀
.ignoreTableSuffix(ignoreSuffix).build();
//配置
Configuration config = Configuration.builder()
//版本
.version("1.0.0")
//描述
.description("数据库设计文档生成")
//数据源
.dataSource(dataSource)
//生成配置
.engineConfig(engineConfig)
//生成配置
.produceConfig(processConfig)
.build();
//执行生成
new DocumentationExecute(config).execute();
}
前因:
电信免费升级到千兆宽带,趁机将全屋网络设备升级一下:
1)J1900 软路由4口千兆 -> J4125 软路由6口2.5G;
2)TPlink XDR6080 自带SFP口 -> 购入一个电口2.5G SFP模块;
3)群晖DS920+ -> 购入USB3.0 2.5G网卡。
后果(坑):
1、J4125软路由的坑:
1)Exsi + Openwrt 跑不满千兆带宽,电信光猫直连可以跑950mbps,它只能跑770mbps;
2)PVE 7.2-3 + Openwrt 和 PVE + iKuai 启动时插好的网线可以正常运行,但新插网线到空闲口,然后联网测速就会断网、死机,必须重启才能恢复。
直接跑 Openwrt 或 直接安装 iKuai 系统,可以正常运行。
2、群晖NAS的坑(最后发现不是群晖本身问题):
1)2.5G网卡连接不稳定,总是过一会或半天断开连接;
2)移动硬盘一会报连接上了,一会报未安全退出;
3)有2块硬盘重新连接次数一直在增加,没有规律,一会系统卡顿一下,次数就会加几次;
4)还有一块8T硬盘,干脆直接报损毁了!欲哭无泪(好在质保期内已送修)。
经过反复的验证,各种方法,一开始怀疑是硬盘坏了、又怀疑是电压不稳(连UPS还能电压不稳?UPS坏了?)、又怀疑有静电,然后搬出网络机柜运行,都不能解决。
最终发现罪魁祸首是 Tplink 2.5G 电口SFP模块!虽然它没有插网线,但是插在XDR6080上,XDR6080其他网口的网线插在软路由器上,其他设备也是插在软路由上。什么原因我确实不清楚,不知道是静电问题还是频率干扰,总之拔掉它,NAS的硬盘的重新连接次数终于不涨了!移动硬盘也可以一直正常连接了!
普联 TP-LINK 2.5G SFP电口模块 TL-SM410U长这样:

3、XDR6080无线网络变差
1)外网查看摄像头实时录像,画面一卡一顿,甚至打不开;
2)室内信号强度非常差,手机网络经常断开。
罪魁祸首还是 Tplink 2.5G 电口SFP模块!虽然它没有插网线,但是插在XDR6080上。
巨坑。
ps:折腾无止境,人到中年男人就这些爱好了?。。
1、PVE安装 openwrt
固件下载地址 Lenyu2020/Actions-OpenWrt-x86/releases ,PVE后台上传img文件
PVE创建虚拟机,删除硬盘,然后执行命令将固件加到虚拟机下,然后调整硬盘大小
qm importdisk 101 /var/lib/vz/template/iso/openwrt_x86-64-2207161818_5.15.55_uefi-gpt_dev_Lenyu.img local-lvm
2、openwrt安装 caddy2
官网下载链接:https://caddyserver.com/download
Platform:Linux amd64,选中 mholt/caddy-webdav 下载可执行文件,重命名为 caddy
openwrt管理后台上传到openwrt,然后ssh命令行 mv 到 /home 文件夹
chmod 777 caddy
./caddy hash-password --plaintext 明文密码
创建配置文件
vim Caddyfile
{
order webdav last
}
:8080 {
encode gzip
basicauth {
用户名 加密格式密码
}
webdav {
root /mnt
prefix /webdav
}
}
启动命令
./caddy run --config Caddyfile
vim /etc/init.d/caddy
#!/bin/sh /etc/rc.common
START=99
SERVICE_USE_PID=1
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
start() {
service_start /home/caddy run --config /home/Caddyfile
}
stop() {
service_stop /home/caddy
}
添加执行权限 chmod +x /etc/init.d/caddy 设置开机启动 /etc/init.d/caddy enable,启动服务 /etc/init.d/caddy start
3、PVE挂载硬盘到openwrt
PVE ssh
ls /dev/disk/by-id
会显示一堆磁盘信息,其中有类似 ata-ST1000LM024_HN-M101MBB_S2ZWJ9AFxxxxxx 的信息
qm set 101 -scsi1 /dev/disk/by-id/ata-ST1000LM024_HN-M101MBB_S2ZWJ9AFxxxxxx
提示成功 update VM 101 : -scsi1 /dev/disk/by-id/ata-ST1000LM024_HN-M101MBB_S2ZWJ9AFxxxxxx
注意:-scsi1 或是 -sata1 是创建虚拟机的磁盘控制器类型决定
openwrt管理后台-挂载点,就可以看到新的挂载信息:
/dev/sdb1 /mnt/sdb1
4、修改 Caddyfile 配置文件,将路径修改为磁盘路径
root /mnt/sdb1
浏览器访问 http://IP:8080/webdav
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.10.10.10' identified by 'pass123';
FLUSH PRIVILEGES;
CREATE TABLESPACE DEMO LOGGING DATAFILE '/opt/oracle/oradata/ORCLCDB/DEMO.dbf' SIZE 200M AUTOEXTEND ON NEXT 32M MAXSIZE 500M EXTENT MANAGEMENT LOCAL;
create temporary tablespace DEMO_TEMP tempfile '/opt/oracle/oradata/ORCLCDB/DEMO_TEMP.dbf' size 100m autoextend on next 32m maxsize 500m extent management local;
alter session set "_ORACLE_SCRIPT"=true;
create user DEMO identified by DEMO default tablespace DEMO temporary tablespace DEMO_TEMP;
alter user DEMO identified by DEMO;
grant connect,resource,dba to DEMO;
alter user DEMO quota unlimited on users;
同事带我们去一个偏僻的农家乐吃饭,有个上小学的小姑娘给我们端菜,端第一道菜扎着头发,端第二道菜又披着头发,来来回回好几次。我就问同事:“这小姑娘是不是人格分裂?” 同事说:“这是双胞胎。”
nvm 切换node版本
nvm alias default 14
nvm use 14
nodes-sass 安装
npm install --target_arch=x64
1、打开终端,粘贴如下内容,注意加上空格
sudo xattr -rd com.apple.quarantine
2、从访达的应用程序中把App拖到终端执行:
sudo xattr -rd com.apple.quarantine /Applications/Parallels\ Desktop.app
location /api/v1 {
set $is_matched 0;
if ($request_uri ~ /api/v1/user/100001/ ) {
proxy_pass https://127.0.0.1:1001/;
set $is_matched 1;
}
if ($request_uri ~ /api/v1/user/100002/ ) {
proxy_pass https://127.0.0.1:1001/;
set $is_matched 1;
}
# 没有匹配到,跳转到默认页面
if ($is_matched = 0) {
proxy_pass https://127.0.0.1:8080;
}
}
采用最新Java驱动
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.3.0</version>
</dependency>
获取数据源及数据库
/**
* @author wizzer@qq.com
*/
public class ZMongoDatabase {
private MongoDatabase db;
public ZMongoDatabase(MongoDatabase db) {
this.db = db;
}
/**
* 获取集合,集合不存在则返回 null
*
* @param name 集合名称
* @return 集合薄封装
*/
public MongoCollection<Document> getCollection(String name) {
if (!this.collectionExists(name)) {
return null;
}
return db.getCollection(name);
}
/**
* 获取一个集合,如果集合不存在,就创建它
*
* @param name 集合名
* @param dropIfExists true 如果存在就清除
* @return 集合薄封装
*/
public MongoCollection<Document> createCollection(String name, boolean dropIfExists) {
// 不存在则创建
if (!this.collectionExists(name)) {
return createCollection(name, null);
}
// 固定清除
else if (dropIfExists) {
db.getCollection(name).drop();
return createCollection(name, null);
}
// 已经存在
return db.getCollection(name);
}
/**
* 获取一个集合,如果集合不存在,就创建它
*
* @param name 集合名
* @param options 集合配置信息
* @param dropIfExists true 如果存在就清除
* @return 集合薄封装
*/
public MongoCollection<Document> createCollection(String name, CreateCollectionOptions options, boolean dropIfExists) {
// 不存在则创建
if (!this.collectionExists(name)) {
return createCollection(name, options);
}
// 固定清除
else if (dropIfExists) {
db.getCollection(name).drop();
return createCollection(name, options);
}
// 已经存在
return db.getCollection(name);
}
/**
* 创建一个集合
*
* @param name 集合名
* @param options 集合配置信息
* @return 集合薄封装
*/
public MongoCollection<Document> createCollection(String name, CreateCollectionOptions options) {
if (this.collectionExists(name)) {
throw Lang.makeThrow("Colection has exists: %s.%s", db.getName(), name);
}
// 创建默认配置信息
if (null == options) {
options = new CreateCollectionOptions().capped(false);
}
db.createCollection(name, options);
return db.getCollection(name);
}
/**
* 判断集合是否存在
*
* @param collectionName 集合名
* @return
*/
public boolean collectionExists(String collectionName) {
return listCollectionNames().contains(collectionName);
}
/**
* @return 当前数据库所有可用集合名称
*/
public List<String> listCollectionNames() {
return db.listCollectionNames().into(new ArrayList<String>());
}
public MongoDatabase getNativeDB() {
return this.db;
}
}
初始化数据库示例
@Inject
private ZMongoDatabase zMongoDatabase;
public void init() {
CreateCollectionOptions collectionOptions = new CreateCollectionOptions();
TimeSeriesOptions timeSeriesOptions = new TimeSeriesOptions("ts");
timeSeriesOptions.metaField("metadata");
timeSeriesOptions.granularity(TimeSeriesGranularity.SECONDS);
collectionOptions.timeSeriesOptions(timeSeriesOptions);
MongoCollection<Document> deviceCollection = zMongoDatabase.createCollection("device", collectionOptions, true);
List<Document> list = new ArrayList<>();
Device device = new Device(Times.now(), 36.7, "0001");
list.add(new Document().append("ts", device.getTs()).append("temperature", device.getTemperature()).append("metadata",
new Document().append("no", device.getNo())));
Device device1 = new Device(Times.now(), 35.2, "0002");
list.add(new Document().append("ts", device1.getTs()).append("temperature", device1.getTemperature()).append("metadata",
new Document().append("no", device1.getNo())));
Device device2 = new Device(Times.now(), 10.7, "0002");
list.add(new Document().append("ts", device2.getTs()).append("temperature", device2.getTemperature()).append("metadata",
new Document().append("no", device2.getNo())));
Device device3 = new Device(Times.nextDay(Times.now(), 1), 30.0, "0002");
list.add(new Document().append("ts", device3.getTs()).append("temperature", device3.getTemperature()).append("metadata",
new Document().append("no", device3.getNo())));
// Document.parse(Json.toJson(new Device()));
InsertManyResult insertManyResult = deviceCollection.insertMany(list);
log.info(Json.toJson(insertManyResult));
}
时序数据求平均值示例
// 官方时序数据统计Demo https://docs.mongodb.com/manual/core/timeseries-collections/
@Ok("json:full")
@At("/avg")
public Object avg(@Param(value = "no", df = "0002") String no) {
List<Bson> bsons = new ArrayList<>();
// 筛选条件
Bson match = Aggregates.match(Filters.eq("metadata.no", no));
// 输出对象
Bson project = Aggregates.project(Projections.fields(
// 日期格式化
Projections.computed("date", new Document("$dateToParts", new Document().append("date", "$ts"))),
Projections.computed("temperature", 1)
));
// 分组统计 平均值
Bson group = Aggregates.group(new Document("date", new Document().append("year", "$date.year").append("month", "$date.month").append("day", "$date.day")),
Accumulators.avg("avgTemp", "$temperature")
);
bsons.add(match);
bsons.add(project);
bsons.add(group);
log.info(Json.toJson(bsons));
return zMongoDatabase.getCollection("device").aggregate(bsons);
}
完整代码:
nutzboot starter 组件
组件使用示例
nutzboot-demo-simple-mongodb-plus
i’am a separator…
1、el-tabs 中放置 el-tree 使用 this.$ref[‘tree’] 获取不到对象
使用 this.$ref[‘tree’][0] 可以取到
2、el-cascader 动态加载行政区划,修改表单时无法初始化选中的值
需要设置属性 :key=”xx” ,在数据加载完成后让 xx ++ 自加1
rpm -ivh TDengine-server-2.0.18.0-Linux-x64.rpmvi /etc/taos/taos.cfg 加上当前服务器 hostname 主机名# first fully qualified domain name (FQDN) for TDengine system
firstEp wizzer-test:6030
# local fully qualified domain name (FQDN)
fqdn wizzer-test
taos 或 taos -h 127.0.0.1 执行数据库创建命令taos > create database test;
C:\Windows\System32\drivers\etc\hostsip wizzer-test<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.budwk</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<nutzboot.version>2.4.2-SNAPSHOT</nutzboot.version>
<jaxb-api.version>2.3.1</jaxb-api.version>
<slf4j.version>1.7.25</slf4j.version>
<logback.version>1.2.3</logback.version>
<taos-jdbcdriver.version>2.0.23</taos-jdbcdriver.version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-core</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-nutz-dao</artifactId>
</dependency>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>${taos-jdbcdriver.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzboot-parent</artifactId>
<version>${nutzboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>nutz</id>
<url>http://jfrog.nutz.cn/artifactory/libs-release</url>
</repository>
<repository>
<id>nutz-snapshots</id>
<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nutz-snapshots</id>
<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<groupId>org.nutz.boot</groupId>
<artifactId>nutzboot-maven-plugin</artifactId>
<version>${nutzboot.version}</version>
</plugin>
</plugins>
</build>
</project>
/**
* 注意 TDengine 表及字段名都为小写字母
*/
@Table("iot_dev")
public class Iot_dev implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Comment("ID")
@ColDefine(type = ColType.TIMESTAMP)
private Date ts;
@Column("devid") //字段名都为小写字母
@Comment("设备 ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String devId;
@Column("devtype") //字段名都为小写字母
@Comment("设备类型")
@ColDefine(type = ColType.BINARY, width = 32)
private String devType;
@Column
@Comment("状态")
@ColDefine(type = ColType.BOOLEAN)
private Boolean status;
@Column
@Comment("读数 1")
@ColDefine(type = ColType.DOUBLE)
private Double val1;
@Column
@Comment("读数 2")
@ColDefine(type = ColType.INT)
private Integer val2;
@Column
@Comment("读数 3")
@ColDefine(type = ColType.INT,width = 3)
private Integer val3;
@Column
@Comment("读数 4")
@ColDefine(type = ColType.INT,width = 2)
private Integer val4;
}
本插件不同于V5代码生成器插件,无须引入项目中其他jar包,无须事先编译POJO类:
插件下载:
https://gitee.com/budwk/budwk-codegenerator/releases
插件源码:
1、终端设置代理
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080
2、安装Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3、Spotlight 索引占有CPU过高
关闭
sudo mdutil -a -i off
打开
sudo mdutil -a -i on