Skip to content

Instantly share code, notes, and snippets.

View sdstrowes's full-sized avatar

Stephen Strowes sdstrowes

View GitHub Profile
@sdstrowes
sdstrowes / parse-assignment-sizes.sh
Created December 14, 2020 15:34
get inet6num records with assignment-size fields
#!/bin/bash
curl -s https://ftp.ripe.net/ripe/dbase/split/ripe.db.inet6num.gz 2>/dev/null |
gzcat |
awk -F: '
BEGIN {
gotone = false
lines[0] = ""
}
@sdstrowes
sdstrowes / bits.py
Created June 14, 2020 11:10
visualise random vs sequential bit allocations
import random
import numpy as np
from matplotlib import pyplot as plt
fixed_bits = 32
variable_bits = 32
bitlen = fixed_bits + variable_bits
iterations = 2048
@sdstrowes
sdstrowes / .block
Last active May 29, 2020 15:20 — forked from vasturiano/.block
Hilbert Map of IPv6 address space
license: mit
@sdstrowes
sdstrowes / two-days
Last active September 4, 2019 05:07
$ cat /tmp/foo2 | while read line ; do ts=`echo $line | awk '{print $1}'` ; echo -n `gdate -u --date @$ts ` ; echo $line ; done
Mon Aug 5 06:00:00 UTC 20191564984800 89496
Mon Aug 5 07:00:00 UTC 20191564988400 122551
Mon Aug 5 08:00:00 UTC 20191564992000 120459
Mon Aug 5 09:00:00 UTC 20191564995600 9665934
Mon Aug 5 10:00:00 UTC 20191564999200 12854564
Mon Aug 5 11:00:00 UTC 20191565002800 12868717
Mon Aug 5 12:00:00 UTC 20191565006400 12977317
Mon Aug 5 13:00:00 UTC 20191565010000 12921577
Mon Aug 5 14:00:00 UTC 20191565013600 12807037
import arrow
import json
import requests
nextpage = "https://atlas.ripe.net:443/api/v2/measurements/?page_size=500&tags=anchoring&type=traceroute"
count = 0
total = 0
with filtered_table as (
select p.*
from prod.traceroute_atlas_prod as p, unnest(hops) as h, unnest(resultHops) as rh
where (
startTime > "2019-07-01" and
startTime < "2019-07-02"
)
and (
rh.from = "170.238.232.149" or
rh.from = "170.238.232.150" or
{
"type": "trace",
"version": "0.1",
"userid": 0,
"method": "icmp-echo-paris",
"src": "192.42.115.98",
"dst": "23.67.49.1",
"icmp_sum": 61412,
"stop_reason": "COMPLETED",
"stop_data": 0,
{
"type": "trace",
"version": "0.1",
"userid": 0,
"method": "icmp-echo-paris",
"src": "2001:610:510:115:192:42:115:98",
"dst": "2620:116:801d:a1e3:ffa6:9209:edf0:1a8c",
"icmp_sum": 55048,
"stop_reason": "UNREACH",
"stop_data": 3,
@sdstrowes
sdstrowes / notes.md
Last active May 31, 2019 22:59
RIPE78 notes
from ripe.atlas.cousteau import AtlasStream
import dns.message
import base64
import json
import sys
def decode_qbuf_abuf(result):
if "qbuf" in result:
try:
dnsmsg = dns.message.from_wire(base64.b64decode(result["qbuf"]))