Learning something new every morning

Thanks to Enki app I learn something new in programming every day. Give it a try.

Advertisements

Log mysql queries in Docker container

To log mariadb (mysql) SQL queries in a Docker container add - ./docker/mysql/conf.d:/etc/mysql/conf.d to volumes of the database service.

version: '3'

services:
   db:
     container_name: db
     image: mariadb:10.1
     volumes:
       - db_data:/var/lib/mysql
       - ./docker/mysql/conf.d:/etc/mysql/conf.d
     environment:
       MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'

volumes:
    db_data:

The contents of docker/mysql/conf.d/my.cnf

# docker/mysql/conf.d/my.cnf

[mysqld]
general_log = 1
general_log_file = /var/log/mysql/query.log

slow_query_log = 1
long_query_time = 1 # seconds
slow_query_log_file = /var/log/mysql/slow.log
log_queries_not_using_indexes = 0

 

Tried mitmproxy & mitmweb

Today I came by https://mitmproxy.org/ and gave it a shot just to know what it is capable of. For example for REST API communication debugging. The mitmweb is in beta, but looks good and also worked for me 🙂

The best is that they provide a docker image so trying it out was really simple.

  1. Just run docker run --rm -it -p 8080:8080 -p 8081:8081 --net="host" mitmproxy/mitmproxy mitmweb
  2. Open http://127.0.01:8081
  3. I changed Firefox to use proxy at 127.0.0.1 and port 8080 and browsed the web with mitmproxy intercepting the HTTP communication

mitmproxy & mitmweb

Put WordPress in maintenance mode without a plugin

1. In your web root directory (where the wp-config.php is located) create file .maintenance
2. It’s content should be <?php $upgrading = time();
3. You can customize the page by creating wp-content/maintenance.php

See source https://github.com/WordPress/WordPress/blob/9041e7a07150b10ed28ec274374ce7d397b0ac9b/wp-includes/load.php#L203-L206

GitHub compare for changelog check

Changelogs are handy sometimes, but I’m curious so I prefer to see code changes and learn new things so while the new WordPress security release came by I looked at it at GitHub with compare

https://github.com/WordPress/WordPress/compare/4.8.14.8.2

I also checked what’s new in Arch Linux’s today’s VIM update.

https://github.com/vim/vim/compare/v8.0.1092v8.0.1127

To check other repo just replace thinks in the URL:

https://github.com/NAMESPACE/REPOSITORY/compare/TAG_BRANCH_FROM...TAG_BRANCH_TO

For more about GitHub compare read https://help.github.com/articles/comparing-commits-across-time/

Switched to browser bookmarks from Pocket

I got annoyed by malformed articles in Pocket so I removed the app from tablet, smartphone and browser and switched to use browser (Chrome) bookmarks. Just created a _read bookmark directory to be it up in the order (due sort by title).

read bookmark directory

So now during my morning reading on tablet I use Chrome instead Pocket app.
While using Chrome I provide better analytics data for the article authors. If they share knowledge for free, they get some free statistics from me in return 🙂