Skip to content

Instantly share code, notes, and snippets.

View mrtonyhuynh's full-sized avatar
😇
Nice & Professional

Tony Huỳnh mrtonyhuynh

😇
Nice & Professional
View GitHub Profile
@mrtonyhuynh
mrtonyhuynh / Instructions.sh
Created February 26, 2019 14:36
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
sudo apt-get update
@mrtonyhuynh
mrtonyhuynh / Laravel PHP7 LEMP AWS.md
Created February 26, 2019 14:36 — forked from santoshachari/Laravel PHP7 LEMP AWS.md
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@mrtonyhuynh
mrtonyhuynh / Instructions.sh
Created February 26, 2019 14:36 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@mrtonyhuynh
mrtonyhuynh / nginx-tuning.md
Created February 14, 2019 09:43 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@mrtonyhuynh
mrtonyhuynh / string-utils.js
Created January 30, 2019 08:47 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();

Call stack là gì

Call stack là một cấu trúc dữ liệu với đặc điểm là: FILO(First in - Last out). Trong Javascript, call stack được sử dụng để quản lý thứ tự các câu lệnh thực thi.

Trường hợp 1

/* Trong file main.js */

var firstFunction = function () { 

Callback là gì

Hiểu đơn giản thì callback là một function (A) được truyền vào 1 function khác (B) thông qua các tham số của B. Lúc này function B sẽ gọi đến function A để thực hiện 1 chức năng gì đó hoặc là khi function B hoàn thành chức năng của mình.

Ví dụ đơn giản:

function dihoc(callback){
// Làm các công việc cần thiết khi đi học. Và cuối cùng kết quả nhận được là thu lại kiến thức.
callback('Kiến thức');
}
@mrtonyhuynh
mrtonyhuynh / lemp16.4.sh
Created January 7, 2019 14:05 — forked from Saleh7/lemp16.4.sh
Auto Install and Setup LEMP for Ubuntu 16.04 (PHP7, Nginx, MySql, PhpMyAdmin)
#!/bin/sh
# Auto Install and Setup LEMP #
#Example:sudo bash lemp16.4.sh -p MyPassword
# By Saleh7 - https://github.com/Saleh7
E=`tput setaf 1`
G=`tput setaf 2`
A=`tput setaf 3`
C=`tput setaf 6`
B=`tput bold`
@mrtonyhuynh
mrtonyhuynh / osx_install.sh
Created December 13, 2018 17:11 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@mrtonyhuynh
mrtonyhuynh / .htaccess
Created December 3, 2018 08:25 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/