3 ms·
FWIW you can get code-formatting by prefixing lines with a 4-space indent: parse_dns_header(raw_packet) -> << ID:16, QR:1, OPCODE
by masklinn 10y ago
FWIW you can get code-formatting by prefixing lines with a 4-space indent:
parse_dns_header(raw_packet) ->
<<
ID:16,
QR:1, OPCODE:4, AA:1, TC:1, RD:1, RA:1, Z:3, RCODE:4,
QDCOUNT:16,
ANCOUNT:16,
NSCOUNT:16, ARCOUNT:16,
Tail/binary
>> = raw_packet,
Also for readers, this does depend on customisable (per-segment/field) defaults: `ID:16` is a shorthand for `ID:16/big-unsigned-integer-unit:1` aka "16-bits wide segment parsed as an unsigned integer in big endian"
- signa11 10y ago> FWIW you can get code-formatting by prefixing lines with a 4-space indent ah thank you ! that is very good to know. will it be possible to have some formatting guidelines / examples on the site somewhere ? similar to what we see on reddit ?
- masklinn 10y ago> will it be possible to have some formatting guidelines / examples on the site somewhere ? https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc Sadly HN has jack shit formatting-wise (the most annoying part being you can't escape asterisks so half the time it's going to emphasise a comment section and remove your asterisks despite that not being what you wanted)