PHP 7.0 - Anonymous Classes

A new feature of php 7.0 is anonymous classes. Anonymous classes are useful when simple, one-off objects need to be created, such as a value object. Below is an example of using an anonymous class for ensuring a user provided string is valid, and converts it for later use.…

Read this article

Comparing VP9 AND x265 HEVC

In case you didn't know, x265 (HEVC) and VP9 are two different video codecs that are supposed to achieve the same perceptual video quality at half the bit-rate (thus half the file size and required bandwidth) of x264 content. Most of your video content is likely to be in x264…

Read this article

Using DI to Avoid Inheritance

I often find myself using inheritance to try and DRY up my codebase. However, that can easily lead to inheritance hell, which you know you are in when: You have to implement methods you don't want/need in child classes. You enter the "great" territory with great-grandparent and great-great-grandparent classes.…

Read this article

Ubuntu 16.04 - Install GPG Extension for PHP 7

Below is a script you can run to install the GPG extension for the PHP 7.0 CLI on Ubuntu 16.04. It may work on other distributions and versions of PHP, but I have not tested that. Related Posts Debian 8 - Install GPG Extension for PHP 5.6…

Read this article

Extremely Defensive PHP

Below is a talk from Marco (Ocramius) on extremely defensive PHP. Marco works at a company called Roave (software consultancy), and is an active contributor in th Zend Framework and Doctrine teams. He conveys a lot of great points that I think we could all benefit from. Introduction to speaker…

Read this article

Ubuntu 16.04 - Install Yarn Package Manager

The easiest way to install yearn is to use the following prog-exec command. prog-exec "34/1" "c6a9ccef59c818e546fda89456bfe73f3a363f2ee17798411b067b0306f3ad75" ... or you can copy, paste, and execute the following script: curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo…

Read this article

Duplicity - Backing up to A Remote Computer

This tutorial will show you how to back up your files to a remote computer in an encrypted format using duplicity. Steps First, generate a gpg key if you don't have one already that you wish to use. gpg --gen-key I would go with the the default options, a 2048…

Read this article

Install Duplicity From PPA

A short snippet to install duplicity from the PPA on your servers. sudo apt install software-properties-common python-software-properties -y sudo apt-add-repository ppa:duplicity-team/ppa -y sudo apt install duplicity -y References Launchpad - Duplicity…

Read this article

Key File Formats

The samples below are all examples of using asymmetric (public-key) RSA encryption. Unfortunately, it appears there are various competing formats for storing the data in files which I aim to cover here. GPG Private Key Generated from gpg --export-secret-key -a "username@email.com" > [filename].asc -----BEGIN PGP PRIVATE KEY…

Read this article

Hard & Soft Links

I've often thought there should be a relational database based filesystem in order to better organize my media collection, but it turns out all I needed was to understand hard links. Soft links are also referred to as symbolic links or symlinks. I may use these terms interchangeably. The Problem…

Read this article