来源:https://gist.github.com/ihipop/8ef5e38b4b3116ba0d4e04dbb7ca9fa5
update-komari-agent.sh 用于下载最新的 Komari Agent Linux 二进制文件并重启对应的 systemd 服务。
默认值:
- Agent 目录:
/data/komari-agent - systemd 服务:
komari-agent
| #!/bin/sh | |
| # Transactional br0 network stack for LibreELEC + ConnMan + DHCP client. | |
| # | |
| # Public commands: | |
| # install - provision DHCP support and install/enable units and drop-ins | |
| # enable - create br0.enabled and start bridge mode now | |
| # disable - remove br0.enabled and return to the stock ConnMan | |
| # status - show switch, service and network state | |
| # fallback - force cleanup and return to the stock ConnMan | |
| # |
来源:https://gist.github.com/ihipop/8ef5e38b4b3116ba0d4e04dbb7ca9fa5
update-komari-agent.sh 用于下载最新的 Komari Agent Linux 二进制文件并重启对应的 systemd 服务。
默认值:
/data/komari-agentkomari-agent| #!/bin/bash | |
| INTERVAL=5 | |
| THRESHOLD=5 | |
| echo "开始监控 TcpOutRsts..." | |
| last_out_rsts=$(nstat -az TcpOutRsts | awk 'NR==2 {print $2}') | |
| while true; do | |
| sleep $INTERVAL | |
| current_out_rsts=$(nstat -az TcpOutRsts | awk 'NR==2 {print $2}') |
| [Unit] | |
| Description=Lid Monitor for Controlling KRFB Virtual Monitor | |
| After=graphical-session.target | |
| Requires=graphical-session.target | |
| [Service] | |
| ExecStart=/bin/bash %h/.local/bin/lid-monitor.sh | |
| Restart=on-failure | |
| Type=simple |
| #!/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 | |
| get_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 "" |