Install Python 3.7 on CentOS 7

Posted on 1 year ago by Ping Cheng

CentOS series natively comes with Python 2 installed, since there are some system level parts are depending on python 2, it is not safe and easily to replace python 2 with python 3.

Therefore, this article would express install python with altinstall.

Step 1 Install dependency

yum install gcc openssl-devel bzip2-devel libffi-devel wget

Step 2 Download Python 3 source code

cd ~
tar xzf Python-3.7.2.tgz

Step 3 Install

cd Python-3.7.2.tgz
./configure --enable-optimizations
make altinstall

Note, if you encountered some error message such as no permission, please use sudo.


python3.7 -V
Python 3.7.2

python -V
Python 2.7.5

Create new swap file on CentOS 7 / RHEL 7

Posted on 1 year ago by Ping Cheng

Shared from

In this tutorial we will learn how to create new swap file on CentOS 7 / RHEL 7. Generally on Cloud Servers ( AWS/ DigitalOcean) or VPS, swap space is not created by default. This requirement we can achieve within a few steps.


Must have free space on mounted disk. You can check by using df -Th command.

Steps to create / add new swap file on Linux

1. Create swapfile-additional file with dd command in / (root). You can select any other partition but it should be mounted (For eg. /opt, /usr ,/NewMountedPartition)

dd if=/dev/zero of=/swapfile-additional bs=1M count=4048

dd = It is a unix command used for convert and copy a file
if = read from FILE instead of stdin
/dev/zero = /dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it
of = write to FILE instead of


[ Read More ]

Validate slack slash commands via signing secret

Posted on 2 years ago by Ping Cheng

Here is a gist for validating the slack slash command via the slack signing secret.

The sample is for Laravel middleware. Since the validation process is written below, you can modify to suit your project.

GitHub gist:


namespace App\Http\Middleware;
use Exception;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\Log;

class SlackRequest
     * Validate a slack request
     * by the slack signing secret (not the token)
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     * @throws Exception
    public function handle($request, Closure $next)
        // define the version number
        $version = 'v0';

        // load the secret, you also can load it from env(YOUR_OWN_SLACK_SECRET)
        $secret = config('services.slack.signing_secret');



[ Read More ]

Hand crafted with by Ping Cheng