Skip to content

Instantly share code, notes, and snippets.

@jackyyf
jackyyf / netns-launch
Created October 19, 2016 11:10
Launch tox-bootstrapd inside network namespace.
#!/bin/bash
who am i 1>&2
NSNAME=tox-bootstrapd
## ${VETH_PREFIX}0 is outside, and ${VETH_PREFIX}1 is inside.
VETH_PREFIX=tox
OUT_ADDRS="
A.B.C.125/31
@jackyyf
jackyyf / keybase.md
Created June 24, 2016 02:08
keybase.md

Keybase proof

I hereby claim:

  • I am jackyyf on github.
  • I am jackyyf (https://keybase.io/jackyyf) on keybase.
  • I have a public key whose fingerprint is A79A 462E 8261 2861 546F 7584 B6C4 28B6 524E 31AB

To claim this, I am signing this object:

#! /bin/bash
### BEGIN INIT INFO
# Provides: ipv6
# Required-Start: $local_fs $all
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the ipv6 tunnel
# Description: ipv6 tunnel start-stop-daemon
@jackyyf
jackyyf / ohioport-client.go
Created August 16, 2015 15:49
Gist by paste.py @ 2015-08-16 23:49:10.567352
package main
import (
"crypto/tls"
"crypto/x509"
"net/http"
"net"
"fmt"
"strings"
"io"
@jackyyf
jackyyf / <stdin>
Created August 3, 2015 09:21
Gist by paste.py @ 2015-08-03 17:21:12.215087
Start: Mon Aug 3 17:21:11 2015
HOST: Eve-PC Loss% Snt Last Avg Best Wrst StDev
1.|-- 10.131.235.1 0.0% 20 1.2 1.0 0.8 2.2 0.2
2.|-- 10.149.1.5 0.0% 20 0.2 0.2 0.2 0.2 0.0
3.|-- 10.250.1.21 0.0% 20 0.8 1.7 0.7 12.9 2.6
4.|-- 10.6.0.253 0.0% 20 0.8 1.1 0.8 5.7 1.1
5.|-- 210.13.97.33 0.0% 20 0.9 1.3 0.8 5.4 0.9
6.|-- 210.13.69.225 0.0% 20 1.4 1.9 1.4 7.9 1.4
7.|-- 112.64.242.38 0.0% 20 4.1 9.1 4.0 32.3 8.5
8.|-- 210.13.75.138 0.0% 20 2.8 6.2 2.8 20.0 5.9
@jackyyf
jackyyf / chnroute.sh
Created July 20, 2015 08:37
Gist by paste.py @ 2015-07-20 16:37:49.741682
#!/bin/bash
CHN_GW=192.168.1.1
CHN_METRIC=5
CHN_DEV=eth0
for _route in `cat /usr/lib/routetable.txt | awk '{FS="|"}{if($2=="CN" && $3=="ipv4"){print $4 "/" (32-log($5)/log(2))}}'`
do
ip route add "$_route" metric "$CHN_METRIC" via "$CHN_GW" dev "$CHN_DEV"
done
@jackyyf
jackyyf / main.py
Created July 4, 2015 01:11
Gist by paste.py @ 2015-07-04 09:11:16.505897
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.web import RequestHandler, Application, url
from tornado.httpserver import HTTPServer
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.gen import coroutine, Return, WaitIterator
from tornado.netutil import bind_sockets, bind_unix_socket
from tornado.process import fork_processes
@jackyyf
jackyyf / fproxy.conf
Created June 3, 2015 16:31
Gist by paste.py @ 2015-06-04 00:31:01.998949
upstream googleapis {
server fonts.googleapis.com:443;
keepalive 4;
}
server {
listen 80;
listen [::]:80;
server_name f.eve.moe;
My traceroute [v0.85]
Eve-PC (::) Wed Jun 3 04:59:09 2015
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 2001:da8:8001:3306::1 0.0% 676 1.7 1.6 1.5 10.6 0.6
2.
@jackyyf
jackyyf / <stdin>
Created May 19, 2015 13:42
Gist by paste.py @ 2015-05-19 21:42:46.926878
; <<>> DiG 9.9.5-9-Debian <<>> zh.wikipedia.org @114.114.114.114
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45014
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION: