Skip to content

Instantly share code, notes, and snippets.

let data = process.argv[2]
let unmarshalled = JSON.parse(data)
function toCamelCase(key) {
return key.split('_')(key).map(convertCase).join('')
}
function convertCase(key) {
if(key.toLowerCase() == "id") return key.toUpperCase()
return key[0].toUpperCase() + key.slice(1)
@olof
olof / dnspkt.erl
Created June 27, 2013 16:12
Parsing a DNS packet with erlang. Learning erlang kind of thing. Not complete, but can parse up to, and including, the question section.
% vim: ts=2:sw=2:noet:tw=80
% dnspkt.erl: Parse a dns query packet.
% Copyright 2013, Olof Johansson <olof@ethup.se>
%
% Copying and distribution of this file, with or without
% modification, are permitted in any medium without royalty
% provided the copyright notice are preserved. This file is
% offered as-is, without any warranty.