Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gyakkun on github.
  • I am gyakkun (https://keybase.io/gyakkun) on keybase.
  • I have a public key ASDuyCvQ3JSF_82xrorT7acCV-cIKaj-jHc2wCF5f6FLMwo

To claim this, I am signing this object:

@gyakkun
gyakkun / random_pic.js
Last active May 6, 2018 04:48
Random picture server.
var fs = require('fs'),
path = require('path'),
http = require('http'),
url = require('url');
//Params
const imageDir = '/home/steve/图片/miyamori_avatar/'
const imageURL = '/pic.jpg';
const servePort = 8080;
function getRandFile() {
@gyakkun
gyakkun / rename_torrents.sh
Created September 10, 2018 02:14
Rename some torrent files in my convention.
#!/bin/bash
for i in $(ls *.torrent); do
new_filename=`transmission-show $i | grep -Po "(?<=^Name: ).+$"`
rename -v "s/(?<=\[U2\]\.)(?=(\d+))/$new_filename\./" $i
done
@gyakkun
gyakkun / Naive-VPN.md
Last active September 19, 2018 12:47 — 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

@gyakkun
gyakkun / handle_space_in_for_loop_shell_script.sh
Created December 22, 2018 14:44
handle_space_in_for_loop_shell_script.sh
#!/bin/bash
IFS=$'\n'
OLDIFS="$IFS"
for i in $(find . -depth -name a.txt); do
rename -v "s/a(?=(\.txt))/b/" $i
# echo $i
done
@gyakkun
gyakkun / bvav.py
Created March 23, 2020 11:51
BV-AV bidirection translate by mcfx@zhihu
# https://www.zhihu.com/question/381784377/answer/1099438784
table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'
tr={}
for i in range(58):
tr[table[i]]=i
s=[11,10,3,8,4,6,2,9,5,7]
xor=177451812
add=100618342136696320
def dec(x):
@gyakkun
gyakkun / ip-detour-list.txt
Last active May 13, 2020 03:04
ip-detour-list
#START_CF,
173.245.48.0/20,
103.21.244.0/22,
103.22.200.0/22,
103.31.4.0/22,
141.101.64.0/18,
108.162.192.0/18,
190.93.240.0/20,
188.114.96.0/20,
197.234.240.0/22,
@gyakkun
gyakkun / 转发_INC000000030481.eml
Created April 22, 2020 02:43
中山大学网络与信息技术中心: 对事件编号INC000000030481邮件的回复
Received: from 183.3.255.33 (unknown [183.3.255.33])
by newmx34.qq.com (NewMx) with SMTP id
for <[email protected]>; Thu, 16 Apr 2020 11:48:08 +0800
X-QQ-FEAT: ELd9oBCFI5nYAgc7c/23vqDDqv7iQ4IGSYIjFaWfhMOl0HCW2kTT4w0//WxP4
C7K+u24WisGDS7Wmuoxn3o6lwcTRHTg23KHOUs942JcsBKolIRInYZ58Me70ZybSILcbYGn
j5OkZCovsn7Wx+GPdQXYe59FeaWBkvuT6XEnHzntvxxo9uS2CY1sByF7/rLfoTU5COJX0nY
IAKWzy+KhoJd1seSe+ToXFyMkp8YRt9IuGHiqSlHQgJQmBTqlFG3HUHLvAFvd3frSCh3r+x
gSzBsfxMCAARZMrzO11/sKJp6eCXLM37ykoV4h22F5gdV4
X-QQ-MAILINFO: MD/1pXCwXV+leBrhSiwXek865c0TqZe7iDK4TsNEzM7XTQYo7rHl6DKih
9X5GvEuUjsIxvCp8CAU2wJNlSlVGvxmdH2dXSS6OiyKsNA6si/VQ77DMLmhwOyG1AoU1CmO
@gyakkun
gyakkun / 转发_关于最近 IPv6 被限速的问题.eml
Created April 22, 2020 02:44
jipeng: 关于最近 IPv6 被限速的问题
Received: from 183.3.255.187 (unknown [183.3.255.187])
by newmx35.qq.com (NewMx) with SMTP id
for <[email protected]>; Thu, 16 Apr 2020 11:47:49 +0800
X-QQ-FEAT: XrBk/hpS3+7Eh9hNCDzhLfSvEJvSmWU6TR5Pl+bPBBMzUNuy2sUt0t/uwpGzW
tKtpByU2htGPw9QefX1dC9hxW/BxWjQf1fSnQ8J5mYxEfSzlpsK9yFaVlGy9bjGS9N/q6/H
v80jDRSQAI97pDhJjpmLCvN7IEI5R74FO2SLKRPgD6imByZeHxpq+HA8O4ZZhTfJNwchPqH
fQrK0QEhx11T/YATRxwL0d5rkrn/pu7vQjApUlp7gayuJTGnXl0gMIMpSg/7y78/JzyRsRo
YbolYqyd60ozF61WPQj/Tjw8N14IXEPiYRsA==
X-QQ-MAILINFO: MYXo83QL9FbjBW9wc72y6W8apxxhcHdDyKqpRY4Vaxodt/WmqO1vrNIqw
IBti0aRJW7DPaILnToOxJlwfBXHOxNqHJlndkUW/Nb6OFQQszhuOjxo/uSa3N3RNUbSEeip
@gyakkun
gyakkun / two-onedrive-mklink.bat
Last active May 12, 2020 06:59
Sync Two Onedrives