Manipulate tmux with shell script

I used to open a few windows in terminal with tmux session,
and I did the same thing everyday when I start to to work.

Recently, I find a way to start up the tmux with standard working windows.

Read More

AWS Cognito User Pool custom domain error

One or more aliases specified for the distribution includes an incorrectly configured DNS record that points to another CloudFront distribution.

Read More

Vim DB client: vim-dadbod-ui connection via SSH tunnel

I’m using vim-dadbod-ui as my MySQL client.

I was trying to connect to RDS via SSH tunnel, finally figure out how to do that.

Read More

PHP7 Callable Examples

A callable as class property

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class Processor
{
private $postHook;

public function __construct(callable $postHook)
{
$this->postHook = $postHook;
}

public function process()
{
// some statements here
($this->postHook)($param1, $param2, $param3);
}
}

class Client
{
public function main()
{
$processor = new Processor($this->postProcess());
$processor->process();
}

private function postProcess()
{
return function ($arg1, $arg2, $arg3) {
// some statements
};
}
}

Read More

Setup postgres in Ubuntu server

To install PostgreSQL in Ubuntu (tested in 20.04)

1
2
3
4
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt update
apt -y install postgresql

Read More

Shell script - remove lines contain some words

A sample file demo.txt contains the following content

1
2
3
4
5
6
7
8
9
10
1 Linux Operating System
2 Unix Operating System
3 RHEL
4 Red Hat
5 Fedora
6 Arch Linux
7 CentOS
8 Debian
9 Ubuntu
10 openSUSE

Read More

Enable AWS SES in Laravel web app

I believe most of AWS users will use Amazon Simple Email Service (SES)
for system email sending.

Before you can use in production, by default it’s in sandbox mode, which

Read More

AWS EC2 instance used up CPU 100% - Malware kdevtmpfsi

I was wondering what’s wrong with my server (host Laravel web app),
it’s fine after reboot the instance, but after a while it become very

Read More

Real world practice on Docker in Laravel web app

I heard about Docker few years ago, but wasn’t know about best practice how to use that.
I’ve tried Laradock, it’s way too many stuff in the config, should I use 1 docker for multiple

Read More

Laravel Unit Test Mail Send

Case 1: Mail send without Mailable class

Sometime we don’t use mailable class, instead we want to send directly with send method.

Read More