<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[泛小栈]]></title><description><![CDATA[<coding>]]></description><link>http://www.dev-f.cn/</link><image><url>http://www.dev-f.cn/favicon.png</url><title>泛小栈</title><link>http://www.dev-f.cn/</link></image><generator>Ghost 5.79</generator><lastBuildDate>Fri, 02 Oct 2026 07:58:31 GMT</lastBuildDate><atom:link href="http://www.dev-f.cn/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[浮点数乘以100也会有问题]]></title><description><![CDATA[<p>&#x4E4B;&#x524D;&#x4E00;&#x76F4;&#x77E5;&#x9053;&#x6D6E;&#x70B9;&#x6570;&#x4E4B;&#x95F4;&#x52A0;&#x51CF;&#x4E58;&#x9664;&#x53EF;&#x80FD;&#x6709;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x662F;&#x4E00;&#x76F4;&#x8BA4;&#x4E3A;&#x4E58;&#x4EE5;100&#xFF0C;&#x9664;&#x4EE5;100&#x8FD9;&#x79CD;&#x4E0D;&#x5E94;&#x8BE5;&#x6709;&#x95EE;&#x9898;&#x3002;</p><p>&#x4F46;&#x4ECA;&#x5929;&#x53D1;&#x73B0;&#x4E2A;&#x6570;</p>]]></description><link>http://www.dev-f.cn/fu-dian-shu-cheng-yi-100ye-hui-you-wen-ti/</link><guid isPermaLink="false">6abb76228745fb0001cce7df</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Tue, 29 Sep 2026 08:28:39 GMT</pubDate><content:encoded><![CDATA[<p>&#x4E4B;&#x524D;&#x4E00;&#x76F4;&#x77E5;&#x9053;&#x6D6E;&#x70B9;&#x6570;&#x4E4B;&#x95F4;&#x52A0;&#x51CF;&#x4E58;&#x9664;&#x53EF;&#x80FD;&#x6709;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x662F;&#x4E00;&#x76F4;&#x8BA4;&#x4E3A;&#x4E58;&#x4EE5;100&#xFF0C;&#x9664;&#x4EE5;100&#x8FD9;&#x79CD;&#x4E0D;&#x5E94;&#x8BE5;&#x6709;&#x95EE;&#x9898;&#x3002;</p><p>&#x4F46;&#x4ECA;&#x5929;&#x53D1;&#x73B0;&#x4E2A;&#x6570;&#x5B57;4.35*100&#x4E0D;&#x7B49;&#x4E8E;435&#xFF0C;&#x800C;&#x662F;434.99999999999994</p>]]></content:encoded></item><item><title><![CDATA[k8s批量查看pods cpu request]]></title><description><![CDATA[<pre><code class="language-bash">#!/bin/bash
kubectl get pods -A --field-selector=&apos;status.phase==Running,spec.nodeName=xxx&apos; -o=jsonpath=&apos;console.log([{range .items[*]}{&quot;{&quot;}&quot;name&quot;:&quot;{.metadata.name}&quot;,&quot;containers&quot;:[{range .spec.containers[*]}{&quot;{&quot;}&quot;name&quot;:&quot;{.name}&quot;,&quot;cpu_requests&quot;:&quot;</code></pre>]]></description><link>http://www.dev-f.cn/k8spi-liang-cha-kan-pods-limit/</link><guid isPermaLink="false">66dfb6b08745fb0001cce7d2</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Tue, 10 Sep 2024 03:02:55 GMT</pubDate><content:encoded><![CDATA[<pre><code class="language-bash">#!/bin/bash
kubectl get pods -A --field-selector=&apos;status.phase==Running,spec.nodeName=xxx&apos; -o=jsonpath=&apos;console.log([{range .items[*]}{&quot;{&quot;}&quot;name&quot;:&quot;{.metadata.name}&quot;,&quot;containers&quot;:[{range .spec.containers[*]}{&quot;{&quot;}&quot;name&quot;:&quot;{.name}&quot;,&quot;cpu_requests&quot;:&quot;{.resources.requests.cpu}&quot;},{end}]},{end}].map(pod=&gt;{&quot;{&quot;} const requests = (pod.containers||[]).map(c=&gt;{&quot;{&quot;} let cpu = c.cpu_requests||&quot;0&quot;; if (cpu[cpu.length-1]===&quot;m&quot;) {&quot;{&quot;} cpu = cpu.substr(0, cpu.length-1)|0;} else {&quot;{&quot;} cpu = 1000 * (cpu|0);} return cpu;});return [pod.name, requests.reduce((a,b)=&gt;a+b), requests.join(&quot;\t&quot;)]}).sort((a,b)=&gt;b[1]-a[1]).map(o=&gt;o.join(&quot;\t&quot;)).join(&quot;\n&quot;))&apos;|sed &apos;s/,]/]/g&apos;|node</code></pre>]]></content:encoded></item><item><title><![CDATA[js监听扫码枪]]></title><description><![CDATA[<pre><code class="language-javascript">/**
 * @property {RegExp[]} patterns
 * @property {function(code:string):void} onScanSuccess
 */
class CodeScanner {

  /**
   * @param {(code:string)=&gt;{}} handler
   * @param {RegExp[]} patterns
   */
  constructor(handler, patterns = []) {
    this.resetScan()
    this.patterns = patterns || []
    this.onScanSuccess = handler || ((code) =&gt; {
      console.log(code)
    })
  }

  /**
   * &#x5F00;&#x59CB;&#x76D1;&#x542C;
   */
  start() {
    this.resetScan()
    const that = this
    this.thatKeyHandler = (e) =&gt; {
      that.</code></pre>]]></description><link>http://www.dev-f.cn/jsjian-ting-sao-ma-qiang/</link><guid isPermaLink="false">66827d1b8745fb0001cce7c5</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Mon, 01 Jul 2024 09:56:27 GMT</pubDate><content:encoded><![CDATA[<pre><code class="language-javascript">/**
 * @property {RegExp[]} patterns
 * @property {function(code:string):void} onScanSuccess
 */
class CodeScanner {

  /**
   * @param {(code:string)=&gt;{}} handler
   * @param {RegExp[]} patterns
   */
  constructor(handler, patterns = []) {
    this.resetScan()
    this.patterns = patterns || []
    this.onScanSuccess = handler || ((code) =&gt; {
      console.log(code)
    })
  }

  /**
   * &#x5F00;&#x59CB;&#x76D1;&#x542C;
   */
  start() {
    this.resetScan()
    const that = this
    this.thatKeyHandler = (e) =&gt; {
      that._keyHandler(e)
    }
    document.addEventListener(&quot;keypress&quot;, this.thatKeyHandler, { passive: true })
  }

  /**
   * &#x505C;&#x6B62;&#x63A5;&#x542C;
   */
  stop() {
    this.resetScan()
    document.removeEventListener(&quot;keypress&quot;, this.thatKeyHandler)
  }

  /**
   *
   * @param {KeyboardEvent} e
   * @private
   */
  _keyHandler(e) {
    if ([&quot;INPUT&quot;, &quot;TEXTAREA&quot;, &quot;BUTTON&quot;].indexOf(document.activeElement.nodeName) &gt;= 0) {
      return // &#x7126;&#x70B9;&#x5728;&#x5176;&#x5B83;&#x8F93;&#x5165;&#x6846;&#x65F6;&#x4E0D;&#x89E6;&#x53D1;
    }
    if (this.scanLastTimeStamp === 0) {
      this.code = e.key
      this.scanLastTimeStamp = e.timeStamp
      return
    }
    if (e.timeStamp - this.scanLastTimeStamp &gt; 50) {
      return this.resetScan(&quot;&#x8D85;&#x8FC7;&#x626B;&#x63CF;&#x95F4;&#x9694;&#x7684;&#x9608;&#x503C;(&#x6BEB;&#x79D2;)&quot;)
    }
    if (e.key === &quot;Enter&quot;) {
      let ok = this.patterns.length === 0
      for (let i = 0; i &lt; this.patterns.length; i++) {
        if (this.code.match(this.patterns[i])) {
          ok = true
          break
        }
      }
      if (ok) {
        if (this.onScanSuccess !== null) {
          this.onScanSuccess(this.code)
        }
        return this.resetScan(&quot;&#x6B63;&#x5E38;&#x7ED3;&#x675F;&#x626B;&#x63CF;&quot;)
      } else {
        return this.resetScan(&quot;&#x626B;&#x63CF;&#x7801;&#x4E0D;&#x7B26;&#x5408;&#x89C4;&#x5219;&quot;)
      }
    }
    this.code += e.key
    this.scanLastTimeStamp = e.timeStamp
  }

  /**
   * @param {?string} reason
   */
  resetScan(reason = null) {
    if (reason) {
      console.log(reason,this.code)
    }
    this.scanLastTimeStamp = 0
    this.code = &quot;&quot;
  }
}</code></pre>]]></content:encoded></item><item><title><![CDATA[k3s You must be logged in to the server (Unauthorized) 问题解决]]></title><description><![CDATA[<ol><li>&#x66F4;&#x65B0;&#x670D;&#x52A1;&#x7AEF;&#x8BC1;&#x4E66;</li></ol><pre><code class="language-shell">sudo /usr/local/bin/k3s certificate rotate</code></pre><ol start="2"><li>&#x91CD;&#x542F;k3s&#x670D;&#x52A1;</li></ol><pre><code class="language-bash">sudo systemctl restart k3s</code></pre><ol start="3"><li>&#x5C06;&#x65B0;&#x7684;<code>/etc/rancher/k3s/k3s.yaml</code>&#x6587;&#x4EF6;&#x4E0B;&#x8F7D;&#x4E0B;&#x6765;&#x4F7F;&#x7528;</li></ol>]]></description><link>http://www.dev-f.cn/k3s-logged-in-to-server-unauthorized/</link><guid isPermaLink="false">65c31bd88745fb0001cce7b3</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Wed, 07 Feb 2024 06:09:22 GMT</pubDate><content:encoded><![CDATA[<ol><li>&#x66F4;&#x65B0;&#x670D;&#x52A1;&#x7AEF;&#x8BC1;&#x4E66;</li></ol><pre><code class="language-shell">sudo /usr/local/bin/k3s certificate rotate</code></pre><ol start="2"><li>&#x91CD;&#x542F;k3s&#x670D;&#x52A1;</li></ol><pre><code class="language-bash">sudo systemctl restart k3s</code></pre><ol start="3"><li>&#x5C06;&#x65B0;&#x7684;<code>/etc/rancher/k3s/k3s.yaml</code>&#x6587;&#x4EF6;&#x4E0B;&#x8F7D;&#x4E0B;&#x6765;&#x4F7F;&#x7528;</li></ol>]]></content:encoded></item><item><title><![CDATA[excel分析身份证号公式]]></title><description><![CDATA[<h2 id="%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E6%98%AF%E5%90%A6%E5%90%88%E6%B3%95">&#x8EAB;&#x4EFD;&#x8BC1;&#x53F7;&#x662F;&#x5426;&#x5408;&#x6CD5;</h2><pre><code class="language-excel">=IF(VLOOKUP(MOD(SUMPRODUCT(MID(A2,ROW($1:$17),1)*{7;9;10;5;8;4;2;1;6;3;7;9;10;5;8;4;2}),11),{0,1;1,0;2,&quot;X&quot;;3,9;4,8;5,7;</code></pre>]]></description><link>http://www.dev-f.cn/excel-id-card-analysis/</link><guid isPermaLink="false">64b63b6ef84d1700017a8418</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Tue, 18 Jul 2023 07:15:02 GMT</pubDate><content:encoded><![CDATA[<h2 id="%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E6%98%AF%E5%90%A6%E5%90%88%E6%B3%95">&#x8EAB;&#x4EFD;&#x8BC1;&#x53F7;&#x662F;&#x5426;&#x5408;&#x6CD5;</h2><pre><code class="language-excel">=IF(VLOOKUP(MOD(SUMPRODUCT(MID(A2,ROW($1:$17),1)*{7;9;10;5;8;4;2;1;6;3;7;9;10;5;8;4;2}),11),{0,1;1,0;2,&quot;X&quot;;3,9;4,8;5,7;6,6;7,5;8,4;9,3;10,2},2,0)&amp;&quot;&quot;=RIGHT(A2,1),&quot;&#x5408;&#x6CD5;&quot;,&quot;&#x4E0D;&#x5408;&#x6CD5;&quot;)</code></pre><h2 id="%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E4%B8%AD%E7%9A%84%E7%94%9F%E6%97%A5">&#x8EAB;&#x4EFD;&#x8BC1;&#x53F7;&#x4E2D;&#x7684;&#x751F;&#x65E5;</h2><pre><code class="language-excel">=--TEXT(MID(A2,7,8),&quot;0-00-00&quot;)</code></pre><h2 id="%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E4%B8%AD%E7%9A%84%E5%B9%B4%E9%BE%84">&#x8EAB;&#x4EFD;&#x8BC1;&#x53F7;&#x4E2D;&#x7684;&#x5E74;&#x9F84;</h2><pre><code class="language-excel">=DATEDIF( --TEXT(MID(A2,7,8),&quot;0-00-00&quot;), TODAY(), &quot;Y&quot;)</code></pre><h2 id="%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E4%B8%AD%E7%9A%84%E6%80%A7%E5%88%AB">&#x8EAB;&#x4EFD;&#x8BC1;&#x53F7;&#x4E2D;&#x7684;&#x6027;&#x522B;</h2><pre><code class="language-excel">=IF(MOD(MID(O2,17,1),2)=0,&quot;&#x5973;&quot;,&quot;&#x7537;&quot;)</code></pre>]]></content:encoded></item><item><title><![CDATA[统计端口调用方连接数]]></title><description><![CDATA[<h3 id="%E7%BB%9F%E8%AE%A1%E5%85%B6%E4%BB%96%E6%9C%8D%E5%8A%A1%E8%B0%83%E7%94%A8%E8%87%AA%E5%B7%B1%E7%9A%84">&#x7EDF;&#x8BA1;&#x5176;&#x4ED6;&#x670D;&#x52A1;&#x8C03;&#x7528;&#x81EA;&#x5DF1;&#x7684;</h3><pre><code class="language-shell">ss -at -o state established &apos;( sport = :8090 )&apos;|awk &apos;NR !=1 {print $4}&apos;|column -s &apos;:&apos; -t|awk &apos;{print $1}&apos;|sort|uniq -c|sort -n</code></pre><ul><li>-a&#xFF1A;&#x5168;&#x90E8;&#x8FDE;&#x63A5;</li><li>-t&#xFF1A;</li></ul>]]></description><link>http://www.dev-f.cn/tong-ji-duan-kou-diao-yong-fang-lian-jie-shu/</link><guid isPermaLink="false">6498fe73f84d1700017a83ef</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Mon, 26 Jun 2023 03:01:45 GMT</pubDate><content:encoded><![CDATA[<h3 id="%E7%BB%9F%E8%AE%A1%E5%85%B6%E4%BB%96%E6%9C%8D%E5%8A%A1%E8%B0%83%E7%94%A8%E8%87%AA%E5%B7%B1%E7%9A%84">&#x7EDF;&#x8BA1;&#x5176;&#x4ED6;&#x670D;&#x52A1;&#x8C03;&#x7528;&#x81EA;&#x5DF1;&#x7684;</h3><pre><code class="language-shell">ss -at -o state established &apos;( sport = :8090 )&apos;|awk &apos;NR !=1 {print $4}&apos;|column -s &apos;:&apos; -t|awk &apos;{print $1}&apos;|sort|uniq -c|sort -n</code></pre><ul><li>-a&#xFF1A;&#x5168;&#x90E8;&#x8FDE;&#x63A5;</li><li>-t&#xFF1A;&#x4EC5;tcp&#x8FDE;&#x63A5;</li><li>-o state established&#xFF1A;&#x8FC7;&#x6EE4;&#x53EA;&#x4FDD;&#x7559;&#x6D3B;&#x8DC3;&#x8FDE;&#x63A5;</li><li>( sport = :8090 )&#xFF1A;&#x4EC5;&#x4FDD;&#x7559;&#x670D;&#x52A1;&#x7AEF;8090&#x7AEF;&#x53E3;</li><li>awk NR!=1 &#x4E0D;&#x8981;&#x6807;&#x9898;&#x884C;</li><li>{print $4} &#x53EA;&#x4FDD;&#x7559;&#x7B2C;&#x56DB;&#x5217;&#xFF08;&#x5BA2;&#x6237;&#x7AEF;ip&#x548C;&#x7AEF;&#x53E3;&#xFF09;</li><li>column -s &apos;:&apos; -t &#x6309;&#x5192;&#x53F7;&#x5207;&#x5272;&#xFF08;ip:port&#xFF09;</li><li>awk &apos;{print $1}&apos; &#x53EA;&#x4FDD;&#x7559;&#x7B2C;&#x4E00;&#x5217;&#xFF08;&#x53EA;&#x4FDD;&#x7559;ip&#xFF09;</li><li>sort&#xFF1A;&#x6392;&#x5E8F;</li><li>uniq -c&#xFF1A;&#x6C47;&#x603B;&#x6BCF;&#x4E2A;ip&#x7684;&#x6570;&#x91CF;&#xFF08;&#x9700;&#x8981;&#x5148;&#x6392;&#x5E8F;&#x540E;&#x6C47;&#x603B;&#xFF09;</li><li>sort -n &#x6309;count&#x6570;&#x6392;&#x5E8F;</li></ul><h3 id="%E7%BB%9F%E8%AE%A1%E8%87%AA%E5%B7%B1%E8%B0%83%E7%94%A8%E5%85%B6%E4%BB%96%E6%9C%8D%E5%8A%A1%E7%9A%84">&#x7EDF;&#x8BA1;&#x81EA;&#x5DF1;&#x8C03;&#x7528;&#x5176;&#x4ED6;&#x670D;&#x52A1;&#x7684;</h3><pre><code class="language-shell">ss -at -o state established &apos;( sport != :8090 )&apos;|awk &apos;NR !=1 {print $4}&apos;|sort|uniq -c|sort -n</code></pre>]]></content:encoded></item><item><title><![CDATA[k8s中部署acme.sh]]></title><description><![CDATA[<h3 id="%E5%88%9B%E5%BB%BAdeployment">&#x521B;&#x5EFA;Deployment</h3><pre><code class="language-yaml">apiVersion: apps/v1
kind: Deployment
metadata:
  name: acme-sh-deployment
  labels:
    app: acme-sh
spec:
  replicas: 1
  selector:
    matchLabels:
      app: acme-sh
  template:
    metadata:
      labels:
        app: acme-sh
    spec:
      volumes:
      - name: acme-sh # &#x5C06;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x548C;&#x751F;&#x6210;&#x7684;&#x8BC1;&#x4E66;&#x6302;&#x8F7D;&#x5230;&#x5BBF;&#x4E3B;&#x673A;
        hostPath:
          path:</code></pre>]]></description><link>http://www.dev-f.cn/k8szhong-bu-shu-acme-sh/</link><guid isPermaLink="false">637374346c43230001e3d492</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Tue, 15 Nov 2022 11:21:29 GMT</pubDate><content:encoded><![CDATA[<h3 id="%E5%88%9B%E5%BB%BAdeployment">&#x521B;&#x5EFA;Deployment</h3><pre><code class="language-yaml">apiVersion: apps/v1
kind: Deployment
metadata:
  name: acme-sh-deployment
  labels:
    app: acme-sh
spec:
  replicas: 1
  selector:
    matchLabels:
      app: acme-sh
  template:
    metadata:
      labels:
        app: acme-sh
    spec:
      volumes:
      - name: acme-sh # &#x5C06;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x548C;&#x751F;&#x6210;&#x7684;&#x8BC1;&#x4E66;&#x6302;&#x8F7D;&#x5230;&#x5BBF;&#x4E3B;&#x673A;
        hostPath:
          path: /data/acme.sh
      containers:
      - name: acme-sh
        image: neilpang/acme.sh:latest
        args: [&quot;daemon&quot;] # &#x4EE5;deamon&#x6A21;&#x5F0F;&#x8FD0;&#x884C;
        env:
        - name: &quot;DP_Id&quot; # &#x63A5;&#x5165;DNSPod API
          value: &quot;****&quot;
        - name: &quot;DP_Key&quot; # &#x63A5;&#x5165;DNSPod API
          value: &quot;****&quot;
        volumeMounts:
        - name: acme-sh
          mountPath: /acme.sh
</code></pre><h3 id="%E9%85%8D%E7%BD%AE%E8%B4%A6%E5%8F%B7">&#x914D;&#x7F6E;&#x8D26;&#x53F7;</h3><pre><code class="language-bash">kubectl exec acme-sh-deployment-**********-***** -- acme.sh --register-account -m xxx@example.com</code></pre><h3 id="%E9%85%8D%E7%BD%AE%E5%9F%9F%E5%90%8D">&#x914D;&#x7F6E;&#x57DF;&#x540D;</h3><pre><code class="language-bash">kubectl exec acme-sh-deployment-**********-***** -- acme.sh --issue --dns dns_dp -d &quot;example.com&quot; -d &quot;www.example.com&quot; -d &quot;*.example.com&quot;</code></pre><h3 id="%E6%B7%BB%E5%8A%A0%E5%88%B0k8s-secret%E4%B8%AD">&#x6DFB;&#x52A0;&#x5230;k8s secret&#x4E2D;</h3><pre><code class="language-bash">kubectl create secret tls dev-f-tls --cert=/data/acme.sh/example.com/example.com.cer --key=/data/acme.sh/example.com/example.com.key</code></pre><h3 id="cron%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0">cron&#x81EA;&#x52A8;&#x66F4;&#x65B0;</h3><pre><code class="language-crontab">0 0 * * *  kubectl create secret tls dev-f-tls --cert=/data/acme.sh/example.com/example.com.cer --key=/data/acme.sh/example.com/example.com.key --dry-run=client --save-config=true  -o yaml| kubectl apply -f -  &gt; /dev/null 2&gt;&amp;1 &amp;</code></pre><h3 id="%E9%9B%86%E7%BE%A4">&#x96C6;&#x7FA4;</h3><p>&#x96C6;&#x7FA4;&#x6A21;&#x5F0F;&#x4E0B;&#x5E94;&#x4FEE;&#x6539;vlumes&#xFF0C;&#x6302;&#x8F7D;&#x7F51;&#x76D8;&#x6216;&#x5176;&#x5B83;&#x5B58;&#x50A8;</p>]]></content:encoded></item><item><title><![CDATA[k8s中部署ghost]]></title><description><![CDATA[<h3 id="%E5%88%9B%E5%BB%BAdeployment">&#x521B;&#x5EFA;Deployment</h3><pre><code class="language-yaml">apiVersion: apps/v1
kind: Deployment
metadata:
  name: ghost-deployment
  labels:
    app: ghost
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ghost
  template:
    metadata:
      labels:
        app: ghost
    spec:
      volumes:
        - name: tz
          hostPath:
            path: /etc/localtime
        - name: ghost-content
          hostPath:
            path: /data/ghost-content
        - name: ghost-db # &#x7B2C;&#x4E00;&#x6B21;&#x521B;&#x5EFA;</code></pre>]]></description><link>http://www.dev-f.cn/k8szhong-bu-shu-ghost/</link><guid isPermaLink="false">6373084d6c43230001e3d45c</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Tue, 15 Nov 2022 08:56:51 GMT</pubDate><content:encoded><![CDATA[<h3 id="%E5%88%9B%E5%BB%BAdeployment">&#x521B;&#x5EFA;Deployment</h3><pre><code class="language-yaml">apiVersion: apps/v1
kind: Deployment
metadata:
  name: ghost-deployment
  labels:
    app: ghost
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ghost
  template:
    metadata:
      labels:
        app: ghost
    spec:
      volumes:
        - name: tz
          hostPath:
            path: /etc/localtime
        - name: ghost-content
          hostPath:
            path: /data/ghost-content
        - name: ghost-db # &#x7B2C;&#x4E00;&#x6B21;&#x521B;&#x5EFA;&#x65F6;&#x4E0D;&#x6302;&#x8F7D;&#x8FD9;&#x4E2A;&#xFF0C;&#x9700;&#x8981;&#x542F;&#x52A8;&#x540E;&#x4ECE;./current/content/data&#x91CC;&#x590D;&#x5236;&#x51FA;&#x6765;&#x4E00;&#x4EFD;
          hostPath:
            path: /data/ghost-dev.db
      containers:
      - name: ghost
        image: ghost:latest
        volumeMounts:
          - name: tz
            mountPath: /etc/localtime
          - name: ghost-content
            mountPath: /var/lib/ghost/content
          - name: ghost-db  # &#x7B2C;&#x4E00;&#x6B21;&#x521B;&#x5EFA;&#x65F6;&#x4E0D;&#x6302;&#x8F7D;&#x8FD9;&#x4E2A;
            mountPath: /var/lib/ghost/current/content/data/ghost-dev.db
        ports:
        - containerPort: 2368
        env:
        - name: NODE_ENV
          value: &quot;development&quot;
        - name: url
          value: &quot;http://www.dev-f.cn&quot;
</code></pre><h3 id="%E5%88%9B%E5%BB%BAservice">&#x521B;&#x5EFA;Service</h3><pre><code class="language-yaml">apiVersion: v1
kind: Service
metadata:
  name: ghost-service
spec:
  selector:
    app: ghost
  ports:
    - protocol: TCP
      port: 80
      targetPort: 2368</code></pre><h3 id="%E5%88%9B%E5%BB%BAingress">&#x521B;&#x5EFA;Ingress</h3><pre><code class="language-yaml">apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ghost-ingress
  annotations:
    # kubernetes.io/ingress.class: traefik
    # traefik.ingress.kubernetes.io/router.middlewares: default-redirect@kubernetescrd
    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;true&quot;
spec:
  # tls: # https&#x914D;&#x7F6E;&#xFF08;&#x9700;&#x8981;&#x6DFB;&#x52A0;secret&#xFF09;
  # - hosts:
  #   - &quot;www.example.com&quot;
  #   secretName: example-tls
  rules:
  - host: &quot;www.example.com&quot;
    http:
      paths:
      - path: &quot;/&quot;
        pathType: Prefix
        backend:
          service:
            name: ghost-service
            port:
              number: 80
</code></pre>]]></content:encoded></item><item><title><![CDATA[解决go build -race在mac上报错的问题]]></title><description><![CDATA[<!--kg-card-begin: html-->
<p>&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;&#x589E;&#x52A0; <code>MallocNanoZone=0</code> &#x5373;&#x53EF;</p>
<!--kg-card-end: html-->]]></description><link>http://www.dev-f.cn/go-build-race-on-mac/</link><guid isPermaLink="false">637249606c43230001e3d3bb</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Mon, 14 Mar 2022 11:50:15 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<p>&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;&#x589E;&#x52A0; <code>MallocNanoZone=0</code> &#x5373;&#x53EF;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[k8s查看pod重启前的日志]]></title><description><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl logs &lt;pod&gt; -n &lt;namespace&gt; --previous=true</code></pre>
<!--kg-card-end: html-->]]></description><link>http://www.dev-f.cn/k8s-pod-log/</link><guid isPermaLink="false">637249606c43230001e3d3b9</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Fri, 06 Aug 2021 17:12:00 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl logs &lt;pod&gt; -n &lt;namespace&gt; --previous=true</code></pre>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[记一次升级go到1.16时遇到的问题]]></title><description><![CDATA[<!--kg-card-begin: html-->
<p>&#x73AF;&#x5883;&#xFF1A;Centos7 + Jenkins + go1.16</p>



