Skip to content

Instantly share code, notes, and snippets.

View trungpv1601's full-sized avatar
🤖
Diversifying; Practical; more code than talk.

trungpv trungpv1601

🤖
Diversifying; Practical; more code than talk.
View GitHub Profile
@trungpv1601
trungpv1601 / elasticsearch-es-delete-all-data.md
Created August 25, 2017 13:01 — forked from diegopacheco/elasticsearch-es-delete-all-data.md
How to Delete All Data in Elasticsearch?
curl -XDELETE localhost:9200/*
@trungpv1601
trungpv1601 / README.MD
Last active August 9, 2017 03:46
Problem Call Store Procedure PDO with MS SQL

If you are using a stored procedure then use

SET NOCOUNT ON 

The problem is that the stored procedure returns a result containing the number of rows affected as the first result.

$NULL = NULL;
@trungpv1601
trungpv1601 / Laravel PHP7 LEMP AWS.md
Created July 28, 2017 05:35 — 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
@trungpv1601
trungpv1601 / index.php
Created July 21, 2017 07:33
PHP SQL Server: Call Stored Proceduree PDO MSSQL PARAM OUT
<?php
try
{
$conn = new PDO ("sqlsrv:server=(local);Database=DatabaseName", "user", "password");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
// Param
$idReturn = 0; // Param Out
$name = 'Name'; // Pram In
@trungpv1601
trungpv1601 / config
Created July 14, 2017 06:24
Laravel in a Sub Directory with NGINX
location ^~ /xxx {
alias /var/www/xxx/public;
try_files $uri $uri/ @xxx;
location ~* \.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/xxx/public/index.php;
}
@trungpv1601
trungpv1601 / create_user_database_mysql
Created July 13, 2017 06:40
Create user and database mysql
CREATE DATABASE xxxDatabase;
CREATE USER 'xxxUser'@'localhost' IDENTIFIED BY 'xxxPassword';
GRANT ALL PRIVILEGES ON xxxDatabase.* TO 'xxxUser'@'localhost';
FLUSH PRIVILEGES;
@trungpv1601
trungpv1601 / .htaccess
Last active October 13, 2018 04:00
Alias apache2 config
RewriteBase /laravel-site
@trungpv1601
trungpv1601 / laravel-worker.conf
Created July 13, 2017 06:36
Supervisor laravel queue
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/xxx/artisan queue:work redis --timeout=0 --tries=8
autostart=true
autorestart=true
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/xxx/worker.log
@trungpv1601
trungpv1601 / tar_untar_linux
Created July 13, 2017 06:35
tar and untar linux .tar.gz
sudo tar -zcvf xxx.tar.gz /var/xxx/
sudo tar -xzvf xxx.tar.gz