Skip to content

Instantly share code, notes, and snippets.

@Blaok
Blaok / .tmux.conf
Created December 16, 2016 00:21
make sure different verions of tmux opens new window in the same directory as the previous window
if-shell 'COMPARE_VERSION=1.8;CURRENT_VERSION=$(tmux -V);CURRENT_VERSION=${CURRENT_VERSION//tmux /};(( ${COMPARE_VERSION%%.*} < ${CURRENT_VERSION%%.*} || ( ${COMPARE_VERSION%%.*} == ${CURRENT_VERSION%%.*} && ${COMPARE_VERSION##*.} < ${CURRENT_VERSION##*.} ) ))' \
'bind c new-window -c "#{pane_current_path}"; bind C-c new-window -c "#{pane_current_path}"; bind | split-window -h -c "#{pane_current_path}"; bind - split-window -v -c "#{pane_current_path}"'\
'bind c new-window; bind C-c new-window; bind | split-window -h; bind - split-window -v'

Keybase proof

I hereby claim:

  • I am Blaok on github.
  • I am blaok (https://keybase.io/blaok) on keybase.
  • I have a public key whose fingerprint is B79C F986 19CF 59DA 1C1E 12F3 9CEB C58A 4217 5567

To claim this, I am signing this object:

@Blaok
Blaok / isatapd.sh
Created November 1, 2015 07:09
ISATAP Daemon. Tested and used under OpenWRT and Arch Linux.
#!/bin/sh
IFACE6=sit1
V4_REMOTE="166.111.21.1"
V6_REMOTE="2402:f000:1:1501:200:5efe"
V6_LOCAL="fe80::200:5efe"
while true
do
IFACE4=`ip route|grep default|awk -F ' ' '{print $5}'`
ip=`ip addr show dev $IFACE4 | sed -e's/^.*inet \([^ ]*\)\/.*$/\1/;t;d'`
ip4=`echo $ip|sed -e 's/\./ /g'`
@Blaok
Blaok / traftop.sh
Last active September 7, 2015 02:37
#!/bin/bash
# Dump network traffic continuously and see who use most quota
# Needs root
# Requires `tcpdump`, `python` and `mergecap`
# Also needs `mv`, `rm`, `clear`, `ps`, `ip`, `date`, `mktemp` and `lsof`
INTERFACE=eth0
INTERVAL=2 # Dump a pcap file every 2 sec by default, this will be the display refresh interval
LEN=50 # 26 ether + 20 ipv4 + 4 tcp/udp port by default
COUNT=30 # Display top 30 by default
MAC=`ip link show $INTERFACE |grep ther|awk -F ' ' '{print $2}'`
@Blaok
Blaok / isatap.sh
Last active December 28, 2016 03:10
Manual ISATAP setup script for Tsinghua University. Tested and used under Arch Linux @ Raspberry Pi.
#!/bin/sh
# Manual ISATAP setup script for Tsinghua University
# Tested and used under Arch Linux @ Raspberry Pi
V4_REMOTE="166.111.21.1"
V6_REMOTE="2402:f000:1:1501:200:5efe"
V6_LOCAL="fe80::200:5efe"
IFACE4=eth0
IFACE6=isatap
IPF=/run/isatap.ip4