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
| # Run "traceroute -n google.com | tee traceroute_output.txt" in your terminal | |
| # Paste your traceroute/tracert output between the triple quotes and run this cell. | |
| TR_TEXT = """ | |
| <PASTE YOUR TRACEROUTE OUTPUT HERE> | |
| """ | |
| import re, requests, ipaddress, sys | |
| def extract_hops(text: str): | |
| """ |
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
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| ) | |
| type Transaction struct { | |
| ID int | |
| Data string |
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
| import requests | |
| import json | |
| def generate_access_list_from_statediff(): | |
| response = ''' | |
| {"jsonrpc": "2.0", "result": {"output": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000001f161421c8e0000000000000000000000000000000000000000000000000000057f864ee247d477", "stateDiff": {"0x9162accd2bf58dcf5f5d46e5818117e3f5cd8333": {"balance": {"*": {"from": "0x1e8b422a215aff2a", "to": "0x1c8a6a7b5aa9727a"}}, "code": "=", "nonce": {"*": {"from": "0x259", "to": "0x25a"}}, "storage": {}}, "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5": {"balance": {"*": {"from": "0xcbf2d42250f0eb19", "to": "0xcbf2e3a93cf93319"}}, "code": "=", "nonce": "=", "storage": {}}, "0xa65303cbe1186f58dda9cf96b29e1e89ae90b165": {"balance": "=", "code": "=", "nonce": "=", "storage": {"0x0000000000000000000000000000000000000000000000000000000000000008": {"*": {"from": "0x65bd127b000000000000b48e759d60c985d500000000000205fd |
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
| from decimal import Decimal | |
| import math | |
| def calculate_summation(N, p): | |
| p = Decimal(p) | |
| result = Decimal(0) | |
| for k in range(math.floor(N/2), N+1): | |
| term = Decimal(math.comb(N, k)) * (p**k) * ((1-p)**(N-k)) | |
| result += term | |
| return float(result) |