咕噜猫小站

do it, do it right, do it right now

0%

Git 备份仓库(mirror)

参考资料: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/duplicating-a-repository|

1. 以 mirror 的方式 clone 仓库

1
git clone --mirror https://github.com/exampleuser/repository-to-mirror.git

2. 设置目标地址

1
2
cd repository-to-mirror
git remote add mirror_host https://github.com/exampleuser/mirrored

3. 更新并同步到目标地址

1
2
git fetch -p origin
git push --mirror mirror_host 

远程上传证书并调用更新脚本

背景: 由于有多个服务器需要更新 https 证书,如果每个服务器单独更新自己的证书,在迁移应用的时候,需要把证书也迁移过去,非常麻烦。因此考虑由一台服务器进行更新 https 证书,并通过 ssh 分发和调用更新命令。

Elasticsearch 相关文档

elk文档.7z

文件列表如下,有空再整理

  • DSL查询举例.ipynb
  • DSL查询举例.md
  • Logstash基本使用.md
  • Metricbeat+ELK实现性能监控.md
  • Python从Elasticsearch中读取CPU数据.md
  • 基于Python+EL实现的数据采集器.md

鼠标点击字体特效

JQuery 版本

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* 鼠标特效 */
var a_idx = 0;
var a = new Array("❤Python❤","❤Julia❤","❤PHP❤","❤C❤","❤C++❤","❤C#❤","❤Java❤","❤Go❤","❤ASM❤","❤SQL❤","❤HTML❤","❤CSS❤","❤Javascript❤");
jQuery(document).ready(function($) {
    $("body").click(function(e) {
        var $i = $("<span></span>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        $i.css({
            "z-index": 9999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});

Javascript 原生版

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class ClickFontEffect {

    constructor(fontArray, colorArray) {
        // 文字列表
        this.fontArray = fontArray || ["快乐", "欢欣", "愉快", "欢喜"];
        // 颜色列表
        this.colorArray = colorArray || ["red", "green", "blue", "orange", "purple", "yellow"];
        // 获取body元素
        this.body = document.getElementsByTagName("body")[0];
        // 默认的css样式
        this.cssStyle = "position:absolute; width: 40px; height: 20px; cursor: default; transform: translate(-50%,-50%); font-weight: bold; opacity: 1; z-index: 1000; transition: 1s; -moz-user-select: none;-webkit-user-select: none;-ms-user-select: none;user-select: none;";

        let that = this;
        document.addEventListener("click", (e) => { that.showFont(e); })
    };

    showFont(e) {

        // 创建一个随机节点
        let newNode = document.createElement('span');
        // 随机字体和颜色
        let fontIdx = Math.floor(Math.random() * this.fontArray.length);
        let coloryIdx = Math.floor(Math.random() * this.colorArray.length);
        let randomFront = this.fontArray[fontIdx];
        let randomColor = this.colorArray[coloryIdx];
        // 向body中添加元素
        this.body.appendChild(newNode);
        // 添加样式
        newNode.style.cssText = this.cssStyle;
        newNode.style.color = randomColor;
        newNode.innerHTML = randomFront;

        // 鼠标点击位置
        newNode.style.left = e.clientX + 'px';
        newNode.style.top = e.clientY + 'px';

        // 动画
        setTimeout(function () {
            newNode.style.opacity = 0;
            newNode.style.top = newNode.offsetTop - 100 + 'px';
        }, 100);
        // 清除
        let that = this;
        setTimeout(function () {
            that.body.removeChild(newNode);
        }, 2000);
    }
};

window.onload = function () {
    let fontEffect = new ClickFontEffect();
}

ISC KEA 服务器安装与配置

本文以 Debian 10 为例,介绍 Kea 服务器的安装与配置方法。

一、Kea 安装与配置

待补充

二、Kea Stork 安装与配置

Stork 为 Kea 服务的一个可视化前端。

参考资料:

Stork 分为 Server 和 Agent 两部分。Agent 需要跟 kea 或者 bind9 服务安装在同一台机器上,用于获取这些服务的数据。Server 从 Agent 处获取信息并展示。Server 可以单独安装其他机器上。

DHCP 服务器安装与配置

本文以 Debian 10 为例,介绍 DHCP 服务器的安装与配置方法。

参考资料:

1. 安装

安装 isc-dhcp-server 程序包。

1
sudo apt install isc-dhcp-server

2. 配置

2.1 指定监听的网络接口

编辑 /etc/default/isc-dhcp-server 文件,修改如下选项,把 eth0 改为自己的网络接口名称

Kubernetes 配置节点支持 GPU

本文以 Debian 10, kubernetes 1.19.3 为例,进行配置 GPU 支持。

参考资料:

1. 前提条件

  • 节点上已经安装了 nvidia 显卡驱动。驱动版本必须大于 384.81 。
  • 节点上已经安装了 nvidia-docker 2.0 插件。安装过程见 docker 添加 nvidia 运行环境
  • nvidia-container-runtime 作为默认的 runtime 。 即在 /etc/docker/daemon.json 中设置 "default-runtime": "nvidia"

2. 安装插件

1
kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.7.0/nvidia-device-plugin.yml

3. 查看节点 gpu 数量

1
kubectl get nodes "-o=custom-columns=NAME:.metadata.name,GPU:.status.allocatable.nvidia\.com/gpu"

Kubernetes 安装 Kubeflow

本文以 Debian 10, kubernetes 1.19.3 为例,进行 Kubeflow 1.1.0 的安装讲解。

参考资料:

1. 准备环境

1.1 配置动态卷供应

Kubernetes 里需要配置了一个默认的动态卷供应 dynamic volume provisioner (重要,一些应用需要这个来存储数据) 。可通过此文档 Kubernetes 配置 NFS StorageClass 配置一个 NFS StorageClass 。