Combinatorics of Boolean functions, and some applications