Temporarily, We Transfer Files

tmp.wtf which stands for Temporarily, We Transfer Files, is the Coding’s Cat new web app. If you want to just quickly share a few files with your friend, without registration etc. this service is for you. The files will be removed after seven days.


Get the source code

The second reason why the app was created is to show use case for the planeupload.com upload widget. The whole project was created in just a few hours and if you wan’t to get the source code (NodeJS), send an email on codingcatcodes@gmail.com

The Coding Cat got some document that he could not read on his Android phone or iPad showing only error because of read only mode that the mobile devices could not handle. He needed it on other devices than his PC, so he wrote a little ‘hack’  in JS.

Note 1: It was tested on Opera Browser.

Note 2: It converts pages to jpg images. The Coding Cat thinks it could be done preserving text, but he didn’t have more time for this and jpg solution was sufficient.

Note 3: If you’re getting only part of the document visible, try zooming out your browser and then run the script.

Step by step:

  1. Open the document in Google Docs
  2. Scroll to the bottom of the document, so all the pages are present
  3. Open Developer Tools on separate window and choose the Console tab
  4. Paste the code below (and hit enter)
    let jspdf = document.createElement("script");
    jspdf.onload = function () {
        let pdf = new jsPDF();
        let elements = document.getElementsByTagName("img");
        for (let i in elements) {
            let img = elements[i];
            console.log("add img ", img);
            if (!/^blob:/.test(img.src)) {
                console.log("invalid src");
            let can = document.createElement('canvas');
            let con = can.getContext("2d");
            can.width = img.width;
            can.height = img.height;
            con.drawImage(img, 0, 0);
            let imgData = can.toDataURL("image/jpeg", 1.0);
            pdf.addImage(imgData, 'JPEG', 0, 0);
    jspdf.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js';
  5. Now the PDF should be downloaded


What it does? It iterates trough the document checking for images (Google Drive stores pages as images) then writes it’s contents to a PDF.

Leave a comment if it works for you.

In this tutorial, the Coding Cat will show you how to implement an advanced AJAX PHP uploader, with progress bars, drag&drop, comments, thumbnails etc in just 5 minutes.

We will use a free upload widget from planeupload.com that will store your files on your Google Drive, Dropbox, Amazon S3 or FTP server, and then you can do operations on those files using API requests.


1. First, register on https://planeupload.com, it creates your account with Google or Facebook in just a few clicks. You should see a view like this:

PlaneUpload - connect cloud


2. Connect your cloud by clicking the icon. With Google Drive or Dropbox is just seconds. After that, your cloud will be added to the list:

PlaneUpload cloud list


3. Click on the “Show buttons” button, and then on “Click here to add your first button

Add button


4. Your first upload button is created. But we need to embed it in our web application. So go now to “Installation code” tab, and click on “Download prepared code“:

Download prepared code


The ZIP package contains ready to use examples with your PlaneUpload’s API key already generated. After unpacking, you should see files like this:

file list


5. Move them into your web server directory, and open your browser at address http://localhost/{your directory}/form-attachment.html

You will get example view:

form attachment example


6. Attach some files and click the “submit” button. Form is submitted to the “form-attachment-submit.php” script which executes “confirmAttachment” method:

(you can open now the “form-attachment-submit.php” file in your favorite IDE)

After that, a new button with a new directory in your cloud is created, and uploaded files moved to it. The button object is returned. Now you can set it to your app’s database for later use, and render it on your application’s view with simple code:


On the browser side, you’ll get an example view, that contains some basic informations:


Section that is most interesting to us is the “Files”. Those are fetched from API and parsed with our php script, so we can so some operations on it:

code files


7. Short video – check out this short 5 min video for more examples of usage

The Coding Cat has tricked you! The best OS for programmers is of course Linux!



So in this article it will show you 10 reasons why Linux is the best operating system for programmers.


1. Linux is not as easy to maintain as other OS’es.

Someone would think this is a bad thing. Well, not for programmers. With Linux you have to think more while configuring or installing (not apt-get, yum etc.) new programs and features. When something breaks, you can spend hours browsing the internet on the right solution. And the most important part here – you learn new things! Windows or OSX makes developers lazy. They are just calling the support, reinstalling the whole Windows, or buying a brand new Mac.

2. In Linux you are the owner of your computer

You can change everything as you want. Wanna totally different interface looks? No problem! Just install different desktop environment like Xfce or KDE and set up everything as you wish. Some process is not responding, eating too much your resources, or you just want to kill it for no reason? Type “kill <pid>” or “killall <name>” and get rid of it instantly.

3. Workspaces


This is one of the Coding Cat’s favourite features. You can work simultaneously on different subjects, just only switching to different workspace. For example in the first workspace you have your project’s code editors on second there is some operation running that require many windows for monitoring and third is your coffee-break workspace, where you read the Coding Cat’s blog while having a break. The Coding Cat has three monitors and six workspaces set up, that gives him 18 different screens!

4. Terminal


In Linux, everything can be done using terminal. You don’t have to go clicking through the jungle of windows when you want to change or check something in your system. Ctrl+alt+t and there you go. All file operations, installing software, checking your computer resources consumption etc. If you want a article about most useful Linux commands, leave a comment here.

..And this is how it looks like in Windows:

Working with windows


Want to run some of your scripts every hour, every two minutes or only sunday at 22PM? Type “crontab -e” in your terminal, and put here your command. As simple as that. Well, there are also some wisest Windows wizards, that can set up this also in their OS. But only check yourself some tutorials on that – you’ll see how f** is that.

6. Customization trough Bash and scripting

You can customize everything with scripting. Don’t like some part of your system, want to change some behavior or add automated features yourself? Linux is open for everything you need.

Psst. want to setup your wallpaper that has a lot of useful information instead of only a picture, and doesn’t consume system resources? Like this:

Linux custom wallpaper with varialbes

That’s very easy to set up. If you wish tutorial about that, leave a comment.

7. Installation from software repositories

When you want to install something on Windows, you have to open your Internet Explorer, then go to some website, download some fishy exe file, and pray, that this is not some malware like WannaCry. In Linux, on most popular programs, just type “apt-get install <name>” (distro dependent), and you’ll get your soft from a secure place. The other benefit from that is you can automate installation of programs you like, in a very easy way. If for example you change your computer often, or have to install the same things on different machines, just create a Bash script that installs everything in one command.

8. Security and encryption

Linux has a lot better user privileges on files resolved than Windows. You don’t need there a heavy antivirus software army that keeps your computer safe and consumes a half of your CPU while scanning trough everything. In Linux, you can set up whole partition encryption, and then your home folder encryption, so your most important code can be encrypted twice by default!

9. Linux servers

Most of the internet runs on Linux servers. If you get familiar with this system on your desktop, it’ll be easier for you to manage servers where you run your projects.

10. Prestige

how they see you

When some programmer asks you: “Which Windows do you have installed on your PC?” and you respond “Linux“, you are like some black magic wizard and Anonymous hacker to him, at the same time. And when he starts complaining, how his Windows is bad and slow, and how last time someone hacked his webcam, you redirect him to this blog post, so he can change his OS, before it’s too late.

Offtopic – Mr. Robot

If you like Mr. Robot series, you must check their website, is the best website made by humans that the Coding Cat has ever seen!


This is a website:

Mr robot website screenshot



Enter your domain name here:

This blog post will be parametrized for your case

Why installing SSL certificate?

SSL certificate is used for encrypting the data transfered between your website and it’s visitors. It encrypts all the data, including passwords, credit cards, files, preventing others from reading them. Nowadays browsers like Google Chrome show security alerts, when such a website has sensitive form data, and is not using SSL encryption. In this tutorial, the Coding Cat will show how to install free Let’s Encrypt SSL certificate for your website, that auto renews on Debian. On other Linux distributions the process is very similar, you can check it here: link.

Let’s Encrypt certificates expire in 90 days, but you can automate renewal, in this article we will show how. There is also a limit: 20 certificates per week. More about the limit: link.

Before installing the certificate make sure you have domain properly installed. If not, check out our tutorials How to install LAMP and How to configure a domain.

Installing certbot

First you need to add jessie-backports to your sources.list:

sudo sh -c 'sudo echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list'

Then update:

sudo apt-get update

Installing certbot for Apache:

sudo apt-get install python-certbot-apache -t jessie-backports

Installing certbot for Nginx:

sudo apt-get install python-certbot-nginx -t jessie-backports

Installing certificate for a domain

For Apache configuration run:

sudo certbot --apache

For Nginx:

sudo certbot --nginx

You should see something like this:

Certbot - choosing domain

Enter numbers of domains you want to enable HTTPS separated by commas or spaces, like “1 2 3” and press enter.

Then enter your email address, which will receive important notices from Let’s Encrypt about security issues and expiration. Then accept Terms of Service by typing “A” and pressing enter.

∗If you see an error like this (Apache):

Expected </VirtualHost> but saw </VirtualHost></IfModule>

Just add an enter to the end of your VirtualHost configuration file and try again by “sudo certbot –apache” command.

If all went well, you should be able to choose “Easy” or “Secure” mode. In “Easy” mode, all requests are allowed, http and https. With secure mode, all http requests are redirected to secure https. Choose one and press enter.

Next you should see “Congratulations! You have successfully enabled https://{domain}” message

Navigate to your website and check if https works, you can also test on ssllabs.com:


Or sslhopper:



Configuring auto renewal

To renew your certificates you can use a command:

sudo certbot renew

If you want to automate that, you need to register it on cron table:

sudo crontab -e

Crontab - choose an editor

Choose your editor and press enter.

Now, at the bottom, add a line:

12 3 * * * /usr/bin/certbot renew

so it looks like this:

Crontab - edit

Your auto-renewal task will be executed every day at 3:21 AM. Don’t worry, certbot will renew only certificates that are soon to expire.


Enter your domain name here:

This blog post will be parametrized for your case

1. Configuration directory

After you installed LAMP, you are ready to set your application online. To do that, you need to set VirtualHost configuration. Apache2 VirtualHost configuation files are in /etc/apache2/sites-enabled/. A good practice is to put them on /etc/apache2/sites-available/ and then symlink to sites-enabled, so you can remove domains by simply removing symlinks, without deleting the file.

So, go to your sites-available directory:

cd /etc/apache2/sites-available/

2. Create a VirtualHost config file

Create your domain config file, let’s assume, your website files are under /var/www/html/{domain}/

sudo nano {domain}.conf

Then, paste the code:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName {domain}
        ServerAlias *.{domain}
        DocumentRoot /var/www/html/{domain}/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/html/{domain}/>
                Options -Indexes
                Options FollowSymLinks MultiViews
                AllowOverride All
                Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log

        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined


Press ctrl+o to save, and ctrl+x to exit.

Then, create a symlink to sites-enabled directory:

sudo ln -s /etc/apache2/sites-available/{domain}.conf /etc/apache2/sites-enabled/{domain}.conf

3. Check configuration and reload

Run this code to test your Apache2. Coding Cat’s advice is to run this code everytime you make changes to Apache configuration. It may save you a lot of trouble.

sudo apachectl configtest

To reload Apache2 without impact of current website visitors, simply run:

sudo service apache2 reload

4. Done! Let’s check if it works

Open your browser, and go to http://{domain}/

If you get DNS errors, check if your domain points at your server:

dig {domain}

If not, you need to configure DNS records at your domain provider.


If you see 404 error, check if you have index file under /var/www/html/{domain}/ directory, like index.html or index.php, and make sure you did not receive any errors at step 3.


If you see other errors or a blank page, check out error.log file:

tail -f /var/log/apache2/error.log


What is LAMP?

LAMP stands for Linux + Apache + Mysql + PHP. In this blog post the Coding Cat will show how to install ready to use LAMP with newest versions: Apache 2.4, Mysql 5.7 and PHP 7.1.


If you are on vanilla Debian 8, first update and upgrade:

sudo apt-get update && sudo apt-get upgrade


Install Apache 2.4 on Debian 8

Installing Apache is simple, just run the code:

sudo apt-get install apache2


Install PHP 7.1 on Debian 8

By default PHP on Debian 8 is in lower version than 7.1, so we need to add some addresses to the sources:

sudo apt-get -y install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

Next, we can use apt-get to install PHP with modules we want:

sudo apt-get update && sudo apt-get install php7.1 php7.1-cli php7.1-fpm php7.1-apcu php7.1-apcu-bc php7.1-common php7.1-curl php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-soap php7.1-xml php7.1-xmlrpc php7.1-xsl php7.1-zip php7.1-gd php7.1-imap php7.1-intl php7.1-zip


Installing Mysql 5.7 on Debian 8

First we need to install libaio1 package

sudo apt-get install libaio1

Then download deb package from mysql website:

sudo wget http://dev.mysql.com/get/mysql-apt-config_0.8.6-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.6-1_all.deb

When you see this screen below, just use arrows to go to this “Ok” and press enter. This is one of the worst UX the Coding Cat have ever seen..

Mysql installation screen


Update and install

sudo apt-get update
sudo apt-get -y install mysql-community-server

Done. Check installed versions.

Now you are all set, check your version of PHP:

php -version

Version of MySQL:

mysql --version

Version of Apache

sudo apache2 -v