Skip to content

Instantly share code, notes, and snippets.

View kelvinblood's full-sized avatar
🎯
CNCF

血衫非弧 kelvinblood

🎯
CNCF
View GitHub Profile
@kelvinblood
kelvinblood / webp2jpg.sh
Created December 4, 2018 05:56
webp2jpg
#!/bin/bash
for file in `ls`
do
len3=`xxd -p -l 3 $file`
len4=`xxd -p -l 4 $file`
echo -n $file
if [ $len3 == "ffd8ff" ]; then
@hydra1983
hydra1983 / docker_images.sh
Last active May 10, 2024 10:58
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
@chareice
chareice / validation.php
Created February 1, 2015 08:47
Localization Validation Message For Chineses With Laravel 5
<?php
use Symfony\Component\Yaml\Yaml;
return Yaml::parse(file_get_contents(base_path().'/resources/lang/zh_cn/validation.yml'));
@klzgrad
klzgrad / Naive-VPN.md
Created November 17, 2014 00:43
朴素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

@flytwokites
flytwokites / proxy.pac
Last active February 19, 2020 10:26
proxy.pac
var PROXY = 'SOCKS5 127.0.0.1:10007';
var PROXY_HOSTS = [
/* google */
'google.com', 'googleusercontent.com', 'gstatic.com', 'ggpht.com', 'googleapis.com',
'googlecode.com', 'google.co.id', 'googleadservices.com',
/* other */
'godaddy.com', 'blogger.com', 'blogspot.jp', 'youtu.be', 'goo.gl', 'facebook.com',
'feedsportal.com', 'cloudfront.net', 'alexa.com', 's3.amazonaws.com', 'cl.ly', 'yfrog.com',