-
debian多语言
```#修改sudoaptinstalllocalessudodpkg-reconfigurelocales#查看所有locale-a#查看当前locale```
debian -
AI技术选型
##编程语言`python`没办法必须了解,几乎所有训练框架都是`python`。```c++python```##训练框架```pytorchlibtorchtensorflowPaddlePaddlescikit-learn```##部署环境```ggmltensorrtopenvinoonnxruntime```##其他框架```dlibfaissollamaopencvffmpeg```
AI -
H2数据库修复
最近有些简单项目直接使用内嵌的`H2`数据库,但是单元测试跑着跑着文件损坏了,使用下面命令可以修复:```#原始JDBC链接:jdbc:h2:file:./hfx.db#导出SQL文件java-cp.\h2-2.2.224.jarorg.h2.tools.Recover-dbhfx.db#修改旧的文件名称hfx.db.mv.db->hfx.db.mv.db.backupjava-cp.\h2-2.2.224.jarorg.h2.tools.RunScript-urljdbc:h2:file:./hfx.db-script.\hfx.db.h2.sql```旧的文件建议保留,没有问题以后再删除。
H2 -
Java通过FFmpeg实现rtp多路推流
```packagecom.acgist.stream;importjava.io.File;importjava.io.IOException;importjava.io.InputStream;importjava.io.OutputStream;importjava.net.DatagramPacket;importjava.net.DatagramSocket;importjava.net.InetAddress;importjava.net.InetSocketAddress;importjava.nio.ByteBuffer;importjava.security.cert.X509Certificate;importjava.util.ArrayList;importjava.util.List;importjava.util.Map;importjava.util.Properties;importjava.util.Timer;importjava.util.TimerTask;importjava.util.concurrent.TimeUnit;importjavax.net.ssl.H...
Java FFmpeg RTP -
Debian解决vim乱码
```vim/etc/vim/vimrc---setfileencodings=utf-8,gbk,gb2312settermencoding=utf-8setencoding=prc---```
debian vim -
Linux配置24小时制
```vim/etc/locale.conf---LANG=zh_CN.utf8LANGUAGE=zh_CN.utf8---source/etc/locale.confvim/etc/default/locale---LANG=zh_CN.utf8LANGUAGE=zh_CN.utf8---source/etc/default/locale```
Linux -
C++ STL ranges
`C++20`在`STL`库里面提供`ranges`头文件,通过这个可以实现类似`Java`流一样的链式编程:```#include#include#includeintmain(){std::vectorv{1,2,3,4};autoc{v|std::ranges::views::filter([](constauto&i){returni%2==0;})|std::ranges::views::reverse|std::ranges::views::take(1)};for(constauto&x:v){std::cout<<x<<'\n';}std::cout<<"===="<<'\n';for(constauto&x:c){std::cout<<x<<'\n';}return0;}``````g++-std=c++20demo.cpp```
C++ STL rnages views -
Android使用termux模拟Linux环境
最近研究怎么在`Android`上面运行`SpringBoot`项目,发现使用`termux`可以模拟`Linux`环境。参考地址:```https://github.com/termux/termux-app/releaseshttps://mirrors.tuna.tsinghua.edu.cn/help/termux/```##安装`SSH````#查看IPifconfig#安装服务pkginstallopenssh#查看账号whoami#设置密码passwd#启动服务sshd#查看端口(需要root权限)netstat-alt```>默认`ssh`端口`8022`##JDK11下载默认`JDK`版本`17`,其他版本下载:```https://github.com/Hax4us/javahttps://github.com/hfib/openjdk11-termuxhttps://github.com/xiliuya/openjdk11-termuxhttps://github.com/SHivnaTH13/Termux-OpenJDKhttps://github.com/Lzhiyong/te...
termux Android -
Git重置提交记录
`Git`重置提交记录,删除旧的所有记录重新提交:```#创建空白分支gitcheckout--orphanresetgitadd.gitcommit-m"[+]init"#删除旧的分支gitbranch-Dmaster#修改新的分支gitbranch-mmaster#覆盖远程分支gitpush-foriginmaster```
GIT -
C++泛型
```/data/lifuren/core/src/source/config/Config.cpp:Inlambdafunction:/data/lifuren/core/src/source/config/Config.cpp:90:55:error:expectedprimary-expressionbefore‘>’token90|autox=client.as();|^/data/lifuren/core/src/source/config/Config.cpp:90:57:error:expectedprimary-expressionbefore‘)’token90|autox=client.as();|^/data/lifuren/core/src/source/config/Config.cpp:Inlambdafunction:/data/lifuren/core/src/source/config/Config.cpp:25:55:error:expectedprimary-expressionbefore‘>’token25|conststd::string&vk=...
C++ -
SpringAI Ollama
今天发现原来还有`SpringAI`这个东西,用来和`Ollama`对接非常方便。##ollama```mkdir-p/data/ollamacondacreate--nameollamapython=3.11condaactivateollamacurl-fsSLhttps://ollama.com/install.sh|shollamapullglm4ollamapullquentinz/bge-large-zh-v1.5condadeactivate```##添加依赖```io.springboot.aispring-ai-ollama-spring-boot-starter1.0.3```##测试代码```@TestpublicvoidtestApi(){finalOllamaApiapi=newOllamaApi("http://192.168.8.50:11434");finalOllamaChatClientclient=newOllamaChatClient(api,OllamaOptions.create().withModel("glm4"));finalScannerscanner=ne...
ollama SpringAI -
SpringBoot3.x学习
`SpringBoot3.x`支持了很多新的特性:`native`/`JDK17`/`WebClient`/`RestClient`/`HTTPInterface`等等。总结一些问题:####`RestClient`乱码```finalRestClientclient=RestClient.builder().baseUrl("https://www.acgist.com").messageConverters((list)->{list.forEach(v->{if(vinstanceofStringHttpMessageConverterx){x.setDefaultCharset(StandardCharsets.UTF_8);}});}).build();```###`WebClient`/`RestClient`/`RestTemplate````@Bean@ConditionalOnMissingBeanRestClient.BuilderrestClientBuilder(RestClientBuilderConfigurerrestClientBuilderConfigurer){...
SpringBoot -
RNNOISE模型训练
#RNNOISE模型训练##环境```sudoaptinstallvimparallelsudoaptinstallbuild-essentialsudoaptinstallpython3python3-pipsudoaptinstallffmpeglibtoolautoconfvim~/.pip/pip.conf---[global]index-url=https://pypi.tuna.tsinghua.edu.cn/simple---pip3installtqdmtorchnumpy```##数据```#提取ffmpeg.exe-i.\source.wav-ar48000-ac1-fs16le-c:apcm_s16lenoise.pcmffmpeg.exe-i.\source.ts-vn-ar48000-ac1-fs16le-c:apcm_s16lenoise.pcm#去掉超过0.4秒的静音ffmpeg-ar48000-ac1-fs16le-inoise.1.pcm-afsilenceremove=stop_periods=-1:stop_duration=0.4:stop_threshold=-60d...
rnnoise -
C++字面量前后缀
```#自动推导usingnamespacestd::string_literals;autoa="1234"s;#自动推导usingnamespacestd::string_view_literals;autoa="1234"sv;#多行文本R"(acgistacgist)"#u8、u、U、Lchar8_t、char16_t、char32_t、wchar_t```#LULLLULL
C++ -
frp配置
#frps```#本地监听bindAddr="0.0.0.0"bindPort=7000vhostHTTPPort=7080vhostHTTPSPort=7443#TLStransport.tls.certFile="/data/project/frp_0.58.1_linux_amd64/certs/server.crt"transport.tls.keyFile="/data/project/frp_0.58.1_linux_amd64/certs/server.key"transport.tls.trustedCaFile="/data/project/frp_0.58.1_linux_amd64/certs/ca.crt"#监控页面webServer.addr="0.0.0.0"webServer.port=7500webServer.user="admin"webServer.password="admin"webServer.tls.certFile="/data/project/frp_0.58.1_linux_amd64/certs/server.crt"webServer.tls.keyFi...
frp -
openssl命令生成证书
#CA脚本```opensslgenrsa-outca.key2048opensslreq-new-x509-keyca.key-days3650-outca.crt-subj"/C=cn/ST=gd/L=gz/O=acgist/OU=acgist/CN=acgist"```#证书脚本```bashmkdir-p/tmp/servercd/tmp/serverecho"keyUsage=nonRepudiation,digitalSignature,keyEnciphermentextendedKeyUsage=serverAuth,clientAuthsubjectAltName=@SubjectAlternativeName[SubjectAlternativeName]IP.1=127.0.0.1IP.2=192.168.8.188DNS.1=*.acgist.com">server.extopensslgenrsa-outserver.key2048opensslreq-new-keyserver.key-outserver.csr-subj"/C=cn/ST=gd/L=gz/O=acgist/...
openssl -
JNI内存释放
不要手动释放:jint、jlong、jchar需要手动释放:jstring、jobject、jobjectArray、jintArray、jclass、jmethodID```FindClassDeleteLocalRefNewStringDeleteLocalRefNewStringUTFDeleteLocalRefNewObjectDeleteLocalRefNewXXXXArrayDeleteLocalRefGetObjectFieldDeleteLocalRefGetObjectClassDeleteLocalRefGetObjectArrayElementDeleteLocalRefGetStringCharsReleaseStringCharsGetStringUTFCharsReleaseStringUTFCharsGetXXXXArrayElementsReleaseXXXXArrayElements``````#入参jstringjProducerIdconstchar*producerId=env->GetStringUTFChars(jProducerId,nullptr);......
JNI -
GraalVM加速启动
```https://github.com/graalvm/graalvm-ce-builds/releases?page=5./bin/guinstallnative-image./bin/guinstall-Lnative-image-installable-svm-java11-linux-amd64-20.2.0.jar./bin/native-image-Dspring.profiles.active=dev-jar./application-1.0.0.jarmvnspring-boot:build-imagemvnnative:compile```参考文章:*https://docs.oracle.com/zh-cn/learn/graalvm-native-image-quick-start/index.html*https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
GraalVM native-image -
修复分区
```#格式查看parted-ldf-Th#卸载umount/data#修复分区fsck/dev/mapper/centos-homefsck.ext4/dev/mapper/centos-homexfs_repair-L/dev/mapper/centos-home#重新挂载mount/dev/mapper/centos-home/data``````ls:无法访问/data:输入/输出错误mount:将/dev/mapper/centos-home挂载到/data失败:结构需要清理```
df xfs_repair fsck.ext4 -
git submodule
##添加```gitsubmoduleadd```##同步```gitsubmoduleupdate--init--recursive```##删除```#删除配置.gitmodulesgitconfig-f.gitmodules--remove-sectionsubmodule.#删除配置.git/configgitconfig--remove-sectionsubmodule.#删除目录rm-rf.git/modules/#删除模块gitrm--cached```
git submodule