<h2>&#x95EE;&#x9898;1: mission $GOPATH</h2>



<p>&#x6211;&#x5728;Jenkins&#x4E2D;&#x4F7F;&#x7528;go&#x7684;&#x63D2;&#x4EF6;&#xFF08;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x4E0B;&#x8F7D;&#x7279;&#x5B9A;&#x7248;&#x672C;&#xFF09;&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x77E5;&#x9053;&#x4E3A;&#x4EC0;&#x4E48;&#x4F7F;&#x7528;1.16&#x7248;&#x672C;&#x662F;</p>]]></description><link>http://www.dev-f.cn/-e8-ae-b0-e4-b8-80-e6-ac-a1-e5-8d-87-e7-ba-a7go-e5-88-b01-16-e6-97-b6-e9-81-87-e5-88-b0-e7-9a-84-e9-97-ae-e9-a2-98/</link><guid isPermaLink="false">637249606c43230001e3d3b8</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Wed, 30 Jun 2021 19:29:04 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<p>&#x73AF;&#x5883;&#xFF1A;Centos7 + Jenkins + go1.16</p>



<h2>&#x95EE;&#x9898;1: mission $GOPATH</h2>



<p>&#x6211;&#x5728;Jenkins&#x4E2D;&#x4F7F;&#x7528;go&#x7684;&#x63D2;&#x4EF6;&#xFF08;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x4E0B;&#x8F7D;&#x7279;&#x5B9A;&#x7248;&#x672C;&#xFF09;&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x77E5;&#x9053;&#x4E3A;&#x4EC0;&#x4E48;&#x4F7F;&#x7528;1.16&#x7248;&#x672C;&#x662F;&#x62A5;<code>mission $GOPATH</code>&#x7684;&#x9519;&#x8BEF;&#xFF0C;&#x4F46;&#x662F;1.15&#x4E0D;&#x62A5;&#xFF0C;&#x5E76;&#x4E14;1.15&#x4E5F;&#x6CA1;&#x6709;&#x8BBE;&#x7F6E;GOPATH&#x3002; </p>



