Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
💭💭💭

jet tsang zeon-git jetsanix

💭
💭💭💭
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jetsanix on github.
  • I am jetsanix (https://keybase.io/jetsanix) on keybase.
  • I have a public key whose fingerprint is EE21 89C4 FE35 4727 6C96 1AE5 6055 5FE0 898C 4907

To claim this, I am signing this object:

@jetsanix
jetsanix / ss.sh
Last active Nov 20, 2021
badvpn-tun2socks over shadowsocks
View ss.sh
#!/bin/bash
LIBROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PKGPATH=$LIBROOT/../pkg
function ss::install() {
case $ARCHITECTURE in
x86_64)
apt-get update
apt-get install shadowsocks-libev build-essential cmake libssl-dev pkg-config libnspr4-dev libnss3-dev
systemctl stop shadowsocks-libev
View .tmux.conf
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-style bg=colour235 #base02
set-option -g status-style fg=colour136 #yellow
# set window split
bind-key v split-window -h
bind-key b split-window
# default window title colors
View .vimrc
set nocompatible " be iMproved, required
set background=dark
set dir=$HOME/.vim_tmp/swap
if !isdirectory(&dir) | call mkdir(&dir, 'p', 0700) | endif
"filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@jetsanix
jetsanix / Naive-VPN.md
Created Mar 25, 2016 — forked from klzgrad/Naive-VPN.md
朴素VPN:一个纯内核级静态隧道
View Naive-VPN.md

朴素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

View strongswan ikev2 server on ubuntu 14.04
# Basic Strongswan ikev2 server setup
* paltform: atlantic.net ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
```
apt-get install strongswan
apt-get install iptables iptables-persistent
```
View del_current_page_fanfou_status.js
count = 0;
jQuery(".time").each(function(){
var $t = jQuery(this);
var $del = $t.parent().parent().find('a.delete');
jQuery.ajax({
type: 'POST',
url: location.href,
data: {
action: 'msg.del',
msg: $t.attr('ffid'),
View pip_upgrade.sh
#!/bin/sh
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U
@jetsanix
jetsanix / podcast_downloader.py
Last active Dec 17, 2015
podcast downloader (with password)
View podcast_downloader.py
#!/usr/bin/env python
# encoding: utf-8
# edit from https://github.com/hrktir/download_podcast_mp3/blob/master/download_podcast_mp3.py
# echo "http://podcasturl/xml podname" >> urls.txt # one podcast rss in each line
# python podcast_downloader.py urls.txt
import urllib2
from xml.dom.minidom import parse
import time
View html2text.py
#!/usr/bin/env python
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "3.1"
__author__ = "Aaron Swartz (me@aaronsw.com)"
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"]
# TODO:
# Support decoded entities with unifiable.