Skip to content

Instantly share code, notes, and snippets.

View v0112358's full-sized avatar

Nguyen Tan Vy v0112358

  • Freelancer
  • Vietnam
View GitHub Profile
@v0112358
v0112358 / Install boost 1.68 on CentOS 7.x.txt
Created August 31, 2018 12:48
Install boost 1.68 on CentOS 7.x
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
tar xzvf boost_1_68_0.tar.gz
cd boost_1_68_0
./bootstrap.sh --prefix=/usr/local/
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/include/python3.6m"
./b2 -j$(nproc) -d0 install --with=all
@v0112358
v0112358 / Install Gcc 5.4 on CentOS 7.x.txt
Created August 31, 2018 12:04
Install Gcc 5.4 on CentOS 7.x
wget https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.bz2
tar xjvf gcc-5.4.0.tar.bz2
yum install -y gmp-devel mpfr-devel libmpc-devel
mkdir gcc-5.5.0-build
cd gcc-5.5.0-build
../gcc-5.5.0/configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc) && make install
@v0112358
v0112358 / Install Cmake 3.11 CentOS 7.x.txt
Last active August 31, 2022 14:35
Install Cmake 3.11 CentOS 7.x
wget https://cmake.org/files/v3.11/cmake-3.11.0.tar.gz
tar zxvf cmake-3.11.0.tar.gz && cd cmake-3.11.0
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
./bootstrap
make -j$(nproc)
make install
cmake --version
##### Hardware info
- CPU: 08 core 2.3GHz
- RAM: 32GB
- HDD: 500GB HDD
##### Raw data from https://github.com/Percona-Lab/ontime-airline-performance/blob/master/download.sh
##### Data on disk
- CSV raw data: 21GB
- Innodb (no compression/original): 7.2GB.
@v0112358
v0112358 / wait-for-it.sh
Created August 30, 2018 07:02
wait-for-it.sh
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
cmdname=$(basename $0)
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
@v0112358
v0112358 / redis-ddr3-ddr4.txt
Created August 23, 2018 06:23
Redis performance on DDR3 and DDR4 memory
###### Result on physical server DDR3-1066 ######################
[root@cp redis-4.0.11]# redis-benchmark -h 172.18.0.1 -d 1024 -n 10000 -r 10000 -c 100 -q
PING_INLINE: 35842.29 requests per second
PING_BULK: 39370.08 requests per second
SET: 39215.69 requests per second
GET: 38022.81 requests per second
INCR: 39840.64 requests per second
LPUSH: 40160.64 requests per second
RPUSH: 39840.64 requests per second
LPOP: 38910.51 requests per second
@v0112358
v0112358 / how-php-store-data-in-redis.txt
Last active August 22, 2018 09:30
How PHP store data in Redis
////// Example: connect to Redis and store an array
<?php
$redis = new Redis;
$connect = $redis->connect( "172.18.0.1", "6379" );
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$array = array(
'message' => "My message",
'to_send' => 2,
'from_send' => 1,
'create_time' => date('Y-m-d H:i:s')
@v0112358
v0112358 / wordpress-behind-nginx.txt
Last active August 17, 2018 04:56
Configure Wordpress use SSL behind reverse proxy (Nginx)
- Topology: Client ==> Reverse proxy (Nginx is listened at port 443) ======> Backend (Apache is listened at port 80).
- Nginx configure
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- Wordpress configure:
cat wp-config.php
@v0112358
v0112358 / aws-latency.txt
Created August 17, 2018 01:54
Check AWS latency
EC2 Reachability Test => http://ec2-reachability.amazonaws.com/
AWS Inter-Region Latency => https://www.cloudping.co/
@v0112358
v0112358 / new-svn-repository.txt
Created August 15, 2018 09:04
Create a new SVN repository on SVN server
Create a new SVN repository on SVN server:
- Step 1: svnadmin create /mnserver/svn-repo/vn-project01
- Step 2: Configure httpd.conf
<Location /vn-project01>
DAV svn
SVNParentPath /mnserver/svn-repo/vn-project01
AuthzSVNAccessFile /mnserver/svn-conf/vn-project01-authz-access
Satisfy Any
AuthType Basic