Skip to content

Instantly share code, notes, and snippets.

View blackgear's full-sized avatar
🎯
Focusing

Daniel Zeng blackgear

🎯
Focusing
View GitHub Profile
/mnt/hdd/suisei/
├── live
│   ├── 20200124.zip
│   ├── 20200703.zip
│   └── 20200719.zip
├── music
│   └── 20200321.zip
├── video
│   ├── bilibili
│   │   ├── BV14z411q7R6.mp4
@blackgear
blackgear / YouTube™双字幕.user.js
Last active February 10, 2022 11:33
点击一下即可开启中英双字幕,适用于YouTube™,改编自https://github.com/ADengrc/youtube-captions/
// ==UserScript==
// @license MIT License
// @name YouTube™双字幕
// @description 点击一下即可开启中英双字幕,适用于YouTube™
// @namespace https://github.com/ADengrc/youtube-captions/
// @version 0.1.0
// @author Dengrc (Adopted by Daniel.Zeng)
// @match https://www.youtube.com/*
// @require https://cdn.jsdelivr.net/npm/xhook@latest/dist/xhook.min.js
// @grant none
@blackgear
blackgear / EN_dfa.in
Last active June 30, 2020 19:00
Linter for Chinese-English mixed content, which hyphenate, space and HTML-escape the content
[0, 0, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 0, 65535, 0, 0, 18520, 0, 0, 0, 0, 1668, 184, 4166, 0, 2184, 184, 4181, 0, 2600, 184, 8021, 0, 2852, 184, 2374, 0, 2732, 184, 15591, 0, 2772, 14064, 24375, 0, 3168, 3304, 24359, 0, 3720, 184, 18566, 0, 3716, 184, 15591, 0, 4180, 21036, 13910, 0, 4364, 184, 20967, 0, 4892, 184, 16713, 0, 5448, 23720, 16713,
@blackgear
blackgear / clock.swift
Last active August 10, 2024 00:13
A simple floating clock for OS X
// The MIT License
// Copyright (c) 2018 Daniel
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@blackgear
blackgear / Appex.c
Created December 25, 2016 11:24
Generate license for AppEX
#include <net/if.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
int main() {
int fd;
struct ifreq ifr;
@blackgear
blackgear / build.sh
Last active December 27, 2016 03:14
TCP_CDG cong_control mod version via http://blog.csdn.net/dog250/article/details/53560304, TCP_BUGS cong_control via http://blog.csdn.net/dog250/article/details/53725236 . Ported from Linux 4.3 to Linux 4.9. This patch should be apply on Linux Kernel v4.9 tag.
# Tested on GCE Debian 8
git clone --depth=1 --branch=v4.9 https://github.com/torvalds/linux.git
cd linux
curl https://raw.githubusercontent.com/google/bbr/master/Documentation/config.gce > .config
# Edit .config by yourself, set CONFIG_TCP_CONG_CDG=y
vi .config
git apply tcp_cdg.patch
# or git apply tcp_bugs.patch
make deb-pkg
@blackgear
blackgear / 00-README.txt
Created February 16, 2016 07:12 — forked from klzgrad/00-README.txt
DNS compression pointer mutation
$ LD_PRELOAD=$PWD/sendmsg.so dig twitter.com @8.8.8.8
;; Warning: Message parser reports malformed message packet. <-- malformed 因为把压缩指针当作域名一部分了
;; Question section mismatch: got twitter.com/RESERVED0/CLASS256
; <<>> DiG 9.9.5-3-Ubuntu <<>> twitter.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44722
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
@blackgear
blackgear / Naive-VPN.md
Last active February 18, 2024 14:57 — forked from klzgrad/Naive-VPN.md
朴素VPN:一个纯内核级静态隧道

朴素VPN:一个纯内核级静态隧道

由于路由管控系统的建立,实时动态黑洞路由已成为最有效的封锁手段,TCP连接重置和DNS污染成为次要手段,利用漏洞的穿墙方法已不再具有普遍意义。对此应对方法是多样化协议的VPN来抵抗识别。这里介绍一种太简单、有时很朴素的“穷人VPN”。

朴素VPN只需要一次内核配置(Linux内核),即可永久稳定运行,不需要任何用户态守护进程。所有流量转换和加密全部由内核完成,原生性能,开销几乎没有。静态配置,避免动态握手和参数协商产生指纹特征导致被识别。并且支持NAT,移动的内网用户可以使用此方法。支持广泛,基于L2TPv3标准,Linux内核3.2+都有支持,其他操作系统原则上也能支持。但有两个局限:需要root权限;一个隧道只支持一个用户。

朴素VPN利用UDP封装的静态L2TP隧道实现VPN,内核XFRM实现静态IPsec。实际上IP-in-IP隧道即可实现VPN,但是这种协议无法穿越NAT,因此必须利用UDP封装。内核3.18将支持Foo-over-UDP,在UDP里面直接封装IP,与静态的L2TP-over-UDP很类似。

创建一个朴素VPN

@blackgear
blackgear / surge.conf
Created October 26, 2015 05:39
Surge config for new user
[General]
loglevel = warning
bypass-system = true
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.lan
bypass-tun = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12
dns-server = 114.114.114.114,114.114.115.115
[Proxy]
PROXY = custom,服务器地址,服务器端口,加密方式,密码,模块地址,tcp-fast-open=true

Keybase proof

I hereby claim:

  • I am blackgear on github.
  • I am atomhelix (https://keybase.io/atomhelix) on keybase.
  • I have a public key whose fingerprint is 105A ED5B B6F0 CDC4 30A6 839D 1E27 FCD8 54EE A679

To claim this, I am signing this object: