Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vlm's full-sized avatar

Lev Walkin vlm

View GitHub Profile
@vlm
vlm / erlang-interview-question.erl
Created April 19, 2011 10:37
Erlang inteview question
%% Given the parsed HTML tree in the following format:
%%
%% Types HTML = [Element]
%% Element = {Tag, [Attribute], [Element | Text]}
%% Tag = atom() % e.g. 'a', 'pre', 'p'
%% Attribute = {Name, Value}
%% Name = atom()
%% Value = string()
%% Text = iolist()
%%
> for accept in `strings dump.pcap | grep -i ^Accept- | cut -f 1 -d':' | sort | uniq`; do echo "==> $accept"; strings dump.pcap | grep -i $accept | sort | uniq -c | sort -n | tail -10; done
==> Accept-Charset
4 Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7
6 Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.3
6 Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
7 Accept-Charset: GBK,utf-8;q=0.7,*;q=0.3
8 Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
8 Accept-Charset: UTF-8,*
11 Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
69 Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7