<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HKL's Notes</title><link>/</link><description>Recent content on HKL's Notes</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sun, 28 Jun 2026 22:32:00 +0800</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml"/><item><title>一级计量师考试公式汇总</title><link>/2026/06/fomula-in-metrology/</link><pubDate>Sun, 28 Jun 2026 22:32:00 +0800</pubDate><guid>/2026/06/fomula-in-metrology/</guid><description>&lt;h2 id="一级计量师考试公式汇总">一级计量师考试公式汇总&lt;/h2>
&lt;h3 id="1实验标准偏差">1、实验标准偏差&lt;/h3>
&lt;p>&lt;strong>(1) 贝塞尔公式，适用于测量次数较多的情况&lt;/strong>
&lt;/p>
\[
s(x) = \sqrt{\frac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n-1}}
\]&lt;p>式中：&lt;/p>
&lt;ul>
&lt;li>\(\bar{x}\)——测量的算术平均值；&lt;/li>
&lt;li>\(x_i - \bar{x}\)——残差；&lt;/li>
&lt;li>\(\nu = n-1\)——自由度。&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>(2) 极差法，适用于测量次数较少的情况&lt;/strong>
&lt;/p>
\[
s(x) = \frac{x_{\max} - x_{\min}}{C_n}
\]&lt;p>式中：&lt;/p>
&lt;ul>
&lt;li>\(R = x_{\max} - x_{\min}\)——极差；&lt;/li>
&lt;li>\(C_n\)——极差系数（查表）。&lt;/li>
&lt;/ul>
&lt;h3 id="2算术平均值及其实验标准偏差">2、算术平均值及其实验标准偏差&lt;/h3>
&lt;p>&lt;strong>(1) 算术平均值&lt;/strong>
&lt;/p>
\[
\bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i
\]&lt;p>&lt;strong>(2) 算术平均值 \(\bar{x}\) 实验标准偏差&lt;/strong>
&lt;/p>
\[
s(\bar{x}) = \frac{s(x)}{\sqrt{n}}
\]&lt;h3 id="3异常值的判断">3、异常值的判断&lt;/h3>
&lt;p>&lt;strong>(1) 拉依达准则（\(3\sigma\) 准则，只适用于 \(n>10\) 时，否则不能剔除任何数据）&lt;/strong>
&lt;/p>
\[
|x_d - \bar{x}| \ge 3s(x)
\]&lt;p>&lt;strong>(2) 格拉布斯准则（\(n \ge 3\)）&lt;/strong>
&lt;/p>
\[
\frac{|x_d - \bar{x}|}{s(x)} \ge G(\alpha, n)
\]&lt;p>式中：&lt;/p></description></item><item><title>Caddy + Let's Encrypt: Automated Public IP TLS Certificates in 2026 (Pitfalls &amp; Solutions)</title><link>/2026/06/enable-ip-cert-in-caddy/</link><pubDate>Sun, 14 Jun 2026 23:12:00 +0800</pubDate><guid>/2026/06/enable-ip-cert-in-caddy/</guid><description>&lt;p>在 HTTPS 普及的今天，“为公网裸 IP 直接签发 TLS 证书” 一直是个令人头疼的痛点。以往我们不得不依赖 ZeroSSL 或昂贵的商业 CA。&lt;/p>
&lt;p>好消息是，&lt;strong>Let&amp;rsquo;s Encrypt 在 2026 年正式开放了公网 IP 地址的免费公开签发能力&lt;/strong>。配合 Caddy 的自动化 ACME 集成，我们可以轻松实现裸 IP 的证书自动申请与续期。本文记录了我在实际配置中踩到的“SNI 握手失败”大坑以及最终的完美解决方案。&lt;/p>
&lt;h2 id="lets-encrypt-ip-证书的核心规则">Let&amp;rsquo;s Encrypt IP 证书的核心规则&lt;/h2>
&lt;p>在开始配置前，必须了解 Let&amp;rsquo;s Encrypt 对 IP 证书的硬性限制：&lt;/p>
&lt;ol>
&lt;li>&lt;strong>有效期仅 6 天&lt;/strong>：必须使用 &lt;code>shortlived&lt;/code> profile（短寿命证书），不支持常规的 90 天证书。&lt;/li>
&lt;li>&lt;strong>必须关闭 TLS-ALPN-01 挑战&lt;/strong>：目前 IP 证书仅支持 &lt;code>HTTP-01&lt;/code> 挑战（即必须开放公网 80 端口）。&lt;/li>
&lt;li>&lt;strong>高频自动续期&lt;/strong>：Caddy 会在证书还剩约 48 小时时自动续期，只要自动化靠谱，6 天有效期完全不是负担。&lt;/li>
&lt;/ol>
&lt;h2 id="致命的大坑裸-ip-访问引发的-err_ssl_protocol_error">致命的大坑：裸 IP 访问引发的 ERR_SSL_PROTOCOL_ERROR&lt;/h2>
&lt;p>在初步配置好 Caddyfile 后，我发现了一个诡异的现象：&lt;strong>同台服务器下的域名访问完全正常，但直接通过 &lt;code>https://您的IP&lt;/code> 访问时，浏览器会报错 &lt;code>ERR_SSL_PROTOCOL_ERROR&lt;/code>，curl 提示 &lt;code>tls alert internal error&lt;/code>&lt;/strong>。&lt;/p></description></item><item><title>From Bare Metal to BrandMeister: Flashing &amp; Calibrating a Duplex MMDVM Hotspot Brare Board</title><link>/2026/06/flashing-and-calibrating-mmdvm-bare-borad/</link><pubDate>Mon, 08 Jun 2026 19:58:00 +0800</pubDate><guid>/2026/06/flashing-and-calibrating-mmdvm-bare-borad/</guid><description>&lt;p>Building a digital hotspot from a bare MMDVM Dual Hat board is a rite of passage for many amateur radio operators. It’s not just plug-and-play; it’s a journey of taming RF physics, serial communications, and operating system quirks.&lt;/p>
&lt;p>After spending days troubleshooting timeout errors and frequency drifts, I finally managed to achieve a perfect 0.2% BER (Bit Error Rate) connection to the BrandMeister network. Here is the complete technical walkthrough of the process, including the hidden pitfalls that most tutorials skip.&lt;/p></description></item><item><title>Migrating from Quagga (ripd) to BIRD2 on OpenWrt: A Practical Guide</title><link>/2026/05/migrate-quagga-to-bird2-on-openwrt/</link><pubDate>Mon, 18 May 2026 22:15:00 +0800</pubDate><guid>/2026/05/migrate-quagga-to-bird2-on-openwrt/</guid><description>&lt;p>Routing daemons on embedded devices like OpenWrt have come a long way. For years, Quagga (and later FRR) was the go-to suite for running traditional dynamic routing protocols like RIP, OSPF, and BGP. However, as networks evolve, resource constraints and configuration elegance become paramount.&lt;/p>
&lt;p>If you are still running Quagga&amp;rsquo;s &lt;code>ripd&lt;/code> on OpenWrt, it is time to upgrade to &lt;strong>BIRD2 (Internet Routing Daemon)&lt;/strong>. This blog post covers why you should migrate, a real-world transformation example involving Tinc VPN tunnels, and a step-by-step transition guide.&lt;/p></description></item><item><title>Auto Build MMDVMhost And DMRGateway by Github Action</title><link>/2026/05/auto-build-mmdvm-by-github-action/</link><pubDate>Mon, 11 May 2026 22:42:00 +0800</pubDate><guid>/2026/05/auto-build-mmdvm-by-github-action/</guid><description>&lt;p>This post introduces my projects for automatically building &lt;code>MMDVMHost&lt;/code> and &lt;code>DMRGateway&lt;/code> with GitHub Actions.&lt;/p>
&lt;h2 id="why-automated-builds">Why automated builds?&lt;/h2>
&lt;p>Building radio gateway software from source can be time-consuming and brittle. Each release may require specific dependencies, toolchains, and build options. For users and maintainers, the build process is easier to manage if it is automated and produces ready-to-download artifacts.&lt;/p>
&lt;h2 id="project-repositories">Project repositories&lt;/h2>
&lt;ul>
&lt;li>&lt;code>https://github.com/BG7KUH/MMDVMHost-Builds&lt;/code>&lt;/li>
&lt;li>&lt;code>https://github.com/BG7KUH/DMRGateway-Builds&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Each repository contains a GitHub Actions workflow that checks out the corresponding upstream source, installs the required build dependencies, compiles the project, and publishes binary artifacts.&lt;/p></description></item><item><title>Building and Running MMDVMHost + DMRGateway (2026) on Windows</title><link>/2026/04/build-and-run-mmdvm-on-windows/</link><pubDate>Thu, 23 Apr 2026 19:08:00 +0800</pubDate><guid>/2026/04/build-and-run-mmdvm-on-windows/</guid><description>&lt;h3 id="native-msys2-build--modern-brandmeister-setup-guide">Native MSYS2 Build + Modern BrandMeister Setup Guide&lt;/h3>
&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>If you are running a personal DMR hotspot on Windows, modern versions of &lt;strong>MMDVMHost (2026)&lt;/strong> no longer behave reliably with direct BrandMeister connections.&lt;/p>
&lt;p>The recommended architecture is now:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>Radio / Hotspot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ↓
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> MMDVMHost
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ↓
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> DMRGateway
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ↓
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> BrandMeister
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>This guide combines:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Windows Native Build Guide&lt;/strong>&lt;/li>
&lt;li>&lt;strong>Modern MMDVMHost + DMRGateway Setup Guide&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>and shows how to:&lt;/p>
&lt;p>✅ Compile from source on Windows
✅ Build standalone &lt;code>.exe&lt;/code> binaries
✅ Connect successfully to BrandMeister
✅ Use OpenGD77 hotspot hardware
✅ Run latest 2026 versions stably&lt;/p></description></item><item><title>Cross-compilation (Windows → Linux using Zig)</title><link>/2026/01/rust-cross-complie-w2l/</link><pubDate>Sat, 03 Jan 2026 22:12:00 +0800</pubDate><guid>/2026/01/rust-cross-complie-w2l/</guid><description>&lt;p>This document explains a small, &lt;strong>project-independent&lt;/strong> way to cross-compile Rust targets (for example, &lt;code>x86_64-unknown-linux-musl&lt;/code>) from Windows using Zig as a system linker/sysroot. It also covers alternative tools (&lt;code>cargo-zigbuild&lt;/code>, &lt;code>cross&lt;/code>) and troubleshooting tips.&lt;/p>
&lt;h2 id="summary-">Summary ✅&lt;/h2>
&lt;ul>
&lt;li>Create Zig wrapper scripts (linker/ar) in a folder on &lt;code>PATH&lt;/code> and add a global Cargo config (&lt;code>%USERPROFILE%\.cargo\config.toml&lt;/code>).&lt;/li>
&lt;/ul>
&lt;p>example Project here:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>cargo build --release --target x86_64-unknown-linux-musl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PS D:\workspace\rust\rust-cross-build-w2l-script&amp;gt; cargo build --release --target x86_64-unknown-linux-musl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling cfg-if v1.0.4
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling libc v0.2.178
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling zerocopy v0.8.31
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling getrandom v0.2.16
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling rand_core v0.6.4
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling ppv-lite86 v0.2.21
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling rand_chacha v0.3.1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling rand v0.8.5
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Compiling helloworld v0.1.0 (D:\workspace\rust\rust-cross-build-w2l-script)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> Finished `release` profile [&lt;span style="color:#66d9ef">optimized&lt;/span>] target(s) &lt;span style="color:#66d9ef">in&lt;/span> &lt;span style="color:#ae81ff">3&lt;/span>.62s
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PS D:\workspace\rust\rust-cross-build-w2l-script&amp;gt; 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="prerequisites-">Prerequisites 🔧&lt;/h2>
&lt;ul>
&lt;li>Install Zig and put it on your &lt;code>PATH&lt;/code> (&lt;a href="https://ziglang.org/download)">https://ziglang.org/download)&lt;/a>.&lt;/li>
&lt;li>Rust toolchain installed with &lt;code>rustup&lt;/code>.&lt;/li>
&lt;li>Add the target you want to build:&lt;/li>
&lt;/ul>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>rustup target add x86_64-unknown-linux-musl
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;p>Global Cargo config + Zig wrappers (recommended for control)&lt;/p></description></item><item><title>rust-aec v0.1.0 Handoff Notes</title><link>/2025/12/rust-aec-handoff-notes/</link><pubDate>Sun, 28 Dec 2025 18:51:00 +0800</pubDate><guid>/2025/12/rust-aec-handoff-notes/</guid><description>&lt;h2 id="编写目的">编写目的&lt;/h2>
&lt;ul>
&lt;li>说明 &lt;code>rust-aec&lt;/code> crate 的使用方式、接口形态与注意事项。&lt;/li>
&lt;li>帮助在 GRIB2 模板 5.0=42（CCSDS/AEC）等场景中，以纯 Rust 方式解码 AEC 负载数据。&lt;/li>
&lt;/ul>
&lt;h2 id="1-current-status-done">1) Current Status (Done)&lt;/h2>
&lt;ul>
&lt;li>&lt;code>rust-aec&lt;/code> is a &lt;strong>pure Rust&lt;/strong> CCSDS &lt;strong>121.0-B-3&lt;/strong> Adaptive Entropy Coding (AEC) decoder, primarily targeting &lt;strong>GRIB2 Data Representation Template 5.0 = 42&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Byte-for-byte correctness vs libaec&lt;/strong>: verified using an oracle approach on real GRIB2 data; output matches &lt;strong>libaec&lt;/strong> exactly (tests pass).&lt;/li>
&lt;li>&lt;strong>crates.io readiness&lt;/strong>: &lt;code>README.md&lt;/code>, MIT &lt;code>LICENSE&lt;/code>, crate metadata (&lt;code>repository/homepage/docs.rs&lt;/code>, etc.) are prepared and &lt;code>cargo package&lt;/code> dry-run succeeds.&lt;/li>
&lt;/ul>
&lt;h2 id="2-key-files-should-exist-in-the-new-repo">2) Key Files (should exist in the new repo)&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>Crate metadata:&lt;/p></description></item><item><title>Windows (x86_64-pc-windows-gnu) 上启用 GRIB2 5.0=42 (CCSDS/AEC) 解码的修复记录</title><link>/2025/12/windows-gnu-ccsds-aec-fix/</link><pubDate>Sat, 27 Dec 2025 10:51:00 +0800</pubDate><guid>/2025/12/windows-gnu-ccsds-aec-fix/</guid><description>&lt;h2 id="背景">背景&lt;/h2>
&lt;p>我们的 GRIB2 预览工具/GUI 使用 Rust 的 &lt;code>grib&lt;/code> crate 解析并解码 GRIB2。
当输入文件采用 &lt;strong>GRIB2 code table 5.0 = 42&lt;/strong>（Data Representation Template 42，CCSDS/AEC packing）时，默认构建会报“不支持”。&lt;/p>
&lt;p>为支持该 packing，需要启用：&lt;/p>
&lt;ul>
&lt;li>&lt;code>grib/ccsds-unpack-with-libaec&lt;/code> → 依赖 &lt;code>libaec-sys&lt;/code>（会触发 native 构建 + bindgen）&lt;/li>
&lt;/ul>
&lt;p>本项目中将其做成 opt-in feature：&lt;/p>
&lt;ul>
&lt;li>&lt;code>--features grib-ccsds&lt;/code>&lt;/li>
&lt;/ul>
&lt;h2 id="现象与问题链路">现象与问题链路&lt;/h2>
&lt;ol>
&lt;li>运行预览时提示 template 42 不支持。&lt;/li>
&lt;li>开启 &lt;code>--features grib-ccsds&lt;/code> 后，开始编译 &lt;code>libaec-sys&lt;/code>：
&lt;ul>
&lt;li>&lt;code>libaec-sys&lt;/code> 先通过 CMake 构建 C 库（libaec）。&lt;/li>
&lt;li>然后通过 bindgen 生成 Rust FFI 绑定，这一步需要加载 &lt;code>libclang.dll&lt;/code>。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>在 Windows GNU 工具链 + 混合环境（MSYS2/Conda/System32 DLL）下，出现两类问题：
&lt;ul>
&lt;li>&lt;strong>MSYS2 工具链组件崩溃/异常&lt;/strong>（例如 assembler 依赖 DLL 冲突）。&lt;/li>
&lt;li>&lt;strong>bindgen/clang-sys 无法加载 &lt;code>libclang.dll&lt;/code>&lt;/strong>，报 &lt;code>LoadLibraryExW failed&lt;/code>。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>
&lt;h2 id="根因定位关键点">根因定位（关键点）&lt;/h2>
&lt;h3 id="1-libclangdll-能找到但加载失败">1. &lt;code>libclang.dll&lt;/code> 能找到，但加载失败&lt;/h3>
&lt;p>即使 &lt;code>LIBCLANG_PATH=C:\msys64\ucrt64\bin&lt;/code> 且该目录存在 &lt;code>libclang.dll&lt;/code>，仍可能加载失败。&lt;/p></description></item><item><title>国家版权登记业务中心软著提交自动化</title><link>/2025/11/autoscript-for-ccopy-submit/</link><pubDate>Wed, 26 Nov 2025 12:42:00 +0000</pubDate><guid>/2025/11/autoscript-for-ccopy-submit/</guid><description>&lt;p>版权登记业务中心 软著提交失败 当前提交人数过多 系统繁忙 请稍后重新提交&lt;/p>
&lt;p>在软著登记过程中，遇到“当前提交人数过多，系统繁忙，请稍后重新提交”的提示是较为常见的现象，这通常是由于版权登记登记登记业务中心系统处理能力有限或同时提交申请的人数过多导致的。针对这一问题，以下提供一份详尽且条理清晰的处理指南。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> &lt;span style="color:#a6e22e">AutoClicker&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">constructor&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalId&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">null&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">isRunning&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">false&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalTime&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">10000&lt;/span>; &lt;span style="color:#75715e">// 10秒
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">secondClickDelay&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#ae81ff">500&lt;/span>; &lt;span style="color:#75715e">// 第二次点击延迟
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 安全的元素选择方法
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">getElement&lt;/span>(&lt;span style="color:#a6e22e">selector&lt;/span>, &lt;span style="color:#a6e22e">description&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">element&lt;/span> &lt;span style="color:#f92672">=&lt;/span> document.&lt;span style="color:#a6e22e">querySelector&lt;/span>(&lt;span style="color:#a6e22e">selector&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#f92672">!&lt;/span>&lt;span style="color:#a6e22e">element&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">warn&lt;/span>(&lt;span style="color:#e6db74">`未找到&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#a6e22e">description&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">元素: &lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#a6e22e">selector&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">`&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#a6e22e">element&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#75715e">// 执行点击操作
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">triggerClick&lt;/span>(&lt;span style="color:#a6e22e">selector&lt;/span>, &lt;span style="color:#a6e22e">description&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">try&lt;/span> { &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">element&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">getElement&lt;/span>(&lt;span style="color:#a6e22e">selector&lt;/span>, &lt;span style="color:#a6e22e">description&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#a6e22e">element&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">element&lt;/span>.&lt;span style="color:#a6e22e">dispatchEvent&lt;/span>(&lt;span style="color:#66d9ef">new&lt;/span> &lt;span style="color:#a6e22e">Event&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;click&amp;#34;&lt;/span>, { &lt;span style="color:#a6e22e">bubbles&lt;/span>&lt;span style="color:#f92672">:&lt;/span> &lt;span style="color:#66d9ef">true&lt;/span> }));
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">`&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#a6e22e">description&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">点击触发成功`&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">false&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#66d9ef">catch&lt;/span> (&lt;span style="color:#a6e22e">error&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">error&lt;/span>(&lt;span style="color:#e6db74">`&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#a6e22e">description&lt;/span>&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">点击出错:`&lt;/span>, &lt;span style="color:#a6e22e">error&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#66d9ef">false&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e">// 主执行逻辑
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">executeClicks&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#f92672">!&lt;/span>&lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">isRunning&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">`[&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>&lt;span style="color:#66d9ef">new&lt;/span> Date().&lt;span style="color:#a6e22e">toLocaleTimeString&lt;/span>()&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">] 开始执行点击序列`&lt;/span>); &lt;span style="color:#75715e">// 第一次点击
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">firstClickSuccess&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">triggerClick&lt;/span>(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;#app &amp;gt; div.account_container &amp;gt; div &amp;gt; div.account_right &amp;gt; div.account_right_list &amp;gt; div.account_list &amp;gt; ul.account_list_content.opus_query.g_clearfix.soft_register &amp;gt; li:nth-child(1) &amp;gt; div.option &amp;gt; button:nth-child(2)&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;主按钮&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ); &lt;span style="color:#75715e">// 只有第一次点击成功才执行第二次点击
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#a6e22e">firstClickSuccess&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">setTimeout&lt;/span>(() =&amp;gt; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">triggerClick&lt;/span>( &lt;span style="color:#e6db74">&amp;#34;body &amp;gt; div.carousel.carouselFixed &amp;gt; div &amp;gt; div &amp;gt; div.hd-msg-box-footer &amp;gt; button.hd-btn.blue.medium&amp;#34;&lt;/span>,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;弹窗确认按钮&amp;#34;&lt;/span> );
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> },
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">secondClickDelay&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#75715e">// 启动定时器
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">start&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">isRunning&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;定时器已经在运行中&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span>; }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">isRunning&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">true&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;自动点击器启动&amp;#34;&lt;/span>); &lt;span style="color:#75715e">// 立即执行一次
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">executeClicks&lt;/span>(); &lt;span style="color:#75715e">// 设置定时执行
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalId&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">setInterval&lt;/span>(() =&amp;gt; {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">executeClicks&lt;/span>();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> },
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalTime&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#75715e">// 停止定时器
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">stop&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">isRunning&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">false&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalId&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">clearInterval&lt;/span>(&lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalId&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalId&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">null&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;自动点击器已停止&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> } &lt;span style="color:#75715e">// 重置定时器
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span> &lt;span style="color:#a6e22e">restart&lt;/span>(&lt;span style="color:#a6e22e">newIntervalTime&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">null&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">stop&lt;/span>();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">if&lt;/span> (&lt;span style="color:#a6e22e">newIntervalTime&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">intervalTime&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">newIntervalTime&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">setTimeout&lt;/span>(() =&amp;gt; &lt;span style="color:#66d9ef">this&lt;/span>.&lt;span style="color:#a6e22e">start&lt;/span>(), &lt;span style="color:#ae81ff">100&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">// 使用示例
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#66d9ef">const&lt;/span> &lt;span style="color:#a6e22e">clicker&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#66d9ef">new&lt;/span> &lt;span style="color:#a6e22e">AutoClicker&lt;/span>(); &lt;span style="color:#75715e">// 启动自动点击
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">clicker&lt;/span>.&lt;span style="color:#a6e22e">start&lt;/span>(); &lt;span style="color:#75715e">// 如果需要停止，可以调用： //
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>&lt;span style="color:#a6e22e">clicker&lt;/span>.&lt;span style="color:#a6e22e">stop&lt;/span>(); &lt;span style="color:#75715e">// 如果需要重新启动并修
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>把上述代码粘贴到console，直接回车。&lt;/p></description></item><item><title>Install Alpine ON Existing Linux system without VNC</title><link>/2025/09/install-alpine-on-existing-system/</link><pubDate>Fri, 05 Sep 2025 07:42:00 +0000</pubDate><guid>/2025/09/install-alpine-on-existing-system/</guid><description>&lt;p>NO WARRANTY!!! BACKUP ALL YOUR DATA BEFORE OPERATING!
Operating the following In the Exsiting Linux System&lt;/p>
&lt;p>Install Alpine ON Existing Linux system without VNC&lt;/p>
&lt;h2 id="print-the-current-disk-partation-table">Print the current Disk Partation table&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># lsblk&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sda 253:0 &lt;span style="color:#ae81ff">0&lt;/span> 30G &lt;span style="color:#ae81ff">0&lt;/span> disk
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>├─sda1 253:1 &lt;span style="color:#ae81ff">0&lt;/span> 106M &lt;span style="color:#ae81ff">0&lt;/span> part /boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>└─sda2 253:2 &lt;span style="color:#ae81ff">0&lt;/span> 29.9G &lt;span style="color:#ae81ff">0&lt;/span> part /
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@hkt:~# cat /etc/netplan/50-network.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># network-config&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>network:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> version: &lt;span style="color:#ae81ff">2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ethernets:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ens17:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> addresses: &lt;span style="color:#f92672">[&lt;/span>&lt;span style="color:#e6db74">&amp;#39;ip.add.re.ss/24&amp;#39;&lt;/span>&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> gateway4: ga.te.w.ay
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> nameservers:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> addresses: &lt;span style="color:#f92672">[&lt;/span>&lt;span style="color:#e6db74">&amp;#39;8.8.8.8&amp;#39;&lt;/span>,&lt;span style="color:#e6db74">&amp;#39;1.1.1.1&amp;#39;&lt;/span>&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="mount-root">Mount root&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkdir -p /tmp/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd /tmp/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://raw.githubusercontent.com/cemkeylan/genfstab/master/genfstab
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/x86_64/alpine-minirootfs-3.22.1-x86_64.tar.gz
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tar xpf alpine-minirootfs-3.22.1-x86_64.tar.gz --xattrs-include&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;*.*&amp;#39;&lt;/span> --numeric-owner
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="mount-the-needed-fake-filesystems">Mount the needed fake filesystems&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mount --types proc /proc /tmp/alpine/proc
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /sys /tmp/alpine/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-rslave /tmp/alpine/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /dev /tmp/alpine/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-rslave /tmp/alpine/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --bind /run /tmp/alpine/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-slave /tmp/alpine/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>test -L /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> rm /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> mkdir /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>chmod &lt;span style="color:#ae81ff">1777&lt;/span> /dev/shm /run/shm
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="1st-chroot-and-setup-virtual-system">1st Chroot and Setup Virtual System&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>chroot /tmp/alpine/ /bin/ash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export PS1&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;root@alpine-chroot-1 # &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tee /etc/resolv.conf &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">nameserver 1.1.1.1
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apk update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apk add tar mount
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir /mnt/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount /dev/sda2 /mnt/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir /mnt/alpine/boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount /dev/sda1 /mnt/alpine/boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cp /genfstab /mnt/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cp /alpine-minirootfs-3.22.1-x86_64.tar.gz /mnt/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd /mnt/alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rm -rf bin home etc lib lib64 opt root sbin srv usr var
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tar xpvf alpine-minirootfs-3.22.1-x86_64.tar.gz --xattrs-include&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;*.*&amp;#39;&lt;/span> --numeric-owner
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --types proc /proc /mnt/alpine/proc
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /sys /mnt/alpine/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-rslave /mnt/alpine/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /dev /mnt/alpine/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-rslave /mnt/alpine/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --bind /run /mnt/alpine/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --make-slave /mnt/alpine/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>test -L /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> rm /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> mkdir /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>chmod &lt;span style="color:#ae81ff">1777&lt;/span> /dev/shm /run/shm
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="2nd-chroot-and-setup-real-alpine-system">2nd Chroot and Setup Real Alpine System&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>chroot /mnt/alpine/ /bin/ash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export PS1&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;root@alpine-chroot-2 # &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export PATH&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir /lib/modules
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tee /etc/resolv.conf &lt;span style="color:#e6db74">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">nameserver 1.1.1.1
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apk update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apk add alpine-conf openrc e2fsprogs --no-cache
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>setup-alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Which NTP client to run? (&amp;#39;busybox&amp;#39;, &amp;#39;openntpd&amp;#39;, &amp;#39;chrony&amp;#39; or &amp;#39;none&amp;#39;) [busybox] chrony&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Allow root ssh login? (&amp;#39;?&amp;#39; for help) [prohibit-password] yes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Which disk(s) would you like to use? (or &amp;#39;?&amp;#39; for help or &amp;#39;none&amp;#39;) [none]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>apk add grub grub-efi efibootmgr linux-lts
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sh /genfstab -U / &amp;gt;&amp;gt; /etc/fstab
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grub-install --target&lt;span style="color:#f92672">=&lt;/span>x86_64-efi --efi-directory&lt;span style="color:#f92672">=&lt;/span>/boot/efi --bootloader-id&lt;span style="color:#f92672">=&lt;/span>ALPINE
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grub-mkconfig -o /boot/grub/grub.cfg
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#e6db74">&amp;#39;GRUB_CMDLINE_LINUX=&amp;#34;console=ttyS0,19200n8 net.ifnames=0 modules=sd-mod,usb-storage,ext4 quiet rootfstype=ext4&amp;#34;&amp;#39;&lt;/span> &amp;gt;&amp;gt; /etc/default/grub
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>update-grub
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add hostname boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add devfs sysinit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add cgroups sysinit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add bootmisc boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add binfmt boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add fsck boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add seedrng boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add root boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add procfs boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add swap boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add sysfs sysinit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add localmount boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add sysctl boot
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rc-update add sshd boot
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="enjoying-alpine">Enjoying Alpine!&lt;/h4>
&lt;p>refer:&lt;/p></description></item><item><title>Converting GSM Calls to SIP with OpenWRT Using a 3G Modem and Asterisk</title><link>/2024/12/openwrt-asterisk-dongle-gsm-to-sip-en/</link><pubDate>Fri, 13 Dec 2024 20:42:00 +0000</pubDate><guid>/2024/12/openwrt-asterisk-dongle-gsm-to-sip-en/</guid><description>&lt;p>This article demonstrates how to convert GSM calls to SIP calls on an OpenWRT system using a Huawei 3G Modem and the Asterisk suite.&lt;/p>
&lt;p>Translated by ChatGPT as the original article is &lt;a href="/2019/12/openwrt-asterisk-dongle-gsm-to-sip/">in Chinese&lt;/a>.&lt;/p>
&lt;h3 id="installing-asterisk16-on-openwrt">Installing Asterisk16 on OpenWRT&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>opkg install asterisk16-app-system asterisk16-chan-dongle asterisk16-pjsip asterisk16-codec-ulaw asterisk16-codec-alaw asterisk16-res-rtp-asterisk asterisk16-bridge-simple
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="configuring-pjsip-as-the-default-service-and-adding-accounts">Configuring PJSIP as the Default Service and Adding Accounts&lt;/h3>
&lt;p>Modify &lt;code>/etc/asterisk/pjsip.conf&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>transport-udp&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>transport
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>protocol&lt;span style="color:#f92672">=&lt;/span>udp
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind&lt;span style="color:#f92672">=&lt;/span>0.0.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6003&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>endpoint
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>transport&lt;span style="color:#f92672">=&lt;/span>transport-udp
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>context&lt;span style="color:#f92672">=&lt;/span>from-internal
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>disallow&lt;span style="color:#f92672">=&lt;/span>all
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>allow&lt;span style="color:#f92672">=&lt;/span>ulaw
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>auth&lt;span style="color:#f92672">=&lt;/span>6003-auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aors&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6003&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6003-auth&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>auth_type&lt;span style="color:#f92672">=&lt;/span>userpass
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>password&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6003&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>username&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6003&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6003&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>aor
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>max_contacts&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6004&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>endpoint
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>transport&lt;span style="color:#f92672">=&lt;/span>transport-udp
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>context&lt;span style="color:#f92672">=&lt;/span>from-internal
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>disallow&lt;span style="color:#f92672">=&lt;/span>all
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>allow&lt;span style="color:#f92672">=&lt;/span>ulaw
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>auth&lt;span style="color:#f92672">=&lt;/span>6004-auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>aors&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6004&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6004-auth&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>auth
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>auth_type&lt;span style="color:#f92672">=&lt;/span>userpass
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>password&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6004&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>username&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">6004&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>6004&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type&lt;span style="color:#f92672">=&lt;/span>aor
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>max_contacts&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="adding-an-internal-dial-plan">Adding an Internal Dial Plan&lt;/h3>
&lt;p>Modify &lt;code>/etc/asterisk/extensions.conf&lt;/code>:&lt;/p></description></item><item><title>Github Action to Upyun and Aliyun OSS</title><link>/2024/11/github-action-to-upyun-alioss/</link><pubDate>Mon, 25 Nov 2024 13:21:00 +0800</pubDate><guid>/2024/11/github-action-to-upyun-alioss/</guid><description>&lt;p>There are some steps to upload files to Aliyun OSS and Upyun OSS using Github Action.&lt;/p>
&lt;p>This article is mainly about examples how to upload files to Aliyun OSS and Upyun OSS using Github Action.&lt;/p>
&lt;p>Just for reference, please modify the content according to your needs.&lt;/p></description></item><item><title>Install Gentoo ON Existed Linux without VNC</title><link>/2023/11/install-gentoo-on-existed-linux/</link><pubDate>Thu, 02 Nov 2023 22:42:00 +0000</pubDate><guid>/2023/11/install-gentoo-on-existed-linux/</guid><description>&lt;h2 id="no-warranty-backup-all-your-data-before-operating">NO WARRANTY!!! BACKUP ALL YOUR DATA BEFORE OPERATING!&lt;/h2>
&lt;h3 id="operating-the-following-in-the-exsiting-linux-distribution">Operating the following In the Exsiting Linux Distribution&lt;/h3>
&lt;p>Install Gentoo ON Exsit Linux without VNC&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Download and move the Gentoo stage3 tar package to /tmp (Exsiting Linux Distribution).&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# cp /root/stage3-amd64-systemd-20231029T164701Z.tar.xz .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Unzip the Gentoo stage3 tar package.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# tar -xf stage3-amd64-systemd-20231029T164701Z.tar.xz 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bin boot dev etc home lib lib64 media mnt opt proc root run sbin stage3-amd64-systemd-20231029T164701Z.tar.xz sys tmp usr var
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# rm stage3-amd64-systemd-20231029T164701Z.tar.xz 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bin boot dev etc home lib lib64 media mnt opt proc root run sbin sys tmp usr var
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# cd ..
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp# ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Editing the make file (Actually it can be done later)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# vim etc/portage/make.conf 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Editing the repos file (Actually it can be done later)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# vim etc/portage/repos.conf/gentoo.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# cp /etc/resolv.conf etc/.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Mount Dynamic links for the system&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --types proc /proc /tmp/stage3/proc
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --rbind /sys /tmp/stage3/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --make-rslave /tmp/stage3/sys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --rbind /dev /tmp/stage3/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --make-rslave /tmp/stage3/dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --bind /run /tmp/stage3/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --make-slave /tmp/stage3/run
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# test -L /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> rm /dev/shm &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> mkdir /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# chmod &lt;span style="color:#ae81ff">1777&lt;/span> /dev/shm /run/shm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp/stage3# 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Now mount to the /tmp Gentoo system&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp# mount --bind /tmp/stage3/ /tmp/stage3/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp# 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp# vim /tmp/stage3/^C
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@ali:/tmp# chroot /tmp/stage3/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ali / &lt;span style="color:#75715e"># &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># export for easily oberve&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ali / &lt;span style="color:#75715e"># export PS1=&amp;#39;root@gentoo-chroot-1 #&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e">#&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="operating-the-following-in-1st-chroot-environment">Operating the following In 1st chroot environment&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>ali / &lt;span style="color:#75715e"># export PS1=&amp;#39;root@gentoo-chroot-1 # &amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e">#env-update &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>!!! Section &lt;span style="color:#e6db74">&amp;#39;gentoo&amp;#39;&lt;/span> in repos.conf has location attribute set to nonexistent directory: &lt;span style="color:#e6db74">&amp;#39;/var/db/repos/gentoo&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>!!! Invalid Repository Location &lt;span style="color:#f92672">(&lt;/span>not a dir&lt;span style="color:#f92672">)&lt;/span>: &lt;span style="color:#e6db74">&amp;#39;/var/db/repos/gentoo&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&amp;gt;&amp;gt;&amp;gt; Regenerating /etc/ld.so.cache...
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e"># mkdir /var/db/repos/gento&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e">#env-update &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e"># lsblk&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loop0 7:0 &lt;span style="color:#ae81ff">0&lt;/span> 61.9M &lt;span style="color:#ae81ff">1&lt;/span> loop 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loop1 7:1 &lt;span style="color:#ae81ff">0&lt;/span> 63.5M &lt;span style="color:#ae81ff">1&lt;/span> loop 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loop2 7:2 &lt;span style="color:#ae81ff">0&lt;/span> 111.9M &lt;span style="color:#ae81ff">1&lt;/span> loop 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loop3 7:3 &lt;span style="color:#ae81ff">0&lt;/span> 79.9M &lt;span style="color:#ae81ff">1&lt;/span> loop 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>loop4 7:4 &lt;span style="color:#ae81ff">0&lt;/span> 40.9M &lt;span style="color:#ae81ff">1&lt;/span> loop 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>vda 252:0 &lt;span style="color:#ae81ff">0&lt;/span> 40G &lt;span style="color:#ae81ff">0&lt;/span> disk 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>├─vda1 252:1 &lt;span style="color:#ae81ff">0&lt;/span> 1M &lt;span style="color:#ae81ff">0&lt;/span> part 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>├─vda2 252:2 &lt;span style="color:#ae81ff">0&lt;/span> 200M &lt;span style="color:#ae81ff">0&lt;/span> part 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>└─vda3 252:3 &lt;span style="color:#ae81ff">0&lt;/span> 39.8G &lt;span style="color:#ae81ff">0&lt;/span> part 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Mount the hard disk according to your actual environment&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@gentoo-chroot-1 &lt;span style="color:#75715e"># mount /dev/vda3 /mnt/gentoo&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount: /mnt/gentoo: mount point does not exist.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> dmesg&lt;span style="color:#f92672">(&lt;/span>1&lt;span style="color:#f92672">)&lt;/span> may have more information after failed mount system call.
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="-mount-the-disk-to-mntgentoo">! Mount the disk to /mnt/gentoo&lt;/h3>
&lt;p>Actually, From the step, you can follow the &lt;a href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base">Gentoo&amp;rsquo;s Handbook&lt;/a> to install the System !&lt;/p></description></item><item><title>Set up OpenVPN Server in OpenWRT</title><link>/2023/08/set-up-openvpn-in-openwrt/</link><pubDate>Thu, 24 Aug 2023 23:40:00 +0000</pubDate><guid>/2023/08/set-up-openvpn-in-openwrt/</guid><description>&lt;p>&lt;em>&lt;strong>This article is an AI translation of the &lt;a href="https://vnf.cc/2019/11/openwrt-openvpn-server/">original version&lt;/a>.&lt;/strong>&lt;/em>&lt;/p>
&lt;p>This article is mainly realized in the OpenWRT router system to build OpenVPN server to facilitate remote connection!&lt;/p>
&lt;p>Before has been in OpenWRT using Openconnect VPN, because it is SSLVPN use up with CISCO anyconnect client is very convenient, but because now even this SSL-based traffic ISPs can do to identify and seal the public IP, so have to consider switching to UDP-based OpenVPN.&lt;/p></description></item><item><title>Set up WireGuard Server in OpenWRT</title><link>/2023/08/set-up-wireguard-in-openwrt/</link><pubDate>Sun, 13 Aug 2023 21:12:00 +0800</pubDate><guid>/2023/08/set-up-wireguard-in-openwrt/</guid><description>&lt;p>&lt;em>&lt;strong>This article is an AI translation of the &lt;a href="https://vnf.cc/2019/11/openwrt-wireguard-server/">original version&lt;/a>.&lt;/strong>&lt;/em>&lt;/p>
&lt;p>This article is mainly to realize in the OpenWRT router system to build WireGuard server to facilitate remote connection.&lt;/p>
&lt;p>Previously, we have been using Openconnect VPN in OpenWRT, because it is SSLVPN, and it is very convenient to use with CISCO&amp;rsquo;s anyconnect client. Still, because now ISPs can recognize this SSL-based traffic and block the public IP, we have to think about switching to the UDP-based OpenVPN -&amp;gt; WireGuard VPN.&lt;/p>
&lt;p>Continued: In the original article sent to the V2EX above, everyone said WireGuard&amp;rsquo;s performance is better and then looked at the information. If the number of Peers is not a lot of words, realizing Server/Client type of Dial-Up VPN is still feasible, so this side of the tutorials also writes more conveniently for you!&lt;/p>
&lt;p>The following two main steps:&lt;/p>
&lt;p>(1) Install and configure WireGuard in OpenWRT.&lt;/p>
&lt;p>(2) Configure the multi-peers program&lt;/p>
&lt;p>So now it starts, the current system is using the latest OpenWRT 19.07.0-rc1, which should also be applicable to OpenWrt 18.06.4&lt;/p></description></item><item><title>Convert m4a/mp3 to 8bit WAV using ffmpeg</title><link>/2023/08/convert-m4a-to-8bit-wav/</link><pubDate>Tue, 01 Aug 2023 12:44:00 +0800</pubDate><guid>/2023/08/convert-m4a-to-8bit-wav/</guid><description>&lt;p>I Convert a m4a/mp3 to 8bit WAV using ffmpeg recently!&lt;/p>
&lt;p>Steps:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>Download and Install &amp;ldquo;ffmpeg&amp;rdquo; windows build,&lt;/p>
&lt;/li>
&lt;li>
&lt;p>run &lt;code>D:\soft\ffmpeg&amp;gt; .\bin\ffmpeg.exe -i .\luocha2.mp3 -ar 8000 -ac 1 -acodec pcm_u8 output3.wav&lt;/code>&lt;/p>
&lt;/li>
&lt;/ol></description></item><item><title>AI against AI a example (Career Essentials in Generative AI by Microsoft and LinkedIn exam answers by ChatGPT)</title><link>/2023/07/ai-against-ai-example-cegai/</link><pubDate>Fri, 28 Jul 2023 02:22:00 +0800</pubDate><guid>/2023/07/ai-against-ai-example-cegai/</guid><description>&lt;p>Recently, I finished the Career Essentials in Generative AI by Microsoft and LinkedIn exam by ChatGPT.&lt;/p>
&lt;p>Career Essentials in Generative AI by Microsoft and LinkedIn is a free course source. It helps to understand the Essentials in Generative AI.&lt;/p>
&lt;p>The exam is challenging. I decided to solve it with ChatGPT. And the final score is 83.&lt;/p>
&lt;p>&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2023/07/20230728090844.png" alt="PIC1">&lt;/p>
&lt;p>And the answers offered by ChatGPT can review here:&lt;/p>
&lt;p>&lt;a href="/cs/CEGAI.html">/cs/CEGAI.html&lt;/a>&lt;/p>
&lt;p>Another example is the Twilio Programmable Messaging and Voice Professional Certificate by vnf.cc and ChatGPT (score 80):&lt;/p></description></item><item><title>Enable IPv6 on Oracle Cloud Infrastructure</title><link>/2022/12/enable-ipv6-on-oracle-cloud/</link><pubDate>Sun, 11 Dec 2022 16:22:00 +0800</pubDate><guid>/2022/12/enable-ipv6-on-oracle-cloud/</guid><description>&lt;p>In this post, Talking about how to enable IPv6 on Oracle Cloud environment and how to assign IPV6 address to your VPS.&lt;/p></description></item><item><title>Ubuntu 22.04 LTS 基于 Intel Fortran Compiler 2022.2.0 Release编译CALPUFF CALMET CALWRF</title><link>/2022/10/intel-fortran-compiler-for-calwrf-calpuff/</link><pubDate>Sat, 15 Oct 2022 08:48:00 +0800</pubDate><guid>/2022/10/intel-fortran-compiler-for-calwrf-calpuff/</guid><description>&lt;p>本文主要介绍在Ubuntu 22.04 LTS 系统基于 Intel Fortran Compiler 2022.2.0 Release 编译 CALPUFF CALMET CALWRF。&lt;/p></description></item><item><title>一种基于虚拟机做网关的组网方案(PVE+OpenWRT VM为例)</title><link>/2021/10/pve-vm-openwrt-gateway/</link><pubDate>Sun, 10 Oct 2021 10:10:00 +0800</pubDate><guid>/2021/10/pve-vm-openwrt-gateway/</guid><description>&lt;p>本文主要介绍一种基于虚拟化平台使用VM作网关的组网方案(本文以PVE作为Host,OpenWRT作为VM Gateway为例)。&lt;/p></description></item><item><title>n2n动态路由异地组网方案</title><link>/2021/07/n2n-rip-virtualnet/</link><pubDate>Fri, 23 Jul 2021 18:51:00 +0800</pubDate><guid>/2021/07/n2n-rip-virtualnet/</guid><description>&lt;p>本文主要介绍通过n2n结合动态路由RIP的异地组网方案，经过近一年的使用，比较稳定，所以分享一下。&lt;/p></description></item><item><title>博客更新主题</title><link>/2021/06/blog-new-theme/</link><pubDate>Tue, 29 Jun 2021 08:15:00 +0800</pubDate><guid>/2021/06/blog-new-theme/</guid><description>&lt;p>博客更新了&lt;a href="https://github.com/hiplon/lighthouse100-theme">lighthouse100-theme&lt;/a> 主题，基于zola &lt;a href="https://quirky-perlman-34d0da.netlify.app/">Light Speed&lt;/a> 。lighthouse测试能接近100分。&lt;/p></description></item><item><title>2021-06 LFCS考试经验</title><link>/2021/06/lfcs-experience/</link><pubDate>Mon, 28 Jun 2021 18:15:00 +0800</pubDate><guid>/2021/06/lfcs-experience/</guid><description>&lt;p>本人在2021年06月参加LFCS考试，顺利通过，一看网上比较少人讨论这考试，所以大概写写自己的考试经验。&lt;/p></description></item><item><title>OpenWRT简易版serverchan脚本推送至企业微信</title><link>/2021/05/wx-serverchan-openwrt/</link><pubDate>Mon, 31 May 2021 15:20:00 +0800</pubDate><guid>/2021/05/wx-serverchan-openwrt/</guid><description>&lt;p>本文主要介绍简易版serverchan脚本推送至企业微信。&lt;/p></description></item><item><title>OpenWRT一脚本通过Cloudfalre API更新IP并推送至企业微信</title><link>/2021/05/cf-ddns-weixin-push/</link><pubDate>Sun, 30 May 2021 19:58:00 +0800</pubDate><guid>/2021/05/cf-ddns-weixin-push/</guid><description>&lt;p>本文主要介绍OpenWRT路由器通过Cloudfalre API更新IP并推送至企业微信，单脚本执行。&lt;/p></description></item><item><title>原版OpenWRT启用FTP ALG功能</title><link>/2021/02/openwrt-ftp-alg/</link><pubDate>Fri, 19 Feb 2021 19:01:00 +0000</pubDate><guid>/2021/02/openwrt-ftp-alg/</guid><description>&lt;p>本文主要介绍原版OpenWRT系统使用FTP ALG功能。&lt;/p></description></item><item><title>通过N2N组网并运行OSPF动态路由</title><link>/2020/12/ospf-via-n2n-on-openwrt/</link><pubDate>Thu, 10 Dec 2020 16:01:00 +0000</pubDate><guid>/2020/12/ospf-via-n2n-on-openwrt/</guid><description>&lt;p>本文主要以通过N2N组二层网并在其上运行OSPF动态路由，最终效果使得运行N2N的各个节点下的子网可以经路由实现互通。&lt;/p>
&lt;p>Chapter 0：
这个运行N2N的节点均为OpenWRT设备，因为OpenWRT官方源已经没有N2N软件了，所以先基于N2N 2.8的源代码编译了N2N for OpenWRT, 交叉编译的Makefile以及预编译的ipk安装包可以在此下载： &lt;a href="https://github.com/hiplon/openwrt-n2n-latest">Github hiplon/openwrt-n2n-latest&lt;/a>&lt;/p>
&lt;p>Chapter 1：&lt;/p>
&lt;p>N2N的配置比较简单，Supernode部分以及Edge的基础部分可以参考 &lt;a href="https://github.com/ntop/n2n">Github ntop/n2n&lt;/a> ，不过由于此次需要经过N2N的虚拟网络作数据包的转发以及动态路由，所以需要启动Enable packet forwarding功能以及Accept multicast MAC addresses，具体可以参考以下配置文件：&lt;/p></description></item><item><title>用动态路由打通各Virtual L2网络</title><link>/2020/09/zerotier-l3-rip/</link><pubDate>Mon, 14 Sep 2020 23:32:00 +0000</pubDate><guid>/2020/09/zerotier-l3-rip/</guid><description>&lt;p>本文主要以Zerotier组好的各Virtual L2网络节点 + 动态路由 RIP 为例，最终效果就是让网关建立Zerotier的Virtual L2网络，网关下的其它网段就能相互通信。&lt;/p>
&lt;p>拓扑如下：&lt;/p>
&lt;p>&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2020/09/MDg1hzo.png" alt="Zerotier RIP 拓扑">&lt;/p>
&lt;p>例如如上拓扑，Zerotier建立了192.168.193.0/24的互联虚拟二层，有192.168.193.6、192.168.193.11、192.168.193.21的网关下面有172.16.0.0/23、192.168.2.0/24、192.168.11.0/24三个网段，那么通过建立rip动态路由，让这三个网段可以互通。&lt;/p>
&lt;p>网关设备默认是OpenWRT设备，前提是已经通过例如VPN/Tinc/Zerotier等方法建立了互联段。&lt;/p>
&lt;p>如果还没建立的话可以参考：
&lt;a href="/2020/03/openwrt-tinc/">/2020/03/openwrt-tinc/&lt;/a>&lt;/p>
&lt;p>&lt;a href="/2019/12/zerotier-sd-lan/">/2019/12/zerotier-sd-lan/&lt;/a>&lt;/p>
&lt;p>先建好互联的段，&lt;/p>
&lt;p>下面开始做动态路由的配置&lt;/p></description></item><item><title>从现有Linux系统上安装Archlinux</title><link>/2020/07/install-archlinux-from-linux/</link><pubDate>Tue, 07 Jul 2020 22:32:00 +0000</pubDate><guid>/2020/07/install-archlinux-from-linux/</guid><description>&lt;p>以Oracle Cloud环境为例，从现有Linux系统上安装Archlinux [理论上可以无VNC实现]&lt;/p>
&lt;p>以Oracle Cloud环境为例,启用一个Oracle Linux 7.8的实例,opc登陆系统,&lt;code>sudo -i&lt;/code>切换为root用户。继续后续操作：&lt;/p>
&lt;p>原系统&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>root@jpt2 tmp&lt;span style="color:#f92672">]&lt;/span>&lt;span style="color:#75715e"># lsblk&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sda 8:0 &lt;span style="color:#ae81ff">0&lt;/span> 46.6G &lt;span style="color:#ae81ff">0&lt;/span> disk 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>├─sda2 8:2 &lt;span style="color:#ae81ff">0&lt;/span> 8G &lt;span style="color:#ae81ff">0&lt;/span> part &lt;span style="color:#f92672">[&lt;/span>SWAP&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>├─sda3 8:3 &lt;span style="color:#ae81ff">0&lt;/span> 38.4G &lt;span style="color:#ae81ff">0&lt;/span> part /
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>└─sda1 8:1 &lt;span style="color:#ae81ff">0&lt;/span> 200M &lt;span style="color:#ae81ff">0&lt;/span> part /boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd /tmp
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://mirrors.edge.kernel.org/archlinux/iso/latest/archlinux-bootstrap-2020.07.01-x86_64.tar.gz &lt;span style="color:#75715e">#下载最新archlinux-bootstrap压缩包&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tar -xf archlinux-bootstrap-*.tar.gz
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --bind /tmp/root.x86_64 /tmp/root.x86_64 &lt;span style="color:#75715e">#&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>vim /tmp/root.x86_64/etc/pacman.d/mirrorlist &lt;span style="color:#75715e">#&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/tmp/root.x86_64/bin/arch-chroot /tmp/root.x86_64/ &lt;span style="color:#75715e">#第一层chroot命令&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>第一层Chroot&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#第一层Chroot&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export PS1&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;root@arch-chroot-1 #&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pacman-key --init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pacman-key --populate archlinux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pacman -Syy
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount /dev/sda3 /mnt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount /dev/sda1 /mnt/boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@arch-chroot-1 &lt;span style="color:#75715e">#lsblk&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sda 8:0 &lt;span style="color:#ae81ff">0&lt;/span> 46.6G &lt;span style="color:#ae81ff">0&lt;/span> disk 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|-sda1 8:1 &lt;span style="color:#ae81ff">0&lt;/span> 200M &lt;span style="color:#ae81ff">0&lt;/span> part /mnt/boot/efi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|-sda2 8:2 &lt;span style="color:#ae81ff">0&lt;/span> 8G &lt;span style="color:#ae81ff">0&lt;/span> part &lt;span style="color:#f92672">[&lt;/span>SWAP&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">`&lt;/span>-sda3 8:3 &lt;span style="color:#ae81ff">0&lt;/span> 38.4G &lt;span style="color:#ae81ff">0&lt;/span> part /mnt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd /mnt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#！！！！！除了 boot、tmp、dev、proc、run、sys 几个目录外的其他所有文件！！！！！&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@arch-chroot-1 &lt;span style="color:#75715e">#ls&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>root@arch-chroot-1 &lt;span style="color:#75715e">#rm -rf bin etc home lib lib64 opt root sbin srv usr var&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>newroot&lt;span style="color:#f92672">=&lt;/span>/mnt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir -m &lt;span style="color:#ae81ff">0755&lt;/span> -p &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>/var/&lt;span style="color:#f92672">{&lt;/span>cache/pacman/pkg,lib/pacman,log&lt;span style="color:#f92672">}&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>/&lt;span style="color:#f92672">{&lt;/span>dev,run,etc&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir -m &lt;span style="color:#ae81ff">1777&lt;/span> -p &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>/tmp
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mkdir -m &lt;span style="color:#ae81ff">0555&lt;/span> -p &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>/&lt;span style="color:#f92672">{&lt;/span>sys,proc&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --bind &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount -t proc /proc &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/proc&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /sys &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/sys&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /run &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/run&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>mount --rbind /dev &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/dev&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pacman -r &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span> --cachedir&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/var/cache/pacman/pkg&amp;#34;&lt;/span> -Sy base linux linux-firmware openssh xfsprogs sudo vi vim
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cp -a /etc/pacman.d/gnupg &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/etc/pacman.d/&amp;#34;&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cp -a /etc/pacman.d/mirrorlist &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">/etc/pacman.d/&amp;#34;&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>genfstab -U /mnt &amp;gt;&amp;gt; /mnt/etc/fstab
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>chroot &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$newroot&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>第二层Chroot #以快速配置为目标，不做其它额外配置&lt;/p></description></item><item><title>CKA Exam 2020-06考试经验</title><link>/2020/06/cka-experience/</link><pubDate>Sun, 07 Jun 2020 21:32:00 +0000</pubDate><guid>/2020/06/cka-experience/</guid><description>&lt;p>最近趁打折入了CKA的考试券，从入门到考试学习了一个多星期参加了考试，最后以93%的分数通过考试，分享一下最新的情况。&lt;/p>
&lt;p>首先还是说下当前Kubernetes已经基本成为业界的标准，连电信行业也引进了Container Network Function (AKA. CNF) 的做法，所以还是有必要更新一下自己的知识库。&lt;/p>
&lt;p>前人已经分享了许多经验了，CKA的考试其实网上也有分享了挺多题库，但是都算比较久，所以仅供参考。我下面只说一些自己考试的一些Bibel。&lt;/p></description></item><item><title>OpenWRT配置Apache Webdav</title><link>/2020/05/openwrt-apache-webdavs/</link><pubDate>Sun, 31 May 2020 13:12:00 +0000</pubDate><guid>/2020/05/openwrt-apache-webdavs/</guid><description>&lt;p>本文主要实现在OpenWRT路由器配置Apache2 based 的 Webdav(s)共享文件，之前曾经试过通过 &lt;a href="/2020/05/openwrt-webdavs/">lighttpd部署Webdav&lt;/a> 不过由于在尝试通过lighttpd部署的Webdav作为&lt;a href="https://joplinapp.org/">Joplin&lt;/a>的后端Webdav存储时，会出现4XX的故障码，经查询，应该是lighttpd的Webdav默认不是全部的Webdav Method都支持，所以这次改用OpenWRT Apache2 Webdav&lt;/p>
&lt;p>（1）安装相关软件&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg install apache2 apache-mod-webdav apache-mod-ssl
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>（2）配置apache2&lt;/p>
&lt;p>以下为模板
由于这次部署基本打算也是全站开启webdav,所以以vhost模式走webdav&lt;/p></description></item><item><title>OpenWRT配置Webdav(s)共享文件</title><link>/2020/05/openwrt-webdavs/</link><pubDate>Wed, 20 May 2020 04:12:00 +0000</pubDate><guid>/2020/05/openwrt-webdavs/</guid><description>&lt;p>本文主要实现在OpenWRT路由器配置Webdav(s)共享文件，主要通过lighttpd&lt;/p>
&lt;p>lighttpd版本的webdav可能有些webdav方法不一定支持，需要全功能的webdav可以参考另外一篇用openwrt-apache做的webdav服务器 &lt;a href="/2020/05/openwrt-apache-webdavs/">/2020/05/openwrt-apache-webdavs/&lt;/a>&lt;/p>
&lt;p>（1）安装相关软件&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg install lighttpd lighttpd-mod-webdav lighttpd-mod-auth lighttpd-mod-authn_file lighttpd-mod-openssl
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>（2）配置lighttpd&lt;/p>
&lt;p>以下为模板&lt;/p></description></item><item><title>trojan for mt7621 ramips</title><link>/2020/05/trojan-for-mt7621/</link><pubDate>Thu, 07 May 2020 23:55:00 +0000</pubDate><guid>/2020/05/trojan-for-mt7621/</guid><description>&lt;p>rampis openwrt-trojan 预编译版本&lt;/p>
&lt;p>基于&lt;code>openwrt-sdk-19.07.0-ramips-mt7621_gcc-7.5.0_musl&lt;/code>的SDK编译，理论上兼容mipsel_24kc的其它设备，依赖boost几个库，下载文件到设备上通过opkg安装应该会自己自动去库里安装相关依赖。&lt;/p>
&lt;p>下载地址：&lt;/p>
&lt;p>trojan_1.15.1-1_mipsel_24kc.ipk&lt;/p>
&lt;p>&lt;a href="https://stu2013jnueducn-my.sharepoint.com/:u:/g/personal/hkl_stu2013_jnu_edu_cn/Ed1xIGrtPeROjiG0Bh7qTnoBi0Hba5M1hpHp_GMa81L3sg?e=0YphFz">https://stu2013jnueducn-my.sharepoint.com/:u:/g/personal/hkl_stu2013_jnu_edu_cn/Ed1xIGrtPeROjiG0Bh7qTnoBi0Hba5M1hpHp_GMa81L3sg?e=0YphFz&lt;/a>&lt;/p>
&lt;p>安装方法：&lt;/p>
&lt;ol>
&lt;li>
&lt;p>复制下载文件到设备&lt;/p>
&lt;/li>
&lt;li>
&lt;p>通过opkg安装&lt;/p>
&lt;/li>
&lt;/ol>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg trojan_1.15.1-1_mipsel_24kc.ipk
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>通过tasker转发短信到微信或者钉钉</title><link>/2020/04/sms-forward-to-weixin/</link><pubDate>Mon, 13 Apr 2020 19:35:00 +0000</pubDate><guid>/2020/04/sms-forward-to-weixin/</guid><description>&lt;p>本文主要实现在Android系统中利用tasker软件以及企业微信应用或者钉钉机器人的Webhook接口将收到的短信方便转发到微信或者钉钉上面，&lt;/p>
&lt;p>准备工作，需要在Android手机安装好tasker软件，申请好企业微信号或者钉钉团队，并且有管理员权限&lt;/p>
&lt;p>下面主要分三步：&lt;/p>
&lt;p>（1）注册企业微信应用或者钉钉机器人，或者接口所需资料&lt;/p>
&lt;p>（2）部署tasker任务&lt;/p>
&lt;p>（1）注册企业微信应用或者钉钉机器人，或者接口所需资料&lt;/p>
&lt;p>企业微信：&lt;/p>
&lt;p>企业微信应用需要&lt;code>企业ID&lt;/code>、&lt;code>企业应用Secret&lt;/code>、&lt;code>企业应用AgentId&lt;/code>&lt;/p></description></item><item><title>OpenWRT结合tinc组自己的SDLAN</title><link>/2020/03/openwrt-tinc/</link><pubDate>Wed, 04 Mar 2020 11:12:00 +0000</pubDate><guid>/2020/03/openwrt-tinc/</guid><description>&lt;p>本文主要实现在OpenWRT路由器以及不同系统下通过tinc switch mode搭建SDLAN内网服务器方便远程连接，&lt;/p>
&lt;p>Switch Mode相对来说配置比较简单，各节点均在同一广播域内，方便调控，tinc节点本身通过DNAT+SNAT可以实现对不同网间端口的调通，&lt;/p>
&lt;p>同时Switch Mode中各节点的hosts文件只需保证在公网地址的节点中全部拥有维护即可，其他节点只需维护本节点以及公网节点的hosts文件&lt;/p>
&lt;p>下面主要分三步：&lt;/p>
&lt;p>（1）公网节点的部署(Master节点)&lt;/p>
&lt;p>（2）其他节点的部署(Slave节点)&lt;/p>
&lt;p>（3）节点的NAT配置&lt;/p>
&lt;p>本次搭建的拓扑以下为例，两个Master节点，若干个Slave节点（以3个不同操作系统的为例）&lt;/p></description></item><item><title>Github Pages同步到Qcloud腾讯云对象存储COS</title><link>/2020/02/github-pages-sync-qcloud-cos/</link><pubDate>Thu, 20 Feb 2020 12:12:00 +0000</pubDate><guid>/2020/02/github-pages-sync-qcloud-cos/</guid><description>&lt;p>以本站为例，配置Github Pages同步到Qcloud腾讯云对象存储COS&lt;/p>
&lt;p>主要是由于Github Pages + CloudFalre CDN的方式最近访问经常会出问题，所以不得不考虑将本站在国内也新增一个节点，&lt;/p>
&lt;p>很久之前就已经&lt;a href="/2019/12/coding-jenkins-jekyll-cos/">尝试过&lt;/a> 将本站部署到阿里、腾讯、又拍等地方，之前测试过兼容性最好的应该就是又拍云，但是无奈╮(╯▽╰)╭ 腾讯云还有很多优惠券还没使用，所以这次就先将其同步到腾讯云的对象存储+CDN。&lt;/p>
&lt;p>方法主要是通过Github的Action功能，&lt;/p>
&lt;p>先通过jekyll的docker生成&lt;code>_pages&lt;/code>文件夹，然后通过&lt;code>coscmd&lt;/code>同步文件到腾讯的对象存储中。CDN配置比较简单忽略。&lt;/p>
&lt;p>主要是贴一下action的实现文件如下：&lt;/p></description></item><item><title>Zerotier网卡NAT via iptables</title><link>/2020/02/openwrt-zerotier-nat-via-iptables/</link><pubDate>Sat, 01 Feb 2020 10:25:00 +0000</pubDate><guid>/2020/02/openwrt-zerotier-nat-via-iptables/</guid><description>&lt;p>Zerotier网卡NAT&lt;/p>
&lt;p>包括SNAT+DNAT，以Openwrt自带iptables为例&lt;/p>
&lt;p>情况举例：&lt;/p>
&lt;p>目前有10节点的Zerotier终端，部分终端也是其它子网的网关，那么通过这个网关的端口可以映射子网内其它主机的端口&lt;/p>
&lt;p>例如&lt;/p>
&lt;p>作为网关br-lan接口地址为192.168.22.1&lt;/p>
&lt;p>有一Zerotier子网地址192.168.193.6&lt;/p>
&lt;p>那么如果要做一个Zerotier的子网端口映射 192.168.193.6:8080 -&amp;gt; 192.168.22.7:80&lt;/p>
&lt;p>可以通过以下iptables规则&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>iptables -A input_rule -i zt+ -j ACCEPT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -A forwarding_rule -i zt+ -j ACCEPT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -A forwarding_rule -o zt+ -j ACCEPT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -A output_rule -o zt+ -j ACCEPT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -t nat -A POSTROUTING -s 0.0.0.0/0 -o br-lan -j SNAT --to 192.168.22.1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -t nat -A PREROUTING -i ztuku6smag -p tcp -d 192.168.193.6 --dport &lt;span style="color:#ae81ff">8080&lt;/span> -j DNAT --to-destination 192.168.22.7:80
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>希望大家身体健康&lt;/p></description></item><item><title>通过Cloudflare API更新DNS记录</title><link>/2020/01/cloudflare-api-ddns/</link><pubDate>Wed, 01 Jan 2020 11:25:00 +0000</pubDate><guid>/2020/01/cloudflare-api-ddns/</guid><description>&lt;p>2020又一新年了&lt;/p>
&lt;p>今年第一篇贴一个通过Cloudflare API更新DNS记录的脚本&lt;/p>
&lt;p>过程基于OpenWRT系统，需要先安装&lt;code>curl&lt;/code>和&lt;code>jsonfilter&lt;/code>&lt;/p>
&lt;p>先在Profile-&amp;gt;api-tokens中申请一个API Token，权限需要Zone-&amp;gt;Zone以及Zone-&amp;gt;DNS的Edit权限&lt;/p>
&lt;p>得到的token作为变量&lt;code>cftoken&lt;/code>&lt;/p></description></item><item><title>通过Zerotier跨NAT组大内网</title><link>/2019/12/zerotier-sd-lan/</link><pubDate>Thu, 26 Dec 2019 19:25:00 +0000</pubDate><guid>/2019/12/zerotier-sd-lan/</guid><description>&lt;p>通过Zerotier组大内网&lt;/p>
&lt;p>目前加了7个活跃节点进来，2台PC，一台腾讯云服务器，4台OpenWRT路由器。&lt;/p>
&lt;p>腾讯云和其中一台有公网IP的OpenWRT作为Moons卫星中继，&lt;/p>
&lt;p>测试了两个不同地方的内网设备，带宽能跑到40.8 Mbits/sec，超出预期的效果。&lt;/p></description></item><item><title>OpenWRT通过3G Modem加asterisk将GSM通话转为SIP</title><link>/2019/12/openwrt-asterisk-dongle-gsm-to-sip/</link><pubDate>Tue, 24 Dec 2019 23:25:00 +0000</pubDate><guid>/2019/12/openwrt-asterisk-dongle-gsm-to-sip/</guid><description>&lt;p>本文主要实现OpenWRT系统通过Huawei 3G Modem加asterisk套件将GSM通话转为SIP通话&lt;/p>
&lt;p>安装openwrt下的asterisk16套件&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>opkg install asterisk16-app-system asterisk16-chan-dongle asterisk16-pjsip asterisk16-codec-ulaw asterisk16-codec-alaw asterisk16-res-rtp-asterisk asterisk16-bridge-simple
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>调整PJSIP作为默认服务，并且新增几个PJSIP账户，用以测试内线通&lt;/p></description></item><item><title>Coding通过Jenkins生成jekyll并发布到腾讯云对象存储Qcloud COS</title><link>/2019/12/coding-jenkins-jekyll-cos/</link><pubDate>Fri, 20 Dec 2019 22:33:00 +0000</pubDate><guid>/2019/12/coding-jenkins-jekyll-cos/</guid><description>&lt;p>Coding项目通过Jenkins生成jekyll并发布到腾讯云对象存储Qcloud COS&lt;/p>
&lt;p>主要是通过Coding Git + 自带的Jenkins构建Docker以及coscmd同步&lt;/p>
&lt;p>贴一下Jenkins的实现文件如下：&lt;/p></description></item><item><title>OpenWRT搭建WireGuard服务器</title><link>/2019/11/openwrt-wireguard-server/</link><pubDate>Fri, 29 Nov 2019 15:25:00 +0000</pubDate><guid>/2019/11/openwrt-wireguard-server/</guid><description>&lt;p>本文主要实现在OpenWRT路由器系统下搭建WireGuard服务器方便远程连接，&lt;/p>
&lt;p>之前一直是在OpenWRT使用Openconnect VPN,因为是SSLVPN使用起来结合CISCO的anyconnect客户端是很方便的，但是由于现在ISP连这种基于SSL的流量也有可以做识别并封公网IP，所以不得不考虑切换至基于UDP的OpenVPN了-&amp;gt;WireGuard VPN。&lt;/p>
&lt;p>续：原来的文章发到V站上面大家都说WireGuard的性能更好，然后看了一下资料，如果Peers数不是很多的话其实实现Server/Client类型的Dial Up VPN还是可行的，所以这边也写一下教程方便大家&lt;/p>
&lt;p>下面主要分两步：&lt;/p>
&lt;p>（1）在OpenWRT安装并配置好WireGuard&lt;/p>
&lt;p>（2）配置多Peers方案&lt;/p>
&lt;p>那么现在开始吧，目前系统是使用了最新的OpenWRT 19.07.0-rc1, 应该同时适用于OpenWrt 18.06.4&lt;/p></description></item><item><title>OpenWRT搭建OpenVPN服务器</title><link>/2019/11/openwrt-openvpn-server/</link><pubDate>Thu, 28 Nov 2019 23:21:00 +0000</pubDate><guid>/2019/11/openwrt-openvpn-server/</guid><description>&lt;p>本文主要实现在OpenWRT路由器系统下搭建OpenVPN服务器方便远程连接&lt;/p>
&lt;p>之前一直是在OpenWRT使用Openconnect VPN,因为是SSLVPN使用起来结合CISCO的anyconnect客户端是很方便的，但是由于现在ISP连这种基于SSL的流量也有可以做识别并封公网IP，所以不得不考虑切换至基于UDP的OpenVPN了。&lt;/p>
&lt;p>下面主要分三步：&lt;/p>
&lt;p>（1）在OpenWRT安装并配置好OpenVPN&lt;/p>
&lt;p>（2）配置多用户方案&lt;/p>
&lt;p>（3）结合Luci去显示OpenVPN&lt;/p>
&lt;p>那么现在开始吧，目前系统是使用了最新的OpenWRT 19.07.0-rc1, 同时适用于OpenWrt 18.06.4&lt;/p>
&lt;p>1.在OpenWRT安装并配置好OpenVPN&lt;/p>
&lt;p>先安装好本次所需的全部软件&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>opkg update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>opkg install openvpn-easy-rsa openvpn-mbedtls luci-app-openvpn
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>配置防火墙开放相应端口&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Configure firewall&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci rename firewall.@zone&lt;span style="color:#f92672">[&lt;/span>0&lt;span style="color:#f92672">]=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;lan&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci rename firewall.@zone&lt;span style="color:#f92672">[&lt;/span>1&lt;span style="color:#f92672">]=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;wan&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci rename firewall.@forwarding&lt;span style="color:#f92672">[&lt;/span>0&lt;span style="color:#f92672">]=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;lan_wan&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci del_list firewall.lan.device&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;tun0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci add_list firewall.lan.device&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;tun0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci -q delete firewall.vpn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;rule&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn.name&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;Allow-OpenVPN&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn.src&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;wan&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn.dest_port&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;1194&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn.proto&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;udp&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci set firewall.ovpn.target&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;ACCEPT&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>uci commit firewall
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/etc/init.d/firewall restart
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2019/11/kWcLKdG.png" alt="OpenWRT Firewall">&lt;/p>
&lt;p>生成服务器和客户端证书&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Configuration parameters&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export EASYRSA_PKI&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;/etc/easy-rsa/pki&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export EASYRSA_REQ_CN&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;ovpnca&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Remove and re-initialize the PKI directory&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>easyrsa --batch init-pki
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Generate DH parameters&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 此步会较久&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>easyrsa --batch gen-dh
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Create a new CA&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>easyrsa --batch build-ca nopass
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Generate a keypair and sign locally for a server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>easyrsa --batch build-server-full server nopass
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Generate a keypair and sign locally for a client&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>easyrsa --batch build-client-full client nopass
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>生成服务器配置文件&lt;/p></description></item><item><title>ELK收集处理Huawei/H3C交换机日志</title><link>/2019/11/elk-h3c-huawei-log/</link><pubDate>Thu, 21 Nov 2019 22:13:00 +0000</pubDate><guid>/2019/11/elk-h3c-huawei-log/</guid><description>&lt;p>通过ELK logstash模块收集处理交换机日志并进行可视化处理&lt;/p>
&lt;p>这里主要是写一下logstash grok的对交换机日志的正则实现，之后再补充可视化的分析模板&lt;/p>
&lt;p>1.Huawei Switch 华为交换机&lt;/p>
&lt;p>效果如下&lt;/p></description></item><item><title>UniFi Register Device with keadhcp</title><link>/2019/09/keadhcp-ubnt-ap-assign/</link><pubDate>Wed, 25 Sep 2019 10:21:00 +0000</pubDate><guid>/2019/09/keadhcp-ubnt-ap-assign/</guid><description>&lt;p>本文主要实现通过Kea DHCP Server下发AC(UniFi Controller)信息给Ubnt AP,&lt;/p>
&lt;p>Kea DHCP是由ISC推出的新品种开源DHCP Server，与传统ISC DHCP Server比较主要添加了ipv6的支持，不过目前可参考的资料较少，设备厂商一般不会对Kea DHCP进行配置的说明。&lt;/p>
&lt;p>主要参考Ubnt官方文档中ISC的相关文档：&lt;/p>
&lt;p>&lt;a href="https://help.ubnt.com/hc/en-us/articles/204909754-UniFi-Device-Adoption-Methods-for-Remote-UniFi-Controllers#7">Ubnt official manual for DHCP Option 43&lt;/a>&lt;/p>
&lt;p>&lt;code>Linux's ISC DHCP server: dhcpd.conf&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># ...&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>option space ubnt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>option ubnt.unifi-address code 1 &lt;span style="color:#f92672">=&lt;/span> ip-address;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>class &lt;span style="color:#e6db74">&amp;#34;ubnt&amp;#34;&lt;/span> &lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> match &lt;span style="color:#66d9ef">if&lt;/span> substring &lt;span style="color:#f92672">(&lt;/span>option vendor-class-identifier, 0, 4&lt;span style="color:#f92672">)&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;ubnt&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> option vendor-class-identifier &lt;span style="color:#e6db74">&amp;#34;ubnt&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> vendor-option-space ubnt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>subnet 10.10.10.0 netmask 255.255.255.0 &lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> range 10.10.10.100 10.10.10.160;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> option ubnt.unifi-address 201.10.7.31; &lt;span style="color:#75715e">### UniFi Controller IP ###&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> option routers 10.10.10.2;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> option broadcast-address 10.10.10.255;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> option domain-name-servers 168.95.1.1, 8.8.8.8;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#75715e"># ...&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>参考通过Kea DHCP配置主要实现部分如下&lt;/p></description></item><item><title>Huawei esight to 钉钉dingding (RESTful API)</title><link>/2019/09/esight-to-dingtalk-robot/</link><pubDate>Sun, 01 Sep 2019 20:21:00 +0000</pubDate><guid>/2019/09/esight-to-dingtalk-robot/</guid><description>&lt;p>Huawei esight告警本身不能使用dingtalk,wechat等webhook api，但是其自带了一个HTTPS SMS Server，经过分析，可以通过这个功能将其转换成其它API接口可用的数据。&lt;/p>
&lt;p>&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2019/09/kfa7qb7vmx.png" alt="package">&lt;/p>
&lt;p>抓包看了一下，这明显是个Get方法，Huawei esight直接当成了post写，也是666，所以正常情况我们不是要在esight的HTTPS SMS Server将方法改成GET&lt;/p>
&lt;p>&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2019/09/lo8t8we2zm.png" alt="att">&lt;/p>
&lt;p>实现很简单，我就是用了flask处理了一下拿到的数据，然后再重组一下发到新的API接口就行了。&lt;/p>
&lt;p>简单地实现代码如下：&lt;/p></description></item><item><title>megacli修复raid1硬盘</title><link>/2019/08/megaraid-rebuild-raid1/</link><pubDate>Tue, 27 Aug 2019 07:11:00 +0000</pubDate><guid>/2019/08/megaraid-rebuild-raid1/</guid><description>&lt;p>使用megaraid修复raid1掉线硬盘&lt;/p>
&lt;p>使用说明：&lt;/p></description></item><item><title>ngrokc rampis预编译版本</title><link>/2019/08/ngrokc-prebuild-for-ramips/</link><pubDate>Fri, 16 Aug 2019 06:11:00 +0000</pubDate><guid>/2019/08/ngrokc-prebuild-for-ramips/</guid><description>&lt;p>&lt;a href="https://github.com/dosgo/ngrok-c">ngrokc&lt;/a> 是用c语言实现的ngrok1的客户端，非常适合在嵌入式设备中使用，&lt;/p>
&lt;p>不过官方github上面的release已经有点旧了，在18.06.4上已经无法正常运行，所以重新用最新的18.06.4 ramips SDK编译，测试过mt7620和mt7621的机器都能可以正常运行。&lt;/p>
&lt;p>tested on mt7620 and mt7621&lt;/p>
&lt;p>下载链接：&lt;/p>
&lt;p>&lt;a href="https://stu2013jnueducn-my.sharepoint.com/:u:/g/personal/hkl_stu2013_jnu_edu_cn/EbcXrXWPY4pJpXcLWh_XoKEBkY2D3anyCiOLo9qAax6PeQ?e=OXNypn">https://stu2013jnueducn-my.sharepoint.com/:u:/g/personal/hkl_stu2013_jnu_edu_cn/EbcXrXWPY4pJpXcLWh_XoKEBkY2D3anyCiOLo9qAax6PeQ?e=OXNypn&lt;/a>&lt;/p>
&lt;p>使用说明：&lt;/p></description></item><item><title>DNSPOD自动更新公网IP脚本</title><link>/2019/08/dnspod-api-update-ip/</link><pubDate>Wed, 14 Aug 2019 12:48:00 +0000</pubDate><guid>/2019/08/dnspod-api-update-ip/</guid><description>&lt;p>通过DNSPOD提供的API实现自动更新域名公网ip&lt;/p>
&lt;p>配置脚本&lt;/p>
&lt;p>&lt;code>cat update_ip.sh&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#!/bin/sh
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>ipaddr&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">`&lt;/span>curl -s https://ip.cn | jsonfilter -e &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$&lt;span style="color:#e6db74">.ip&amp;#34;&lt;/span>&lt;span style="color:#e6db74">`&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo $ipaddr
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST https://dnsapi.cn/Record.Modify -d &lt;span style="color:#e6db74">&amp;#34;login_token=ID,TOKEN&amp;amp;format=json&amp;amp;domain_id=DOMAIN_ID&amp;amp;record_id=RECORDID&amp;amp;sub_domain=sub&amp;amp;value=&lt;/span>$ipaddr&lt;span style="color:#e6db74">&amp;amp;record_type=A&amp;amp;record_line=默认&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>定时任务&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>sudo crontab -l
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>*/1 * * * * sh /root/update_ip.sh&lt;/code>&lt;/p>
&lt;p>获取&lt;code>domain_id&lt;/code>信息的脚本&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>curl -k https://dnsapi.cn/Domain.List -d &lt;span style="color:#e6db74">&amp;#34;login_token=ID,TOKEN&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>frp定时监控脚本</title><link>/2019/08/frp-monitor-script/</link><pubDate>Tue, 13 Aug 2019 23:35:00 +0000</pubDate><guid>/2019/08/frp-monitor-script/</guid><description>&lt;p>frp是用和比较多的反代了，这种工具目的就是24online的，所以写一个监控脚本让其不断线，或者程序出问题终止后自动运行是很有必要的，特别是在内网IP的主机了，
frp一出问题就再连不上，所以让其本地恢复是相当重要。&lt;/p>
&lt;p>脚本用于frp服务器和客户端&lt;/p></description></item><item><title>再次将Blog迁移到github pages</title><link>/2019/08/migrate-blog-from-typecho/</link><pubDate>Wed, 07 Aug 2019 07:15:00 +0000</pubDate><guid>/2019/08/migrate-blog-from-typecho/</guid><description>&lt;p>再次将博客站从self host的typecho迁移回github pages上，顺便测试了几个CDN的加速效果。&lt;/p>
&lt;p>第一次将blog放到github pages应该是15年的时候结合hexo，现在github pages已经能够自动deploy jekyll了，所以将blog theme更新至后将blog后就直接能用了。&lt;/p></description></item><item><title>iptables上入站流量同时启用DNAT和SNAT</title><link>/2019/07/iptables-dnat-snat/</link><pubDate>Mon, 08 Jul 2019 11:15:00 +0000</pubDate><guid>/2019/07/iptables-dnat-snat/</guid><description>&lt;p>情况
目的主机网关是否为同一个openwrt,如果不是的话有可能是因为dnat没有对请求源地址做转换导致来回路径不一样，需要用iptables同时对dnat的到内网流量做源地址转换&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>iptables -t nat -A PREROUTING -d 公网IP -p tcp --dport 公网端口 -j DNAT --to-destination 内网IP:内网端口
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iptables -t nat -A POSTROUTING -s 0.0.0.0/0 -o br-lan&lt;span style="color:#f92672">(&lt;/span>内网网卡名字&lt;span style="color:#f92672">)&lt;/span> -j SNAT --to 内网网卡接口IP
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>tasker调用钉钉机器人实现短信转钉钉</title><link>/2019/06/sms-to-dingtalk/</link><pubDate>Fri, 28 Jun 2019 17:06:00 +0000</pubDate><guid>/2019/06/sms-to-dingtalk/</guid><description>&lt;p>tasker可以通过javascriptlet方法调用钉钉群聊机器人api接口可以实现短信转钉钉&lt;/p>
&lt;p>tasker配置可以参考以下文章&lt;/p>
&lt;p>&lt;a href="https://ishare.cf/2019/04/06/forwarded-sms-to-dingtalk/">https://ishare.cf/2019/04/06/forwarded-sms-to-dingtalk/&lt;/a>&lt;/p>
&lt;p>我与文章不同处主要是：&lt;/p>
&lt;p>1.使用“群聊机器人”而不是“企业内部应用”；&lt;/p>
&lt;p>2.修正了群聊机器人与企业内部应用脚本的不同之处；&lt;/p>
&lt;p>过程主要不同就是申请群聊机器人并获得其API access token&lt;/p>
&lt;p>配置脚本的改动，其它过程可完全参照以上文章&lt;/p>
&lt;p>群聊机器人配置如下：&lt;/p></description></item><item><title>EdgeCore AS6700 自带系统 AOS 风扇速度修改命令</title><link>/2019/06/edgecore-as6700-fan-speed/</link><pubDate>Fri, 14 Jun 2019 15:11:00 +0000</pubDate><guid>/2019/06/edgecore-as6700-fan-speed/</guid><description>&lt;ol>
&lt;li>登入 AS6700 ( telnet [swithc_ip] )&lt;/li>
&lt;li>指令 linux shell&lt;/li>
&lt;li>使用以下指令调整转速：
cd /initrd/usr/sbin/&lt;/li>
&lt;/ol>
&lt;p>** 以下指令择一使用，最后一个值越小，风扇转速越慢
./i2cmw 1 0x35 0x20 0x07 &amp;lt;&amp;ndash; 设定为高转速(目前机台上使用的设定)
./i2cmw 1 0x35 0x20 0x06 &amp;lt;&amp;ndash; 大概就会降一半
./i2cmw 1 0x35 0x20 0x00 &amp;lt;&amp;ndash; 完全关掉(不建议)&lt;/p>
&lt;p>** 以下指令可以查询目前的值
./i2cmd 1 0x35 0x20 &amp;lt;&amp;mdash;可以查看目前的值&lt;/p>
&lt;p>查看系统温度:
console# show system&lt;/p></description></item><item><title>EdgeCore AS6700 ONIE Firmware固件 For HWr01c</title><link>/2019/06/edgecore-as6700-onie-firmware/</link><pubDate>Thu, 13 Jun 2019 15:38:00 +0000</pubDate><guid>/2019/06/edgecore-as6700-onie-firmware/</guid><description>&lt;p>EdgeCore AS6700 ONIE固件，用最新ONIE官方源编译
官方代码有一个bug:&lt;/p>
&lt;p>&lt;a href="https://github.com/opencomputeproject/onie/issues/776#issuecomment-501582435">https://github.com/opencomputeproject/onie/issues/776#issuecomment-501582435&lt;/a>&lt;/p>
&lt;p>固件如下：硬件版本r01c可用，r01b不可用。&lt;/p></description></item><item><title>sddm启动root登陆kde</title><link>/2019/04/sddm-permit-root-login/</link><pubDate>Tue, 16 Apr 2019 09:04:36 +0000</pubDate><guid>/2019/04/sddm-permit-root-login/</guid><description>&lt;p>1.&lt;code>cp /usr/share/doc/sddm/sddm.conf /etc/sddm.conf&lt;/code>&lt;/p>
&lt;p>2.&lt;code>vim /etc/sddm.conf&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">[&lt;/span>Users&lt;span style="color:#f92672">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Default $PATH for logged in users &lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>DefaultPath&lt;span style="color:#f92672">=&lt;/span>/bin:/usr/bin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Comma-separated list of shells.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Users with these shells as their default won&amp;#39;t be listed&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>HideShells&lt;span style="color:#f92672">=&lt;/span>/usr/sbin/nologin,/bin/false
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Comma-separated list of users that should not be listed&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>HideUsers&lt;span style="color:#f92672">=&lt;/span>sync
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#通过HideShells和HideUsers隐藏应用用户&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Maximum user id for displayed users&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MaximumUid&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">60000&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Minimum user id for displayed users&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>MinimumUid&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#主要是这一行MinimumUid修改为0后才能使用root用户&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Remember the session of the last successfully logged in user&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RememberLastSession&lt;span style="color:#f92672">=&lt;/span>true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Remember the last successfully logged in user&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>RememberLastUser&lt;span style="color:#f92672">=&lt;/span>true
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>3.&lt;code>vim /etc/pam.d/sddm&lt;/code>&lt;/p></description></item><item><title>H3C在端口同时配置MAC地址认证和802.1x</title><link>/2019/01/h3c-mac-auth-and-dot1x/</link><pubDate>Thu, 17 Jan 2019 09:47:00 +0000</pubDate><guid>/2019/01/h3c-mac-auth-and-dot1x/</guid><description>&lt;p>1.H3C交换机是支持在同一端口同时配置MAC地址认证和802.1x认证的。&lt;/p>
&lt;p>一开始由于交换机提示的问题以为在全局上只能启用MAC地址认证或者802.1x其中的一种，后来尝试只需全局启用&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> port-security enable
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>就同时开启了MAC地址认证和802.1x&lt;/p>
&lt;p>2.架构&lt;/p>
&lt;p>(1)交换机端口设定801.1x和MAC auth的port-security方式，交换机会按 &lt;code>PAP的MAC地址&lt;/code> -&amp;gt; &lt;code>EAP的802.1x&lt;/code> 顺序给RADIUS Server发送请求报文，当其中有一项RADIUS检验通过并回复&lt;code>Access-Accept&lt;/code>报文时，交换机准予终端接入&lt;/p></description></item><item><title>移除Blog对jQuery的依赖</title><link>/2018/12/remove-blog-jquery/</link><pubDate>Tue, 18 Dec 2018 04:47:00 +0000</pubDate><guid>/2018/12/remove-blog-jquery/</guid><description>&lt;p>1.由于博客其实动态功能并不多，而且很多都是多年前完全不懂前端的情况下写的，所以有些功能没有考虑好，现在再看了一下前端代码部分，发现很多DOM操作已经完全没有必要去用jQuery了，以后再加新功能也不会用到jQuery的特性，所以计划改写jQuery部分为原生javascript。&lt;/p>
&lt;p>2.逐步改写&lt;/p>
&lt;p>(1)部分插件的改用&lt;/p>
&lt;p>主要是博客使用了Bootstrap的框架，所以官方的Bootstrap部分功能是依赖jQuery的，这个直接替换成&lt;a href="https://thednp.github.io/bootstrap.native/v4.html" title="Bootstrap.native">Bootstrap.native&lt;/a>了&lt;/p>
&lt;p>另外一个就是timeago的实现替换了jquery.timeago为使用原生js的&lt;a href="https://timeago.org" title="timeago">timeago&lt;/a>&lt;/p>
&lt;p>(2)DOM操作部分&lt;/p>
&lt;p>原来博客主要通过jQuery做了许多DOM操作，例如Query Selector，这部分参考了&lt;a href="https://github.com/nefe/You-Dont-Need-jQuery">You-Dont-Need-jQuery&lt;/a>进行改写&lt;/p>
&lt;p>(3)特殊部分&lt;/p>
&lt;p>有一些jQuery特有的方法通过事件绑定重新实现了功能&lt;/p></description></item><item><title>使用python的paramiko加flask模块实现H3C设备实时ssh信息查询</title><link>/2018/12/paramiko-flask-h3c/</link><pubDate>Fri, 14 Dec 2018 12:47:00 +0000</pubDate><guid>/2018/12/paramiko-flask-h3c/</guid><description>&lt;p>1.本文主要初步实现一个通过Web实时查询H3C网络设备的终端MAC信息所在端口查询，这个是通过实际网络环境设计的操作逻辑，因而代码部分仅供参考&lt;/p>
&lt;p>2.系统架构&lt;/p></description></item><item><title>通过expect脚本在H3C设备批量执行命令</title><link>/2018/12/expect-to-autoconf-h3c/</link><pubDate>Mon, 10 Dec 2018 18:47:00 +0000</pubDate><guid>/2018/12/expect-to-autoconf-h3c/</guid><description>&lt;p>1.本文主要记录了在Linux系统中使用自动化测试工具expect通过ssh登陆H3C设置并批量执行相同命令&lt;/p>
&lt;p>2.安装expect&lt;/p>
&lt;p>以ubuntu为例&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>sudo apt install expect
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>3.编辑expect脚本&lt;/p></description></item><item><title>配置使用Quagga</title><link>/2018/12/use-quagga/</link><pubDate>Mon, 03 Dec 2018 07:00:00 +0000</pubDate><guid>/2018/12/use-quagga/</guid><description>&lt;p>1.add the user/group quagga
[On RedHat/CentOS]
groupadd -g 92 quagga
groupadd -r -g 85 quaggavt
useradd -u 92 -g 92 -M -r -s /sbin/nologin
-c &amp;ldquo;Quagga routing suite&amp;rdquo; -d /var/run/quagga quagga
[On Debian / Ubuntu]
addgroup &amp;ndash;system &amp;ndash;gid 92 quagga
addgroup &amp;ndash;system &amp;ndash;gid 85 quaggavty
adduser &amp;ndash;system &amp;ndash;ingroup quagga &amp;ndash;home /var/run/quagga/ &lt;br>
&amp;ndash;gecos &amp;ldquo;Quagga routing suite&amp;rdquo; &amp;ndash;shell /bin/false quagga&lt;/p>
&lt;p>groupadd quagga
useradd quagga -g quagga&lt;/p>
&lt;p>chown quagga:quagga /var/run/
chmod 777 /var/run/&lt;br>
chown quagga:quagga /usr/etc/ 编辑配置文件
chmod 777 /usr/etc/&lt;/p></description></item><item><title>MotherBoard JCOM to DB9 female</title><link>/2018/11/jcom-to-db9-female/</link><pubDate>Fri, 30 Nov 2018 07:00:00 +0000</pubDate><guid>/2018/11/jcom-to-db9-female/</guid><description>&lt;p>Since there is a project to deploy an x86 VyOS as the router, After I install the system and I find out that I can use the console to connect to the system just like other Cisco(H3C) routers rather than using the screen.&lt;/p>
&lt;p>However, The Cisco router are using RS232-RJ45 port, and I just spot that the H61 MotherBoard ais using jcom jumper to the DB9 male port. And my USB-RS232 converter is also with the DB9 male port, so I&amp;rsquo;d like to make a &lt;code>jcom to DB9 female&lt;/code> plan.&lt;/p>
&lt;p>I just find out some jcom and DB9 information here,&lt;/p></description></item><item><title>PHP实现根据请求的域名跳转到不同目录</title><link>/2018/11/http-301-php/</link><pubDate>Thu, 22 Nov 2018 18:00:00 +0000</pubDate><guid>/2018/11/http-301-php/</guid><description>&lt;p>使用一些PHP虚拟主机的时候，多个域名绑定到同一空间下，但是希望不同域名能通过不同目录实现访问不同网站的效果：&lt;/p>
&lt;p>如：&lt;/p>
&lt;p>&lt;code>a.example.com -&amp;gt; /a/&lt;/code>&lt;/p>
&lt;p>&lt;code>b.example.com -&amp;gt; /b/&lt;/code>&lt;/p>
&lt;p>也就是访问 a.example.com 的时候定向至 a.example.com/a/ 访问 b.example.com 的时候定向至 b.example.com/b/&lt;/p>
&lt;p>实现代码如下 ：&lt;/p></description></item><item><title>Typecho迁移到Hugo</title><link>/2018/11/typecho-to-hugo/</link><pubDate>Tue, 20 Nov 2018 07:22:00 +0000</pubDate><guid>/2018/11/typecho-to-hugo/</guid><description>&lt;p>用了一段时间（没几天）Typecho后，因为Deploy的小虚机性能太差，自己又不想花时间再部署一套PHP的Web Server平台，又换回静态Blog了，这次试试Hugo&lt;/p>
&lt;p>真的是瞎折腾&lt;/p></description></item><item><title>OPNsense 内置Netflow工作不正常或者获取不到数据</title><link>/2018/11/opnsense-netflow-problem/</link><pubDate>Mon, 19 Nov 2018 09:46:00 +0000</pubDate><guid>/2018/11/opnsense-netflow-problem/</guid><description>&lt;p>flowd_aggregate服务没有工作，或者报表没有数据
此情况一般为日志缓存有问题，需要手动清缓存
命令如下&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>rm /var/log/flowd.log*
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rm /var/netflow/*.sqlite
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Bootstrap 3 升级到 Bootstrap 4</title><link>/2018/11/bootstrap3-to-bootstarp4/</link><pubDate>Tue, 06 Nov 2018 13:49:00 +0000</pubDate><guid>/2018/11/bootstrap3-to-bootstarp4/</guid><description>&lt;p>网站前端用的 Bootstrap 3 已经用了点时间升级到 Bootstrap 4
Bootstrap 3 跟 Bootstrap 4 有些类是不通用的，例如&lt;code>pull-right&lt;/code>改成了&lt;code>float-right&lt;/code>
其Layout以及字体、着色也有些不一样，有些地方还需要慢慢调，大布局已经基本OK&lt;/p></description></item><item><title>包转发线速的衡量标准</title><link>/2018/11/about-pps/</link><pubDate>Tue, 06 Nov 2018 13:49:00 +0000</pubDate><guid>/2018/11/about-pps/</guid><description>&lt;p>包转发线速的衡量标准是以单位时间内发送64byte的数据包（最小包）的个数作为计算基准的。对于千兆以太网来说，计算方法如 下：1,000,000,000bps/8bit/（64 + 8 + 12）byte=1,488,095pps 说明：当以太网帧为64byte时，需考虑8byte的帧头和12byte的帧间隙的固定开销。故一个线速的千兆以太网端口在转发64byte包时的包转 发率为1.488Mpps。快速以太网的线速端口包转发率正好为千兆以太网的十分之一，为148.8kpps。
*对于万兆以太网，一个线速端口的包转发率为14.88Mpps。
*对于千兆以太网，一个线速端口的包转发率为1.488Mpps。
*对于快速以太网，一个线速端口的包转发率为0.1488Mpps。&lt;/p></description></item><item><title>欢迎使用 Typecho | 从Jekyll迁移到Typecho</title><link>/2018/10/welcome-to-typecho/</link><pubDate>Mon, 29 Oct 2018 11:02:00 +0000</pubDate><guid>/2018/10/welcome-to-typecho/</guid><description>&lt;p>如果您看到这篇文章,表示您的 blog 已经安装成功.&lt;/p>
&lt;p>####用Jekyll+Upyun CDN已经有很长的一段时间了，这个真的是对国内有备案域名最友好的静态博客解决方案（Jekyll可更改为其它的&lt;a href="https://www.staticgen.com">Static Site Generators&lt;/a>）了，Upyun同步对象文件十分方便，但是由于自己经常需要切换终端以及系统（瞎折腾），所以还是换成了PHP Web Blog (目前是用Typecho + SQLite)，主题也model过去了，之后再慢慢更新一下。&lt;/p></description></item><item><title>Proxmox PVE 为VM挂载物理硬盘</title><link>/2018/08/proxmox-with-hardisk/</link><pubDate>Tue, 28 Aug 2018 22:13:00 +0000</pubDate><guid>/2018/08/proxmox-with-hardisk/</guid><description>&lt;p>1、查询物理硬盘标号
&lt;code>ls /dev/disk/by-id/&lt;/code>
假设搜到的硬盘ID为”ata-ST1000DM010-ABCDE_FGHJKL”&lt;/p>
&lt;p>2、挂载硬盘到虚拟机中
&lt;code>qm set 100 --sata2 /dev/disk/by-id/ata-ST500DM002-1BD142_S2AKZ4ML&lt;/code>&lt;/p>
&lt;p>其中100为虚拟机ID号&lt;/p></description></item><item><title>proxmox notes</title><link>/2018/08/proxmox-notes/</link><pubDate>Sun, 26 Aug 2018 09:17:00 +0000</pubDate><guid>/2018/08/proxmox-notes/</guid><description>&lt;p>&lt;code>/etc/apt/sources.list&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>deb http://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>deb http://mirrors.tuna.tsinghua.edu.cn/debian sid main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>deb http://mirrors.tuna.tsinghua.edu.cn/debian experimental main contrib non-free
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>deb http://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>deb http://mirrors.ustc.edu.cn/proxmox/debian/pve buster pve-no-subscription
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># security updates&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>deb http://security.debian.org buster/updates main contrib
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Unix每分钟监控进程的状态</title><link>/2018/08/unix-monitor-process/</link><pubDate>Thu, 02 Aug 2018 20:43:00 +0000</pubDate><guid>/2018/08/unix-monitor-process/</guid><description>&lt;p>（以FreeBSD为服务器监控frps进程为例）&lt;/p>
&lt;p>1、创建监控Shell脚本&lt;code>monfrp.sh&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#! /bin/sh 
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>proc_name&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;frps&amp;#34;&lt;/span> &lt;span style="color:#75715e">#进程名&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>proc_num&lt;span style="color:#f92672">()&lt;/span> &lt;span style="color:#75715e">#查询进程数量&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 	num&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">`&lt;/span>ps -ef | grep $proc_name | grep -v grep | wc -l&lt;span style="color:#e6db74">`&lt;/span> &lt;span style="color:#75715e">#视乎情况&amp;#34;ps -ef&amp;#34;需要更改为&amp;#34;ps -aux&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 	&lt;span style="color:#66d9ef">return&lt;/span> $num
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>proc_num
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>number&lt;span style="color:#f92672">=&lt;/span>$? &lt;span style="color:#75715e">#获取进程数量&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#f92672">[&lt;/span> $number -eq &lt;span style="color:#ae81ff">0&lt;/span> &lt;span style="color:#f92672">]&lt;/span> &lt;span style="color:#75715e">#如果进程数量为0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">then&lt;/span> &lt;span style="color:#75715e">#重新启动服务器，或者扩展其它内容。&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 	/root/frp/frps -c /root/frp/frps.ini &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> echo &lt;span style="color:#e6db74">&amp;#34;frpc start&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#e6db74">&amp;#34;the process is running&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">fi&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>OpenBSD的更新过程</title><link>/2018/07/openbsd-upgrade/</link><pubDate>Wed, 18 Jul 2018 20:09:00 +0000</pubDate><guid>/2018/07/openbsd-upgrade/</guid><description>&lt;p>（以arch为amd64的服务器从6.2更新升级6.3为例）&lt;/p>
&lt;p>更改bsd.rd&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>wget https://openbsd.hk/pub/OpenBSD/6.3/amd64/bsd.rd -O /bsd.rd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>reboot
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>启动引导新的bsd.rd
&lt;code>boot&amp;gt; boot hd0a:/bsd.rd&lt;/code>
根据引导程序安装新的OpenBSD版本&lt;/p></description></item><item><title>NetBSD使用sysupgrade工具更新系统</title><link>/2018/06/netbsd-sysupgrade-upgrade/</link><pubDate>Wed, 27 Jun 2018 19:07:00 +0000</pubDate><guid>/2018/06/netbsd-sysupgrade-upgrade/</guid><description>&lt;p>解决报错&lt;/p>
&lt;blockquote>
&lt;p>550 netbsd-: No such file or directory.&lt;/p>
&lt;p>E: Failed to determine kernel name; please set KERNEL explicitly&lt;/p>&lt;/blockquote>
&lt;p>1.使用pkg_add工具下载sysupgrade&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>PKG_PATH&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;http://cdn.NetBSD.org/pub/pkgsrc/packages/&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>uname -s&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">/&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>uname -m&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">/&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>uname -r|cut -f &lt;span style="color:#e6db74">&amp;#39;1 2&amp;#39;&lt;/span> -d.&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">/All/&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export PKG_PATH
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pkg_add sysupgrade
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>2.修改配置文件&lt;code>/usr/pkg/etc/sysupgrade.conf&lt;/code>
主要修改&lt;/p>
&lt;p>&lt;code>KERNEL=GENERIC&lt;/code>&lt;/p>
&lt;p>3.运行更新程序sysupgrade
&lt;code>sysupgrade auto ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-7.1.2/amd64&lt;/code>&lt;/p></description></item><item><title>安装zabbix的windows系统agent</title><link>/2018/06/zabbix-agent-on-windows/</link><pubDate>Thu, 14 Jun 2018 23:11:00 +0000</pubDate><guid>/2018/06/zabbix-agent-on-windows/</guid><description>&lt;p>一、下载软件&lt;/p>
&lt;p>首先从官网下载agent软件，解压
&lt;a href="https://www.zabbix.com/downloads/3.4.6/zabbix_agents_3.4.6.win.zip">https://www.zabbix.com/downloads/3.4.6/zabbix_agents_3.4.6.win.zip&lt;/a>&lt;/p>
&lt;p>二、编辑配置文件
修改配置文件&lt;code>zabbix_agentd.win.conf&lt;/code> 主要修改以下的选项&lt;/p></description></item><item><title>asterisk服务器的sip、iax2中继对接</title><link>/2018/06/asterisk-trunk-sip-iax2/</link><pubDate>Wed, 13 Jun 2018 20:08:00 +0000</pubDate><guid>/2018/06/asterisk-trunk-sip-iax2/</guid><description>&lt;p>一、sip中继
1.Asterisk 互連～ SIP Provider 模式
&lt;a href="http://www.osslab.org.tw/VoIP/IP_PBX/">http://www.osslab.org.tw/VoIP/IP_PBX/&lt;/a> 軟體式_IP_PBX/Asterisk/Tips/Asterisk_互連～_SIP_Provider_模式&lt;/p>
&lt;p>什麼是 SIP Provider 模式？ 當 Asterisk(provider) 想成為一個類似 SIP Provider 的應用，讓另一台 Asterisk(end) 可以註冊，並且可以透過 Asterisk(provider) 的 Trunk 撥出以及也可以撥到 Asterisk(provider) 所有分機，但此模式的 Asterisk(end) 只是扮演 user，所以它的所有分機是與 Asterisk(provider) 是隔絕的，而且可以使用 Inbount Route 來控制 Asterisk(provider) 的來電。&lt;/p>
&lt;p>簡單來說，要使兩台 Asterisk 互連，如果其目的是僅限其中一方的資源被對方使用，應該使用 SIP Provider 模式，反之，若互連的目的是使雙方的資源都可以彼此互用，就像總公司與分公司關係，兩地的分機群必須完全互通，就好像是同一個主機一般，這類的應用請參考另一篇教學。&lt;/p>
&lt;p>IP-PBX Asterisk 使用 IAX 互連設定~總整理&lt;/p></description></item><item><title>2018年的更新</title><link>/2018/06/2018-update/</link><pubDate>Mon, 11 Jun 2018 20:48:00 +0000</pubDate><guid>/2018/06/2018-update/</guid><description>&lt;p>&lt;strong>很久不见&lt;/strong>&lt;/p>
&lt;p>2018年的第一次更新,将原来文章做了字符集更新，同时调整了不同系统中兼容性。&lt;/p></description></item><item><title>用Windows10自带PowerShell获取文件Hash(MD5、SHA1/256)值得方法</title><link>/2017/09/hash-in-win10/</link><pubDate>Sat, 09 Sep 2017 21:51:00 +0000</pubDate><guid>/2017/09/hash-in-win10/</guid><description>&lt;p>通常为了保证我们从网上下载的文件的完整性和可靠性，我们把文件下载下来以后都会校验一下MD5值或SHA1值（例如验证下载的Win10 ISO镜像是否为原始文件），这一般都需要借助专门的MD5检验工具来完成。但其实使用Windows系统自带的Windows PowerShell运行命令即可进行文件MD5、SHA1值校验。方法如下：&lt;/p>
&lt;hr>
&lt;h2 id="校验文件hash值的命令格式如下">&lt;strong>校验文件Hash值的命令格式如下：&lt;/strong>&lt;/h2>
&lt;p>&lt;code>Get-FileHash 文件路径 -Algorithm 校验的Hash值类型| Format-List&lt;/code>&lt;/p>
&lt;p>PS: 如果需要校验的文件路径比较复杂，例如路径中包含空格、括号等特殊符号，则需要在路径前后加上英文双引号。&lt;/p></description></item><item><title>在Windows10 Bash中默认启动其他shell</title><link>/2017/05/fish-in-win10-bash/</link><pubDate>Mon, 15 May 2017 19:51:00 +0000</pubDate><guid>/2017/05/fish-in-win10-bash/</guid><description>&lt;h2 id="首先通过apt安装其他shell软件">&lt;strong>首先，通过apt安装其他shell软件&lt;/strong>&lt;/h2>
&lt;p>（以fish为例）&lt;/p>
&lt;p>&lt;code>sudo apt install fish&lt;/code>
&lt;img src="https://cdn.jsdelivr.net/gh/hkwk/blog-photo/2017/05/bpoo782qct.jpeg" alt="img">&lt;/p>
&lt;p>安装之后使用&lt;code>fish&lt;/code>命令尝试启动。能成功启动则继续下一步。&lt;/p></description></item><item><title>USTC Google Fonts 加速服务</title><link>/2017/05/ustc-google-fonts/</link><pubDate>Thu, 11 May 2017 12:44:00 +0000</pubDate><guid>/2017/05/ustc-google-fonts/</guid><description>&lt;p>USTC LUG 提供的 Google Fonts 加速服务&lt;/p>
&lt;hr>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>fonts.googleapis.com fonts.lug.ustc.edu.cn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ajax.googleapis.com ajax.lug.ustc.edu.cn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>themes.googleusercontent.com google-themes.lug.ustc.edu.cn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>fonts.gstatic.com fonts-gstatic.lug.ustc.edu.cn
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;p>转自：https://lug.ustc.edu.cn/wiki/lug/services/googlefonts&lt;/p></description></item><item><title>通过JavaScript实现HTTP到HTTPS的强制跳转</title><link>/2017/05/javascript-http-to-https/</link><pubDate>Mon, 01 May 2017 09:04:00 +0000</pubDate><guid>/2017/05/javascript-http-to-https/</guid><description>&lt;p>最近通过一些在线文件云空间测试云存储部署静态网站遇到HTTP到HTTPS的强制跳转的问题，平时通过nginx配置是比较简单实现的，
但是例如七牛云虽然可以设置HTTPS访问，但是不支持设置HTTP到HTTPS的强制跳转，
解决方法可以是先通过设置HSTS，通过浏览器级的强制跳转实现，但是本方法只能在webkit内核的浏览器上生效，而且由一定的时间差，
所以最后寻找到通过前端JavaScript脚本实现HTTP到HTTPS的强制跳转，代码如下&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;lt;&lt;/span>&lt;span style="color:#a6e22e">script&lt;/span> &lt;span style="color:#a6e22e">type&lt;/span>&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;text/javascript&amp;#34;&lt;/span>&lt;span style="color:#f92672">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#66d9ef">var&lt;/span> &lt;span style="color:#a6e22e">targetProtocol&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#e6db74">&amp;#34;https:&amp;#34;&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>	&lt;span style="color:#66d9ef">if&lt;/span> (window.&lt;span style="color:#a6e22e">location&lt;/span>.&lt;span style="color:#a6e22e">protocol&lt;/span> &lt;span style="color:#f92672">!=&lt;/span> &lt;span style="color:#a6e22e">targetProtocol&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>		window.&lt;span style="color:#a6e22e">location&lt;/span>.&lt;span style="color:#a6e22e">href&lt;/span> &lt;span style="color:#f92672">=&lt;/span> &lt;span style="color:#a6e22e">targetProtocol&lt;/span> &lt;span style="color:#f92672">+&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>		window.&lt;span style="color:#a6e22e">location&lt;/span>.&lt;span style="color:#a6e22e">href&lt;/span>.&lt;span style="color:#a6e22e">substring&lt;/span>(window.&lt;span style="color:#a6e22e">location&lt;/span>.&lt;span style="color:#a6e22e">protocol&lt;/span>.&lt;span style="color:#a6e22e">length&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;lt;&lt;/span>&lt;span style="color:#960050;background-color:#1e0010">/script&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>一般将代码防止&lt;code>&amp;lt;head&amp;gt;&lt;/code> &lt;code>&amp;lt;/head&amp;gt;&lt;/code>之间，这样就能先于body提前加载并作跳转&lt;/p></description></item><item><title>让七牛成为存储空间可行性测试</title><link>/2017/04/qiniu-website-storage/</link><pubDate>Fri, 28 Apr 2017 15:52:00 +0000</pubDate><guid>/2017/04/qiniu-website-storage/</guid><description>&lt;p>七牛配置HTTPS会有部分问题，换成UPYUN后基本完美&lt;/p>
&lt;hr>
&lt;p>七牛云的小文件托管感觉十分适合用来做静态站的部署，现已经将网站同步更新至七牛云中，接下来再详细研究一下SDK，继续观察其他问题。&lt;/p>
&lt;hr>
&lt;p>4月30日更新测试情况：
若使用七牛官方开发工具qshell的qupload进行文件上传，会导致文件上传后由于缓存原因不能实时更新，待进一步开发继续测试&lt;/p>
&lt;hr>
&lt;p>5月5日更新测试情况：
取消使用七牛计划，改用阿里OSS+CDN的方法&lt;/p>
&lt;hr>
&lt;p>5月6日更新测试情况：
由于阿里OSS+CDN的方法会存在某些已知bug，因此再次尝试改用又拍云&lt;/p>
&lt;hr></description></item><item><title>foobar2000移动版与foobar2000桌面版链接的方法</title><link>/2017/04/foobar2000-upnp-connect/</link><pubDate>Mon, 03 Apr 2017 20:07:00 +0000</pubDate><guid>/2017/04/foobar2000-upnp-connect/</guid><description>&lt;p>本教程是关于在同一局域网内使用foobar2000桌面版作为UPnP媒体服务器并通过foobar2000移动版（包括Android和iOS版）链接实现远程音乐传输播放功能。&lt;/p>
&lt;p>首先需要在foobar2000桌面版安装&lt;code>foo_upnp&lt;/code>插件，链接：&lt;code>http://www.foobar2000.org/components/view/foo_upnp&lt;/code>&lt;/p>
&lt;p>重启foobar2000后可以在&lt;code>File-&amp;gt;Preferences-&amp;gt;Tools-&amp;gt;UPnP&lt;/code>处配置好UPnP媒体服务，然后打开最新版foobar2000移动版通过主界面最底处的&lt;code>UPnP Media Servers&lt;/code>搜索加入即可实现链接。&lt;/p></description></item><item><title>将FreeBSD由stable分支转到release分支的方法</title><link>/2017/03/freebsd-to-release/</link><pubDate>Fri, 24 Mar 2017 09:30:00 +0000</pubDate><guid>/2017/03/freebsd-to-release/</guid><description>&lt;p>最近在用FreeBSD系统搭建一些实验环境，遇到了在某国内云服务平台提供的FreeBSD旧版本镜像不能升级的情况，
主要原因就是通过&lt;code>freebsd-update&lt;/code>命令升级系统是只支持release版本的FreeBSD，而服务商的提供的基础镜像是stable版本的，
参考了官方论坛和一些资料，通过&lt;code>setenv UNAME_r &amp;quot;10.3-RELEASE&amp;quot;&lt;/code>将版本设定成最近的一个release版本,然后再通过&lt;/p>
&lt;p>&lt;code>freebsd-update fetch&lt;/code>&lt;/p>
&lt;p>&lt;code>freebsd-update install&lt;/code>&lt;/p>
&lt;p>命令成功将其升级到最新的release版本,之后就可以通过系统的命令进行其他的更新了。&lt;/p></description></item><item><title>更换评论系统至畅言</title><link>/2017/03/comment-to-changyan/</link><pubDate>Wed, 22 Mar 2017 09:44:00 +0000</pubDate><guid>/2017/03/comment-to-changyan/</guid><description>&lt;p>一直在用的多说评论即将在6月1号下线了，虽然本站也没多少评论，不过还是感谢多说坚持了这么久。&lt;/p>
&lt;p>目前先将评论系统更换成畅言。&lt;/p></description></item><item><title>Archlinux下解决wireshark普通用户抓包权限问题</title><link>/2016/09/fix-wireshark-in-linux/</link><pubDate>Mon, 19 Sep 2016 10:14:00 +0000</pubDate><guid>/2016/09/fix-wireshark-in-linux/</guid><description>&lt;p>wireshark软件是一个抓包利器，但是其调用的dumpcap组件需要root权限才能使用，以普通用户打开wireshark会提示权限不足的问题。&lt;/p>
&lt;p>当然可以通过&lt;code>sudo wireshark&lt;/code>命令强行使用wireshark，在最新版会提示一下报错信息。&lt;/p>
&lt;blockquote>
&lt;p>Lua: Error during loading: [string
&amp;ldquo;/usr/share/wireshark/init.lua&amp;rdquo;]:44: dofile has been disabled due to
running Wireshark as superuser. See
&lt;a href="https://wiki.wireshark.org/CaptureSetup/CapturePrivileges">https://wiki.wireshark.org/CaptureSetup/CapturePrivileges&lt;/a> for help in
running Wireshark as an unprivileged user.&lt;/p>&lt;/blockquote>
&lt;p>所以我们可以通过新建可以用root权限使用dumpcap的用户组来解决wireshark的权限问题。&lt;/p>
&lt;p>具体实现方法：&lt;/p>
&lt;p>1.添加wireshark用户组&lt;/p>
&lt;p>&lt;code>sudo groupadd wireshark&lt;/code>&lt;/p>
&lt;p>2.将dumpcap更改为wireshark用户组&lt;/p>
&lt;p>&lt;code>chgrp wireshark /usr/sbin/dumpcap&lt;/code>&lt;/p>
&lt;p>3、让wireshark用户组有root权限使用dumpcap&lt;/p>
&lt;p>&lt;code>chmod o-rx /usr/sbin/dumpcap&lt;/code>&lt;/p>
&lt;p>4、将需要使用的普通用户名加入wireshark用户组，我的用户是“example”（需要根据具体用户名修改！），则需要使用命令：&lt;/p>
&lt;p>&lt;code>sudo gpasswd -a example wireshark&lt;/code>&lt;/p></description></item><item><title>在Archlinux上通过qemu运行ReactOS</title><link>/2016/09/install-reactos-qemu/</link><pubDate>Thu, 01 Sep 2016 14:19:00 +0000</pubDate><guid>/2016/09/install-reactos-qemu/</guid><description>&lt;p>ReactOS是一个模拟实现Windows平台运行Windows应用的免费开源系统，按照官方的说法就是&lt;/p>
&lt;p>&lt;code>Imagine running your favorite Windows applications and drivers in an open-source environment you can trust. That's ReactOS. Not just an Open but also a Free operating system. &lt;/code>&lt;/p>
&lt;p>很早就认识这个系统，不过她的稳定性还有可用性当然仍然是比较差的，只能算是技术的先行，不过我们还是要对他们的发展保持乐观的态度，&lt;/p>
&lt;p>而且刚好又认识了qemu这个仿真器，就不妨试试在qemu上运行一下这个系统啦。&lt;/p></description></item><item><title>配置IIS6+PHP5.6+MySQL5</title><link>/2016/08/iis6-mysql-php/</link><pubDate>Tue, 30 Aug 2016 18:19:00 +0000</pubDate><guid>/2016/08/iis6-mysql-php/</guid><description>&lt;p>受学院老师所托，从学校学院那边接手了一台托管在网络中心的windows server 2008服务器，并且要部署好php和mysql数据库的环境，虽然平时也是比较喜欢服务器运维的，不过是Linux方向，没怎么接触过windows server。
本来想直接重装个CentOS上去，不过好像以后可能还会有.net或者asp的东西会要用到，申请机房还比较麻烦，所以还是决定使用win server，感觉道理是差不多的，应该没有问题。&lt;/p>
&lt;p>之前管理的同学告知我wordpress连不上MySQL数据库，觉得是安装出了问题。然后登上服务器一看，发现原来的服务器充斥着phpstudy、xampp等一键部署的东西，文件乱放，没有统一固定的安置方式，网站源码也是D:\有一个，E:\有一个，
对于平时在linux上都是最小化安装的来说有种不能忍的感觉，而不能连MySQL也就是一个简单的端口占用问题，关启服务就已经正常了，不过觉得这种一键的方式还是很不好，
服务器的可扩展性和可维护性都太差了，所以觉得至少也需要每个服务独立部署，然后再集成。&lt;/p></description></item><item><title>在nginx中启用HSTS</title><link>/2016/08/enable-hsts-in-nginx/</link><pubDate>Tue, 23 Aug 2016 09:19:00 +0000</pubDate><guid>/2016/08/enable-hsts-in-nginx/</guid><description>&lt;p>从网上查阅资料可知，HTTP 严格传输安全（HSTS）是一种安全功能，web 服务器通过它来告诉浏览器仅用 HTTPS 来与之通讯，而不是使用 HTTP。&lt;/p>
&lt;p>而且其实现方法也是比较简单，只需要在http报文的头部增加一项&lt;code>Strict-Transport-Security&lt;/code>字段就可以了。&lt;/p>
&lt;p>相对于原来的将http请求通过301重定向到https相比，&lt;/p>
&lt;blockquote>
&lt;p>HSTS 可以用来抵御 SSL 剥离攻击。SSL 剥离攻击是中间人攻击的一种，由 Moxie Marlinspike 于2009年发明。他在当年的黑帽大会上发表的题为 “New Tricks For Defeating SSL In Practice” 的演讲中将这种攻击方式公开。SSL剥离的实施方法是阻止浏览器与服务器创建HTTPS连接。它的前提是用户很少直接在地址栏输入https://，用户总是通过点击链接或3xx重定向，从HTTP页面进入HTTPS页面。所以攻击者可以在用户访问HTTP页面时替换所有https://开头的链接为http://，达到阻止HTTPS的目的。&lt;/p>&lt;/blockquote>
&lt;blockquote>
&lt;p>HSTS可以很大程度上解决SSL剥离攻击，因为只要浏览器曾经与服务器创建过一次安全连接，之后浏览器会强制使用HTTPS，即使链接被换成了HTTP。&lt;/p>&lt;/blockquote>
&lt;blockquote>
&lt;p>另外，如果中间人使用自己的自签名证书来进行攻击，浏览器会给出警告，但是许多用户会忽略警告。HSTS解决了这一问题，一旦服务器发送了HSTS字段，用户将不再允许忽略警告。&lt;/p>&lt;/blockquote>
&lt;p>所以在本站的nginx中也添加了这个功能，实现只需要通过在https的&lt;code>server{ }&lt;/code>段里增加一项&lt;code>add_header Strict-Transport-Security &amp;quot;max-age=63072000; includeSubdomains; preload&amp;quot;;&lt;/code>即可，&lt;/p></description></item><item><title>使用jemalloc对nginx进行优化</title><link>/2016/08/optimize-nginx-jemalloc/</link><pubDate>Mon, 22 Aug 2016 12:19:00 +0000</pubDate><guid>/2016/08/optimize-nginx-jemalloc/</guid><description>&lt;p>jemalloc是比glibc中的malloc高效很多的内存管理方案。&lt;/p>
&lt;p>在nginx中也支持使用jemalloc进行内存管理，那更应该一试了。&lt;/p>
&lt;p>一、安装jemalloc&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>cd /opt/soft
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>wget https://github.com/jemalloc/jemalloc/releases/download/4.2.1/jemalloc-4.2.1.tar.bz2 -O jemalloc-4.2.1.tar.bz2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tar -xvf jemalloc-4.2.1.tar.bz2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd jemalloc-4.2.1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>./configure
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>make &lt;span style="color:#f92672">&amp;amp;&amp;amp;&lt;/span> make install_bin install_include install_lib
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#e6db74">&amp;#39;/usr/local/lib&amp;#39;&lt;/span> &amp;gt; /etc/ld.so.conf.d/local.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ldconfig
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>这样就应该安装完毕了。&lt;/p>
&lt;p>二、添加jemalloc tag重新编译nginx&lt;/p></description></item><item><title>对Jekyll博客的本地化优化</title><link>/2016/08/optimize-speedup-jekyll/</link><pubDate>Thu, 18 Aug 2016 14:53:00 +0000</pubDate><guid>/2016/08/optimize-speedup-jekyll/</guid><description>&lt;p>由于博客从ghost转到了jekyll，很多东西需要进行优化配置。首先从网上找一个比较适合自己的模板，在github上找到了&lt;a href="https://github.com/iamnii/wangana">wangana&lt;/a>这款模板，觉得挺合适，然后就clone下来开始了改造。&lt;/p>
&lt;p>首先是将一些不要的功能都精简掉，同时因为这个模板原来css、font、js等等的资源都是存在本地，考虑到这个主机是托管在国外一个128MB的迷你型VPS上(还要跑个nginx)，所以就将其能在国内找到CDN的资源，如jquery，bootstrap，fontawesome都从国内的公共CDN引用，然后再将主css传到七牛上，同时使用多说而不是disqus，同时找到了多说的完美https方案就用上了。&lt;/p>
&lt;p>然后发现fontawesome的性能依旧不是特别理想，所以再将fontawesome换成了iconfont。所以目前博客在国内完全刷新大概需要2s，握手交换传输主页这个时间差不多是极限了。&lt;/p>
&lt;p>最后再根据自己的需要增加了博客分页的功能，以后再根据需要作一下修正。&lt;/p>
&lt;p>国内有个阿里云学生版主机，不过快毕业了，可能就废弃了，这个国外便宜主机就留着慢慢渣干性能。&lt;/p></description></item><item><title>haproxy与nginx集成实例</title><link>/2016/08/haproxy-with-nginx/</link><pubDate>Wed, 17 Aug 2016 17:34:00 +0000</pubDate><guid>/2016/08/haproxy-with-nginx/</guid><description>&lt;p>一、nginx的配置文件(主要部分)如下：&lt;/p>
&lt;p>&lt;code>server1.conf&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-nginx" data-lang="nginx">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">server&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">listen&lt;/span> &lt;span style="color:#ae81ff">8189&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">server_name&lt;/span> 127.0.0.1;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">root&lt;/span> &lt;span style="color:#e6db74">/opt/nginx/html/php&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">index&lt;/span> &lt;span style="color:#e6db74">index.html&lt;/span> &lt;span style="color:#e6db74">index.htm&lt;/span> &lt;span style="color:#e6db74">index.php&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">location&lt;/span> ~ &lt;span style="color:#e6db74">\.php$&lt;/span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">fastcgi_pass&lt;/span> 127.0.0.1:&lt;span style="color:#ae81ff">9000&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">fastcgi_index&lt;/span> &lt;span style="color:#e6db74">index.php&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">fastcgi_param&lt;/span> &lt;span style="color:#e6db74">SCRIPT_FILENAME&lt;/span> $document_root$fastcgi_script_name;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">include&lt;/span> &lt;span style="color:#e6db74">fastcgi_params&lt;/span>;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>server2.conf&lt;/code>&lt;/p></description></item><item><title>博客已经换到Jekyll</title><link>/2016/08/change-to-jekyll/</link><pubDate>Tue, 16 Aug 2016 10:42:00 +0000</pubDate><guid>/2016/08/change-to-jekyll/</guid><description>&lt;p>从hexo到ghost又回到jekyll&lt;/p>
&lt;p>还是觉得jekyll这种本地管理的方式最适合自己，不过现在不再部署到github上了，而是通过rsync直接同步到自己的服务器上，感觉这样也不错，服务器的配置自己可控可写。&lt;/p></description></item><item><title>Resin4配置</title><link>/2016/08/resin4-config/</link><pubDate>Thu, 11 Aug 2016 11:34:00 +0000</pubDate><guid>/2016/08/resin4-config/</guid><description>&lt;p>Resin4配置文件发生了较大变化，分为：&lt;/p>
&lt;p>app-default.xml web应用配置
cluster-default.xml 集群配置
resin.xml
resin.properties 会被修改的变量&lt;/p>
&lt;p>一.删除/注释resin社区版本不支持的功能&lt;/p>
&lt;p>1.health：
修改resin.xml, 删除&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;lt;resin:import&lt;/span> &lt;span style="color:#a6e22e">path=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;${__DIR__}/health.xml&amp;#34;&lt;/span>&lt;span style="color:#f92672">/&amp;gt;&lt;/span> 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>2.LoadBalance
修改resin.xml, 删除&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;lt;web-app&lt;/span> &lt;span style="color:#a6e22e">id=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span>&lt;span style="color:#f92672">&amp;gt;&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;lt;resin:LoadBalance&lt;/span> &lt;span style="color:#a6e22e">regexp=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&amp;#34;&lt;/span> &lt;span style="color:#a6e22e">cluster=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;app&amp;#34;&lt;/span>&lt;span style="color:#f92672">/&amp;gt;&lt;/span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f92672">&amp;lt;/web-app&amp;gt;&lt;/span> 
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>ssh端口更改后rsync的用法</title><link>/2016/08/rsync-custom-ssh-port/</link><pubDate>Tue, 09 Aug 2016 11:04:00 +0000</pubDate><guid>/2016/08/rsync-custom-ssh-port/</guid><description>&lt;p>rsync有两种常用的认证方式，一种为rsync-daemon方式，另外一种则是ssh。
在一些场合，使用rsync-daemon方式会比较缺乏灵活性，ssh方式则成为首选。但是今天实际操作的时候发现当远端服务器的ssh默认端口被修改后，rsync时找不到一个合适的方法来输入对方ssh服务端口号。
在查看官方文档后，找到一种方法，即使用-e参数。
-e参数的作用是可以使用户自由选择欲使用的shell程序来连接远端服务器，当然也可以设置成使用默认的ssh来连接，但是这样我们就可以加入ssh的参数了。
具体语句写法如下：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>rsync -e &lt;span style="color:#e6db74">&amp;#39;ssh -p 1234&amp;#39;&lt;/span> username@hostname:SourceFile DestFile&lt;span style="color:#e6db74">`&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>从源码编译N(ginx)+M(ySQL)+P(HP)并安装WordPress</title><link>/2016/08/n-m-p-from-source/</link><pubDate>Fri, 05 Aug 2016 08:03:00 +0000</pubDate><guid>/2016/08/n-m-p-from-source/</guid><description>&lt;p>实习项目&lt;/p>
&lt;p>过程&lt;/p>
&lt;p>&lt;strong>1.下载&lt;a href="http://nginx.org/en/download.html%22">nginx-1.11.3&lt;/a>源码包并且编译。&lt;/strong>&lt;/p>
&lt;p>因为nginx HTTP rewrite module 需要PCRE包，同时其依赖的zlib本机也没有安装。所以一并下载源码包编译。&lt;/p>
&lt;p>其中遇到过一次错误，就是nginx依赖的是PCRE而不是PCRE2，在下载的时候需要区分清楚。&lt;/p>
&lt;p>PCRE和zlib编译安装过程比较简单，只需./configure好然后make make install即可。&lt;/p>
&lt;p>然后可以进入nginx编译过程。&lt;/p>
&lt;p>在./configure时需要添加好参数 &amp;ndash;with-pcre=PATH/TO/pcre  &amp;ndash;with-zlib=PATH/TO/zlib&lt;/p>
&lt;p>执行make make install 编译安装&lt;/p>
&lt;p>因为没有设定路径，所以安装在/usr/local/nginx目录&lt;/p>
&lt;p>修改conf目录下的nginx.conf文件&lt;/p>
&lt;p>要对公网开放，所以不能只监听localhost，将listen改成0.0.0.0:80&lt;/p>
&lt;p>经过测试，发现也是只有通过本地loop能访问，公网其它主机依然不能访问。初步判断是防火墙设定问题，为iptables添加80端口的ACCEPT规则之后问题解决。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>iptables -I INPUT -p tcp --dport &lt;span style="color:#ae81ff">80&lt;/span> -j ACCEPT
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>2.下载php 7.0.9源码包并进行编译&lt;/strong>&lt;/p>
&lt;p>因为从php7开始，&lt;code>./configure&lt;/code>参数中已经删除了&amp;quot;&amp;ndash;with-mysql&amp;quot;，换成了&amp;quot;&amp;ndash;enable-mysql&amp;quot;，所以&lt;code>./configure&lt;/code> 添加了&lt;code>--enable-mysql&lt;/code> 和 &lt;code>--enable-fpm&lt;/code>&lt;/p>
&lt;p>然后编译安装&lt;/p>
&lt;p>安装后需要修改&lt;code>/usr/local/etc&lt;/code>下的&lt;code>php-fpm.conf&lt;/code>，将&lt;code>include&lt;/code>参数设定为&lt;code>php-fpm.d&lt;/code>下的所有.conf文件，并且修改&lt;code>php-fpm.d&lt;/code>目录下的&lt;code>www.conf&lt;/code>&lt;/p>
&lt;p>再通过修改nginx配置文件&lt;code>nignx.conf&lt;/code>以支持fastcgi，期间遇到错误就是通过URL访问php文件时没有执行而是直接下载。通过查阅配置文件以及文档，确定是nginx配置文件中fastcgi中的项参数&lt;code>SCRIPT_FILENAME&lt;/code>配置不正确，将其修改成绝对路径+脚本名字的形式/usr/local/nginx/html$fastcgi_script_name问题解决。&lt;/p>
&lt;p>&lt;strong>3.编译安装MySQL5.7.14&lt;/strong>&lt;/p>
&lt;p>MySQL的编译安装应该是最麻烦的一步，因为本机已经运行了一个mysqld实例，所以需要额外设定一些参数以避免冲突。&lt;/p>
&lt;p>首先，编译安装MySQL需要使用cmake，所以先编译安装好cmake，过程比较简单，不过要执行的是&lt;code>./bootstrap&lt;/code> 而不是&lt;code>./configure&lt;/code> &lt;code>make&lt;/code>过程使用&lt;code>gmake&lt;/code> &lt;code>gmake install&lt;/code>&lt;/p>
&lt;p>然后编译安装好依赖包ncurses即可开始配置MySQL&lt;/p>
&lt;p>第一次编译安装的时候就是因为参数配置失误，使得安装之后执行mysql遇到了&lt;code>&amp;quot;segmentation fault (core dumped)&amp;quot;&lt;/code>的问题。第一次是因为只设定了&lt;code>&amp;lt;span class=&amp;quot;pun&amp;quot;&amp;gt;-&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;pln&amp;quot;&amp;gt;DDEFAULT_CHARSET&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;pun&amp;quot;&amp;gt;=&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;pln&amp;quot;&amp;gt;utf8mb4&lt;/code>而没有设定&lt;code>DDEFAULT_COLLATION&lt;/code>参数，在&lt;code>initialize&lt;/code>过程中遇到&lt;code>&amp;quot;collation 'latin1_swedish_ci' is not valid for character set 'utf8mb4'&amp;quot;&lt;/code>错误，然后强行修改&lt;code>my.cnf&lt;/code>文件之后&lt;code>initialize&lt;/code>通过，能开启mysqld服务，但是客户端每次登录都会报错。&lt;/p>
&lt;p>所以第二次重装编译安装，将参数设定好。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>cmake &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DCMAKE_INSTALL_PREFIX&lt;span style="color:#f92672">=&lt;/span>/usr/local/mysql57 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DMYSQL_UNIX_ADDR&lt;span style="color:#f92672">=&lt;/span>/usr/local/mysql5714/mysql57.sock &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DDEFAULT_CHARSET&lt;span style="color:#f92672">=&lt;/span>utf8mb4 &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DDEFAULT_COLLATION&lt;span style="color:#f92672">=&lt;/span>utf8mb4_general_ci &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DWITH_INNOBASE_STORAGE_ENGINE&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DWITH_ARCHIVE_STORAGE_ENGINE&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DWITH_BLACKHOLE_STORAGE_ENGINE&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">1&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DMYSQL_DATADIR&lt;span style="color:#f92672">=&lt;/span>/var/mysql/data &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DMYSQL_TCP_PORT&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">23306&lt;/span> &lt;span style="color:#ae81ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ae81ff">&lt;/span>-DWITH_BOOST&lt;span style="color:#f92672">=&lt;/span>boost
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>然后mysqld以及mysql均正常。&lt;/p></description></item><item><title>MPEG4视频中，I帧、p帧、B帧的判定（转载）</title><link>/2016/07/mpeg4-i-b-p-frame/</link><pubDate>Wed, 27 Jul 2016 09:37:00 +0000</pubDate><guid>/2016/07/mpeg4-i-b-p-frame/</guid><description>&lt;p>mpeg4的每一帧开头是固定的：00 00 01 b6，那么我们如何判断当前帧属于什么帧呢？在接下来的2bit，将会告诉我们答案。注意：是2bit，不是byte，下面是各类型帧与2bit的对应关系：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ini" data-lang="ini">&lt;span style="display:flex;">&lt;span>　　&lt;span style="color:#a6e22e">00: I Frame&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>　　&lt;span style="color:#a6e22e">01: P Frame&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>　　&lt;span style="color:#a6e22e">10: B Frame　&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>为了更好地说明，我们举几个例子，以下是16进制显示的视频编码：&lt;/p></description></item><item><title>使用attrib命令解决存储器中毒后文件夹被隐藏的方法</title><link>/2016/06/autorun-virus/</link><pubDate>Tue, 21 Jun 2016 14:51:00 +0000</pubDate><guid>/2016/06/autorun-virus/</guid><description>&lt;p>U盘中了某种文件夹类型的病毒，特别是autorun病毒。杀了毒之后U中的文件夹都被隐藏了。&lt;/p>
&lt;p>介绍一个使用attrib命令解决存储器中毒后文件夹被隐藏的方法。
原理是autorun病毒会将原来U盘中的文件和文件夹设置为“系统文件”和“隐藏文件”属性，而一般Windows系统会隐藏“系统文件”。所以只需要使用attrib命令将文件和文件夹设定为初始的一般属性即可。&lt;/p>
&lt;p>命令使用方法：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>attrib c:\&lt;span style="color:#960050;background-color:#1e0010">”&lt;/span>*&lt;span style="color:#960050;background-color:#1e0010">”&lt;/span> -s -h /s /d
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>其中C为U盘盘符&lt;/p>
&lt;p>拓展阅读：attrib命令详解&lt;/p></description></item><item><title>解决仙剑3免CD补丁在64位系统不能正常工作的问题</title><link>/2016/06/pal3-in-64bit/</link><pubDate>Thu, 09 Jun 2016 14:30:00 +0000</pubDate><guid>/2016/06/pal3-in-64bit/</guid><description>&lt;p>从旧硬盘里导出了以前玩过的仙剑3，发现提示要我Insert DISC了，感觉是免CD补丁出了问题，分析了一下，应该是游戏太过久远免CD补丁没有考虑到现在新出的WIN8，WIN10 64位系统，所以只要将补丁新增一个64位系统的支持即可了。&lt;/p>
&lt;p>修改后完整reg文件如下：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-powershell" data-lang="powershell">&lt;span style="display:flex;">&lt;span>Windows Registry Editor Version &lt;span style="color:#ae81ff">5.00&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[HKEY_LOCAL_MACHINE\SOFTWARE\SOFTSTAR\PAL3]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">&amp;#34;CDriver&amp;#34;&lt;/span>=&lt;span style="color:#e6db74">&amp;#34;.&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SOFTSTAR\PAL3]
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#e6db74">&amp;#34;CDriver&amp;#34;&lt;/span>=&lt;span style="color:#e6db74">&amp;#34;.&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>C# 如何给Winform的button等控件添加快捷键</title><link>/2016/06/winform-key-program/</link><pubDate>Tue, 07 Jun 2016 15:54:00 +0000</pubDate><guid>/2016/06/winform-key-program/</guid><description>&lt;p>第一种：Alt + *(按钮快捷键)&lt;/p>
&lt;p>在大家给button、label、menuStrip等控件设置Text属性时在名字后边加&amp;amp;键名就可以了,
比如&lt;code>button1.text= &amp;quot;确定(&amp;amp;O)&amp;quot;&lt;/code>。就会有快捷键了，这时候按Alt+O就可以执行按钮单击事件。&lt;/p>
&lt;p>第二种：Ctrl+*及其他组合键&lt;/p>
&lt;p>在WinForm中设置要使用组合键的窗体的KeyPreview(向窗体注册键盘事件)属性为True;&lt;/p>
&lt;p>然后使用窗体的KeyDown事件(在首次按下某个键时发生).&lt;/p>
&lt;p>实例代码：&lt;/p></description></item><item><title>切换至Let's Encrypt</title><link>/2016/06/change-to-lets-encrypt/</link><pubDate>Fri, 03 Jun 2016 07:35:00 +0000</pubDate><guid>/2016/06/change-to-lets-encrypt/</guid><description>&lt;p>由于Let&amp;rsquo;s Encrypt开源签名已经越来越成熟，所以已将本站的安装证书切换至Let&amp;rsquo;s Encrypt提供的证书。&lt;/p></description></item><item><title>kmskeys10</title><link>/2016/05/kmskeys10/</link><pubDate>Sat, 07 May 2016 11:34:00 +0000</pubDate><guid>/2016/05/kmskeys10/</guid><description>&lt;p>Windows.10.and.Office.2016.gVLK&lt;/p>
&lt;p>&lt;a href="https://technet.microsoft.com/en-us/library/jj612867.aspx?lc=1033">https://technet.microsoft.com/en-us/library/jj612867.aspx?lc=1033&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ini" data-lang="ini">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Professional W269N-WFGWX-YVC9B-4J6C9-T83GX&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Professional N MH37W-N47XK-V7XM9-C7227-GCQG9&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Education NW6C2-QMPVW-D7KKK-3GKT6-VCFB2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Education N 2WH4N-8QGBV-H22JP-CT43Q-MDWWJ&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Enterprise NPPR9-FWDCX-D2C8J-H872K-2YT43&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Enterprise N DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Enterprise 2015 LTSB WNMTR-4C88C-JK8YV-HQ7T2-76DF9&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Enterprise 2015 LTSB N 2F77B-TNFGY-69QQF-B8YKP-D69TJ&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Home - TX9XD-98N7V-6WMQ6-BX7FG-H8Q99&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Home N - 3KHY7-WNT83-DGQKR-F7HPR-844BM&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Home Single Language - 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">Windows 10 Home Country Specific - PVMJN-6DFY6-9CCP6-7BKTT-D3WVR&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>C# Random 生成不重复随机数</title><link>/2016/05/create-random-in-c-sharp/</link><pubDate>Wed, 04 May 2016 14:42:00 +0000</pubDate><guid>/2016/05/create-random-in-c-sharp/</guid><description>&lt;h2 id="方法一以系统时间作为随机因子">方法一：以系统时间作为随机因子&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-csharp" data-lang="csharp">&lt;span style="display:flex;">&lt;span>Random ro = &lt;span style="color:#66d9ef">new&lt;/span> Random(&lt;span style="color:#ae81ff">10&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">long&lt;/span> tick = DateTime.Now.Ticks;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Random ran = &lt;span style="color:#66d9ef">new&lt;/span> Random((&lt;span style="color:#66d9ef">int&lt;/span>)(tick &amp;amp; &lt;span style="color:#ae81ff">0xffffffffL&lt;/span>) | (&lt;span style="color:#66d9ef">int&lt;/span>) (tick &amp;gt;&amp;gt; &lt;span style="color:#ae81ff">32&lt;/span>));
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>这样可以保证99%不是一样。
之后，我们就可以使用这个Random类的对象来产生随机数，这时候要用到Random.Next()方法。这个方法使用相当灵活，你甚至可以指定产生的随机数的上下限。&lt;/p>
&lt;p>不指定上下限的使用如下：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-csharp" data-lang="csharp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">int&lt;/span> iResult;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>iResult=ro.Next();
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>发布两款Chrome平台应用</title><link>/2016/05/release-chrome-web-apps/</link><pubDate>Tue, 03 May 2016 01:10:00 +0000</pubDate><guid>/2016/05/release-chrome-web-apps/</guid><description>&lt;p>1.Shadowsocks
&lt;a href="https://chrome.google.com/webstore/detail/shadowsocks/fnhhahhihediajgefcnlpdmnogndblbi">https://chrome.google.com/webstore/detail/shadowsocks/fnhhahhihediajgefcnlpdmnogndblbi&lt;/a>&lt;/p>
&lt;p>2.Netease Music
&lt;a href="https://chrome.google.com/webstore/detail/netease-music/fogcjafchgdhdoieggbeldnckbghdpkn">https://chrome.google.com/webstore/detail/netease-music/fogcjafchgdhdoieggbeldnckbghdpkn&lt;/a>&lt;/p>
&lt;p>在Chrome官方商店即可搜索下载&lt;/p></description></item><item><title>Windows SDK 10.0.10586.15 离线安装包</title><link>/2016/03/win10-sdk-bdcloud-dl/</link><pubDate>Tue, 22 Mar 2016 08:38:00 +0000</pubDate><guid>/2016/03/win10-sdk-bdcloud-dl/</guid><description>&lt;p>在校园网使用VS安装程序更新Windows SDK经常会出现哈希校验错误，所以上传了离线安装程序方便使用&lt;/p>
&lt;p>下载地址：http://pan.baidu.com/s/1eRqYl5w&lt;/p></description></item><item><title>解决OSX系统Safari的主页被恶意篡改为search-quick.com的问题</title><link>/2016/03/fix-osx-search-quick-virus/</link><pubDate>Sat, 19 Mar 2016 15:11:00 +0000</pubDate><guid>/2016/03/fix-osx-search-quick-virus/</guid><description>&lt;p>1.在 &lt;code>/Library/LaunchDeamons&lt;/code> 找到名如 &lt;code>com.&amp;quot;abc&amp;quot;.deamon.plist&lt;/code> 和 &lt;code>com.&amp;quot;abc&amp;quot;.helper.plist&lt;/code> 的两个文件并删除掉；
2.在 &lt;code>/Library/LaunchAgents&lt;/code> 找到名如 &lt;code>com.&amp;quot;abc&amp;quot;.agent.plist&lt;/code> 的文件并删除掉；
3.在 &lt;code>/Library/Application Support&lt;/code> 找到名如 &amp;ldquo;abc&amp;rdquo; 的文件夹并删除掉；
4.在 &lt;code>/System/Library/Frameworks&lt;/code> 里找到 &lt;code>.framwork&lt;/code> 或者 &lt;code>vmnet.framwork&lt;/code> 的文件夹并删除掉；
5.重启电脑&lt;/p>
&lt;p>其中&amp;quot;abc&amp;quot;是一个随机的字符串，类似一个软件的名字&lt;/p>
&lt;p>这个问题是由于安装了不明软件造成的，所以在安装软件时应该格外小心，注意验证软件来源的可靠性。&lt;/p></description></item><item><title>为网站添加了SSL证书</title><link>/2016/01/add-ssl-for-the-website/</link><pubDate>Mon, 25 Jan 2016 11:12:00 +0000</pubDate><guid>/2016/01/add-ssl-for-the-website/</guid><description>&lt;p>#现在访问网站可以使用HTTPS的安全连接了。&lt;/p>
&lt;p>使用的是StartSSL的免费证书。&lt;/p>
&lt;p>现在网上流传的使用StartSSL教程很多已经过期，自己折腾了很久才正确用上。&lt;/p>
&lt;p>以后可以用https://hkl.jnuer.com/ 来访问咯&lt;/p></description></item><item><title>解决Archlinux系统Flash乱码</title><link>/2016/01/archlinux-flash-fonts/</link><pubDate>Fri, 22 Jan 2016 05:20:00 +0000</pubDate><guid>/2016/01/archlinux-flash-fonts/</guid><description>&lt;p>1.安装文泉驿字体&lt;/p>
&lt;pre tabindex="0">&lt;code> # pacman -S wqy-zhenhei
&lt;/code>&lt;/pre>&lt;p>2.用你的编辑器，打开并修改 /etc/fonts/conf.d/49-sansserif.conf ，修改内容为以下：&lt;/p></description></item><item><title>New to Ghost</title><link>/2016/01/new-to-ghost/</link><pubDate>Thu, 14 Jan 2016 05:51:00 +0000</pubDate><guid>/2016/01/new-to-ghost/</guid><description>&lt;p>This blog system is really awesome!
旧站内容已经封存不再使用，全面切换至新网站。&lt;/p>
&lt;p>旧站信息将以html静态页面保存到http://huangkunlun.cn, 但是不再保证图片能正常显示。其精品内容将会在以后转至新网站中！&lt;/p></description></item><item><title>Monkey's Audio vs. WavPack vs. FLAC</title><link>/2013/09/ape-vs-flac/</link><pubDate>Thu, 05 Sep 2013 09:58:00 +0000</pubDate><guid>/2013/09/ape-vs-flac/</guid><description>&lt;p>Background (背景)&lt;/p>
&lt;p>For a long time I&amp;rsquo;ve been thinking about getting a HTPC running Windows Media Center Edition. I&amp;rsquo;m not quite there yet for various reasons. However, one of the problems I&amp;rsquo;m trying to solve is what to do with my music collection. I recently bought some very decent loudspeakers, and now my CD collection is growing again.&lt;/p>
&lt;p>For the HTPC one could argue that space is not really an issue. With a 750 GB harddrive I can probably store somewhere between 1.000 and 1.500 uncompressed CD&amp;rsquo;s. The first problem is, I also need space for more demanding content: Video recordings. Secondly, I need a format that can be transfered to my portable music player. Finally, WAV lacks tag support, i.e. no metadata for the music files.&lt;/p>
&lt;p>Sorry about the messy state this article is in. I never got around to finishing it, so I&amp;rsquo;ll just publish as it is.&lt;/p>
&lt;p>（原作者大概是想要给家里添一台htpc,但是750G的硬盘可能不能放完ta的wav格式的唱片「应该是正版，我们不用考虑这东西」，所以就作者开始找个较好的无损音频压缩格式了）&lt;/p></description></item><item><title>彻底屏蔽优酷广告</title><link>/2013/08/block-youku-ads/</link><pubDate>Mon, 12 Aug 2013 12:52:00 +0000</pubDate><guid>/2013/08/block-youku-ads/</guid><description>&lt;p>不久之前网络上有一个通过修改Hosts来屏蔽各大视频网站广告的方法，谁想到优酷嗅觉灵敏，很快推出了反屏蔽的策略——即便不看广告也会有30秒的黑屏等待。正所谓“道高一尺，魔高一丈”，广大电工又研究出了反“反屏蔽”的方法……&lt;/p></description></item><item><title>Writting from Archlinux</title><link>/2013/08/writting-from-archlinux/</link><pubDate>Mon, 12 Aug 2013 07:57:00 +0000</pubDate><guid>/2013/08/writting-from-archlinux/</guid><description>&lt;p>从Archlinux进行发文测试,看来在Linux下nodejs的兼容性比win下好多了..&lt;/p>
&lt;p>有了&lt;a href="https://github.com/tommy351/hexo">hexo&lt;/a>之后跨平台写博显得方便了许多.&lt;/p></description></item><item><title>备案成功</title><link>/2013/08/beian/</link><pubDate>Sun, 11 Aug 2013 21:18:00 +0000</pubDate><guid>/2013/08/beian/</guid><description>&lt;p>经过一番努力，本网站终于得到一个有中国网站特色的东西————备案号。。。&lt;/p>
&lt;p>这算是从良了吧，今后定不再折腾，认真写写抄抄博客。。&lt;/p>
&lt;p>但本网站还是打算挂在&lt;a href="http://github.io">github pages&lt;/a>上，毕竟这样发文更加方便，就用国内的cdn加速好了。。&lt;/p></description></item><item><title>读书笔记&amp;lt;麦田里的守望者&amp;gt;</title><link>/2013/08/catcher-in-the-rye/</link><pubDate>Wed, 07 Aug 2013 17:36:00 +0000</pubDate><guid>/2013/08/catcher-in-the-rye/</guid><description>&lt;p>知道这本书已经有好几年了，但直到这个月真正的阅读它。当我看完后，心中有个疑惑，直到查阅了相关资料才得到了证实——这正是上世纪六十年代反战主义浪潮最蓬勃的时代。&lt;/p>
&lt;p>主角霍尔顿是个叛逆的美国中学生，对于一切都抱着憎厌——包括自己。在他看来，都是虚伪、残忍和暴力的，所有的都是这样。&lt;/p>
&lt;p>他是一个高高瘦瘦的男生，就读于一所好学校，却受不了那些虚伪的&amp;quot;伪君子&amp;quot;，所有的都是，一切都让他无法忍受。在被开除了以后，他呆在了汽车旅馆，看到了人的黑暗面——人前俨然君子，人后却有穿女人衣服的怪癖；长得很漂亮的女人，却总是热衷于和男人赤裸着身体互相吐水。接着是他的前女友，又是一个标准的&amp;quot;假模假式&amp;quot;的人，看着无聊的戏剧都&amp;quot;假模假式&amp;quot;的笑，和一个&amp;quot;假模假式&amp;quot;的高才生聊着&amp;quot;假模假式&amp;quot;的话题。他又和以前高中时辅导员在酒吧聊天，听着她聪明的头脑说着&amp;quot;假模假式&amp;quot;的话，作着&amp;quot;假模假式&amp;quot;的事情。&lt;/p></description></item><item><title>《千与千寻》这部作品最成功的地方</title><link>/2013/07/spirited-away/</link><pubDate>Tue, 30 Jul 2013 21:08:00 +0000</pubDate><guid>/2013/07/spirited-away/</guid><description>&lt;p>刚刚又看完了一遍千与千寻..也忘记了是第几次看了&amp;hellip;不过每次看完不像其它的电影一样,都是那种感受&amp;hellip;&lt;/p>
&lt;p>当一次又一次地看完这部电影时.每次都是不同的年龄阶段去看..都有不同的感受&amp;hellip; 这部电影所带来的..确实不一般&amp;hellip; 比起那些所谓的欧美大片./不点名了&amp;hellip;.还是这种朴素,纯真的电影好看&lt;/p>
&lt;p>&lt;strong>《千与千寻》这部作品最成功的地方 《千与千寻》给人们的一些暗示:&lt;/strong>&lt;/p></description></item><item><title>八款基于Firefox的浏览器</title><link>/2013/07/8-based-on-firefox/</link><pubDate>Mon, 29 Jul 2013 15:41:00 +0000</pubDate><guid>/2013/07/8-based-on-firefox/</guid><description>&lt;h2 id="1waterfox">1.&lt;a href="http://www.waterfoxproject.org/">WaterFox&lt;/a>&lt;/h2>
&lt;p>Waterfox是64-bit平台上基于firefox源代码的编译版本，而且兼容32-bit的插件&lt;/p>
&lt;p>&lt;img src="http://photo.fanpou.com/f/p/" alt="alt text">&lt;/p></description></item><item><title>Unlock a VBA password protected Excel file</title><link>/2013/07/unlock-vba-password/</link><pubDate>Sun, 28 Jul 2013 07:41:00 +0000</pubDate><guid>/2013/07/unlock-vba-password/</guid><description>&lt;h2 id="unlock-a-vba-password-protected-excel-file">Unlock a VBA password protected Excel file&lt;/h2>
&lt;p>##（怎样解除受VBA密码保护的Excel文件）&lt;/p>
&lt;blockquote>
&lt;p>Ever felt the need to open a VBA protected excel file… maybe one of your old files that contained an excellent routine! How do you come out of that pain?&lt;/p>&lt;/blockquote>
&lt;h2 id="当你想要打开一个vba加密的文件这篇文章可能会帮助到你">当你想要打开一个VBA加密的文件。这篇文章可能会帮助到你。。&lt;/h2></description></item><item><title>在Ubuntu使用TOR遇到Vidalia detected that the tor software exited unexpectedly解决方案</title><link>/2013/07/vidalia-unexpectedly/</link><pubDate>Sat, 27 Jul 2013 21:30:00 +0000</pubDate><guid>/2013/07/vidalia-unexpectedly/</guid><description>&lt;p>If you are reading this, its because you have installed Tor and Vidalia in Ubuntu (or Debian) and found out that they do not play nice together.&lt;/p>
&lt;p>当你看到这往篇文章的时候。大概是因为你在Ubuntu或者Debian时遇到Vidalia detected that the tor software exited unexpectedly吧。而且英文不太好。&lt;/p>
&lt;p>You probably got an error:看好了，大概就是这个样子吧！&lt;/p>
&lt;p>![alt text][logo]
[logo]: &lt;a href="http://m1.img.libdd.com/farm5/1/6308D60663F91957414B4E0924B3FF01_500_453.jpg">http://m1.img.libdd.com/farm5/1/6308D60663F91957414B4E0924B3FF01_500_453.jpg&lt;/a> &amp;ldquo;Vidalia detected that the tor software exited unexpectedly.&amp;rdquo;&lt;/p>
&lt;blockquote>
&lt;p>Vidalia detected that the tor software exited unexpectedly.&lt;/p>&lt;/blockquote>
&lt;blockquote>
&lt;p>Please check the message log for recent warning or error messages.&lt;/p></description></item><item><title>kde安装gtk主题(kde-gtk-theme)KDE4下gtk程序美化</title><link>/2013/07/kde-gtk-theme/</link><pubDate>Sat, 27 Jul 2013 16:31:00 +0000</pubDate><guid>/2013/07/kde-gtk-theme/</guid><description>&lt;p>默认安装的kde桌面使用gtk程序很难看,原因是没装主题 (KDE 4 Theme Integration with GTK Applications)&lt;/p>
&lt;p>以下为在Archlinux中KDE美化gtk程序的方法。其它Linux发行版方法雷同。&lt;/p>
&lt;p>To better integrate GTK and KDE 4 themes, you can use &lt;code>QtCurve&lt;/code> and(or) &lt;code>oxygen-gtk&lt;/code>&lt;/p>
&lt;p>首先安装 QtCurve 或 oxygen-gtk&lt;/p>
&lt;p>&lt;code>#pacman -S qtcurve-gtk2 qtcurve-kde4 gtk-kde4&lt;/code>&lt;/p>
&lt;p>然后安装 gtk-chtheme&lt;/p>
&lt;p>&lt;code>#pacman -S gtk-chtheme&lt;/code>&lt;/p>
&lt;p>打开 gtk-chtheme 更换主题即可&lt;/p>
&lt;p>&lt;code>gtk-chtheme&lt;/code>&lt;/p></description></item><item><title>谷歌GAE应用盘点</title><link>/2013/07/gae-applications/</link><pubDate>Tue, 23 Jul 2013 09:02:00 +0000</pubDate><guid>/2013/07/gae-applications/</guid><description>&lt;h1 id="博客类">博客类&lt;/h1>
&lt;h2 id="1micolog">1.Micolog&lt;/h2>
&lt;p>&lt;a href="https://github.com/xuming/micolog">https://github.com/xuming/micolog&lt;/a>&lt;/p>
&lt;h2 id="2b3log-solo">2.B3log Solo&lt;/h2></description></item><item><title>解决fedora启动时显示cannot open font file true的办法</title><link>/2013/07/fedora-font/</link><pubDate>Mon, 22 Jul 2013 22:00:00 +0000</pubDate><guid>/2013/07/fedora-font/</guid><description>&lt;h3 id="to-get-rid-of-cannot-open-font-file-true">To get rid of &amp;ldquo;cannot open font file true&amp;rdquo;&lt;/h3>
&lt;p>打开&lt;code>/etc/default/grub&lt;/code> 文件 (&lt;code># nano /etc/default/grub&lt;/code>)&lt;/p>
&lt;p>将&lt;code>GRUB_CMDLINE_LINUX=&lt;/code>行中的&lt;code>SYSFONT=True&lt;/code> 改为 &lt;code>SYSFONT=latarcyrheb-sun16&lt;/code> ；&lt;/p>
&lt;p>保存退出；&lt;/p>
&lt;p>运行命令：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grub2-mkconfig -o /boot/grub2/grub.cfg
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>然后reboot (&lt;code># reboot&lt;/code>)&lt;/p>
&lt;p>问题即可解决。&lt;/p></description></item><item><title>About Me</title><link>/contact/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/contact/</guid><description>&lt;h4 id="welcome">Welcome!&lt;/h4>
&lt;p>My Linkedin: &lt;a href="https://www.linkedin.com/in/huangkl/">www.linkedin.com/in/huangkl/&lt;/a>&lt;/p>
&lt;p>MSTP via HK to Internet: &lt;a href="">Temporary Unavailable&lt;/a>&lt;/p>
&lt;p>Guangzhou,China&lt;/p>
&lt;p>📧Email Address:&lt;/p>
&lt;p>PGP&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-txt" data-lang="txt">&lt;span style="display:flex;">&lt;span>-----BEGIN PGP PUBLIC KEY BLOCK-----
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>xjMEaGPddhYJKwYBBAHaRw8BAQdA6AeW37R2YlLMQVcGaaULNTbq+br5UrJQ
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>WJa8sYJAY4fNF2R1Y2ttYWlsIDxoa2xAZHVjay5jb20+wowEEBYKAD4Fgmhj
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>3XYECwkHCAmQpQCXxsl2phwDFQgKBBYAAgECGQECmwMCHgEWIQRAXhdUhaZn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>kgEyhM2lAJfGyXamHAAA6+QBANhZvCQduGEv6mVe9LrV9s6RR9Dgf8Pq6IX0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FmgRMpY4AP9xAblMjh7+yCahvaNrvGd6SdwHSVpRb0cF1NdMgkd0C844BGhj
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>3XYSCisGAQQBl1UBBQEBB0B+0XMIilxXwdqGFxWZVRPsExhEsyu9YaqbPtzJ
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>7co6FwMBCAfCeAQYFgoAKgWCaGPddgmQpQCXxsl2phwCmwwWIQRAXhdUhaZn
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>kgEyhM2lAJfGyXamHAAAg9kBAPtVXkI+YpJnc8rN6xXcA8IYT1g+DRiNS3uR
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>QaXYjVnzAQD2o1p0LGy6sJwdKxIPG9AdkRjtZDILjEFbXah5Uaa1Aw==
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>=/GKd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-----END PGP PUBLIC KEY BLOCK-----
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="comment">Comment&lt;/h4>
&lt;p>For comments, please send me 📧an email or &lt;a href="https://github.com/hkwk/hkwk.github.io/issues">left it on Github&lt;/a>.&lt;/p></description></item><item><title>Apply for Riseup Invitation Code</title><link>/page/apply-riseup-code/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/page/apply-riseup-code/</guid><description>&lt;p>In&lt;/p>
&lt;p>&lt;a href="https://szo.cc/page/apply-riseup-code/">https://szo.cc/page/apply-riseup-code/&lt;/a>&lt;/p>
&lt;p>Please leave your email address here, and I will send you the invitation code when I am free.&lt;/p></description></item><item><title>Domain Sales</title><link>/page/domainsales/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/page/domainsales/</guid><description>&lt;p>Domain Sales&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Domain(s)&lt;/th>
 &lt;th>Prince(In CNY)&lt;/th>
 &lt;th>Status&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>xou.net&lt;/td>
 &lt;td>6666&lt;/td>
 &lt;td>&lt;a href="https://mi.aliyun.com/domain-detail?domain=xou.net">https://mi.aliyun.com/domain-detail?domain=xou.net&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>vnf.cc&lt;/td>
 &lt;td>999&lt;/td>
 &lt;td>Already Sold&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>jnuer.com&lt;/td>
 &lt;td>999&lt;/td>
 &lt;td>Already Sold&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>wtto.cn&lt;/td>
 &lt;td>230&lt;/td>
 &lt;td>&lt;a href="https://mi.aliyun.com/domain-detail?domain=wtto.cn">https://mi.aliyun.com/domain-detail?domain=wtto.cn&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>ut.wiki&lt;/td>
 &lt;td>580&lt;/td>
 &lt;td>&lt;a href="https://mi.aliyun.com/domain-detail?domain=ut.wiki">https://mi.aliyun.com/domain-detail?domain=ut.wiki&lt;/a>&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table></description></item><item><title>Math Test</title><link>/page/mathtest/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/page/mathtest/</guid><description>&lt;p>This is an inline \(a^*=x-b^*\) equation.&lt;/p>
&lt;p>These are block equations:&lt;/p>
\[a^*=x-b^*\]\[ a^*=x-b^* \]\[
a^*=x-b^*
\]&lt;p>These are also block equations:&lt;/p>
$$a^*=x-b^*$$$$ a^*=x-b^* $$$$
a^*=x-b^*
$$$$C_p[\ce{H2O(l)}] = \pu{75.3 J // mol K}$$</description></item><item><title>SS</title><link>/page/ss/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/page/ss/</guid><description>&lt;p>MSTP&lt;/p></description></item><item><title>搜索</title><link>/search/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/search/</guid><description/></item></channel></rss>