rand(Ø)

> beautiful code & photos

about <

DigitalOcean to Fly.io

Hello folks,

In the pursuit of saving more and more money to run my websites, I recently switched this blog to Fly.io. A pretty neat developer-oriented hosting solution that has a fabulous free tier and bills extra as you go.

It's been out there since 2017 but only found out recently. Thanks to @Chris from Servers For Hackers!

Last time, I was very happy to announce that my hosting costs were around $5-6 a month, while now it's very close to $0.

The solution I had in mind was to convert my Ghost blogs into static websites, using Hugo

> Continue Reading

To rewind, or ! (to rewind)

Lately, I was missioned to integrate a vendor PHP SDK that is transport-agnostic as it implements HTTPlug. Pretty cool.

Everything went well until I found out that the SDK used a response reader method helper which is:

/**
 * @param ResponseInterface $response
 *
 * @return stdClass
 */
private function handleResponse(ResponseInterface $response)
{
    $this->setRateLimitDetails($response);

    $stream = $response->getBody()->getContents();

    return json_decode($stream);
}

First issue: I can't pick the response format, I'm forced to deal with the object deserialization version of the JSON payload. This is okay but not completely since the structure of the JSON may vary if my peers

> Continue Reading

Plus le temps

Salut, je voulais prendre un peu de temps en cet après-midi d'anniversaire pour faire une petite rétrospective sur ma vie. En emmenant mon aîné à l'école lundi matin, je me suis posé des questions sur le rythme actuel de ma vie quotidienne et ça m'a permis de me rappeler comment c'était "avant".

"Avant"

Non, pas avant J-C, ce serait hypocrite et risible d'écrire sur une période où mon existence ne faisait même pas partie du plan.

Avant d'être père.

J'ai toujours eu beaucoup de chance d'avoir un travail compatible à mon rythme de vie : couche tard, lève tard. M'extirper de

> Continue Reading

Link ID fields in EasyAdmin

If you also use EasyAdmin and are exhausted by clicking twice to see an entity ID when on the entity index page, you can use this small tweak to have your index page generate the detail page link on the ID field.

For this, simply override the template crud/field/id.html.twig.  
The original value is currently this:

{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{# this template is used to display Doctrine entity primary keys #}
{{ field.formattedValue }}

Instead, you could replace its content with this:

> Continue Reading

MySQL: silent insecure password warning

I won't invent anything new here but I'll share a quick improvement on an answer I've found on Stack Overflow.

If you are doing batch actions and don't want to write in .mylogin.cnf file, there's the trick: use a process substitution!

$ mysqldump --defaults-extra-file=<(printf "[client]\nhost = host.rds.amazonaws.com\nuser = username\npassword = \$PassW0rd\$") \
    database > dump.sql

This also works for any other file input, like Docker env file run param:

> Continue Reading

Cross-region & cross-account AWS resources Terraform planning

Hey, it's been a while, right?

Lately, I'm leading some big changes in our infrastrure since I'm wrapping a Blue/Green deployment into another one. Uh?

Long story short: our product runs on AWS ECS Docker containers, and because we have one sub-domain per app instance, we use Apache wildcard sub-domains. Meaning a single container handles traffic from many clients/instances. We already have a Blue/Green deployment process in place but at the Docker container level, not at the client level. The idea is to entirely duplicate the whole stack (with all its flaws) and a sub-domain pointing to

> Continue Reading