Renew Let’s Encrypt certificate

If you have no automatic certificate renewal, you may found out one day that the browser is telling you that your site is “unsafe” as the certificate has expired.

Just type at the command line:

  • letsencrypt renew

But you can also add a simple cron job for automatic renewal, for example:

  • 15 5,17 * * * /usr/bin/letsencrypt renew

Checking twice a day is recommended for the unlikely event if something happens to your certificate due to the Let’s Encrypt themselves.

If the certificate is valid and new nothing happens aside from reading the certificate locally, so you can run it as often as you want.

UTF-8 from MySQL does not show correctly in PHP

The data you have in MySQL is all in UTF-8, you have UTF-8 specified in your HTML, PHP is set up to use UTF-8, but you still get gibberish as output, with question marks showing up on screen instead of correct symbols.

The problem may be that the communication between MySQL and PHP is not happening in UTF-8.

Try telling “SET NAMES ‘utf8′” to MySQL when you initiate the connection, before you run any other queries.

For example, as soon as you establish the connection to database, run this in your script:

mysqli_query( $conection, “SET NAMES ‘utf8′” );

Reset filters in LibreOffice

You may experience a situation where may not be able to reset filters in LibreOffice, with the Data -> More filters -> Reset all.

Use the alternative way by directly ordering the rows to be shown by Format -> Row -> Show.


Postfix 451 4.3.0 Temporary lookup failure

You set up Postfix and attempt to send the mail, but receive an error saying “451 4.3.0 Temporary lookup failure”.

Check to see if you have /etc/postfix/transport file. If you don’t, run the command below and try again:

  • cd /etc/postfix
  • touch transport
  • postmap transport

Blank lines in top of file downloaded via PHP

You are serving a file for download directly from your PHP script, by setting its mime type,  sending headers with Content-Type and Content-Disposition, then piping the contents.

Everything works fine, but then suddenly the downloads become corrupted, with extra data added in their top, with blank extra lines clearly visible in downloaded text files.

The first thing to do without thinking much is to go through your PHP files and remove closing “?>“, if they are at the very end of the file. They are not needed and actually can be harmful, as anything after “?>” may served to the user with potentially damaging results.

Just remove those “?>” and your downloads may be fine again.

Removing line breaks from base64 encoded data

You may experience a weird problem, when you attempt to embed base64 encoded TTF font file in a Web page with CSS @font-face and the font just does not work. You try decompressing the base64 data, and get perfectly valid TTF file. Everything is fine, but nothing works.

Well, the problem is caused by line breaks in the base64 encoded data. It is said that those line breaks are there because once upon a time software could not handle long strings. Well, these days it is obviously the opposite. Web browsers seem unable to handle base64 data with line breaks SOMETIMES, because base64 encoded images work perfectly well even if there are the breaks. The fonts don’t though.

Whatever. Take your base64 encoded file and run this command on the command line:

tr -d "\n\r" < Font.base64 > Font-valid.base64

Linux Mint 18 Mate memory leak

You may experience your Mint 18 Mate occasionally getting slow and non-responsive, with Mate panel freezing or mouse pointer moving slowly and in jerky fashion.

If you run top, you see that that CPU usage is constantly up, with mate-settings-daemon hogging close to 100%.


  • tail -f .xsession-errors

If you see something like “unable to create file ‘/run/user/1000/dconf/user’: Permission denied.  dconf will not work properly.”, a memory leak causing bug may be at fault.

The bug makes wrong permissions to be assigned to the file /run/user/1000/dconf/user , making it non-writable for your processes.

Fix it as root by making the respective user to own the file respective file, e.g. /run/user/1000/dconf/user , and killing and restarting the mate-settings-daemon .