This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## CVM is algorithm to estimate amount of unique items in list of items. It is so simple and cheap that | |
## it could reasonably be implemented in silicon, so that cheap switches and routers could report fps or flows | |
## per second counter in addition to bps and pps. Understanding total flow count allows you to do understand | |
## statistical probability and confidence in your ability to reason from ipfix sampled data, if you don't know | |
## your total flow count, you don't know what share of flows you see, and most things cannot be reasoned from ipfix | |
## My implementation almost certainly is wrong, as I don't understand the paper, and Quanta version is wrong | |
## - https://arxiv.org/abs/2301.10191 | |
## - https://www.cs.toronto.edu/~meel/Slides/meel-distinct.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "google/cloud/dns" | |
require "commander" | |
#require "pry" | |
# | |
class GDNS | |
PROJECT = "resonant-petal-318815" | |
AUTH = File.join(Dir.home, ".config", "google_cloud_sdk_auth.json") | |
TTL = 1800 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem statement: You require that your contributors sign a contract, perhaps to relinquish the copyright, perhaps to accept the licensing terms. This disincentivizes contributing due to creating barrier of entry. | |
Paid repositories could have opt-in feature for 'approved contributors only'. If repository owner has opted-in, then every pull request signature is verified to come from pre-approved developer. If pull request is not from appreved developer the developer is presented with a process to become approved developer. | |
The process starts with a web page where developer writes personal string or draws personal picture, after that is done, the web page queries for an email address and then repsents random string used for signature later. | |
After the email arrives to a developer, developer clicks on the URL and is directed to a web page, which presents the personal string or personal picture and developer is asked if they made it. If they answer 'yes', they are presented with terms of agreement, if they acce |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "logger" | |
require "stringio" | |
class PCAPop | |
class Error < StandardError; end | |
class InvalidFormat < Error; end | |
class ByteOrderError < Error; end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## 1) ssh asr9k | tee spp.capture | |
## 2) do spp/netio capture in asr9k | |
## 3) ./sppcapture.rb spp.capture | |
## 4) text2pcap spp.capture.packet spp.capture.pcap | |
## 5) open spp.capture.pcap | |
class SPPCapture | |
FILE_EXTENSION = 'packet' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module NetMonte | |
STANDARD_DEVIATION = 2.5 | |
MINUTES = 365*24*60 | |
class Simulate | |
def initialize(years, *networks) | |
years.times do |year| | |
nets = init_networks networks | |
roulette year, nets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module NetMonte | |
STANDARD_DEVIATION = 2.5 | |
MINUTES = 365*24*60 | |
class Simulate | |
def initialize years, *networks | |
years.times do |year| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# your IP header | |
DATA = [0x4501, 0x0028, 0x87ea, 0x4000, 0x3006, 0x5bfd, 0xXXXX, 0xXXXX, 0xXXXX, 0xXXXX] | |
IS = DATA[5] # checksum on the packet | |
WANT = 0x5bfc # checksum you want | |
# output | |
# (here we can see that packet had ECN bit set, but had it not had, checksum would be correct) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# script to generate PCAP from Trio exception trace. Potentially you may need to change POP_BYTES variable. | |
# Trio exception trace allows you to capture things like broken packets (checksum error), to see who is sending them | |
# clogin junos-trio-box | tee exception_trace | |
# start shell pfe network fpc0 | |
# show jnh 0 exceptions terse | |
# debug jnh exceptions N discard ## get N from above command | |
# debug jnh exceptions-trace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## 1) capture data => monitor np counter MDF_PUNT_POLICE_DROP np0 count 25 location 0/2/CPU0 | |
## | |
## 2) You'll need 'text2pcap' => sudo apt-get install wireshark-common | |
## | |
## 3) Run with file as argument: | |
## [ytti@lintukoto ~/tmp/ios-xr-npu-monitor-pcap]% ./xr2pcap.rb r04.miamfl02.us.bb.MDF_PUNT_POLICE_DROP.ioscap | |
## Input from: r04.miamfl02.us.bb.MDF_PUNT_POLICE_DROP.txt | |
## Output to: r04.miamfl02.us.bb.MDF_PUNT_POLICE_DROP.pcap |
NewerOlder