Skip to content

Instantly share code, notes, and snippets.

View blackgear's full-sized avatar
🎯
Focusing

Daniel Zeng blackgear

🎯
Focusing
View GitHub Profile
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@be5invis
be5invis / scroll.ahk
Created September 15, 2013 14:05
DPI-aware FocuslessScroll
; Modified by Belleve Invis
; In order to support High DPI environment
; FocuslessScroll by Scoox
; Source: http://www.autohotkey.com/board/topic/6292-send-mouse-scrolls-to-window-under-mouse/?p=398492
; Modifications by Geoff Stokes
;Directives
#NoEnv
#SingleInstance Force
@vishvananda
vishvananda / tunnel.sh
Created October 22, 2013 03:16
Script to set up an ipsec tunnel between two machines For Example: ./tunnel.sh 10.10.10.1 10.10.10.2 192.168.0.1 192.168.0.2 would set up an ipsec tunnel over 10.10.10.1 address using 192.168.0.1 as a virtual address passwordless sudo required for user on remote machine
#!/bin/bash
if [ "$4" == "" ]; then
echo "usage: $0 <local_ip> <remote_ip> <new_local_ip> <new_remote_ip>"
echo "creates an ipsec tunnel between two machines"
exit 1
fi
SRC="$1"; shift
DST="$1"; shift
@stefanschmidt
stefanschmidt / flash_plugin_without_admin_rights.sh
Last active June 4, 2016 21:51
Installing the Flash plugin in your home folder on OS X (without admin rights)
FLASH_URL="http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_player_12_osx.dmg"
FLASH_DMG=$(mktemp -d -t flash_dmg)/flash.dmg
FLASH_MOUNTPOINT=$(mktemp -d -t flash_mountpoint)
FLASH_PKG="$FLASH_MOUNTPOINT/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg"
curl -o $FLASH_DMG $FLASH_URL
hdiutil attach -mountpoint $FLASH_MOUNTPOINT -nobrowse $FLASH_DMG
FLASH_PKG_ARCHIVE="$FLASH_MOUNTPOINT/Install Adobe Flash Player.app/Contents/Resources/Adobe Flash Player.pkg"
FLASH_PKG_EXTRACT_DIR=$(mktemp -d -t flash_pkg_extract_dir)
@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

@imjasonh
imjasonh / markdown.css
Last active November 6, 2024 14:26
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@lsylsy2
lsylsy2 / apnic_pku.sh
Last active August 23, 2018 00:17
从APNIC下载中国IP,并挑出免费地址
#!/bin/bash
echo "Downloading IP list from APNIC...."
apniclist=`wget -q -O- http://ftp.apnic.net/stats/apnic/delegated-apnic-latest |grep "apnic|CN|ipv4|"`
echo "Checking blocks..."
rm cidr.txt
for ipblock in ${apniclist[@]}
do
ip=`echo $ipblock | cut -d "|" -f4`
@lsylsy2
lsylsy2 / cidr_merge
Last active April 30, 2016 17:01
2015-6-2生成,APNIC中国IP中北京大学免费地址可以访问部分,通过cidrmerge压缩
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19
1.1.0.0/24
1.1.2.0/23
1.1.4.0/22
1.1.8.0/21
1.1.16.0/20
1.1.32.0/19
@soffchen
soffchen / surge.conf
Last active March 4, 2024 05:23
surge.conf
[General]
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
BJ-All = custom
BJ-HK-Azure = custom
BJ-US-Azure = custom