Skip to content

Instantly share code, notes, and snippets.

View wen-long's full-sized avatar
☘️
wish to be lucky

wen-long

☘️
wish to be lucky
View GitHub Profile

常见误解

  1. ❌ USB-C 是对称的
    人机交互上是对称的,但电气/信号上,USB-C 公头是区分正反的,USB-C 公对公连接线两端 A/B 不区分, 但 A/B 各自的正反面并不相同. 插入母口后, 母口负责对 CC 供电以判断公头正反方向
  2. ❌ eMarker 芯片只有一端且 VCONN 线两端直通
    根据下文权威资料,eMarker 有两种配置方式, 1是两端配置二极管给 eMarker 供电, 2是缺失 VCONN 线缆, 两头各自配置一个 eMarker 芯片
    也有厂家宣传双芯片的好处慧能泰半导体
  3. ❌ 公头满针是最好的
    按照规范,公头 B6,B7(也就是 USB2.0 D+ D- 的对侧) 不应当存在. 正反插依赖母口设计(如短接), Dp1 and Dp2 may be shorted on the host/device as close to the receptacle as possible to minimize stub length; Dn1 and Dn2 may also be shorted.

最佳实践

常见的误解

  1. 误以为需要额外供电 F50 可以在 4.6V 电压下工作, 多数情况无需购买供电配件, (并不是说所有的情况都OK, 比如 我需要从Tpcy-c电源口的5V引脚直接飞线到USB的VBUS供电引脚就是有意义的修改)

常犯的错误

  1. usb hub 接错 如下, 这类数据供电分离器多用于直接插手机, 唯一的公头用于连接 host, F50 连路由器的场景, 路由器是 host
    因此正确接法是公头连路由器, usb3.1 10G 口连 F50
    错误接法 GL-MT3000 - 5G modem testing (ZTE F50)
    错误接法 Beryl MT3000 - 5G modem testing (ZTE F50)
@wen-long
wen-long / gist:b17560bf82d128e99473bcc1c08c87fe
Last active October 5, 2024 03:19
Btrfs subvolume path 怎么理解.md

有许多教程提到创建 subvolume 举例如下, 这些 path 为什么要有 @ 字样? 事先没有创建这些, 事后如何修改?

@rootfs
btrfs su cr @snapshots
btrfs su cr @home
btrfs su cr @log
btrfs su cr @cache
btrfs su cr @crash
btrfs su cr @tmp
btrfs su cr @spool

caddyfile:

example.com:443 {
    tls /home/cer /home/key
    log {
        output stdout
        format console
    }
    @http11 protocol http/1.1
 respond @http11 "leave me" 404
@wen-long
wen-long / learn hash.txt
Last active August 23, 2024 18:14
learn hash
hash 重要吗?
Rust杂谈 HashMap性能比不上Java? https://www.bilibili.com/video/BV1RTiceCEr6/
https://github.com/rurban/smhasher
可以作为索引, 如果有专门讲 hash 的书没有提到 smhasher, 要么过时要么不专业
务必 clone 代码自己在自己的机器上测试并得出结论, 不要过于关心其他人的结果
smhasher 的 Summary 竟然将 rapidhash 放在首位, 这与我的实际测试不符
吹牛逼和傲慢在 hash 算法这个领域也有出现
@wen-long
wen-long / dns.go
Created July 15, 2023 08:16 — forked from timothyandrew/dns.go
Barebones Recursive DNS Resolver
package main
import (
"fmt"
"math/rand"
"os"
"github.com/miekg/dns"
)

为什么关心 AS

因特网上的一个 IP 必定属于某个 AS,也就是一个自治系统。一般一个 AS 里的 IP 具有共性,比如网络质量较高或者较差,欺诈风险较高或者较低。 在使用 mtr 或者 traceroute 查看路由时,通过确认中间路由节点 IP 的 AS,可以确认路由质量。 举例说明,对于常见的 CN2 线路,通过 mtr 看到有经过 59.43.138.70,使用 whois 命令查看 IP 信息如下

~$ whois 59.43.138.70
route:          59.43.0.0/16
descr:          Chinatelecom Next Carrying Network backbone
origin:         AS4809
mnt-by: MAINT-CHINANET
root@GL-MV1000:~# iperf3 -c 45.14.107.x -u -b 20MB --get-server-output --bidir
Connecting to host 45.14.107.x, port 5201
[ 5] local 100.64.189.159 port 47629 connected to 45.14.107.x port 5201
[ 7] local 100.64.189.159 port 57883 connected to 45.14.107.x port 5201
[ ID][Role] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5][TX-C] 0.00-1.00 sec 2.38 MBytes 20.0 Mbits/sec 1735
[ 7][RX-C] 0.00-1.00 sec 2.26 MBytes 19.0 Mbits/sec 0.085 ms 96/1745 (5.5%)
[ 5][TX-C] 1.00-2.00 sec 2.38 MBytes 20.0 Mbits/sec 1736
[ 7][RX-C] 1.00-2.00 sec 2.26 MBytes 19.0 Mbits/sec 0.112 ms 85/1733 (4.9%)
[ 5][TX-C] 2.00-3.00 sec 2.38 MBytes 20.0 Mbits/sec 1736
@wen-long
wen-long / keepsolid.server.list.txt
Last active October 1, 2022 06:09
collect from vpnunlimitedapp.com, icmp ping test from hong kong, tag: web vpn server KeepSolid VPN Unlimited all server full list. if you know more server, welcome to leave here
0 59 jp1.vpnunlimitedapp.com 85.208.110.122 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 59 jp13.vpnunlimitedapp.com 172.104.64.213 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 59 jp16.vpnunlimitedapp.com 172.104.119.195 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 59 jp18.vpnunlimitedapp.com 139.162.125.238 match:3 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 60 jp6.vpnunlimitedapp.com 172.104.83.34 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 60 jp7.vpnunlimitedapp.com 172.104.99.172 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 60 jp10.vpnunlimitedapp.com 172.104.75.121 match:2 trust:0 threat:100 vpn:100 proxy:100 [日本 东京]
0 60 jp11.vpnunlimitedapp.com 172.104.67.80 match:2 trust:0 threat:100 vpn:100 proxy:100