取消pve登录订阅弹窗

文件位置 /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 修改前先备份 查找 data.status 关键字 将 .data.status !== 'Active'修改为 .data.status == ‘aaaaActive’,条件修改为永久false即可

if (res === null || res === undefined || !res || res
                        .data.status !== 'Active') {
                        Ext.Msg.show

保存文件 重启systemctl restart pveproxy 清空浏览器缓存

阅读更多

常用shell

# 替换中英文标点以及特殊符号
rename "s/[\s\·\~\!\@\#\¥\%\……\&\*\(\)\——\-\+\=\【\】\{\}\、\|\;\‘\’\:\“\”\《\》\?\,\。\、\`\~\!\#\\$\%\^\&\*\(\)\_\[\]{\}\\\|\;\'\'\:\"\"\,\.\/\<\>\?]//" *


rename “s/[,.()’’””]//“ * 

i=1; for x in *.js; do mv $x numbers-$i.mp4; let i=i+1; done

i=1; for x in *.jpg; do mv $x wx-$i.jpg; let i=i+1; done

i=1; for x in ent* ; do cp $x/service.js $x; let i=i+1; done



i=1; for x in *.(mp4|MP4); do mv $x $(pwd | awk -F "/" '{print $NF}')-$(printf "%02d" "$i").mp4; let i=i+1; done

sudo killall -HUP mDNSResponder

find . -name "*.zip" -exec unar -o ./zips -f {} \;

find . -name "*.mp4" -exec mv {} ../mvto-hgst6t/ \;

find . -name "*.mp4" -type f -size -200M -exec rm -rf \;
find . -type f -size -200M -exec rm -rf {} \;

find . -type f -size +200M -exec mv {} ../mvto-hgst6t/ \;

du --max-depth=1 -h | sort -n -r

du ./ --exclude="sharedfolders" --exclude="srv" --exclude="proc" --max-depth=2 -h | sort -n -r

du /* --exclude="sharedfolders" --exclude="srv" --exclude="proc" -sh


find . -name "*.zip" -exec unzip -o ./zips -f {} \;


i=1; for x in *; do echo $x; let i=i+1; done

阅读更多

Docker Daemonjson

  • 路径 /etc/docker/daemon.json 没有就新建一个
{
  "registry-mirrors":[
    "https://hub-mirror.c.163.com/",
    "https://registry.docker-cn.com"
  ]
}
  • 详细文档https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file

阅读更多

Ssh Keygen

# 生成密钥对
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
# 公钥上传至目标服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub user@server

阅读更多

Sourcetree

  • Q: env: node: No such file or directory
  • A:使用nvm安装node或其他版本管理工具会出现类似问题,查看 .git/hooks 文件夹有使用js执行的hooks,将其替换成shell执行的即可,或者将node环境变量暴露到全局

阅读更多

Numpy取值

# coding=utf-8
import numpy as np
# ./np.csv
# 1,2,3,4
# 5,6,7,8
# 9,8,7,6
# 5,4,3,7
# 2,6,8,9
# 12,61,18,19
t1 = np.loadtxt("./np.csv", delimiter=",", dtype="int")
print(t1)
# 取行
print(t1[2])
# 取多行
print(t1[2:])
# 取不连续多行
print(t1[[2, 3, 5]])

# 取列
print(t1[:, 0])
# 取连续多列
print(t1[:, 1:])
# 取不连续多列
print(t1[:, [0, 2, 3]])

# 取第3行,第2列
a = t1[3, 2]
print(a)
print(type(a))

# 取第1-3行,第1-3列
print(t1[0:3, 0:3])

# 取不相邻的点
print(t1[[0, 1], [2, 1]])

阅读更多

Matplotlib

# coding=utf-8
from matplotlib import pyplot as plt
import random
# 显示中文
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号
x = range(0, 10)
y1 = [random.randint(0, 10) for i in range(10)]
y2 = [random.randint(0, 10) for i in range(10)]
plt.figure(figsize=(20, 8), dpi=80)
plt.plot(x, y1, label="小明", color="red", linestyle="--", linewidth=3, alpha=0.2)
plt.plot(x, y2, label="小红", color="orange", linestyle=":", linewidth=3)

plt.grid(alpha=0.4)
plt.legend()

_x = list(x)

_xtick_labels = ["中文".format(i) for i in range(10)]

plt.xticks(_x[::2], _xtick_labels[::2], rotation=70)
plt.xlabel("时间")
plt.ylabel("刻度")
plt.title("折线图")

plt.show()

阅读更多

Proxmox硬盘直通

# 查询硬盘列表
ls /dev/disk/by-id

# 希捷500G
qm set 100 -sata1 /dev/disk/by-id/ata-ST500LM021-1KJ152_W62BER60

# 日立4T 1
qm set 100 -sata2 /dev/disk/by-id/ata-HGST_HDN724040ALE640_PK1334PEJNHADS

# 日立4T 2
qm set 100 -sata3 /dev/disk/by-id/ata-MB4000GCWLV_P4G5RGEB

# 日立6T 
qm set 100 -sata4 /dev/disk/by-id/ata-HGST_HUS726060ALA640_AR11021EGAWD2B

# 东芝500G(未使用)
qm set 100 -sata4 /dev/disk/by-id/ata-MB4000GCWLV_P4G5RGEB

如果返回以下信息,说明已成功挂载
update VM 100: -sata1 /dev/disk/by-id/ata-WDC_WDXXXX_XXXX_XXXX

阅读更多