Skip to content

Instantly share code, notes, and snippets.

View phamngsinh's full-sized avatar

Pham Ng Sinh phamngsinh

View GitHub Profile
@phamngsinh
phamngsinh / Monitoring.txt
Created July 28, 2016 11:14
Monitoring Linux
htop
The htop is an interactive process viewer for Linux on command-line mode.
$ sudo apt-get install htop
Read more: http://hisham.hm/htop/
iotop
@phamngsinh
phamngsinh / size_of_directory.txt
Created August 18, 2016 08:18
Get the size of a directory in linux
du -h --max-depth=1 | sort -hr
http://unix.stackexchange.com/questions/185764/how-do-i-get-the-size-of-a-directory-on-the-command-line
@phamngsinh
phamngsinh / xhprof
Created August 21, 2016 10:38
MAMP with XHProf
MAMP doesn't come with XHProf support by default and sometimes we need more than just a simple debug tool with Xdebug.
Just for the record, I'm posting this in the current version of MAMP, that is 2.1.1 and in the Mountain Lion OSX 10.8.1 version. I'm not sure if it works the same way on other versions, but you can leave a comment about it :)
So, how can we enable it and make it work?
Requirements
First of all you'll need Xcode and Command Line Tools. Download and install them.
@phamngsinh
phamngsinh / php5.6
Created August 23, 2016 03:51
Install php 5.6 on Ubuntu 16.04
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php5.6 libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-xmlrpc
sudo a2dismod php7.0
sudo a2enmod php5.6
sudo systemctl restart apache2
@phamngsinh
phamngsinh / phpold.txt
Created September 6, 2016 08:06
Multi Php Version in Ubuntu 16
Install PHP 5.4
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php5-oldstable
$ sudo apt-get update
$ sudo apt-get install -y php5
Install PHP 5.5
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
@phamngsinh
phamngsinh / aws-certification.md
Created September 7, 2016 16:37 — forked from miglen/aws-certification.md
AWS Certification guide and notes on how to prepare for the aws associate certification architect, sysops and developer exams

AWS Certification notes

Those are my personal notes on AWS Solution Architect certification preparation. Hope you find them usefull.

To pass AWS certification, you should have:

  • Sound knowledge about most of the AWS services ( EC2, VPC, RDS, Cloudfront, S3, Route53 etc,)
  • Hands on experience with AWS services.
  • Good knowledge of disaster recovery, security and High availability architectures.

If you do not have prior hands-on experience and knowledge or you have little knowledge about AWS services, it is better to take an online course. If you already have experience in architecting solutions on AWS it is not necessary to take an online course.

@phamngsinh
phamngsinh / host.txt
Created September 10, 2016 04:40
Multiple Sites on a Single Amazon EC2 Instance
<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot "/var/www/html/website1_folder"
ServerName yourdomain.com
ErrorLog "logs/yourdomain.com-error_log"
CustomLog "logs/yourdomain.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
@phamngsinh
phamngsinh / symfony-ubuntu.txt
Last active January 16, 2018 11:06
install symfony on ubuntu linux step by step
1.Update souces list.
apt-get update and apt-get upgrade for new packages.
2.Installing Pear on you machine.
sudo apt-get install php-pear
3.Installation starts for Symfony
@phamngsinh
phamngsinh / grep.text
Created September 27, 2016 10:37
find all files containing specific text on Linux
grep -rnw '/path/to/somewhere/' -e "pattern"
-r or -R is recursive,
-n is line number, and
-w stands match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
Along with these, --exclude or --include parameter could be used for efficient searching. Something like below:
grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
This will only search through the files which have .c or .h extensions. Similarly a sample use of --exclude:
grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
@phamngsinh
phamngsinh / enabling.txt
Created October 2, 2016 06:32
apache2 - enabling and disabling sites
# enable site
sudo a2ensite
# disable site
sudo a2dissite
# enable an apache2 module
sudo a2enmod
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user