Skip to content

Instantly share code, notes, and snippets.

View EngKhaledB's full-sized avatar
🏠
Working from home

Khaled Abu Alqomboz EngKhaledB

🏠
Working from home
View GitHub Profile
@EngKhaledB
EngKhaledB / .htaccess
Created May 20, 2018 17:25
CodeIgniter Sub-folder htaccess
RewriteEngine On
RewriteBase /chalets/
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php?/$1 [L]
@EngKhaledB
EngKhaledB / acf.php
Created August 19, 2018 17:35
Convert ACF Fields Registered by PHP to Importable JSON Format
<?php
/*
The source for this code is: https://dev-notes.eu/2017/01/convert-acf-fields-registered-by-php-to-importable-json-format/
*/
$groups = acf_get_local_field_groups();
$json = [];
foreach ($groups as $group) {
// Fetch the fields for the given group key
@EngKhaledB
EngKhaledB / .lando.yml
Last active May 21, 2023 20:52
Setup MailHog with Lando, Pantheon & WordPress
name: appname
recipe: pantheon
config:
framework: wordpress
site: appname
id: [side-id]
proxy:
mailhog:
- mail.appname.lndo.site
services:
@EngKhaledB
EngKhaledB / Restore Deleted MobyLinux Virtual Machine.md
Last active July 28, 2022 01:35
To restore the deleted Hyper-V MobyLinuxVM machine of Docker on windows.

1- Exit the docker application

2- Open Power Shell as administrator

3- Run this command Stop-Service com.docker.service

4- Run this command cd 'C:\Program Files\Docker\Docker\resources'

5- Run This command -ExecutionPolicy ByPass -File .\MobyLinux.ps1 -Destroy

@EngKhaledB
EngKhaledB / Setup WordPress on LEMP on Ubuntu 18.04 .md
Last active February 12, 2023 21:27
This will Setup WordPress with LEMP Stack, on Ubuntu Server 18.04 with support of SSL

This will Setup WordPress with LEMP Stack, on Ubuntu Server 18.04 with support of SSL

Update Ubuntu Packages Index

sudo apt update

Install NGINX

sudo apt install nginx

@EngKhaledB
EngKhaledB / Fix dpkg lock issue.md
Last active October 9, 2018 13:04
Fix of the errors: E: Could not get lock /var/lib/dpkg/lock , E: Unable to lock the administration directory.

The Error Message

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

The Fix

Check if there is processes uses apt?

ps -A | grep apt

Suppose that this is the result?

1314 pts/1 00:00:00 apt

How to install wp-cli ( WordPress command line) on Ubunut:

Download the wp-cli.phar file using

sudo curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Make wp-cli.phar excutable

sudo chmod +x wp-cli.phar

Move wp-cli to bin path

sudo mv wp-cli.phar /usr/local/bin/wp

@EngKhaledB
EngKhaledB / Reset MySQL root Password.md
Last active February 20, 2019 11:36
Reset MySQL root Password

How to Reset MySQL Root Password?

Stop the mysql demon process using this command :

sudo /etc/init.d/mysql stop

Start the mysqld demon process using the --skip-grant-tables option with this command

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

Start the mysql client process using this command & Update the password:

mysql -u root

FLUSH PRIVILEGES;

@EngKhaledB
EngKhaledB / Ubuntu Helpful Commands.md
Last active November 16, 2018 10:40
List of helpful commands snippets I searched for, and helped me.

List of helpful commands snippets I searched for, and helped me.

Run command in background with no-output ( Hide the optput ).

nohup command > /dev/null 2>&1 &

Run command on startup

  1. create /etc/systemd/system/foo.service
    [Unit]
 Description=Job that runs your user script
@EngKhaledB
EngKhaledB / php-curl-post-with-headers-exmple.php
Last active November 29, 2019 06:20
PHP CURL POST with HEADERS Exmaple
<?php
$handle = curl_init();
$postData = array(
'firstName' => 'Khaled',
'lastName' => 'Abu Alqombpz',
'email' => '[email protected]'
);
$headers = [
'api-key' => '{api-key}',
'another-header' => '{another-header-value}'