Skip to content

Instantly share code, notes, and snippets.

View yocoldle's full-sized avatar
😇
Busy af

Coldle yocoldle

😇
Busy af
View GitHub Profile
@yocoldle
yocoldle / traffic-monitor.py
Created July 20, 2024 16:47
Network interface traffic monitor based on vnstat, automatic disable network interface or shutdown
import subprocess
import json
import os
import sys
"""
通过 vnstat 统计当日&当月流量,达到第一限制时禁用网络
接口,达到第二限制则禁用网络接口+关机
p.s. 若开机时间不足最小开机时长,则达到第二限制时只会
@yocoldle
yocoldle / RandomColorscheme.vim
Created July 18, 2023 11:42
vimscript func: RandomColorscheme
" Random colorscheme function
function! RandomColorscheme()
" Get a list of all colorschemes
let s:colorschemes = split(globpath(&rtp, 'colors/*.vim'), '\n')
" Remove the path and extension from each colorscheme name
let s:colorschemes = map(s:colorschemes, 'fnamemodify(v:val, ":t:r")')
" Remove unwanted colorschemes
let s:colorschemes = filter(s:colorschemes, 'v:val != "blue" && v:val != "darkblue" && v:val != "default" && v:val != "delek" && v:val != "morning" && v:val != "peachpuff" && v:val != "shine" && v:val != "zellner"')
" Select a random colorscheme from the list
let s:random_colorscheme = s:colorschemes[rand() % len(s:colorschemes)]
@yocoldle
yocoldle / main.sh
Created June 28, 2023 09:02
replit部署go-proxy-bingai, 理论其他平台可用
repo="adams549659584/go-proxy-bingai"
# 获取远程tag
tag=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -o '"tag_name": ".*"' | sed 's/"tag_name": "//;s/"//')
# 获取本地tag
if [ -f "cur_tag" ]; then
cur=$(cat "cur_tag")
else
cur=""