Skip to main content

Encapsulate an entire Docusaurus site in a Docker image

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

Encapsulate an entire Docusaurus site in a Docker image

Started on 2 November 2023, this article is already the hundredth I've published on this blog. To mark the occasion, I wanted to do something a bit special to honor the blog. What better way than to build a 100% Docker version, i.e. in the form of a downloadable Docker image that you can run with a single command line.

A single command to download the blog and run it on your machine (Linux, Mac or Windows) and have a fully working site; nice isn't it?

And as usual, you'll find all the information you need below so that you can do the same for your own Docusaurus installation.

Don't wait more

Start a console, run docker pull cavo789/blog && docker run -d -p 80:80 --name blog cavo789/blog to download a local copy of my blog and to start it. Once done, just open http://localhost on your computer and ... congratulations, you've just obtained an offline yet executable version!

Now, we'll learn to do the same for your own Docusaurus instance. Ladies and gentlemen, please follow the guide...

CodeSnap addon for VSCode

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

CodeSnap addon for VSCode

The extension CodeSnap will take beautiful screenshots of your code in VS Code without effort.

Open your file in vscode, select the desired lines, press CTRL-SHIFT-P, run CodeSnap. You just need to select lines now.

CodeSnap partial example

Export the list of extensions you've installed in VSCode

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

Export the list of extensions you've installed in VSCode

A small tip: by running code --list-extensions in a console (Linux or DOS), you'll get the list of all extensions you've installed in VSCode.

Now, just copy/paste that list and you can send it to a friend Hey, here are the extensions I use. Maybe one or the other will be useful to you..

Multiple cursors in vscode

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

Multiple cursors in vscode

One of the best features in vscode is the Multiple cursors one.

Imagine you've a bunch of lines where you need for instance remove the first two characters. Each lines starts with '//' and you wish to remove them but only there (a search & replace can't be used).

Or, for another example, you must enclose each line in double brackets.

With vscode, it's ultra-simple: multiple cursors.

Quarto Callout Blocks

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

Quarto Callout Blocks

A callout (called admonition by Docusaurus) is a special syntax used to highlight a paragraph, f.i. a Pay attention to... or Tip: Did you know that... box.

On this blog powered by Docusaurus, the syntax for admonition is

:::caution[Pay attention to...]
Never give your bank card code to a stranger.
:::

and this is rendered like

Pay attention to...

Never give your bank card code to a stranger.

And now a nice tip:

Did you know that...

By going to bed earlier, you'll get better quality sleep.

Quarto implements this a little differently, so let's have a look...

Quarto includes short code

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

Quarto includes short code

Using the Quarto includes short code, writing a long document can easily be broken down into several smaller ones.

Imagine the following main.qmd file:

# My thesis in Latin

{{< include chapter1.md >}}

{{< include chapter2.md >}}

Quarto will then merge the three files when you render main.qmd.

Quarto Inline style

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

Quarto Inline style

Don't want to take the time to create a CSS class and figure out how to integrate it into Quarto to quickly highlight part of your paragraph?

Quarto supports an inline css style syntax for producing HTML documents (not working for, f.i., pdf or docx).

Syntax

You can apply styles to inline text by creating spans using [] to surround the text you want to style and {} to define the style you want to apply.

Obfuscate your PHP code

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

Obfuscate your PHP code

A few years ago, I sold a software called aeSecure, which was a Web Application Firewall. In order to prevent my proprietary code from being picked up by someone who could then sell it, for example, I had developed an obfuscation script.

Since then, I've released a reusable version of that script: https://github.com/cavo789/php_obfuscator.

And what if, today, with artificial intelligence, this type of code was no longer of any interest? The aim of this article is to see if it's always a good idea to make your code unreadable.

Docker image that provides static analysis tools for PHP

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

Docker image that provides static analysis tools for PHP

For years now, I'm using https://github.com/jakzal/phpqa to run a lot of static analysis tools on my PHP codebase.

The list of available tools is huge; see by yourself: Available tools.

In this blog post, we will see how we can take advantage of all these tools and increase the quality of our scripts.

MS Excel - Connect to a SQL Server database, run a query and get the results

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

MS Excel - Connect to a SQL Server database, run a query and get the results

Imagine you can execute a query like SELECT customer_id, first_name, last_name, email FROM customers ORDER BY last_name ASC; in your Excel sheet and that Excel will connect your Microsoft SQL Server database, run the query there, get the result and put the data directly in your sheet. Would be nice, no?

Imagine your sheet has already a nice layout with colors, titles having filters enabled and f.i. has a name (like rngMyCustomers). It would be nice if the updated data still keep all the layouts and just extends the name; no?

Stop imagining, it's just so easy!