Skip to content

Instantly share code, notes, and snippets.

@boypt
boypt / tproxy.sh
Last active December 25, 2023 07:28
TPROXY use case with v2ray
#!/bin/bash
apply_mangle() {
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N V2RAY_MASK
iptables -t mangle -A V2RAY_MASK -m set --match-set white_list dst -j RETURN
iptables -t mangle -A V2RAY_MASK -p udp -m multiport --ports 53,67:68,135:139 -j RETURN
@boypt
boypt / gist:80d9ecaaa7f3c799c525e91f3c0b35d1
Created February 22, 2019 14:27
v2ray-core 流量统计 StatsService 使用要点
StatsService API获得数据统计功能,配置里面必须满足以下条件
1. `"stats":{}`对象的存在
2. `"api"`配置对象里面有`StatsService`
3. `"policy"`中的统计开关为true,除了各个用户的统计,还有全局统计
4. clients里面要有email
5. 有个专用的`dokodemo-door`协议的入口,tag为api
6. routing里面有inboundTag:api -> outboundTag:api的规则
另外:
@boypt
boypt / cfddns-v6.sh
Created December 5, 2018 05:57
Cloudflare API Dynamic AAAA DNS Updater for IPv6 addresse in Bash
#!/bin/bash
#
# Cloudflare API Dynamic AAAA DNS Updater for IPv6 addresse in Bash
#
# Credit:
# Part of this script got inspired from the work of `benkulbertis`@github:
# https://gist.github.com/benkulbertis/fff10759c2391b6618dd
# And of `4ft35t`@github for the OpenWrt mod in grep command.
# https://gist.github.com/4ft35t/510897486bc6986d19cac45b3b9ca1d0
@boypt
boypt / thinkphp.conf
Created March 31, 2017 05:36
ThinkPHP 5 子目录伪静态Nginx规则
upstream php {
server 127.0.0.1:9000;
}
server {
listen 80;
gzip on;
gzip_min_length 1000;
gzip_types application/json text/css application/x-javascript;
#!/usr/bin/env python3
import sqlite3
import sys
import subprocess
from urllib.parse import quote
def main():
if len(sys.argv) < 2:
@boypt
boypt / txt2sel.py
Last active November 5, 2024 06:05
股票代码txt转同花顺导出导入板块sel格式
#!/usr/bin/python3
'''
同花顺自选股文件格式:
0000000: 0900 0721 3030 3039 3731 0711 3630 3036 ...!000971..6006
0000010: 3738 0721 3030 3231 3134 0721 3030 3232 78.!002114.!0022
0000020: 3336 0721 3330 3031 3034 0711 3630 3031 36.!300104..6001
0000030: 3133 0711 3630 3033 3638 0711 3630 3032 13..600368..6002
0000040: 3030 0711 3630 3030 3630 0a 00..600060.