### Archive

Archive for December, 2015

## 2015 in review

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here's an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 200,000 times in 2015. If it were an exhibit at the Louvre Museum, it would take about 9 days for that many people to see it.

Categories: python Tags: ,

## [nodejs] increase memory limit

Problem
Your Node.js program terminates with a “process out of memory” error. How to increase the memory limit?

Solution
Launch your program with the following switch:

```node --max-old-space-size=8192 mem_eater.js
```

This way you give 8 GB RAM to your process.

More tips here.

Categories: nodejs Tags: ,

## generate all subsets of a set

Problem

Having a set, generate all its possible subsets. This time I had a list, but the problem is the same.

Solution

```from itertools import chain, combinations

def all_subsets(ss):
return chain(*map(lambda x: combinations(ss, x), range(0, len(ss)+1)))

for subset in all_subsets([1, 2, 3, 4]):
print(subset)
```

Output:

```()
(1,)
(2,)
(3,)
(4,)
(1, 2)
(1, 3)
(1, 4)
(2, 3)
(2, 4)
(3, 4)
(1, 2, 3)
(1, 2, 4)
(1, 3, 4)
(2, 3, 4)
(1, 2, 3, 4)
```
Categories: python Tags: , , ,

Categories: python Tags: ,

## Mr. Robot

I started to watch the TV show Mr. Robot. It’s a very cool techno thriller that displays hacking scenes quite realistically.

But what does it have to do with this blog? Well, in episode “eps1.3_da3m0ns.mp4” I saw the following image:

Check out the source code on the left side :)