rand(Ø)

> beautiful code & photos

about <

Posts tagged: trick

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

S3: List objects using filters

One thing that really sucks about the Amazon S3 command is not being able to efficiently list objects using the exclude and include filters.

I recently had a case when I needed to list GZip archives from one of our S3 buckets but only the ones ending by .gzip.

Since the ls command doesn't support filters (yet?), I found another way to get that listing: use the cp command, but in dry-run mode:

#!/bin/bash
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=

# Very important: DO NOT remove the --dryrun flag!
aws s3 cp s3://bucket-name . --recursive --no-progress
> Continue Reading

Ghost: RetinaJS integration

In this post, I will show you how to quickly make your Ghost blog retina-ready.

If you are new to the retina thing, please read the Wikipedia page so you know what we are talking about.

Step 1: make your images retina-ready

I won't explain the whole thing about how to make your images retina-ready but this article covers the most of it.

Whether or not you are using the provided Photoshop export script, just make sure you save your files with @{factor}x.{ext} instead of _{factor}x.{ext}.
Where:

  • {factor} is the image dimension factor
  • {ext} is the
> Continue Reading

OSX: Dealing with property list files

During my last CareerBuilder Hackathon, I worked finished a project that will incredibly help our growing tech teams. If you ever worked in a consulting company, you know how painful it is to wait to gather server credentials and set up them on your machine to be fully operational.

My project is very simple but damn useful: it generates several type of configuration directly from our platform API. You need to have SSH access to servers or connect to database servers? No problems, you provide your SSH user/key path and I take care of generating the file for you

> Continue Reading

cURL: forward POST over HTTP redirections

Recently, I've been stuck on a Web service call that wouldn't be called as supposed to be. When having troubles with WS, it's very important to dump client request and server response.

Using cURL withing PHP, I couldn't understand why my code was building a POST request and cURL returned me a GET request instead when the URI was getting a 301 redirection.

Turned out that it was a configuration issue because the URI wasn't the right one. Thanks to the config team!

What cURL says

When curl follows a redirect and the request is not a plain GET (for
> Continue Reading