rand(Ø)

> beautiful code & photos

about <

Posts tagged: english

Ghost: How I moved my images to Cloudinary

For the past two weeks, I have been very busy moving all my Ghost apps images over to Cloudinary. As you probably know, my Photography Portfolio is running with Ghost and even there is not a ton of content, I needed to ensure it could meet these requirements:

  1. Deliver top quality images faster than my hosting solution
  2. Support RetinaJS assets upload via Ghost

If I was pretty confident with the 1st requirement, the 2nd was a tricky one in addition to move all existing content in Cloudinary.

A new Cloudinary storage adapter for Ghost

I looked for existing

> Continue Reading

MySQL: Table count for all databases

Answers I found on the internet were all based on the table information_schema.tables but truth is, this table contains table schemas of databases, not the database list.

What happens when you also need to include databases with no table?
Answer with this query:

SELECT SCHEMA_NAME AS 'Database', COUNT(information_schema.tables.TABLE_SCHEMA) AS 'Table Count'
FROM information_schema.SCHEMATA
LEFT JOIN information_schema.tables ON information_schema.tables.TABLE_SCHEMA = information_schema.SCHEMATA.SCHEMA_NAME
WHERE SCHEMA_NAME NOT IN ('mysql', 'information_schema', 'performance_schema', 'tmp')
GROUP BY SCHEMA_NAME;
+----------+-------------+
| Database | Table Count |
+----------+
> 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

MySQL: adding an index on a big-ass table

Okay, I'll admit it: SQL and big data things aren't at the top of my skillset.

No earlier than today, I resolved an issue we had in our customer databases: adding a missing index.
Seems easy at first but if the table is HUGE (yea, 8GB+ is big for me) with about 246MM rows (!!), it gets damn slow and the downtime doesn't last for an eye blink.

Reminder: ALTER TABLE allows read operations while altering the table then blocks reads and writes ops when the alteration is done and needs to go live. This may vary according to the configuration

> Continue Reading

Chrome: how to fix a gone basic auth dialog

Last night, I tried to display a basic auth protected page but without any success because I didn't know the credentials. Obviously, I got a 401 Error.

Today, I was back to that page with the credentials but Google Chrome wouldn't display the basic auth dialog anymore. How annoying to have directly the HTTP 401 Error page right away!

I found the fix from this page and I'm sharing it here so it will be faster for me to get to the fix as it might be for you as well.

Anyway, from the command line (I'm a OSX user)

> 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