Skip to content

Instantly share code, notes, and snippets.

View xiangchu0's full-sized avatar

xiangchu xiangchu0

View GitHub Profile
@xiangchu0
xiangchu0 / Makefile
Created April 12, 2017 09:35 — forked from llj098/Makefile
a sample tcp server runs in kernel
obj-m += tcp_svr_sample.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea
@xiangchu0
xiangchu0 / .Xresources
Last active August 1, 2017 05:50 — forked from Liblor/.Xresources
My .Xresources file. Color Scheme: Dark Tango
!xrdb ~/.Xresources
xterm.locale:true
xterm.utf8: true
xterm*utf8Title:true
xterm*fontMenu*fontdefault*Label:Default
xterm*faceName:xos4 Terminus Regular:antialias=true:pixelsize=12
xterm*faceNameDoublesize:WenQuanYi Micro Hei Mono:pixelsize=12:antialias=true
@xiangchu0
xiangchu0 / xrandr.sh
Created July 28, 2017 05:47 — forked from debloper/xrandr.sh
Add system unrecognized but monitor supported resolution in X
#!/bin/bash
# First we need to get the modeline string for xrandr
# Luckily, the tool `gtf` will help you calculate it.
# All you have to do is to pass the resolution & the-
# refresh-rate as the command parameters:
gtf 1920 1080 60
# In this case, the horizontal resolution is 1920px the
# vertical resolution is 1080px & refresh-rate is 60Hz.
@xiangchu0
xiangchu0 / host-network-setup.sh
Created April 18, 2018 10:00 — forked from x2c3z4/host-network-setup.sh
Run OpenWrt on QEMU virtual machines with LAN and WAN network.
#
# The following script will
# - Create Linux bridge $BR_WAN, $BR_LAN
# - Install IP addresses and basic routes
# - Enable proxy_arp on $BR_WAN
# - Enable ip_forward
# - Enable MASQUERADE on $IF_INET
# - $BR_LAN, $BR_WAN has to be allowed in ~/.usr/etc/qemu/bridge.conf
#
@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 / 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 / .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")