Skip to content

Instantly share code, notes, and snippets.

@gofly
gofly / benchmark.go
Last active June 14, 2020 05:43
http benchmark tool
package main
import (
"crypto/sha1"
"encoding/hex"
"flag"
"fmt"
"io"
"net/http"
"sync"
@gofly
gofly / sshd.go
Created April 1, 2020 02:17 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@gofly
gofly / Dockerfile
Last active February 27, 2019 02:07
Compile openwrt in ubuntu
FROM ubuntu:16.04
RUN sed -i 's/archive\.ubuntu\.com/mirrors.aliyun.com/g;s/security\.ubuntu\.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y asciidoc autoconf binutils bison bzip2 ca-certificates curl diffutils file flex \
g++ gawk gcc git locales make openssh-client patch python perl rsync subversion texinfo unzip \
util-linux wget xz-utils zlib1g-dev libc6-dev libncurses5-dev libssl-dev && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
rm -rf /var/lib/apt/lists/*
RUN useradd -m openwrt
@gofly
gofly / main.go
Created September 19, 2018 09:16
filemeta
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
"os"
)
@gofly
gofly / shadowsocks_iptables_nat.md
Created March 17, 2017 02:27
shadowsocks + iptables NAT
iptables -t nat -X SS_SPEC_WAN_FW
iptables -t nat -N SS_SPEC_WAN_FW
iptables -A SS_SPEC_WAN_FW -p tcp -j REDIRECT --to-ports 1080

iptables -t nat -X SS_SPEC_WAN_AC
iptables -t nat -N SS_SPEC_WAN_AC
iptables -t nat -A SS_SPEC_WAN_AC -d <shadowsocks server ip> -j RETURN
iptables -t nat -A SS_SPEC_WAN_AC -d 10.0.0.0/8 -j RETURN
iptables -t nat -A SS_SPEC_WAN_AC -d 255.255.255.255 -j RETURN
@gofly
gofly / README.md
Last active March 5, 2017 13:58
合租主卧出租
  • 时间:可立刻入住,合同到2019年1月21日
  • 地点:益丰新村(浦东新区盛夏路靠近张衡路)
  • 楼层:5楼
  • 户型:房东改的微两房一厅总面积大概40平,有个小厨房,卫生间比较宽敞,出租的是主卧
  • 朝向:朝南带飘窗
  • 基础设施:空调、冰箱、洗衣机、电视、微波炉
  • 交通:距离浦软和长泰大约5公里,去浦软可以坐浦东14路/636路,去长泰可以坐636路/浦东11路/张江1路,坐公交20分钟,步行大概50分钟,骑单车大概20分钟
  • 房租价格:1950/月,含水费、网费
  • 说明:我住次卧,不吸烟不喝酒不晚归(除非加班),无不良习惯,平时会做饭。希望招一个同样不吸烟不喝酒无不良习惯的人合租。