Skip to content

Instantly share code, notes, and snippets.


Juyal Ahmed tojibon

View GitHub Profile
tojibon / mysql.bat
Created Feb 8, 2019
Connect MySQL + Create Database + Import SQL via terminal
View mysql.bat
mysql -u root -p
CREATE USER 'phpapp_user'@'localhost' IDENTIFIED BY 'phpapp_user_pass';
GRANT ALL ON phpapp_db.* TO 'phpapp_user'@'localhost';
mysql -u phpapp_user -pphpapp_user_pass -D phpapp_db;
mysql -u phpapp_user -pphpapp_user_pass -D phpapp_db < dummy_data.sql;
tojibon /
Created Jan 7, 2018
Install WordPress via WP-CLI
# Download and Configure WordPress   
wp core download   
wp core config --dbhost=host.db --dbname=prefix_db --dbuser=username --dbpass=password   

# Configure wp-config.php   
chmod 644 wp-config.php   
wp core install --title="Your Blog Title" --admin_name=wordpress_admin --admin_password=4Long&Strong1   

# Enable File Uploading   
View app.dockerfile
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
tojibon /
Last active Nov 29, 2018
Installing pgAdmin4 on Linux Ubuntu by Docker Container

Without Persistent Data

docker pull dpage/pgadmin4
docker run -p 8082:80 \
-e "" \
-d dpage/pgadmin4
docker ps
tojibon /
Last active Nov 21, 2018
CakePHP 3.x and Croogo 3.x Creating a Custom Plugin

Creating Plugins For Croogo

sudo bin/cake bake plugin Apps

You will be asked to choose a location of the plugin. Select outermost Plugin/ folder.
Creates proper directory structure for new plugin
Adds entry in config/bootstrap.php file to load newly created plugin It is recommended that you delete entry of newly baked plugin from config/bootstrap.php file as you will be able to enable-disable plugin from UI. The line will look something like:

tojibon / custom-admin.css
Created Jun 11, 2015
Saving/Editing user profile photo on WordPress admin
View custom-admin.css
.wp_slrp_img_wrap {
max-width: 160px;
text-align: right;
margin-bottom: 10px;
.wp_slrp_img {
display: block;
max-width: 150px;
max-height: 150px;
tojibon /
Last active Sep 17, 2018
Table of Paper Sizes From 4A0 to A10
Size Width x Height (mm) Width x Height (in)
4A0 1682 x 2378 mm 66.2 x 93.6 in
2A0 1189 x 1682 mm 46.8 x 66.2 in
A0 841 x 1189 mm 33.1 x 46.8 in
A1 594 x 841 mm 23.4 x 33.1 in
A2 420 x 594 mm 16.5 x 23.4 in
A3 297 x 420 mm 11.7 x 16.5 in
A4 210 x 297 mm 8.3 x 11.7 in
A5 148 x 210 mm 5.8 x 8.3 in
tojibon / Model.php
Last active Jul 29, 2018
Write custom query in Model with CakePHP 3.x
View Model.php
namespace App\Model\Table;
use App\Model\Entity\Dispensary;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
use Cake\Datasource\ConnectionManager;
tojibon /
Last active Apr 17, 2018
Downloading HTTP directory with all files and sub-directories
wget -r -N -np -nH --cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/


  1. It will download all files and subfolders in ddd directory:
  2. recursively (-r),
  3. not going to upper directories, like ccc/… (-np),
  4. not saving files to hostname folder (-nH),
  5. but to ddd by omitting first 3 folders aaa, bbb, ccc (--cut-dirs=3)
tojibon /
Created Sep 27, 2017
WordPress ubuntu plugin Installation failed: Could not create directory.

Open terminal and move to your WordPress root and execute below commands:

sudo chown -R www-data:www-data ./
sudo find ./ -type d -exec chmod 755  {} \;
sudo find ./ -type f -exec chmod 644  {} \;