Skip to content

Instantly share code, notes, and snippets.

View glw119's full-sized avatar

Liangwu glw119

  • Beijing
  • 02:15 (UTC +08:00)
View GitHub Profile
@glw119
glw119 / dell-power-supply-monitor.yaml
Created November 8, 2025 13:45
DELL电源PMBus读取数据
esphome:
name: dell-power-supply-monitor
friendly_name: dell_power_supply_monitor
includes:
- dell_power_supply/main.hpp
- dell_power_supply/pmbus.cpp
- dell_power_supply/pmbus.h
esp8266:
board: d1_mini
@glw119
glw119 / PVE-HP-ssacli-smart-storage-admin.md
Created July 28, 2025 11:36 — forked from mrpeardotnet/PVE-HP-ssacli-smart-storage-admin.md
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

Why use HP Smart Storage Admin CLI?

You can use ssacli (smart storage administrator command line interface) tool to manage any of supported HP Smart Array Controllers in your Proxmox host without need to reboot your server to access Smart Storage Administrator in BIOS. That means no host downtime when managing your storage.

CLI is not as convenient as GUI interface provided by BIOS or desktop utilities, but still allows you to fully manage your controller, physical disks and logical drives on the fly with no Proxmox host downtime.

ssacli replaces older hpssacli, but shares the same syntax and adds support for newer servers and controllers.

Installation

@glw119
glw119 / install-lsi-megacli-and-create-raid5-for-ovh-servers.md
Created April 20, 2025 19:26 — forked from jesussuarz/install-lsi-megacli-and-create-raid5-for-ovh-servers.md
Install LSI MegaCli package on Debian/Ubuntu/RedHat and Create 2 groups RAID5 for OVH Servers to use maximum disk space

Install LSI MegaCli package on Debian/Ubuntu/RedHat and Create 2 groups RAID5 for OVH Servers to use maximum disk space

Send your server to rescue mode, If you use rescue custom mode then you probably need to install megacli

Then you can, When your server reboots, log in to it via SSH using the rescue mode credentials that were emailed to you.

Install LSI MegaCli package on Linux - All distributions based on RedHat/Debian:

Ubuntu/Debian

Install necessary tools

@glw119
glw119 / default.custom.yaml
Created April 9, 2025 11:32 — forked from lotem/default.custom.yaml
使用 Control 鍵切換中西文,上屏已輸入的編碼;令 Caps Lock 改變字母的大小寫
# 中西文切換鍵的默認設置寫在 default.yaml 裏面
# 以下的 default.custom.yaml 在全局範圍重定義該組快速鍵
#
# 可用的按鍵有 Caps_Lock, Shift_L, Shift_R, Control_L, control_R
# Mac 系統上的鼠鬚管不能區分左、右,因此只有對 Shift_L, Control_L 的設定起作用
#
# 已輸入編碼時按切換鍵,可以進一步設定輸入法中西文切換的形式。
# 可選的臨時切換策略有三:
# inline_ascii 在輸入法的臨時西文編輯區內輸入字母、數字、符號、空格等,回車上屏後自動復位到中文
# commit_text 已輸入的候選文字上屏並切換至西文輸入模式
#!/bin/bash
# Update on 2024/05/29
# 1. use wget to fetch latest frp version when curl was not installed
# 2. Remind users that frp will be run in non-root user
# 3. Add CI
#
# Update on 2024/04/13
# 1. Improved OS compatibility: try wget and then curl for downloading files.
#
# Update on 2024/01/26
@glw119
glw119 / check_hdd_status.py
Created September 18, 2024 07:45
check the hdd status via ilo4 and send alert email
import requests
import smtplib
import urllib3
urllib3.disable_warnings()
# Replace with your iLO4 IP address and credentials
ilo_url = "https://192.168.1.1"
username = "liangwu"
password = "liangwu"
@glw119
glw119 / 03-edgerouter-backup.sh
Created January 28, 2024 11:58
Home Network Configuration
#!/bin/bash
source /config/user-data/edgerouter-backup.conf
# ref https://github.com/psitem/edgerouter-backup
# This script runs during the commit
# Pull commit info
COMMIT_VIA=${COMMIT_VIA:-other}
COMMIT_CMT=${COMMIT_COMMENT:-$DEFAULT_COMMIT_MESSAGE}
firewall {
ipv6-name dmz-lan-6 {
default-action drop
enable-default-log
rule 100 {
action accept
log enable
protocol ipv6-icmp
}
rule 1 {
@glw119
glw119 / lvm-cache-debian.md
Created July 26, 2023 14:09 — forked from ntn888/lvm-cache-debian.md
Instructions to create an LVM cache for root in Debian

LVM cache in Debian

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

package main
import (
"bytes"
"log"
"os"
"strconv"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/ssh"