Skip to content

Instantly share code, notes, and snippets.

@iamdylanngo
iamdylanngo / exit-bash-code
Created March 8, 2021 10:56
exit-bash-code
# For example:
## my-bash.sh
```bash
echo "Hello world"
exit 0
```
## Run command
bash my-bash.sh && echo "Good bye"
@iamdylanngo
iamdylanngo / Install-PHPBrew-Ubuntu
Last active January 26, 2021 03:18
Install-PHPBrew-Ubuntu
1. Install platform-specific dependencies:
sudo apt-get install \
libcurl4-openssl-dev \
libonig-dev \
libjpeg-dev \
libjpeg8-dev \
libjpeg-turbo8-dev \
libpng-dev \
libicu-dev \
@iamdylanngo
iamdylanngo / magento2-nginx-php-fpm-config
Created January 4, 2021 04:09
magento2-nginx-php-fpm-config
server {
listen 80;
server_name m241cc.local;
set $MAGE_ROOT /var/www/m241cc;
set $MAGE_DEBUG_SHOW_ARGS 0;
#
## Optional override of deployment mode. We recommend you use the
## command 'bin/magento deploy:mode:set' to switch modes instead.
##
@iamdylanngo
iamdylanngo / CleanTableCronJob
Last active December 8, 2020 07:54
CleanTableCronJob
<?php
namespace Demo\Demo\Cron;
// Need move to CleanTableCronJobTest class
use Magento\Catalog\Model\ProductRepository;
use Magento\Store\Model\StoreManagerInterface;
class CleanTableCronJob
{
@iamdylanngo
iamdylanngo / magento-select-product-mysql
Last active August 20, 2020 10:41
magento-select-product-mysql
-- Product entity type ID
SET @etype = (SELECT
entity_type_id
FROM
eav_entity_type
WHERE
entity_type_code = 'catalog_product');
-- Product name attribute ID
SET @name = (SELECT
attribute_id
@iamdylanngo
iamdylanngo / change-history-commit
Last active August 8, 2020 08:48
change-history-commit
git log
git reset --soft HEAD~N
Change code, add everything and commit code
git add <file>
git commit -m "new commit"
git push orign <branch> -f
N: number commit you want to reset
@iamdylanngo
iamdylanngo / switch-php-version.txt
Created June 23, 2020 23:29
switch php version
scl enable rh-php72 bash
scl enable php72 bash
@iamdylanngo
iamdylanngo / magento-data-patch
Last active June 5, 2020 03:16
magento-data-patch
1, Create code for data patch
Setup/Patch/Data
2, Install data patch
bin/magento set:up
Check patch is installed in table: patch_list
3, Update dat patch
Go to table: patch_list delete Patch
Change code
@iamdylanngo
iamdylanngo / centos-7-install-apcu.txt
Created June 1, 2020 15:02
centos 7 install apcu
yum install php73-pecl-apcu.x86_64
@iamdylanngo
iamdylanngo / http_true_client_ip
Created May 28, 2020 01:12
http_true_client_ip
vim /etc/ngin/fastcgi_params
fastcgi_param REMOTE_ADDR $http_true_client_ip;