Skip to content

Instantly share code, notes, and snippets.

@runwu2012
runwu2012 / iprule.sh
Created December 30, 2024 13:03 — forked from codehz/iprule.sh
nftables for redir proxy
ip rule add fwmark 0x233 lookup 100
ip route add local 0.0.0.0/0 dev lo table 100
@runwu2012
runwu2012 / a-clash-tproxy-gateway.md
Created December 30, 2024 10:51 — forked from phlinhng/a-clash-tproxy-gateway.md
Clash as transparent proxy gateway via TPROXY

Notes

  1. If your local network use public IP ranges instead of private ones, make sure to add respecive RETURN rules to iptables to prevent looping issue
  2. Set clash as DHCP's only DNS server to allow domain-based filter (shunting) rules work
  3. Use lsof -i udp:53 to check if clash's DNS module work fine, otherwise you may have to kill systemd-resolved and any other processes occupying the UDP 53 port
  4. The given scripts will NOT hangle the traffic of gateway itself since it is not recommend to do so. If you want to redirect the egress traffic of the gateway, the following material may be useful

Reference

#!/usr/bin/env ansible-playbook -i hosts
---
- hosts: all
gather_facts: no
tasks:
- name: values without gather_facts
debug:
msg: |
ansible_host = {{ ansible_host }}
ansible_hostname = {{ ansible_hostname | default('*undefined*') }}
@runwu2012
runwu2012 / Default.ppx
Created September 27, 2024 02:41 — forked from baobao1270/Default.ppx
Proxifier Configuration
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxifierProfile version="102" platform="Windows" product_id="0" product_minver="400">
<Options>
<Resolve>
<AutoModeDetection enabled="true" />
<ViaProxy enabled="false" />
<ExclusionList OnlyFromListMode="false" />
<DnsUdpMode>0</DnsUdpMode>
</Resolve>
<Encryption mode="basic" />
@runwu2012
runwu2012 / 00-cloud-config.yml
Created May 24, 2024 04:06 — forked from janeczku/00-cloud-config.yml
Annotated RancherOS Cloud-init configuration snippets
#cloud-config
# Set the hostname for this machine (takes precedence over hostname assigned by DHCP lease).
hostname: myhost
# Authorize SSH keys for the `rancher` sudoer user
ssh_authorized_keys:
- ssh-rsa AAA...ZZZ example1@rancher
@runwu2012
runwu2012 / wsl_clash_proxy.sh
Created September 28, 2023 03:00 — forked from libChan/wsl_clash_proxy.sh
WSL2使用clash for windows代理
# WSL通过Win访问网络,所以WSL的网关指向的是Windows,DNS服务器指向的也是Windows,设置WSL的proxy为win的代理ip+端口即可
# WSL中的DNS server在/etc/resolv.conf中查看,该文件是由/etc/wsl.conf自动生成的。
# 如果关闭了wsl.conf中自动生成resolve.conf并自行修改了resolve.conf,DNS nameserver并不是本机win ip
# 需要开启wsl.conf的自动生成,再运行以下命令
# https://zhuanlan.zhihu.com/p/153124468
# 添加到环境变量设置中,例如~/.zshrc
export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890"
export http_proxy="http://${hostip}:7890"
@runwu2012
runwu2012 / WSLWindows10Setup.md
Created December 22, 2022 01:25 — forked from AjkayAlan/WSLWindows10Setup.md
Windows SubSystem For Linux setup that I like with some developers stuff mixed in

Setting Up WSL

Install A Distro:

  1. Run the following in powershell as admin Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Install a distro (ex: Ubuntu 18.04 LTS - https://www.microsoft.com/store/apps/9N9TNGVNDL3Q)

  3. Open your distro you installed via the start menu, let it setup

  4. Update and upgrade

sudo apt-get update
@runwu2012
runwu2012 / Dockerfile
Created December 21, 2022 07:40 — forked from moolen/Dockerfile
cfssl: multiple CA w/ nginx mutual tls
FROM ubuntu:14.04
# install nginx
RUN apt-get update && \
apt-get install software-properties-common -y && \
add-apt-repository ppa:nginx/stable -y && \
apt-get update && \
apt-get install -y nginx=1.12.2-0+trusty0
RUN rm -rf /etc/nginx/sites-enabled/default
@runwu2012
runwu2012 / Set up Vim with clipboard on Ubuntu on WSL2.md
Created December 16, 2022 06:39 — forked from necojackarc/Set up Vim with clipboard on Ubuntu on WSL2.md
Set up Vim on Ubuntu on Windows Subsystem for Linux 2 (WSL2) to share clipboard

This explains how to set up Vim on Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2) in order to share the clipboard between Windows and Ubuntu.

Environments

  • Windows 10 Home
  • Ubuntu 18.04 on Windows Subsystem for Linux 2 (WSL2)

Steps

  1. Build Vim with the clipboard option enabled
  2. Set up VcXsrv Windows X Server