Open link in browser from VIM

Just read about VIMs gx shortcut which opens the URL under the cursor.

Source: https://bluz71.github.io/2017/05/15/vim-tips-tricks.html#launch-browser-with-gx-command

 

Posted in vim | Tagged , , | Leave a comment

Change locale for WooCommerce email

To change WooCommerce email language you need to change the locale after order submit.

Using $_GET might be dirty, but works 🙂

Posted in Uncategorized, woocommerce, wordpress | Tagged , , , , | Leave a comment

VIM indent shiftwidth in insert mode

In insert mode I incidentally pressed Ctrl+d and VIM removed one shiftwidth indentation. To revert just press Ctrl+t
Pretty handy. Always learning/improving my vim-fu.

Posted in vim | Tagged , | Leave a comment

VIM tags basics

This post is more of a reminder/cheatsheet for myself.
Whenever in doubt or have question check VIM :help.
For help with tags use :help tagstack

Shortcuts

  • Jump to a tag Ctrl+]
  • Jump back Ctrl+Shift+o
  • List tags g[
    Vim tags list
Posted in vim | Tagged | Leave a comment

Purging mysql-bin files, a.k.a. saving GBs of SSD space

My SSD was filling up and while searching for the cause I ended at MySQL binary log files. They used almost 40GB :-O while I don’t use the logs so often and especially not so backdated

$ sudo ls -lSh /var/lib/mysql |head 
total 7.8G
-rw-rw---- 1 mysql mysql 1.1G May 18 13:34 mysql-bin.000521
-rw-rw---- 1 mysql mysql 796M May 14 20:36 mysql-bin.000517
-rw-rw---- 1 mysql mysql 528M May 21 20:18 mysql-bin.000525
-rw-rw---- 1 mysql mysql 370M May 22 20:18 mysql-bin.000526
-rw-rw---- 1 mysql mysql 367M May 17 19:44 mysql-bin.000520
-rw-rw---- 1 mysql mysql 354M May 13 20:38 mysql-bin.000516
-rw-rw---- 1 mysql mysql 348M May 2 20:25 mysql-bin.000503
-rw-rw---- 1 mysql mysql 297M May 18 20:13 mysql-bin.000522
-rw-rw---- 1 mysql mysql 285M May 16 20:29 mysql-bin.000519

After some googling I found how to purge the files.

PURGE BINARY LOGS BEFORE '2017-05-01 00:00:00';

Because I don’t want to be bothered with this same issue a set expire_log_days to the 60 days in my.cnf, because the default is 0, so no automatic removal.

Posted in mysql | Tagged , , , | Leave a comment

Prestashop on localhost with friendly URL

Finally got Prestashop to run on localhost for development

Changes in the database:
--
-- Localhost modifications for dev
--
UPDATE `shop_url` SET
`domain` = 'localhost',
`domain_ssl` = 'localhost',
`physical_uri` = '/example.eu/'
WHERE `id_shop_url` = '1';

UPDATE `employee` SET
`lastname` = 'Zuber',
`firstname` = 'Michal',
`email` = 'info@nevilleweb.sk',
`passwd` = '57b43e92dbb27ff1974b85673e1b32f2' -- MD5(CONCAT(_COOKIE_KEY_, MY_PASSWORD))
WHERE `id_employee` = '1';

Password hash is a MD5 of a combination (concatenation) of _COOKIE_KEY_ from config/settings.inc.php and your desired password

For friendly URLs to work the following .htaccess should work (replace yourproject)

Posted in php | Tagged , | Leave a comment

Invoice items from last month via Git alias

I invoice some of my clients on monthly basis so the following Git alias in my .gitconfig for listing last month commits is a big timesaver for me:

Posted in git | Tagged , , | Leave a comment