Let’s Encrypt

Generating a certificate:

# Point to the letsencrypt directory
$ cd /root/letsencrypt;
$ ./letsencrypt-auto certonly --standalone --email developer@example.com -d example.com -d www.example.com

Docker – Modify files in a running container

Here is a solution to use a fully functioning text editor within a docker container when ssh’d into a remote linux host.

# Log on to your container
docker exec -it grave_ride /bin/bash

# Run this command to fix the terminal
export TERM=xterm

# Continue to open and edit your file in your faviourite text editor.
nano my-file.js

Symfony form querybuilder with parameters

->add( 'weeks', 'entity', array(
    'class' => 'MV\CaravanBundle\Entity\CaravanRow',
    'property' => 'line',
    'query_builder' => function(EntityRepository $er ) use ( $caravan ) {
        return $er->createQueryBuilder('w')
                  ->orderBy('w.dateFrom', 'ASC')
                  ->where('w.caravan = ?1')
                  ->andWhere('w.visible = 1')
                  ->andWhere('w.booked = 0')
                  ->setParameter(1, $caravan);

Source: http://stackoverflow.com/a/13847387