Skip to content

Instantly share code, notes, and snippets.

@wd
wd / config.json
Last active August 19, 2023 22:23
路由器梅林固件上面使用 v2ray 的方案
{
"log": {
"loglevel": "none"
},
"inbound": {
"port": 23456,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"udp": true
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
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;
}
@jbeda
jbeda / gist:16191ad2cec4835de40b
Last active May 10, 2019 11:48
IP CIDR math in bash
function increment_ipv4 {
local ip_base=$1
local incr_amount=$2
local -a ip_components
local ip_regex="([0-9]+).([0-9]+).([0-9]+).([0-9]+)"
[[ $ip_base =~ $ip_regex ]]
ip_components=("${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" "${BASH_REMATCH[4]}")
ip_dec=0
local comp
for comp in "${ip_components[@]}"; do
@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

@klzgrad
klzgrad / 00-README.txt
Last active April 19, 2024 09:26
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
#!/bin/sh
#reinstall everything you currently have in brew
for f in `brew list`; do
echo $f
brew uninstall $f && brew install $f
done
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active February 1, 2024 20:14
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@wisicn
wisicn / Galaxy_nexus_app.csv
Last active December 13, 2015 22:59
record my android phone Galaxy Nexus app, especially the position in launcher
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 6 columns, instead of 7. in line 1.
apk_name,apk_source,apk_link,folder,apk_position,comments
FT中文网,google_play,N/A,News,1:1:1:01,,
华尔街日报中文版,google_play,N/A,News,1:1:1:02,,
路透中文新闻,google_play,N/A,News,1:1:1:03,,
NetEase News,google_play,N/A,News,1:1:1:04,,
CNN,google_play,N/A,News,1:1:1:05,,
BBC News,google_play,N/A,News,1:1:1:06,,
China AQI,google_play,N/A,News,1:1:1:07,,
eduPort,google_play,N/A,Education,1:1:2:01,,
TED,google_play,N/A,Education,1:1:2:02,,
@underhilllabs
underhilllabs / delicious_scuttle_export.py
Created April 22, 2012 18:31
Export delicious bookmarks into a scuttle site
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# code originally from Michael Klier
# -- licensed unded CC-NC-SA
# http://www.splitbrain.org/blog/2010-12/12-from_scuttle_to_delicious
#
# 1. change username and password in urls below
# 2. change SCUTTLEDOMAIN to the domain of your scuttle site
@Abizern
Abizern / Python3File.py
Created March 6, 2011 18:55
Skeleton Python3 file template
#!/usr/bin/env python3 -tt
"""
Module documentation.
"""
# Imports
import sys
#import os
# Global variables