Skip to content

Instantly share code, notes, and snippets.

@phanlyhuynh
phanlyhuynh / gist:e07c4933421380779e8ac8def2268c7c
Last active October 16, 2020 20:50
Error System limit for number of file watchers reached
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@phanlyhuynh
phanlyhuynh / .babelrc
Last active October 13, 2020 08:03
Eslint file's configuration
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties",
["lodash", { "id": ["lodash", "recompose"] }],
@phanlyhuynh
phanlyhuynh / gist:a5873859f4483f4bc6e1023139549eff
Created October 14, 2020 03:56
Downgrade php7.4 to php7.3
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3
sudo apt-get install php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-mysql php7.3-mbstring php7.3-zip php7.3-fpm php7.3-intl php7.3-simplexml
sudo a2dismod php7.4
supervisord -c path_supervisord_config_file // run supervisord
supervisorctl -c path_supervisord_config_file status all // check status of supervisord
supervisorctl -c path_supervisord_config_file restart all // restart supervisord
Install:
pavucontrol
hdajackretask
public function setUp() : void
{
$this->afterApplicationCreated(function () {
$this->db = m::mock(
Connection::class . '[select,update,insert,delete]',
[m::mock(PDO::class)]
);
$manager = $this->app['db'];
$manager->setDefaultConnection('mock');
$r = new \ReflectionClass($manager);
@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;
@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 / haproxy
Created March 22, 2023 03:06
Show Real IP Ingress nginx
defaults
...
option forwardfor
@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