Skip to content

Instantly share code, notes, and snippets.

View kirk91's full-sized avatar
🎯
Focusing

kirk kirk91

🎯
Focusing
View GitHub Profile
@kirk91
kirk91 / fd_receive.go
Last active November 30, 2022 01:31
Pass File Descriptor over Unix Domain Socket
package main
import (
"fmt"
"log"
"net"
"net/http"
"os"
"syscall"
@kirk91
kirk91 / tcp_abstract_unix.go
Last active August 9, 2020 11:55
TCP Echo over abstract unix domain socket
package main
import (
"io"
"net"
)
func main() {
// '@' indicates the socket held in an abstract namespace
// which doesn't belong to a file in the filesystem
@kirk91
kirk91 / tcp_unix.go
Last active August 9, 2020 09:33
TCP Echo over unix domain socket
package main
import (
"io"
"net"
"os"
)
func main() {
udsPath := "/tmp/tcp-unix.sock"
@kirk91
kirk91 / http_unix.go
Last active July 16, 2021 14:12
Http over unix domain socket
package main
import (
"fmt"
"net"
"net/http"
"os"
)
func main() {
@kirk91
kirk91 / replay-redis-request.go
Last active January 9, 2020 10:43
Replay redis request traffic
package main
import (
"bufio"
"context"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
@kirk91
kirk91 / .gitconfig
Created February 7, 2018 16:04 — forked from huytd/.gitconfig
Use neovim as diff tool
[merge]
tool = vimdiff
[mergetool]
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[difftool]
prompt = false
[diff]
tool = vimdiff
package main
import (
"context"
"flag"
"fmt"
"log"
"runtime"
"strings"
"time"
@kirk91
kirk91 / tmux_cheatsheet.markdown
Created December 28, 2016 03:14 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

#! /usr/bin/env bash
# cancel packet delay
sudo tc qdisc del dev eth0 parent 1:2
sudo tc qdisc del dev eth0 root
#! /usr/bin/env bash
# emulate network latency in etcd cluster.
# set 30ms delay before sending packet that comes from source port 2380
sudo tc qdisc add dev eth0 root handle 1: htb default 1
sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 1000kbps
sudo tc class add dev eth0 parent 1: classid 1:2 htb rate 1000kbps
sudo tc qdisc add dev eth0 parent 1:2 handle 10: netem delay 30ms
sudo tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip sport 2380 0xffff flowid 1:2