<p>&#x7ECF;&#x6392;&#x67E5;&#x540E;&#x53D1;&#x73B0;&#x8FD9;&#x4E2A;&#x670D;&#x52A1;&#x5668;&#x7684;jenkins&#x7528;&#x6237;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;&#x6CA1;&#x6709;HOME&#x8FD9;&#x4E2A;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;&#x5982;&#x679C;&#x4E0D;&#x914D;&#x7F6E;GOPATH&#x65F6;&#xFF0C;GOPATH&#x9ED8;&#x8BA4;&#x4E3A;<code>~/go</code>&#x3002;</p>



<p>&#x4F30;&#x8BA1;&#x662F;1.16&#x4EE5;&#x540E;&#x7528;&#x6237;HOME&#x67E5;&#x627E;&#x76EE;&#x5F55;&#xFF0C;1.15&#x53CA;&#x4EE5;&#x524D;&#x7528;&#x5176;&#x5B83;&#x65B9;&#x5F0F;&#x67E5;&#x627E;&#x3002; </p>



<p>&#x4E3A;&#x4E86;&#x4E0D;&#x91CD;&#x542F;&#x670D;&#x52A1;&#x5668;&#xFF0C;&#x5728;jenkins&#x7684;Configure System&#x4E2D;&#x589E;&#x52A0;&#x4E86;&#x8FD9;&#x4E2A;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;</p>



