VBoxManage setextradata "Win 11" "VBoxInternal/Devices/efi/0/Config/DmiBoardSerial" "string:SN001"
VBoxManage setextradata "Win 11" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "string:SN001"
如果是传统BIOS引导,把efi 换成 pcbios 即可
| #!/bin/bash | |
| # 监听 KDE 6 的 org.kde.Solid.PowerManagement 用户级会话信号,控制 krfb-virtualmonitor 服务 | |
| # 完全用户级,无需 root 权限,增强信号解析和错误处理 | |
| # 用于后台监听显示器插拔事件 | |
| start_monitor_listener() { | |
| gdbus monitor --session --dest org.freedesktop.PowerManagement -o /org/kde/ScreenBrightness | | |
| while IFS= read -r line; do | |
| if echo "$line" | grep --line-buffered -q -E "DisplayAdded|DisplayRemoved"; then | |
| echo "检测到显示器相关事件,重新检查 4K 状态" |
| #!/bin/bash | |
| match=eth0 # Network interface name | |
| num_big_cores=2 # Number of high-performance cores to select | |
| # Retrieve cpu_capacity for each core and sort in descending order | |
| declare -A cpu_capacities | |
| for cpu in /sys/devices/system/cpu/cpu[0-9]*; do | |
| capacity_file="$cpu/cpu_capacity" | |
| if [ -f "$capacity_file" ]; then |
| ACTION=="change", SUBSYSTEM=="power_supply", DEVPATH=="*:046D:B342.*", RUN+="/bin/bash -c \"DEV_RAW=/dev/$$(echo $$(ls -1 $$(echo /sys$${DEVPATH} |sed -E 's#(.*)/power_supply/.*#\1#g')/hidraw)); [ -c $${DEV_RAW} ] && echo -ne '\x10\xff\x0b\x1e\x00\x00\x00' > $${DEV_RAW} || true\"" |
| #!/bin/bash | |
| # from https://stackoverflow.com/a/76260286 | |
| dmesg | awk -F ] '{"cat /proc/uptime | cut -d \" \" -f 1" | getline st;a=substr( $1,2, length($1) - 1);print strftime("%F %H:%M:%S %Z",systime()-st+a)" -> "$0}' |
| #!/bin/bash | |
| [ "$XDG_SESSION_DESKTOP" = "KDE" ] || exit | |
| #dbus-send --session --print-reply --dest=org.kde.kded5 \ | |
| # /kded \ | |
| # org.kde.kded5.unloadModule \ | |
| # string:"kscreen" | |
| { | |
| dbus-send --session --type=method_call --print-reply --dest=org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.refreshCurrentShell || | |
| { killall plasmashell -u ${USER:-$(whoami)} && echo killed plasmashell ; kstart5 -- plasmashell >/dev/null 2>&1 & } | |
| } & |
| #!/bin/bash | |
| # from https://stackoverflow.com/questions/20762575/explanation-of-convertor-of-cidr-to-netmask-in-linux-shell-netmask2cdir-and-cdir | |
| # see also https://gist.github.com/RichardBronosky/7902f062ab36d3c99413ba21986ed0cb | |
| mask2cdr () | |
| { | |
| # Assumes there's no "255." after a non-255 byte in the mask | |
| local x=${1##*255.} | |
| set -- 0^^^128^192^224^240^248^252^254^ $(( (${#1} - ${#x})*2 )) ${x%%.*} | |
| x=${1%%$3*} | |
| echo $(( $2 + (${#x}/4) )) |
| #!/bin/bash | |
| # put me in the directory of "/etc/NetworkManager/dispatcher.d/",permission `u+x,g-w,o-w` | |
| GUARDED_CONNECTION_NAMES='SSTP' | |
| CONTROL_FILE=/tmp/NM-CONN-GUARD-DISABLED | |
| if [ -f "$CONTROL_FILE" ] || [ -f "$CONTROL_FILE-$CONNECTION_ID" ]; then | |
| echo -n "VPN GUARD DISABLED" | |
| [ -f "$CONTROL_FILE-$CONNECTION_ID" ] && echo -n " FOR CONNECTION ${CONNECTION_ID}" | |
| echo "" |
| [Unit] | |
| Description=MAC address loader for %I From bootloader env | |
| ConditionFileIsExecutable=/usr/sbin/fw_printenv | |
| Wants=network-pre.target | |
| Before=network-pre.target | |
| BindsTo=sys-subsystem-net-devices-%i.device | |
| After=sys-subsystem-net-devices-%i.device | |
| [Service] | |
| Type=oneshot |
| package main | |
| import ( | |
| "fmt" | |
| "github.com/reiver/go-oi" | |
| "github.com/reiver/go-telnet" | |
| ) | |
| func main() { |