Clone an lxc container to another host in five commands

Copying a lxc container to a new host is so damn easy that I couldn’t believe at first!

  1. First of all, stop your container
    sudo lxc-stop -n <YOUR-CONTAINER-NAME>
  2. Compact it into a tar archive. Containers are usually found on
    sudo tar --numeric-owner -czvf lxc.tgz /var/lib/lxc/<YOUR-CONTAINER-NAME>
  3. Move tar file to new host. Do it the way you like: by network, usb stick or pigeon.
  4. Untar your container to where it belongs, usually /var/lib/lxc
    sudo tar --numeric-owner -xzvf lxc.tgz
  5. Enjoy!
    sudo lcx-start -n<YOUR-CONTAINER-NAME>

AngularJS: learn the difference between emit and broadcast

When I was a neofite with Angular JS I had many problems to understand when I had to EMIT or BROADCAST an event: both methods are called the same way but event will take opposite directions:


When an event is emitted, the curent scope and its anchestors will receive it.


So, if I emit an event from SCOPE 4, I can intercept it on scopes 4, 2 and the root scope.


As opposite, a broadcasted event is sent by the scope to and all its children.

broadcast (1)

If I broadcast en event from scope 2, it can be intercepted by scope 2 itself but also scope 3 and 4… so, if I broadcast from the root scope, i can intercept the event EVERYWHERE!!

A simple query to know when Postgres’ autovacuum will run

Understanding Postgres’ autovacuum isn’t easy at the beginning: it’s a balance between many settings. To help you, here’s a query to understand them and know which tables are pending for autovacuum and how many dead tuples are required before a table gets vacuumed again. Continue reading A simple query to know when Postgres’ autovacuum will run

Easy virtual development envinronments with Vagrant

Vagrant is your next work companion: it will create a virtual development environment ready to run on every machine, you no longer need to install a web server, a database or any other package on every single machine, just set it up once and share the same environment with your team. Continue reading Easy virtual development envinronments with Vagrant