Skip to content

Instantly share code, notes, and snippets.

View xiangchu0's full-sized avatar

xiangchu xiangchu0

View GitHub Profile
@xiangchu0
xiangchu0 / create-hotspot.md
Created September 3, 2018 06:43 — forked from narate/create-hotspot.md
Create Wi-Fi Hotspot on Linux using nmcli

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
@xiangchu0
xiangchu0 / wireless-link-bonding.sh
Created September 7, 2018 08:11 — forked from braian87b/wireless-link-bonding.sh
Linux Interface Bonding on Wireless Link (OpenWrt / LEDE)
@xiangchu0
xiangchu0 / bw
Created September 13, 2018 12:49
network test
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
exit
@xiangchu0
xiangchu0 / iptables-cheatsheet.md
Created September 19, 2018 08:29 — forked from mcastelino/iptables-cheatsheet.md
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@xiangchu0
xiangchu0 / openssl.md
Created October 24, 2018 08:43
cross-compile-package

mips

./Configure linux-mips32  --prefix=/ no-ssl2 no-ssl3 no-idea no-shared no-asm no-async

x86_64

./Configure linux-x86_64  --prefix=/ no-ssl2 no-ssl3 no-idea no-shared no-asm no-async
@xiangchu0
xiangchu0 / .zshrc
Created December 15, 2018 10:00 — forked from dimitardanailov/.zshrc
My personal zsh and tmux configurations
# Path to your oh-my-zsh installation.
export ZSH=/Users/dimitar.danailov/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
@xiangchu0
xiangchu0 / jenkins_delete_builds.groovy
Created February 26, 2019 06:38 — forked from kumbasar/jenkins_delete_builds.groovy
Jenkins - Delete old builds script
MAX_BUILDS = 10 // max builds to keep
def jobs = Jenkins.instance.items;
for (job in jobs) {
println "Job: " + job.name
try {
if(job instanceof jenkins.branch.MultiBranchProject) {
println "Multibranch"
job = job.getJob("master")
@xiangchu0
xiangchu0 / os_transparent_proxy.md
Last active October 26, 2021 07:18
tproxy example

本文是对不同平台不同 IP packet 过滤程序透明代理实现的一些思考,主要考虑过滤规则以及如何在代理程序中获取客户端网络请求的原目标 IP 地址。

参数、函数的解释

dst_addr:所需获取的目标地址;

client_addr:客户端请求的源地址,可通过 accept() 获取;

local_addr:代理程序绑定的地址,在 bind() 调用中传入的地址;

log_printf():类比 printf(),只不过用来输出信息至日志文件,这里没有给出具体的实现。

@xiangchu0
xiangchu0 / makefile
Created May 3, 2019 14:36
makefile template
# ------------------------------------------------
# Generic Makefile
#
# Author: yanick.rochon@gmail.com
# Date : 2011-08-10
#
# Changelog :
# 2010-11-05 - first version
# 2011-08-10 - added structure : sources, objects, binaries
# thanks to http://stackoverflow.com/users/128940/beta
@xiangchu0
xiangchu0 / makefile
Created May 3, 2019 14:36
makefile template
# ------------------------------------------------
# Generic Makefile
#
# Author: yanick.rochon@gmail.com
# Date : 2011-08-10
#
# Changelog :
# 2010-11-05 - first version
# 2011-08-10 - added structure : sources, objects, binaries
# thanks to http://stackoverflow.com/users/128940/beta