Skip to main content

Search your FTP server at lightning speed

2 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Search your FTP server at lightning speed

Did you know that using WinSCP, you can run a search on your FTP to find all the documents containing a given string? It's native in WinSCP; nothing more to install but...

However, it's insanely slow; let's see how we can do it better and almost instantaneous.

Git - pre-commit-hooks

9 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Git - pre-commit-hooks

You like clean code, don't you? And you hate getting an email from your versioning tool (e.g. Github or GitLab) telling you that your last commit didn't go through, that the formatting of your code is bad; this is because you've left one space too many at the end of a line or you've used single quote instead of double (or the opposite), for example.

You've pushed your changes, already start to work on another activity, perhaps another project and boum, two hours after your last commit (because the CI server was working on a lot of pipelines before yours), boum, you get a Your last commit has failed, #gnagnagna. I hate it as much as I love clean code.

So, what should we do to avoid this?

The answer is simple! Before each push, we should run the same code analysis tools that are executed in the CI, i.e. phplint, php-cs-fixer, phpcbf, phan, phpstan, ... (for PHP) or pylint, mypy, prospector, black, ruff, ... (for Python) or shellcheck and shellformat (for Linux Bash) or ...

We should, but do we think about it every time? Unfortunately not.

Let's see how to correct this.

Using Docker init to quickly dockerize your PHP application

5 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Using Docker init to quickly dockerize your PHP application

How about asking Docker to create the files it needs itself?

If you're a regular reader of this blog, you'll know by now that you need a Dockerfile to describe how the Docker image should be created and what should be included in it, and very often you'll also need a composer.yaml file to explain how the container should be created, e.g. which port to map to, which volumes to use, and so on.

Imagine you've an existing PHP application and you don't want to create the files needed for the dockerization by hand.

You just want to very quickly and using a wizard, to be able to answer to some questions and hop, it's ready.

The docker init command is the one you're looking for.

AI - Image generation using recraft.ai

One min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

AI - Image generation using recraft.ai

Very small article today, just to introduce recraft.ai (thanks Pierre for the tip) which is an image generation tool assisted by AI.

Unlike other tools like Bing image creator (the one I used to illustrate my articles), recraft.ai can produce the same image but using some variations (using the fine-tune or the variate feature).

Using the editor, we can do some rotation, add text, resize the image, ...

And adding words like Realistic photo will generate images as if they were photos.

Python - Code Quality tools

9 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Python - Code Quality tools

If you're a self-respecting programmer, you can't develop without code analysis tools. For PHP programmers, you already know a lot of them (rector, phpstan, phan, phpcs, ...). See my previous articles Rector 1.0.0, my friend, my coach and Docker image that provides static analysis tools for PHP f.i.

What about Python?

Dagger.io - Using dagger to automate your CI workflows

19 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Dagger.io - Using dagger to automate your CI workflows

Be careful, it's a bomb. Docker has revolutionised the world; let's not be afraid to say it loud and clear, and most probably Dagger.io, created by the same people as Docker, will follow in its footsteps.

Dagger.io aims to be a tool that lets you execute steps of a workflow in exactly the same way as a CI/CD (Continuous Integration / Continuous Development) system like the ones of GitHub, GitLab, Jenkins, ... does.

But what is a CI? It's a step carried out by your server once you've pushed a new version of your project. During a CI, you can validate the syntax of your code, make sure it conforms (e.g. to formating rules), run code quality analysis tools such as checking that you don't have any undeclared or untyped variables or dead code (e.g. a function you no longer use).

During a CI, you can also launch your unit tests and run them each time you push out a new version of your project.

The aim of the CI is to ... crash as soon as something isn't in the expected state; e.g. you've forgotten a ;, you've got a violation (spaces used instead of tabs), a unit test no longer works, etc. So the aim of CI is to guarantee that your code is excellent.

Markitdown - Convert files and MS Office documents to Markdown

5 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Markitdown - Convert files and MS Office documents to Markdown

Recently a good friend has notified me about a new tool from Microsoft: an utility for converting PDF and MS Office files (like .docx or .xlsx) to Markdown.

By looking at the repo on Github (https://github.com/microsoft/markitdown/), it seems really interesting since, they said, "it converts pdf, PowerPoint, word, excel, images, audio, html, text-based formats like csv, json or xml and even zip file (iterates over contents)". It's a lovely promise!

So, because it's always good to be able to quickly convert some docx files written by colleagues who don't speak Markdown, I was really interested to test it.

Docker-in-Docker aka dind

7 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Docker-in-Docker aka dind

In very exceptional situations, you may need to be able to run Docker commands from a Docker container. Wait? What?

Imagine this situation: you're running a PHP container, everything is fine and you wish to run a code quality tool like, let's start easy, phplint (see this article for deeper info). You don't want to install phplint because you know a very cool Docker image who already contains it (think to jakzal/phpqa)

So, you're inside a container and you wish to run another container.

Another example: you're still inside a container and you wish to access to the list of running containers, already installed Docker images, volumes, ... (think to portainer)

Let's see in this article how to create your own Docker image, running as root or not, and configure it to allow Docker-in-Docker requests.

Python - Generate flows using pydot

4 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Python - Generate flows using Pydot

Pydot is a diagram as code generator i.e. you write lines of code and thanks to a magic process, you can render the code as an image.

For guys just like me who are terrible at visuals, this is gold.

Let's say you have to describe an IT process such as ETL (data is loaded, one or other transformation rule is applied and the result is loaded into a database, for example), you can easily imagine to draw some rectangles using a tool like https://app.diagrams.net/ (formerly known as draw.io) or use a smarter way to do it.

Let's see how in this article.

Markdown - Convert CSV to Markdown tables

5 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Markdown - Convert CSV to Markdown tables

See also Markdown - Convert Excel ranges to Markdown tables.

Next to my XLS2MD script, you can also convert CSV file to Markdown very easily.

Just copy/paste your CSV content like the one below on the main text area appearing on Markdown - Convert CSV to Markdown tables and enjoy.

Column 1 Header,Column 2 Header
Row 1-1,Row 1-2
Row 2-1,Row 2-2