Using GNU extensions.
Refferences:
$ sudo ip xfrm state | |
↓ info for local→remote direction IPsec tunnel(ESP) | |
src 192.168.0.2 dst 10.0.0.1 | |
proto esp spi 0xaaaaaaaa reqid 1 mode transport | |
replay-window 0 | |
auth-trunc hmac(sha1) 0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 96 | |
enc cbc(aes) 0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccc | |
encap type espinudp sport 4500 dport 4500 addr 0.0.0.0 | |
anti-replay context: seq 0x0, oseq 0xaab, bitmap 0x00000000 | |
sel src 192.168.0.2/32 dst 10.0.0.1/32 |
# SPDX-License-Identifier: Apache-2.0 | |
""" | |
https://gist.github.com/wataash/dc9f8352dc147b223382def86c3a592b | |
A Python implementation of "Packrat Parsers Can Support Left Recursion" by | |
Alessandro Warth, James R. Douglass, and Todd Millstein. | |
http://www.vpri.org/pdf/tr2007002_packrat.pdf | |
2. An Overview of Packrat Parsing |
require "set" | |
unless ARGV.length == 1 | |
warn("usage: systemd-analyze dot | systemd-analyze-dot-only-n N") | |
exit(1) | |
end | |
n = ARGV.shift.to_i(10) | |
txt = ARGF.read | |
pairs_unit_count = Hash.new(0) |
inline code