<h2>&#x95EE;&#x9898;2: unrecognized relocation (0x2a) in section `.text&#x2019;</h2>



<p>&#x5728;&#x7F51;&#x4E0A;&#x67E5;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x8BF4;&#x662F;Centos&#x6216;ld&#x7248;&#x672C;&#x592A;&#x4F4E;&#x5BFC;&#x81F4;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x7528;&#x7684;Centos7&#x7248;&#x672C;&#x4E0D;&#x7B97;&#x592A;&#x8001;&#x3002;</p>



<p>&#x6309;&#x7167;&#x7F51;&#x4E0A;&#x7684;&#x65B9;&#x6CD5;<code>sudo yum -y install binutils</code>&#x5347;&#x7EA7;&#x4E86;ld&#x540E;&#xFF0C;&#x95EE;&#x9898;&#x89E3;&#x51B3;</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[找出有限数列中和值最大的连续子数列]]></title><description><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="javascript" class="language-javascript">((list) =&gt; {
    let max = {
        total: 0,
        first: 0,
        last: 0,
    };
    let tmp = {
        total: 0,
        first: 0,
        last: 0,
    };
    let op = 0;//&#x662F;&#x5426;&#x8FDE;&#x7EED;&#xFF0C;0&#x4E0D;&#x8FDE;&#x7EED;&#xFF0C;1&#x9012;&#x589E;&#x8FDE;&#x7EED;&#xFF0C;-1&#x9012;&#x51CF;&#x8FDE;&#x7EED;
    list.forEach((current, i) =&gt; {
        if (i === 0)</code></pre>]]></description><link>http://www.dev-f.cn/-e6-89-be-e5-87-ba-e6-9c-89-e9-99-90-e6-95-b0-e5-88-97-e4-b8-ad-e5-92-8c-e5-80-bc-e6-9c-80-e5-a4-a7-e7-9a-84-e8-bf-9e-e7-bb-ad-e5-ad-90-e6-95-b0-e5-88/</link><guid isPermaLink="false">637249606c43230001e3d3b7</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Mon, 22 Feb 2021 16:12:53 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="javascript" class="language-javascript">((list) =&gt; {
    let max = {
        total: 0,
        first: 0,
        last: 0,
    };
    let tmp = {
        total: 0,
        first: 0,
        last: 0,
    };
    let op = 0;//&#x662F;&#x5426;&#x8FDE;&#x7EED;&#xFF0C;0&#x4E0D;&#x8FDE;&#x7EED;&#xFF0C;1&#x9012;&#x589E;&#x8FDE;&#x7EED;&#xFF0C;-1&#x9012;&#x51CF;&#x8FDE;&#x7EED;
    list.forEach((current, i) =&gt; {
        if (i === 0) {
            tmp.total = current;
            max.total = current;
            return;
        }
        const prev = list[i - 1];
        if (op === 0) {
            if (current &gt; prev) {
                op = 1;
            } else if (current &lt; prev) {
                op = -1;
            } else {
                op = 0;
            }
        }
        if (op !== 0 &amp;&amp; current - prev === op) {
            tmp.total += current;
        } else {
            if (max.total &lt; tmp.total) {
                max.total = tmp.total;
                max.first = tmp.first;
                max.last = tmp.last;
            }
            op = 0
            tmp.first = i;
            tmp.total = current;
        }
        tmp.last = i;
    });
    if (max.total &lt; tmp.total) {
        max = tmp;
    }
    return [
        &quot;&#x548C;&#x503C;&#xFF1A;&quot; + max.total,
        &quot;&#x503C;&#xFF1A;&quot; + list[max.first] + &quot;&#xFF5E;&quot; + list[max.last],
        &quot;&#x7D22;&#x5F15;&#xFF1A;&quot; + max.first + &quot;&#xFF5E;&quot; + max.last
    ].join(&quot;\n&quot;);
})([1, 2, 3, 4, 3, 2, 5, 6, 7, 8]);</code></pre>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[新项目代码规范]]></title><description><![CDATA[<!--kg-card-begin: html-->
<div id="toc_container" class="toc_white no_bullets"><p class="toc_title">&#x76EE;&#x5F55;</p><ul class="toc_list"><li><a href="#Result"><span class="toc_number toc_depth_1">1</span> Result&#x7C7B;</a><ul><li><a href="#i"><span class="toc_number toc_depth_2">1.1</span> &#x7ED3;&#x6784;</a></li><li><a href="#code"><span class="toc_number toc_depth_2">1.2</span> code&#x7684;&#x5B9A;&#x4E49;</a></li></ul></li><li><a href="#i-2"><span class="toc_number toc_depth_1">2</span> &#x6027;&#x522B;</a></li><li><a href="#i-3"><span class="toc_number toc_depth_1">3</span> &#x7248;&#x672C;&#x53F7;</a><ul><li><a href="#i-4"><span class="toc_number toc_depth_2">3.1</span> &#x5B57;&#x7B26;&#x4E32;&#x683C;&#x5F0F;</a></li><li><a href="#i-5"><span class="toc_number toc_depth_2">3.2</span> &#x6570;&#x5B57;&#x683C;&#x5F0F;</a></li></ul></li></ul></div>
<h2><span id="Result">Result&#x7C7B;</span></h2>



<h3><span id="i">&#x7ED3;&#x6784;</span></h3>



<pre class="wp-block-code"><code lang="json" class="language-json">{
  &quot;code&quot;: 0,
  &quot;msg&quot;: &quot;ok&quot;,
  &quot;</code></pre>]]></description><link>http://www.dev-f.cn/coding-guide/</link><guid isPermaLink="false">637249606c43230001e3d3b6</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Wed, 18 Nov 2020 10:30:58 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<div id="toc_container" class="toc_white no_bullets"><p class="toc_title">&#x76EE;&#x5F55;</p><ul class="toc_list"><li><a href="#Result"><span class="toc_number toc_depth_1">1</span> Result&#x7C7B;</a><ul><li><a href="#i"><span class="toc_number toc_depth_2">1.1</span> &#x7ED3;&#x6784;</a></li><li><a href="#code"><span class="toc_number toc_depth_2">1.2</span> code&#x7684;&#x5B9A;&#x4E49;</a></li></ul></li><li><a href="#i-2"><span class="toc_number toc_depth_1">2</span> &#x6027;&#x522B;</a></li><li><a href="#i-3"><span class="toc_number toc_depth_1">3</span> &#x7248;&#x672C;&#x53F7;</a><ul><li><a href="#i-4"><span class="toc_number toc_depth_2">3.1</span> &#x5B57;&#x7B26;&#x4E32;&#x683C;&#x5F0F;</a></li><li><a href="#i-5"><span class="toc_number toc_depth_2">3.2</span> &#x6570;&#x5B57;&#x683C;&#x5F0F;</a></li></ul></li></ul></div>
<h2><span id="Result">Result&#x7C7B;</span></h2>



<h3><span id="i">&#x7ED3;&#x6784;</span></h3>



<pre class="wp-block-code"><code lang="json" class="language-json">{
  &quot;code&quot;: 0,
  &quot;msg&quot;: &quot;ok&quot;,
  &quot;data&quot;: null
}</code></pre>



<ul><li>code&#xFF1A;&#x4E3A;&#x9519;&#x8BEF;&#x7F16;&#x7801;&#xFF0C;&#x53EA;&#x80FD;&#x662F;int</li><li>msg&#xFF1A;&#x4E3A;&#x9519;&#x8BEF;&#x4FE1;&#x606F;&#xFF0C;&#x53EA;&#x80FD;&#x662F;&#x5B57;&#x7B26;&#x4E32;</li><li>data&#xFF1A;&#x4E3A;&#x6570;&#x636E;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55;&#x7C7B;&#x578B;</li></ul>



<h3><span id="code">code&#x7684;&#x5B9A;&#x4E49;</span></h3>



<figure class="wp-block-table is-style-regular"><table><thead><tr><th>&#x503C;</th><th>&#x8BF4;&#x660E;</th></tr></thead><tbody><tr><td>0</td><td>&#x6210;&#x529F;</td></tr><tr><td>&#x5927;&#x4E8E;0</td><td>&#x4E3A;&#x4E1A;&#x52A1;&#x9519;&#x8BEF;&#xFF0C;&#x53EF;&#x76F4;&#x63A5;&#x5C06;msg&#x5C55;&#x793A;&#x7ED9;&#x524D;&#x7AEF;</td></tr><tr><td>&#x5C0F;&#x4E8E;0</td><td>&#x4E3A;&#x7CFB;&#x7EDF;&#x9519;&#x8BEF;&#xFF0C;&#x4E0D;&#x5E94;&#x5C06;msg&#x5C55;&#x793A;&#x7ED9;&#x524D;&#x7AEF;</td></tr></tbody></table></figure>



<h2><span id="i-2">&#x6027;&#x522B;</span></h2>



<ul><li>&#x5B57;&#x6BB5;&#x540D;&#xFF1A;gender</li></ul>



<figure class="wp-block-table is-style-regular"><table><thead><tr><th>&#x503C;</th><th>&#x8BF4;&#x660E;</th></tr></thead><tbody><tr><td>0</td><td>&#x672A;&#x77E5;</td></tr><tr><td>1</td><td>&#x7537;</td></tr><tr><td>2</td><td>&#x5973;</td></tr></tbody></table></figure>



<h2><span id="i-3">&#x7248;&#x672C;&#x53F7;</span></h2>



<h3><span id="i-4">&#x5B57;&#x7B26;&#x4E32;&#x683C;&#x5F0F;</span></h3>



<p>&lt;major&gt;.&lt;minor&gt;.&lt;patch&gt; &#x6216; v&lt;major&gt;.&lt;minor&gt;.&lt;patch&gt;</p>



<p>&#x4E09;&#x6BB5;&#x5FC5;&#x987B;&#x90FD;&#x6709;&#xFF0C;&#x4E0D;&#x80FD;&#x7701;&#x7565;&#xFF0C;&#x5982;&#xFF1A;v1.0.0&#xFF0C;v1.2.3&#xFF0C;2.5.7</p>



<ul><li>major&#x4E3A;&#x5927;&#x7248;&#x672C;&#xFF0C;&#x5347;&#x7EA7;major&#x65F6;&#x53EF;&#x4E0D;&#x5411;&#x4E0B;&#x517C;&#x5BB9;</li><li>minor&#x4E3A;&#x529F;&#x80FD;&#x7248;&#x672C;&#xFF0C;&#x5347;&#x7EA7;minor&#x65F6;&#x5E94;&#x5C3D;&#x53EF;&#x80FD;&#x5411;&#x4E0B;&#x517C;&#x5BB9;</li><li>patch&#x4E3A;&#x8865;&#x4E01;&#x7248;&#x672C;&#xFF0C;&#x5347;&#x7EA7;patch&#x65F6;&#x5FC5;&#x987B;&#x5411;&#x4E0B;&#x517C;&#x5BB9;&#xFF0C;&#x5347;&#x7EA7;patch&#x7248;&#x672C;&#x65F6;&#x4E0D;&#x5E94;&#x63D0;&#x4F9B;&#x65B0;&#x529F;&#x80FD;&#x6216;&#x65B0;&#x63A5;&#x53E3;</li></ul>



<h3><span id="i-5">&#x6570;&#x5B57;&#x683C;&#x5F0F;</span></h3>



<p>&#x6B63;&#x6574;&#x6570;&#xFF0C;&#x6700;&#x540E;&#x4E09;&#x4F4D;&#x4EE3;&#x8868;patch&#xFF0C;&#x4E2D;&#x95F4;&#x4E09;&#x4F4D;&#x4EE3;&#x8868;minor&#xFF0C;&#x6700;&#x524D;&#x9762;&#x7684;&#x82E5;&#x5E72;&#x4F4D;&#x4EE3;&#x8868;major</p>



<p>&#x5982;&#xFF1A;1000000&#x4E3A;v1.0.0&#xFF0C;21001134&#x4EE3;&#x8868;v21.1.134</p>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[在mac中通过shell弹窗或发通知]]></title><description><![CDATA[<!--kg-card-begin: html-->
<p>Mac&#x4E2D;&#x6709;&#x4E2A;AppleScript&#xFF0C;&#x901A;&#x8FC7;&#x5B83;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x5F39;&#x7A97;&#x6216;&#x7CFB;&#x7EDF;&#x901A;&#x77E5;</p>



<h2>&#x5F39;&#x7A97;</h2>



<pre class="wp-block-code"><code lang="bash" class="language-bash">osascript -e &apos;display alert &quot;&#x544A;&#x8B66;&#xFF01;&#xFF01;&quot; as critical&apos;</code></pre>



<ul><li>osascript -e &#x662F;&#x6267;&#x884C;&#x4E00;&#x6BB5;apple script</li><li>display alert&#x662F;&#x5F39;&#x7A97;</li></ul>]]></description><link>http://www.dev-f.cn/-e5-9c-a8mac-e4-b8-ad-e9-80-9a-e8-bf-87shell-e5-bc-b9-e7-aa-97-e6-88-96-e5-8f-91-e9-80-9a-e7-9f-a5/</link><guid isPermaLink="false">637249606c43230001e3d3b4</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Mon, 18 May 2020 16:38:12 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<p>Mac&#x4E2D;&#x6709;&#x4E2A;AppleScript&#xFF0C;&#x901A;&#x8FC7;&#x5B83;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x5F39;&#x7A97;&#x6216;&#x7CFB;&#x7EDF;&#x901A;&#x77E5;</p>



<h2>&#x5F39;&#x7A97;</h2>



<pre class="wp-block-code"><code lang="bash" class="language-bash">osascript -e &apos;display alert &quot;&#x544A;&#x8B66;&#xFF01;&#xFF01;&quot; as critical&apos;</code></pre>



<ul><li>osascript -e &#x662F;&#x6267;&#x884C;&#x4E00;&#x6BB5;apple script</li><li>display alert&#x662F;&#x5F39;&#x7A97;</li><li>as critcal&#x662F;&#x7528;&#x6765;&#x63A7;&#x5236;&#x56FE;&#x6807;&#xFF0C;&#x53EF;&#x4EE5;as&#x4E09;&#x4E2A;&#x503C;&#xFF08;informational&#xFF0C;warning&#xFF0C;critical&#xFF0C;&#x9ED8;&#x8BA4;&#x662F;informational&#xFF09;</li></ul>



<h2>&#x53D1;&#x901A;&#x77E5;</h2>



<pre class="wp-block-code"><code lang="bash" class="language-bash">osascript -e &apos;display notification &quot;&#x901A;&#x77E5;&#x5185;&#x5BB9;&quot; with title &quot;&#x6807;&#x9898;&quot; subtitle &quot;&#x5B50;&#x6807;&#x9898;&quot; sound name &quot;Glass&quot;&apos;</code></pre>



<ul><li>display notification &#x662F;&#x53D1;&#x901A;&#x77E5;&#x7684;&#x547D;&#x4EE4;&#x540E;&#x9762;&#x7D27;&#x8DDF;&#x7740;&#x901A;&#x77E5;&#x5185;&#x5BB9;</li><li>with title &#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x901A;&#x77E5;&#x6807;&#x9898;&#xFF08;&#x9ED8;&#x8BA4;&#x662F;&#x201C;&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x201D;&#xFF09;</li><li>subtitle &#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x5B50;&#x6807;&#x9898;&#xFF08;&#x9ED8;&#x8BA4;&#x6CA1;&#x6709;&#xFF09;</li><li>sound name &#x53EF;&#x4EE5;&#x7528;&#x6765;&#x9009;&#x62E9;&#x4E00;&#x79CD;&#x901A;&#x77E5;&#x7684;&#x58F0;&#x97F3;&#xFF0C;&#x58F0;&#x97F3;&#x5B58;&#x653E;&#x5728;<code>/System/Library/Sounds</code>&#x4E2D;</li></ul>



<h2>&#x7ED3;&#x5408;PHP&#x5B9E;&#x6218;</h2>



<pre title="check.php" class="wp-block-code"><code lang="php" class="language-php line-numbers">&lt;?php
ini_set(&apos;date.timezone&apos;,&apos;PRC&apos;);

$host = &apos;mysql.example.org&apos;;
$port = &apos;3306&apos;;
$dbname = &apos;test&apos;;
$username = &apos;root&apos;;
$password = &apos;123456&apos;;
$pdo = new PDO(&quot;mysql:host={$host};port={$port};dbname={$dbname};charset=UTF8&quot;, $username, $password);

$sql = &lt;&lt;&lt;SQL
SELECT u.uid, p.privilege_id, u.updated_at 
FROM user_privilege AS p 
LEFT JOIN user AS u ON u.uid = p.uid
WHERE u.del = 1 and p.del = 0;
SQL;

$statement = $pdo-&gt;query($sql);
$result = $statement-&gt;fetchAll(PDO::FETCH_ASSOC);
$new = [];

$logDir = __DIR__ . &apos;/log/&apos;;
if (!file_exists($logDir)) {
    mkdir($logDir, 0755, true);
}
foreach ($result as $item) {
    $fileName = $logDir . &apos;/&apos; . $item[&apos;uid&apos;] . &apos;.json&apos;;
    if (!file_exists($fileName)) {
        file_put_contents($fileName, json_encode($item, JSON_PRETTY_PRINT));
        $new[] = $item[&apos;uid&apos;];
    }
}
if ($new) {
    $msg = sprintf(&apos;%s&#x53D1;&#x73B0;&#x65B0;&#x5F02;&#x5E38;&#x6570;&#x636E;%d&#x6761;&#xFF01;(%s)&apos;, date(&apos;Y-m-d H:i:s&apos;), count($new), implode(&apos;, &apos;, $new));
    $cmd = &lt;&lt;&lt;CMD
osascript -e &apos;tell application &quot;System Events&quot; to display alert &quot;{$msg}&quot; as critical&apos;
CMD;
    exec($cmd);
}</code></pre>



<p>&#x8FD9;&#x4E2A;&#x811A;&#x672C;&#x8FDE;&#x63A5;&#x4E00;&#x4E2A;&#x8FDC;&#x7A0B;&#x7684;&#x6570;&#x636E;&#x5E93;&#xFF0C;&#x68C0;&#x67E5;&#x662F;&#x5426;&#x51FA;&#x73B0;&#x7528;&#x6237;&#x88AB;&#x5220;&#x9664;&#xFF0C;&#x4F46;&#x662F;&#x6743;&#x9650;&#x6CA1;&#x6709;&#x88AB;&#x5220;&#x9664;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x5982;&#x679C;&#x53D1;&#x73B0;&#x5C06;&#x5B83;&#x8BB0;&#x5F55;&#x5230;&#x65E5;&#x5FD7;&#x5E76;&#x5F39;&#x7A97;&#x63D0;&#x793A;&#x3002;&#x8FD9;&#x91CC;&#x589E;&#x52A0;&#x4E86;<code>tell application &quot;System Events&quot; to</code>&#x8FD9;&#x4E48;&#x4E2A;&#x524D;&#x7F00;&#xFF0C;&#x662F;&#x6307;&#x4EE5;&#x201C;System Events&#x201D;&#x8FD9;&#x4E2A;&#x5E94;&#x7528;&#x5F39;&#x8FD9;&#x4E2A;&#x7A97;&#xFF0C;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x597D;&#x50CF;&#x6709;&#x4EC0;&#x4E48;&#x673A;&#x5236;&#x4F1A;&#x963B;&#x6B62;cron&#x4EFB;&#x52A1;&#x4E2D;&#x76F4;&#x63A5;&#x5F39;&#x7A97;&#xFF0C;&#x9700;&#x8981;&#x501F;&#x7528;&#x53E6;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x7684;&#x8EAB;&#x4EFD;&#x3002;&#x4E5F;&#x53EF;&#x4EE5;&#x501F;&#x7528;&#x201D;Finder&#x201D;&#xFF0C;&#x53D1;&#x5F39;&#x7A97;&#x65F6;Finder&#x4F1A;&#x8DF3;&#x52A8;&#x4E00;&#x4E0B;&#xFF0C;&#x4F46;&#x662F;&#x5F39;&#x7A97;&#x9700;&#x8981;&#x70B9;Finder&#x624D;&#x80FD;&#x51FA;&#x6765;&#xFF0C;&#x800C;&#x4F7F;&#x7528;System Event&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x5F39;&#x51FA;&#x6765;&#x3002;</p>



<p>&#x63A5;&#x4E0B;&#x6765;&#x53EF;&#x4EE5;&#x5728;&#x6267;&#x884C;<code>crontab -e</code>&#x6765;&#x589E;&#x52A0;&#x4E2A;&#x8BA1;&#x5212;&#x4EFB;&#x52A1;</p>



<pre title="crontab -e" class="wp-block-code"><code class>MAILTO=&quot;&quot;
*/1 * * * * php ~/check.php &gt; /dev/null</code></pre>



<ul><li>MAILTO=&#x201D;&#x201D; &#x662F;&#x6267;&#x884C;crontab&#x4E0D;&#x53D1;&#x6267;&#x884C;&#x7ED3;&#x679C;&#x7684;&#x7CFB;&#x7EDF;&#x90AE;&#x4EF6;</li><li>*/1&#x662F;&#x6307;&#x6BCF;1&#x5206;&#x949F;&#x6267;&#x884C;&#x4E00;&#x6B21;&#xFF0C;&#x5269;&#x4E0B;&#x7684;*&#x5206;&#x522B;&#x4EE3;&#x8868;&#xFF1A;&#x6BCF;&#x5C0F;&#x65F6;(0~23)/&#x6BCF;&#x5929;(1~31)/&#x6BCF;&#x6708;(1~12)/&#x6BCF;&#x5468;&#x51E0;(0~6)</li></ul>
<!--kg-card-end: html-->]]></content:encoded></item><item><title><![CDATA[PHP交换两个值]]></title><description><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="php" class="language-php">$a = 1;
$b = 2;
list($a, $b) = array($b, $a);
[$a, $b] = [$b, $a];</code></pre>
<!--kg-card-end: html-->]]></description><link>http://www.dev-f.cn/php-e4-ba-a4-e6-8d-a2-e4-b8-a4-e4-b8-aa-e5-80-bc/</link><guid isPermaLink="false">637249606c43230001e3d3b3</guid><dc:creator><![CDATA[fyn]]></dc:creator><pubDate>Wed, 15 Apr 2020 17:06:56 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: html-->
<pre class="wp-block-code"><code lang="php" class="language-php">$a = 1;
$b = 2;
list($a, $b) = array($b, $a);
[$a, $b] = [$b, $a];</code></pre>
<!--kg-card-end: html-->]]></content:encoded></item></channel></rss>