修復VCenter Log Disk Exhaustion on vc 錯誤

參考: https://kb.vmware.com/s/article/2143565

輔助指令

df -h |awk '0+$5 >= 78 {print}'
du --max-depth=1 | sort -n -r  | head -n 20

修復指令

cp /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.bak
sed -i 's/size=\"50 MB\"/size=\"10 MB\"/g' /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml
sed -i 's/max=\"10\"/max=\"3\"/g' /usr/lib/vmware-sso/vmware-sts/webapps/ROOT/WEB-INF/classes/log4j2.xml

cd /storage/log/vmware/sso/

rm localhost_access_log.*
rm vmware-identity-sts.*
rm vmware-identity-sts-perf.*
rm *2020*
rm *2021*

service vmware-stsd restart

git 範例

git 分支, 合併, tag 之範例

# 建立 develop branch
git branch develop
git checkout develop
git branch

for t in {1..5};
do
  TAG=v0.${t}
  FEATURE=feature/${TAG}

  # 建立 feature branch
  git branch ${FEATURE}
  git checkout ${FEATURE}
  git branch

  # commit 5個版本
  for i in {1..5};
  do
    data=$(printf "${FEATURE}-%03d" $i)
    echo $data >> history.txt
    history=$(cat history.txt)
    printf "# Test\n## Version\n${data}\n## History\n\`\`\`\n${history}\n\`\`\`\n" > readme.md
    git add .
    git commit -m "version: ${data}"
    git push -u origin ${FEATURE}
  done
  git branch

  # 切換develop
  git checkout develop
  git branch

  # 合併
  git merge --no-ff -m "合併(from ${FEATURE} to develop)" ${FEATURE}
  git push -u origin develop

  # 刪除分支
  git branch -d ${FEATURE}
  git push -u origin :${FEATURE}
  git push -u origin develop

  # 切換到master
  git checkout master
  git branch

  # 合併
  git merge --no-ff -m "合併(from 合併 to master)" develop
  git push -u origin master

  # 建立release
  git tag ${TAG}
  git tag -l
  git push origin ${TAG}
done

在macos使用qemu安裝windows

安裝Qemu

brew install qemu

建立硬碟

qemu-img create -f raw ~/qemu/disk.img 20G
qemu-img info ~/qemu/disk.img

修正Qemu錯誤

原生安裝好的qemu執行虛擬機時,會出現qemu-system-x86_64: Error: HV_ERROR的錯誤,
修正方式如下:

# 參考 https://stackoverflow.com/a/64993771/4802467
cat << EOF > app.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.hypervisor</key>
    <true/>
</dict>
</plist>
EOF
md5 $(which qemu-system-x86_64)
codesign -s - --entitlements app.entitlements --force $(which qemu-system-x86_64)
md5 $(which qemu-system-x86_64)
rm -f app.entitlements

開啟虛擬機

qemu-system-x86_64 \
  -m 4G \
  -vga virtio \
  -display default,show-cursor=on \
  -usb \
  -device usb-tablet \
  -machine type=q35,accel=hvf \
  -smp 2 \
  -drive file=/Users/slanla/qemu/disk.img,index=0,format=raw,if=virtio \
  -drive file=windows.iso,index=1,media=cdrom \
  -drive file=virtio-win-drivers-20120712-1.iso,index=2,media=cdrom \
  -cpu Nehalem

資源下載

virtio-win-drivers-20120712-1.iso

透過run-avrdude燒錄Arduino Yun

由於不小心在上一支程式用太多記憶體(接近99%)
造成Arduino Yun無法透過IDE Upload程式了
原本打算用 Arduino as ISP方式用另外一台Arduino Yun來燒錄.
但是試不出來.

後來在論壇上( https://forum.arduino.cc/index.php?topic=355657.0 )看到可以用run-avrdude來進行燒錄
因此就先用Blink建立最簡單的hex後,
再把檔案傳到Arduino上.
接著ssh進去yun後,透過下列指令進行燒錄

merge-sketch-with-bootloader.lua Blink.ino.hex
run-avrdude Blink.ino.hex

如果只是單純使用run-avrdude,也是可以燒錄.
但是IDE依然無法燒錄.
後來用merge-sketch-with-bootloader.lua對hex檔案天加入了bootloader後.
就可以讓IDE燒錄了.

擋廣告神器 Adguard Home 架設

mkdir -p $PWD/adguardhome/workdir
mkdir -p $PWD/adguardhome/confdir
docker rm -f adguardhome
docker run \
  -d \
  --name=adguardhome \
  --restart=always \
  -v $PWD/adguardhome/workdir:/opt/adguardhome/work \
  -v $PWD/adguardhome/confdir:/opt/adguardhome/conf \
  -p 53:53/tcp \
  -p 53:53/udp \
  -p 67:67/udp \
  -p 68:68/tcp \
  -p 68:68/udp \
  -p 80:80/tcp \
  -p 443:443/tcp \
  -p 853:853/tcp \
  -p 3000:3000/tcp \
  adguard/adguardhome

gitlab runner 500錯誤

解決辦法1

gitlab-rails console
Ci::Runner.all.update_all(token_encrypted: nil)

並重啟gitlab

解決辦法2

gitlab-rails dbconsole
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;

並重啟gitlab

reference

https://blog.csdn.net/qq_15904277/article/details/90751271

更新k8s憑證

#確認憑證
kubeadm alpha certs check-expiration

#匯出設定
kubeadm config view > /root/kubeadm.yaml
更新憑證
kubeadm alpha certs renew all --config=/root/kubeadm.yaml
kubeadm alpha certs check-expiration

#刪除
rm -rf /root/kubeadm.yaml

#重啟
docker ps |grep -E 'k8s_kube-apiserver|k8s_kube-controller-manager|k8s_kube-scheduler|k8s_etcd_etcd' | awk -F ' ' '{print $1}' |xargs docker restart