Skip to content

Instantly share code, notes, and snippets.

View timercrack's full-sized avatar

JeffChen timercrack

View GitHub Profile
@timercrack
timercrack / config.json
Last active May 19, 2024 09:37
openwrt + XRAY 使用 iptables 实现 IPV4 / IPV6 透明代理
{//服务器使用的方案:VLESS+TLS+WS+NGINX+CDN,看情况替换成自己的
"log": {
"access": "/dev/null",
"error": "/var/log/xray_error.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag":"transparent",
"port": 12345,
@timercrack
timercrack / holiday.py
Created August 16, 2016 09:41
获取近5年的法定节假日和休息日,使用百度公共API
import datetime
import aiohttp
import asyncio
import tqdm
type_name = ['工作日', '休息日', '节假日']
max_conn = asyncio.Semaphore(15) # 最大并发连接数, 默认15
async def fetch(url, day):
await max_conn.acquire()
@timercrack
timercrack / checksum.py
Created January 20, 2016 07:39
python construct checksum fields made easy for common tasks
#!/usr/bin/env python
# from https://groups.google.com/forum/#!topic/construct3/FzYFmdv4qTg
from construct import *
# copied from core.py
def _read_stream(stream, length):
if length < 0:
raise ValueError("length must be >= 0", length)
data = stream.read(length)