阡陌 发布的文章

阡陌

Chrome 报错:ERR_UNSAFE_PORT

问题 在使用一个自定义端口 6000 提供网络服务时,总是无法访问。一开始没有留意具体的报错信息,觉得是不是服务程序没有打开端口,是不是路由器没有映射端口,是不是防火墙屏蔽了端口……,直到看到一行小字:ERR_UNSAFE_PORT 无法访问此网站 网址为 http://test:6000/ 的网页可能暂时无法连接,或者它已永久性地移动到了新网址。 ERR_UNSAFE_PORT 用 IE 浏览器试了一下确实能正常打开,看来就是 Chrome 的问题了。查了一下资料,我用的这个 6000 端口确实是个特殊端口。看来不止 Chrome,Edge 也有同样的问题喽。Firefox 的端口略有不同,也有所限...

如何修改 Visual Studio 中 Windows SDK 路径的宏定义

Visual Studio 2022 有时候莫名其妙地在不能正常编译(可能是装多个 SDK 造成的),找不到 ctype.h 等头文件。在项目的 VC++ 目录定义中发现是 SDK 宏定义出错了,比如正常路径是 C:\Program Files (x86)\Windows Kits,但变成了 C:\Program Files \Windows Kits 或 D:\Windows Kits 等。但是这些宏定义在 IDE 中是不能修改的,需要在系统注册表中修改...

Linux 代理设置

建配置文件 enproxy: export proxy="https://192.168.1.182:33355" export http_proxy=$proxy export https_proxy=$proxy export ftp_proxy=$proxy export no_proxy="localhost, 127.0.0.1, ::1" 建配置文件 disproxy: unset http_proxy unset https_proxy unset ftp_proxy unset no_proxy 用时: source enproxy 不用时: source disprox...

MDK-ARM(Keil)使用 GCC 编译器

MDK 自带的编译器是 ARMCC 或 ARMCLANG(Arm Compiler 6),有时需要使用 GCC 编译器(例如需要使用 GCC 编译的静态库)。当然,用 GCC 不一定非要用 MDK IDE。 先去 ARM 官网下载 GNU 工具链(Arm GNU Toolchain) Arm GNU Toolchain is a community supported pre-built GNU compiler toolchain for Arm based CPUs. Arm GNU Toolchain releases consists of cross toolchains for the following host operating systems: GNU/Linux Available for x86_64 and AArch64 host architectures Available for bare-metal and Linux targets Windows Available for x86 host architecture only (compatible with x86_64) Available for bare-metal and Linux targets macOS Available for x86_64 host architecture only Available for bare-metal targets onl...

Linux 邮件

mail mail 是 mailx 的软连接,它相当于邮箱客户端(例如 foxmail 客户端),可以单独使用通过 smtp 发送邮件或查看邮箱(/var/spool/mail/[用户名])中的邮件。单独使用 mail 发邮件需要配置 smtp: /etc/mail.rc set from=xxx@163.com set smtp=smtp.163.com set smtp-auth-user=xxx@163.com set smtp-auth-password=*** set smtp-auth=login 发邮件测试: echo "test" |mail -v -s "subjuct" xxx@qq.com -v:显示发送过程 公司使用的是阿里的企业邮箱,感觉不稳定(可能是被某种策略过滤),有时候发送会出错: SMTP: Connection reset by peer Unexpected EOF on SMTP connection 换成 163 邮箱测试就很稳定。 查阅邮件:mail d* #删除所有邮件 d n #删除编号n的邮件 sendmail/postfix sendmail/postfix 则是邮件服务器程序,类似 163、qq 邮箱。 配置 postfix 使用代理 stmp 发送邮件: vim /etc/postfix/main.cf # Enable auth smtp_sasl_auth_enable = yes # Set username and password smtp_sasl_password_maps = static:gitlab@example.com:passwordstring smtp_sasl_security_options = noanonymous smtp_tls_security_level = encrypt smtp_tls_wrappermode = yes relayhost = [smtp.qiye.aliyun.com]:465 systemctl restart postfix 这样 cron 就可以通过 postfix 发送邮件了。没有 postfix 时 cron 不会通过 mail.rc 配置的 stmp 发送邮件的。 在已经配好 postfix 时可以不用通过配 mail.rc 来使用 mailx 发信了测试命令如下: echo "test" |mailx -v -s "subjuct" -r "gitlab@example.com(Gitlab)" xxx@qq.com 需要注意的是必须包括发件人(用 -r 定义的(可以只写邮箱 -r gitlab@example.com),且必须与 smtp 代理的账户是一致的(通常邮件服务器都是这样要求的)),否则会提示错误: 440 mail from account doesn't conform with authentication (Auth Account:gitlab@example.com|Mail Account:root@gitserver.localdomain) (in reply to MAIL FROM command) 怀疑 cron 不是使用 mailx 发邮件的,而是直接通过 sendmail/postfix 来发的。 crontab 的配置开头除了 MAILTO="xxx@qq.com" 还要有 MAILFROM="gitlab@example.com",否则邮件不能被正常发送。 vim /var/spool/cron/root MAILTO="xxx@qq.com" MAILFROM="gitlab@example.com" */10 * * * * /root/script/backup-svn-authz.sh 0 2 * * * /root/script/backup-svn-gitlab.sh 0 6 1 * * /root/script/backup-svn-monthly.sh postfix 小于 3.0 的版本不支持 465 加密端口,需要注意。 CentOS 7 安装 postfix 3 查看版本: postconf -d | grep mail_version mail_version = 2.10.1 milter_macro_v = $mail_name $mail_version 或 rpm -qa | grep postfix postfix-2.10.1-9.el7.x86_64 删除 postfix 2: yum remove postfix 添加 postfix 3 源: vim /etc/yum.repos.d/gf.repo [gf] name=Ghettoforge packages that won't overwrite core distro packages. mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 failovermethod=priority [gf-plus] name=Ghettoforge packages that will overwrite core distro packages. mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist # Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository! enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 failovermethod=priority 安装 postfix 3: yum install postfix3 重新配置后就可以启动...