Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Hans Phung hanhpv

🎯
Focusing
View GitHub Profile
@hanhpv
hanhpv / .gitignore
Created Apr 20, 2019
Magento 2 .gitignore
View .gitignore
*
!/.gitignore
!/robots_staging.txt
!/app
!/app/*/
!/app/code/**
!/app/design/**
!/app/etc/config.php
!/app/i18n/**
!/auth.json
@hanhpv
hanhpv / git-ignore-globally.md
Last active May 24, 2017
git ignore globally
View git-ignore-globally.md

Set up your global core.excludesfile configuration file to point to this global ignore file.

git config --global core.excludesfile '~/.gitignore_global'

@hanhpv
hanhpv / remove-default-macos-apache2.md
Created Apr 11, 2017
Remove default Mac OS apache2
View remove-default-macos-apache2.md

To stop the built-in Apache server in Mac OS X, use this command:

sudo apachectl -k stop

Then just enter your administrator password. And to prevent Apache from coming up again on if your system reboots/restarts just run this launchctl unload command; you’ll need your administrator password again:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

When that’s all done, check the output of sudo lsof -i:80 and the built-in Apache web server in Mac OS X should be completely stopped and disabled.

@hanhpv
hanhpv / login-using-ssh-key.md
Created Mar 27, 2017
How to login to sever using SSH key
View login-using-ssh-key.md
  1. SSH Key

If you don’t (yet) have a SSH-key on your local workstation you need to create one. A SSH-key provides a safe way to connect with another computer. It exists of two parts: a private and a public key. The private key is stored on your local workstation, and the public key is put on the machine you wish to connect with. To create a SSH-key on your local workstation you must enter the following command:

$ ssh-keygen -t rsa -C 'name@domain.com'
$ ssh-keygen -t rsa -C 'name@domain.com'
```
Of course you fill in your own e-mail address here. A couple of questions are asked like where to store the key and which password you want to use.
With the next command you can read your public key (and copy/paste it to your clipboard):
@hanhpv
hanhpv / nginx-homebrew-magento2.md
Created Jan 23, 2017
Magento 2 Nginx configuration on Mac (installed using Homebrew)
View nginx-homebrew-magento2.md

In /usr/local/etc/nginx/sites-enabled/magento2.conf:

server {
	listen 80;

	server_name magento2.local;
	set $MAGE_ROOT /Users/admin/htdocs/magento2;
	include /usr/local/etc/nginx/snippets/magento2.conf;
}
@hanhpv
hanhpv / gist:85f6d64f2b934687802e21bf721af965
Created Dec 27, 2016
Fix Mysql error The user specified as a definer ... does not exist
View gist:85f6d64f2b934687802e21bf721af965
sed -i -e 's/DEFINER=`root`@`10.%`/DEFINER=CURRENT_USER/g' filename.sql
View varnish.params
# Varnish environment configuration description. This was derived from
# the old style sysconfig/defaults settings
# Set this to 1 to make systemd reload try to switch vcl without restart.
RELOAD_VCL=1
# Main configuration file. You probably want to change it.
VARNISH_VCL_CONF=/etc/varnish/default.vcl
# Default address and port to bind to. Blank address means all IPv4
@hanhpv
hanhpv / xdebug.ini
Last active Sep 16, 2016
XDebug configuration
View xdebug.ini
[xdebug]
zend_extension="/usr/local/opt/php70-xdebug/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=10000
xdebug.remote_handler=dbgp
@hanhpv
hanhpv / magento-1-nginx.md
Created Sep 15, 2016
Magento 1 nginx configuration
View magento-1-nginx.md
server { 
	listen 80; 
	root /Users/admin/htdocs/vax-uk;
	index index.php index.html index.htm;
	 
	server_name vax.local; 
	access_log /usr/local/etc/nginx/logs/vax_access.log;
	access_log /usr/local/etc/nginx/logs/vax_error.log;
	 
@hanhpv
hanhpv / osx-nginx-phpfpm-mysql-aliases
Last active Sep 15, 2016
OSX nginx, php-fpm, mysql command aliases
View osx-nginx-phpfpm-mysql-aliases
### SERVER SERVICES ALIAS
# Nginx
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
# PHP-FPM
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'