Today I wanted to add HTTPS support using Let’s Encrypt certificates for couple of old sites on very outdated legacy server, running Ubuntu 10.04.4 LTS and apache2.
The default “certbot” client which I’m using on other servers didn’t work because of outdated python and openssl version, so after some googling and trying couple of other clients, I finally found one that worked easy and flawlessly. It’s called acme.sh – https://github.com/Neilpang/acme.sh
Continue reading →
To optimize every table in all databases on the server, just run this command:
mysqlcheck -o --all-databases -u root -p
In case you want to optimize tables for a single database:
mysqlcheck -o <db_name> -u root -p
Couple of days ago nginx released nginx-1.10.0 stable version with http2 support.
I was already running nginx from their repos on couple of servers, and as the upgrade was possible just by running apt-get upgrade and adding a single parameter to config file, I decided to give it a try immediately.
I knew http2 use should impact sites with lots of http requests the most, so I compared the results from my hobby site for Latvian gamers – https://exs.lv/ – which has quite a lot of small images and other assets. I removed 3rd party ads so they don’t impact the load times and run couple of tests using gtmetrix.com. The results were pretty impressive for changing a single line of code. Continue reading →
I will provide basic code that’s needed to turn Excel or LibreOffice Calc file (.xlsx, .xls, .csv, .ods and some other formats) into a MySQL table with all the corresponding fields and data. This code will assume the first row of the document contains (unique) column names. That’s pretty much the only requirement.
First thing we need is PHPExcel package (it’s free and open source) for reading spreadsheet files. You can download it here: https://phpexcel.codeplex.com/. Download, extract and move it a folder where you can execute php files. We will include them in the following scripts. Continue reading →
I will show how to use any server with ssh as a proxy, I’m doing this on Debian Linux, but it should be the same on all Debian derivatives, and very similar on any other Linux distribution. I use this method to watch Netflix and bypass country restrictions, and to test website access speed from different locations, but it can be used for many other purposes. Continue reading →
I have one server with a lot of MySQL databases, and I wanted to know witch ones are taking up most of the disk space. Continue reading →
There are couple of different ways how you can make an animated GIF. You can either use multiple images and combine them together as a GIF animation (it can be hand draw frames, edited images, photos), or convert a video (or part of it) to GIF. Continue reading →
The shelf as it stands now. Continue reading →
Simple example on how to retrieve and display video title, description and some other associated data from YouTube video.
First step – get the API key
YouTube API key can be obtained for free from this address: https://console.developers.google.com/home/dashboard Continue reading →
Heres a little trick to kill of unwanted processes that are running for more than X minutes on Linux.
I use this on a production server, where imagemagick and ffmpeg are executed many thousands of times per day and in normal conditions each process takes 0.x to 30 seconds. On rare cases they seem to run out of control and never finish execution or take longer than seems reasonable and worthwhile for the particular task. To free up resources taken by such processes, I decided it would be ok to just kill them if they are running for more than 10 minutes. It may not be a very safe and beautiful way to deal with such processes, but it’s working well for me for years now, so I’ll share… Continue reading →