-
Notifications
You must be signed in to change notification settings - Fork 41
Examples
Ilya Sher edited this page Oct 29, 2018
·
9 revisions
Welcome to the ngs wiki!
In this wiki we will assemble simple examples and Q&A, about some of the most valuable NGS features. They are not in any particular order, or logic, but rather some useful things as we develop the language and the feature set.
ngs -pi 'globals().filterv(Fun)'
Get all certificates from a certificate chain
certs = read(fileName) ~~ /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/ms
subject = (`echo ${cert} | openssl x509 -subject -noout` - Sfx("\n") - Pfx("subject= /")).split("/").map(split(X, "=")).Hash()
-
- Sfx("\n")
removes newline at the end -
- Pfx("subject= /")
removes undesired prefix of the string -
.split("/")
splits the line by/
, resulting an array of strings -
.map(split(X, "="))
splits each string in the array, resulting an array of the form[["k1", "v1"], ["k2, "v2"]]
-
.Hash()
converts array of the form[["k1", "v1"], ["k2, "v2"]]
to a Hash
NGS official website is at https://ngs-lang.org/