Articles & Snippets

Search for content...
/

Start typing to search

How to force HTTPS using the .htaccess file

Posted by Cătălin on Wed, 8 Feb 2017

How to force HTTPS using the .htaccess file using mod_rewrite.

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] To force a specific domain to use HTTPS, use the following lines of code in the .htaccess file...

Read More...
code

CentOS cleaning Yum cache

Posted by Cătălin on Wed, 8 Feb 2017

How to lean the cache of YUM on your CentOS?

yum clean packages Now remove any cached XML-based metadata yum clean metadata Remove any cached database files yum clean dbcache Following this you will want to clean all the files to confirm...

Read More...
code

Useful library repository

Posted by Cătălin on Thu, 26 Jan 2017

Useful CDN Javascript and CSS library repository

CDNJS* is a library repository which hosted on cloudflare.com. It’s freely available CDN for common Javascript and CSS libraries. Currently there are 2756 libraries, check it out at: https://cdnjs...

Read More...
code

Encrypt sensitive data with PHP

Posted by Cătălin on Sat, 7 Jan 2017

Encrypt sensitive data with PHP and MySQL

Class created with construct now add methods to encrypt and decrypt: class Encryption { const CIPHER = MCRYPT_RIJNDAEL_128; // Rijndael-128 is AES const MODE = MCRYPT_MODE_CBC; ...

Read More...
code

GST/HST calculator

Posted by Cătălin on Tue, 8 Nov 2016

GST/HST calculator to find out the amount of tax that applies to sales in Canada.

Province or territory SelectAlbertaBritish ColumbiaManitobaNew BrunswickNewfoundland and LabradorNorthwest TerritoriesNova ScotiaNunavutOntarioPrince Edward IslandQuebecSaskatchewanYukon...

Read More...
code

Script to Backup Mysql Databases

Posted by Cătălin on Mon, 31 Oct 2016

Shell Script to Backup Mysql Databases, you can keep as many versions as you like

Create a cron with this script to backup your databases: #!/bin/sh # List of databases to be backed up separated by space dblist="DATABASE1 DATABASE2 DATABASE3" # Directory for backups backupdir=/PATH/FOR/MYSQL/BACKUPS/gz ...

Read More...
code