Skip to content

Instantly share code, notes, and snippets.

@phanlyhuynh
phanlyhuynh / gist:c78d1d4d7c0384e42ff3558b204a84fe
Last active December 1, 2023 01:48
How To Clean Up Docker Overlay2?
Firstly, we have to check the disk usage by Docker using the following command:
docker system df
Docker does not by default remove the images even if they are not in use. To remove unused photos, we can use the below command:
docker image prune --all
In order to clean up unused containers and images, we can use the docker system prune.
@phanlyhuynh
phanlyhuynh / FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Created September 20, 2023 07:48
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
export NODE_OPTIONS=--max_old_space_size=4096
@phanlyhuynh
phanlyhuynh / Install s3cmd
Created August 30, 2023 03:32
Install s3cmd
sudo apt update
sudo apt install python3-pip
sudo pip install s3cmd
@phanlyhuynh
phanlyhuynh / Magento: PHP extensions
Last active August 30, 2023 03:09
Magento: PHP extensions
sudo apt-get install php7.4-bcmath php7.4-ctype php7.4-curl php7.4-dom php7.4-gd php7.4-hash php7.4-iconv php7.4-intl php7.4-mbstring php7.4-openssl php7.4-mysql php7.4-simplexml php7.4-soap php7.4-xsl php7.4-zip
@phanlyhuynh
phanlyhuynh / Chown current user
Last active August 30, 2023 03:09
Linux: Chown current user
sudo chown -R $(id -u):$(id -g)
@phanlyhuynh
phanlyhuynh / Check file size
Last active August 30, 2023 03:09
Check file size
sudo du -sh * | sort -hr
@phanlyhuynh
phanlyhuynh / Install mailhog on ubuntu
Last active August 30, 2023 03:28
Install mailhog on ubuntu
curl -OL https://golang.org/dl/go1.18.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go env -w GO111MODULE=off
go get github.com/mailhog/MailHog
@phanlyhuynh
phanlyhuynh / haproxy
Created March 22, 2023 03:06
Show Real IP Ingress nginx
defaults
...
option forwardfor
@phanlyhuynh
phanlyhuynh / gist:0c07c45d829083cae99058e319184801
Created February 7, 2022 09:38
Check installed grpc and protobuf (php)
php -r 'phpinfo();' | grep -i "\(grpc\|protobuf\)"
@phanlyhuynh
phanlyhuynh / gist:735f8f1872e7ae6c0b224b6e55712507
Created October 14, 2020 04:32
Unit test: pass authorize
$mock = Mockery::mock(Illuminate\Contracts\Auth\Access\Gate::class);
$mock->shouldReceive('authorize')->once()->andReturn(true);
$mock->shouldReceive('allows')->once()->andReturn(true);
$this->app[Gate::class] = $mock;