Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@fmtarif
fmtarif / xampp_php7_xdebug.md
Created September 16, 2017 14:51 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP
@fmtarif
fmtarif / readme.md
Last active November 10, 2017 09:12
#mysql MySQL query snippets

Insert with select

INSERT INTO table1 ( column1 )
SELECT  col1
FROM    table2  

Show key value row based (e.g., meta) table as columns with main table

Example: if you have users(id, email) and user_meta(user_id, key, value) tables where you have phone, age etc keys in user_meta but need to show these as columns with users table

@fmtarif
fmtarif / mysql-remote-access.md
Last active September 16, 2019 07:42
#mysql #bash mysql grant remote access from MySQL server and SSH tunnel

Option 1 - SSH Tunneling

For quick access or when enabling remote access is not possible, ssh tunneling/port forwarding can be used to access a database (that is not allowed to be accessed remotely) temporarily

First create a SSH session with port forwarding

ssh -L 3300:localhost:3306 user@server

Then connect using the local port on local machine

@fmtarif
fmtarif / wpinstall.sh
Last active January 18, 2023 18:40
#wp #bash #cli Install and initial set up for WordPress sites (uses WP-CLI)
#!/bin/bash
# get wp-cli
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && sudo mv wp-cli.phar /usr/local/bin/wp
# wp-cli auto-completion
# wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash && source wp-completion.bash && echo -e "\nsource wp-completion.bash" >> .bashrc
#verify if wp-cli correctly installed
# wp --info
@fmtarif
fmtarif / wp-cli-install-rec-plugins
Created August 3, 2017 01:03 — forked from MikeNGarrett/wp-cli-install-rec-plugins
Chained WordPress CLI commands to install and activate recommended plugins.
# wordpress-seo provides ability to edit meta information and provides sitemap.
# w3-total-cache provides advanced caching no matter the server technology available.
# better-wp-security provides brute force protection and a number of WordPress enhancements.
# google-analytics-for-wordpress provides robust Google Analytics integration through the Google API.
# redirection detects 404s and 301s and allows admins to set up redirects in the WP admin.
# ewww-image-optimizer provides automatic optimization of uploaded images with local libraries instead of cloud-based services.
# backupwordpress simple backup solution that can store backups above web root.
# relevanssi provides better site search using a local index.
# cloudflare is the best. Free automatic CDN and security solution.
# jarvis is a quick search for the WordPress admin. Indespensible.
@fmtarif
fmtarif / wp-setup.sh
Created August 1, 2017 14:26 — forked from mattbanks/wp-setup.sh
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
# Create directory for new site
cd ~/Sites
mkdir {query}
cd {query}
# Download latest version of WordPress
wp core download
# Setup wp-config file with WP_DEBUG enabled
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP
@fmtarif
fmtarif / wp_auto_install.sh
Created August 1, 2017 14:26 — forked from nicomollet/wp_auto_install.sh
WP-CLI auto install script
#!/bin/bash
# Default options
LOCALE="fr_FR"
DB_HOST='localhost'
VIRUSTOTAL_KEY='YOUR_KEY'
printf "Name of the project? cf My Project: "
read PROJECT_NAME
@fmtarif
fmtarif / README.md
Created July 31, 2017 15:02 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@fmtarif
fmtarif / wptest.sh
Created July 31, 2017 14:58 — forked from jasondewitt/wptest.sh
Install wptest.io via wp-cli
#!/bin/bash
echo "installing WP test content"
wp plugin install wordpress-importer --activate
curl -OL https://raw.githubusercontent.com/manovotny/wptest/master/wptest.xml
wp import wptest.xml --authors=create
wp plugin uninstall wordpress-importer --deactivate
rm wptest.xml
@fmtarif
fmtarif / bash-cheatsheet.sh
Created July 28, 2017 17:16 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04