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 python3 | |
| """Track an Ethereum chain's latest block number and its sync rate. | |
| Polls eth_blockNumber once a second from the given JSON-RPC endpoint, shows the | |
| latest block in place (overwriting, not scrolling), and derives blocks/sec, | |
| blocks/min, and blocks/hour from the last N samples. | |
| Usage: | |
| python blocktracker.py https://my-node:8545 | |
| python blocktracker.py https://my-node:8545 --interval 1 --window 60 |
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 ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "log/slog" | |
| "net/url" | |
| "os" | |
| "math/big" |
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
| // Copyright (c) Gabriel de Quadros Ligneul | |
| // SPDX-License-Identifier: Apache-2.0 (see LICENSE) | |
| // This module implements a colored log handler for log/slog. | |
| // | |
| // For more details on a custom handler implementation, check: | |
| // - https://github.com/golang/example/tree/master/slog-handler-guide | |
| package colorlog | |
| import ( |
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
| // Example of a simple supervisor that start multiple services in different goroutines | |
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "time" | |
| ) | |
| // service.go |
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
| /* | |
| * LLVM 3.5 code sample using MCJit | |
| * | |
| * To compile, execute on terminal: | |
| * clang++ -o mcjit mcjit.cpp `llvm-config --cxxflags --ldflags --libs all --system-libs` | |
| */ | |
| #include <iostream> | |
| #include <memory> |