Skip to content

Instantly share code, notes, and snippets.

View codeout's full-sized avatar

Shintaro Kojima codeout

View GitHub Profile
@codeout
codeout / ds-lite.md
Last active August 13, 2017 16:43
DS-Lite Performance
  • t2.micro
  • iperf3 (tcp)
t2.micro ISP transport protocol ping iperf3 (tcp)
ap-northeast-1a Transix DS-Lite IPv4 13.638 ms 147 Mbps
ap-northeast-1a i-revo PPPoE IPv4 13.926 ms 123 Mbps
ap-northeast-1a IIJ IPoE IPv6 14.301 ms 170 Mbps
us-east-1a Transix DS-Lite IPv4 184.998 ms 26.9 Mbps
us-east-1a i-revo PPPoE IPv4 183.519 ms 10.0 Mbps
@codeout
codeout / juniper.tcl
Created June 13, 2017 15:05
juniper.tcl
log_user 1
set initialized 0
proc init { } {
global prompt initialized
send "set cli complete-on-space on\r"
expect -re $prompt {}
set initialized 1
@codeout
codeout / gobgpd.patch
Created March 7, 2017 08:36
gobgpd.patch
diff --git server/server.go server/server.go
index 31ebd16..8f8107b 100644
--- server/server.go
+++ server/server.go
@@ -472,35 +472,6 @@ func (server *BgpServer) notifyPostPolicyUpdateWatcher(peer *Peer, pathList []*t
}
func (server *BgpServer) dropPeerAllRoutes(peer *Peer, families []bgp.RouteFamily) {
-
- families = peer.toGlobalFamilies(families)
var Gobgp = require('gobgp');
var gobgp = new Gobgp('localhost:50051');
gobgp.addPath({family: 'ipv4-flowspec'}, 'match source 10.0.0.1/32 then discard');
// At shell:
//
// $ gobgp global rib -a ipv4-flowspec
// Network Next Hop AS_PATH Age Attrs
// *> [source:10.0.0.1/32]fictitious 00:00:12 [{Origin: ?} {Extcomms: [discard]}]
@codeout
codeout / hubot-gobgp-flowspec.coffee
Last active January 17, 2016 12:50
Hubot script to manage gobgpd
# Description:
# Allow Hubot to originate flowspec routes with gobgpd
#
# Commands:
# hubot flowspec add <expression> - Originate a flowspec route. <expression> must be in gobgp format - See https://github.com/osrg/gobgp/blob/master/docs/sources/flowspec.md
# hubot flowspec del <expression> - Withdraw a flowspec route. <expression> must be in gobgp format - See https://github.com/osrg/gobgp/blob/master/docs/sources/flowspec.md
# hubot flowspec list - Show flowspec routes.
# hubot route <host address> - Show the best matched prefix in gobgpd
#
# Author:
@codeout
codeout / juniper.md
Last active December 15, 2015 14:38
Juniper: load override with GitHub Private Repo
load override https://<GitHub User Name>%2Ftoken:<Personal Access Token>@raw.githubusercontent.com/<GitHub User Name>/<Repository Name>/<Git Branch Name>/path/to/file
require 'json'
require 'net/http'
require 'uri'
require 'webrick'
class Receiver
def initialize(pattern, slack_endpoint)
@pattern = pattern
@endpoint = slack_endpoint
end
@codeout
codeout / diff.rb
Last active December 2, 2015 21:46
#!/usr/bin/env ruby
require 'easy_diff'
require 'junoser'
require 'net/http'
require 'rugged'
require 'uri'
class Tracker
@codeout
codeout / decimal.md
Last active February 8, 2016 04:06
ipv6 to decimal
$ gem install ipaddress
$ ruby -r ipaddress -e "puts IPAddress('2404:6800:400a:804::2004').data.unpack('C16').join('.')"
36.4.104.0.64.10.8.4.0.0.0.0.0.0.32.4
@codeout
codeout / anti_ddos.coffee
Last active October 9, 2015 15:39
NodeJS script: Open a github issue to mitigate DDoS
# Description
# Open a github issue to mitigate DDoS
#
# Commands:
# hubot anti ddos <path> <title>\n<yaml data> - Open a github issue with template and data
#
# Author:
# Shintaro Kojima <goodies@codeout.net>
yaml = require('js-yaml')