Skip to content

Instantly share code, notes, and snippets.

View 0x5e's full-sized avatar

gaosen 0x5e

  • China, Zhejiang, Hangzhou
  • 04:38 (UTC +08:00)
View GitHub Profile
@0x5e
0x5e / camera-stream.go
Created March 4, 2024 14:41
bambu-go2rtc
// golang version of https://github.com/synman/bambu-go2rtc
// usage: ./camera-stream <accessCode> <hostname>
// with ffplay: ./camera-stream <accessCode> <hostname> | ffplay -hide_banner -fflags nobuffer -analyzeduration 10 -probesize 32 -i -
// tested on bambu lab a1 mini, the fps is really low for this device :(
package main
import (
"bytes"
"crypto/tls"
@0x5e
0x5e / passwall_watchdog.sh
Created July 1, 2023 16:46
OpenWrt passwall service watchdog. Auto restart service when tcp node dns resolve ip changed.
#!/bin/sh
# Run this script from cron every 10 minutes:
# echo '*/10 * * * * /path/to/passwall_watchdog.sh' >> /etc/crontabs/root
enabled=$(uci get passwall.@global[0].enabled)
tcp_node=$(uci get passwall.@global[0].tcp_node)
address=$(uci get passwall.$tcp_node.address)
previous_ip=$(uci get passwall.$tcp_node.ip 2>/dev/null)
current_ip=$(resolveip $address)
@0x5e
0x5e / ddns_watchdog.sh
Created March 29, 2023 05:54
OpenWrt DDNS service watchdog. Auto restart service when it exited unexpectedly.
#!/bin/sh
# Run this script from cron every 10 minutes:
# echo '*/10 * * * * /path/to/ddns_watchdog.sh' >> /etc/crontabs/root
. /lib/functions.sh
handle_ddns_service() {
local cfg="$1"
local enabled
@0x5e
0x5e / telnet.sh
Last active February 19, 2023 08:32
Automate telnet login
#!/bin/bash
# This script is generated by chatgpt for telnet auto-login.
if [ $# -eq 0 ]; then
echo "Usage: $0 <host>"
exit 1
fi
host=$1
user=$(grep -A 2 "Host $host" ~/.ssh/config | grep User | awk '{print $2}')
@0x5e
0x5e / openwrt-wireguard-watchdog.sh
Created September 4, 2022 06:51
openwrt-wireguard-watchdog
#!/bin/sh
# Description:
# A WireGuard watchdog for OpenWrt.
# If peer has an endpoint_host, disconnected 2 minutes ago, and remote ip has changed, we will trigger an force reconnect for this interface.
#
# Usage:
# Add "*/10 * * * * sh /path/to/openwrt-wireguard-watchdog.sh" in crontab.
#
# Dependency: busybox, resolveip, uci, wireguard-tools
@0x5e
0x5e / amlogic-s9xxx-network-failsafe.sh
Last active December 15, 2022 01:56
Amlogic S9xxx network failsafe script
#!/bin/sh
# ./amlogic-s9xxx-network-failsafe.sh
# 使用方式:在 Amlogic S9xxx 盒子及其 Docker 容器的 /etc/rc.local 中加入此文件,可以在开机后网络异常的情况下自动修复。若修复之后 60s 仍不正常,会自动重启。
interface="eth0"
_logger() {
echo "[`basename "$0"`] $1"
}
@0x5e
0x5e / GetTAPasswd.sh
Last active May 5, 2022 12:28
获取电信超管密码
#!/bin/sh
# 使用方式:
# 1. 使用小翼管家App绑定光猫,确保光猫处于在线状态
# 2. 打开抓包工具,同时手机打开网关详情页,开关一下指示灯,获取token和mac地址
# 3. 填入下面的环境变量中运行
mac="112233AABBCC"
token="........................................................................................................"
@0x5e
0x5e / wg-watchdog.sh
Created April 29, 2022 11:01
wireguard watchdog
#!/bin/bash
#
# This watchdog script restart systemctl wireguard service if ping timeout for 3 times
#
# Usage:
# ./wg-watchdog.sh [interface] [ip]
#
# Example:
# ./wg-watchdog.sh wg0 192.168.40.1
#
@0x5e
0x5e / wechat_moment_ad_close.sh
Last active April 26, 2023 08:09
一键关闭微信朋友圈广告
#!/bin/bash
set -e pipefail
uuid=`curl -fsSL "https://open.weixin.qq.com/connect/qrconnect?appid=wxaac6769b766cb943&redirect_uri=http%3A%2F%2Fads.privacy.qq.com%2Foptout%2FwxPassport&response_type=code&scope=snsapi_login&state=gryhphlfgdjhofds#wechat_redirect" | grep 'qrcode-image' | sed -E 's#.*<img class=".*" src="/connect/qrcode/(.*)" />#\1#'`
echo "请使用微信扫码登录..."
echo "二维码地址:https://open.weixin.qq.com/connect/qrcode/$uuid"
while :; do
wx_code=`curl -fsSL "https://long.open.weixin.qq.com/connect/l/qrconnect?uuid=$uuid" | sed -E "s/.*window.wx_code='(.*)';/\1/"`
@0x5e
0x5e / music_oversea.txt
Last active August 3, 2022 01:37
绕过海外音乐版权限制(网易云音乐、QQ音乐、酷狗音乐、酷我音乐、百度音乐)
Iee9keaYk+mfs+S5kAp8fG11c2ljLjE2My5jb20KQEAqLm11c2ljLjEyNi5uZXQKCiFRUemfs+S5kAp8
fHkucXEuY29tXgp8fGkueS5xcS5jb20vdjgvcGxheXNvbmcuaHRtbAp8fGMueS5xcS5jb20vdjgvZmNn
LWJpbi9mY2dfcGxheV9zaW5nbGVfc29uZy5mY2cKQEBkbC5zdHJlYW0ucXFtdXNpYy5xcS5jb20KCiHp
hbfni5fpn7PkuZAKfHxrdWdvdS5jb21eCnx8aXAua3Vnb3UuY29tL2NoZWNrL2lzY24KQEBmcy5vcGVu
Lmt1Z291LmNvbQoKIemFt+aIkemfs+S5kAp8fGt1d28uY25eCnx8aXBjaGVjay5rdXdvLmNuL2lwX2No
ZWNrLmt1d28KQEBzeWNkbi5rdXdvLmNuXgoKIeeZvuW6pumfs+S5kAp8fG11c2ljLmJhaWR1LmNvbS9k
YXRhL3VzZXIvbG9jYXRpb24KQEB5aW55dWVzaGl0aW5nLmJhaWR1LmNvbQo=