Archive for October 2015

Apache enable SSL module

1. ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf result: not found 2. sudo a2enmod ssl 3. ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf result: created

PHP measure execution time

<?php   $start = (float) array_sum(explode(’ ‘,microtime())); // PHP Database Business Logic $end = (float) array_sum(explode(’ ‘,microtime())); print "Processing time: ". sprintf("%.4f", ($end-$start))." seconds.";

Image optimize

Run optipng to optimize png files in directory: for i in `ls`; do optipng -i0 -o7 -zm1-9 $i; done Run optipng for a single file: /usr/bin/optipng -i0 -o7 -zm1-9 upload/banner/kaspi132px.png Run jpegoptim for a single file: /usr/bin/jpegoptim –strip-all upload/banner/kaspi132px.jpg Run gifscle for a single file: /usr/bin/gifsicle -b -O2 upload/banner/kaspi132px.gif

mysql export a single table

mysqldump -u -p db table1 table2 table3

Yii turn debug panel on/off

Edit config/main.php (or config/web.php), add or remove the following code: $config[‘bootstrap’][] = ‘debug’; $config[‘modules’][‘debug’] = ‘yii\debug\Module’;

Mysql check corrupted tables

mysqlcheck -c databasename -uyourusername -pyourpassword

git rename local branch

If you want to rename a branch while pointed to any branch, simply do : git branch -m oldname newname If you want to rename the current branch, you can simply do: git branch -m newname