Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrickz peerasan

View GitHub Profile
@peerasan
peerasan / CPUs-monitor.sh
Created Jun 7, 2021
Monitor CPU per Core
View CPUs-monitor.sh
#!/bin/bash
function getCPU(){
LCPU=`grep "^processor" /proc/cpuinfo | sort -u | wc -l`
echo -n $LCPU-1
}
function getCpuUtilizationByCore(){
# Format: cpu<Number>
local CoreName="$1"
View ffmpeg-build.sh
# Watch video: https://youtu.be/qLw6ZWUXy7U
#Require for Compiler
apt-get install -y autoconf automake build-essential cmake git-core libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev meson ninja-build pkg-config texinfo wget yasm zlib1g-dev
#Require for FFmpeg
apt-get install nasm libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev libunistring-dev
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
@peerasan
peerasan / show-ms.html
Created Jan 22, 2021
OBS - display milliseconds time
View show-ms.html
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--
modidfy from https://codepen.io/jasonleewilson/pen/gPrxwX
-->
<head>
<title>OBS - show time milliseconds</title>
@peerasan
peerasan / Redis benchmark - 2vCPU 4GB (CPU-Optimized)
Last active Dec 12, 2020
redis performance on DigitalOcean
View Redis benchmark - 2vCPU 4GB (CPU-Optimized)
# CPU-Optimized
# 2 vCPUs
# 4GB / 25GB Disk
# ($40/mo)
#
====== PING_INLINE ======
100000 requests completed in 1.54 seconds
50 parallel clients
3 bytes payload
keep alive: 1
@peerasan
peerasan / web-backup.sh
Last active Dec 12, 2020
simple folder backup
View web-backup.sh
#!/bin/bash
DATE=$(date +%Y-%m-%d)
BACKUP_DIR="/mnt/backup-web/"
# To create a new directory into backup directory location.
#mkdir -p $BACKUP_DIR/$DATE
# take each website backup in separate name, use below format.
tar -zcvpf $BACKUP_DIR/my-website-$DATE.tar.gz /my-website
@peerasan
peerasan / simple-php-load-test.php
Last active Dec 12, 2020
php performance quick test
View simple-php-load-test.php
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
for ($i=0 ; $i<1000000 ; $i++) {
serialize($list);
}
@peerasan
peerasan / ffmpeg_v3.3_flv_hevc.patch
Created Nov 27, 2020
FFmpeg 3.3 HEVC over RTMP
View ffmpeg_v3.3_flv_hevc.patch
From 88287f270df660645b3f6c813ab3fd7ad522e64c Mon Sep 17 00:00:00 2001
From: KSC-VBU-SR <KSC-VBU-SRE@kingsoft.com>
Date: Wed, 14 Jun 2017 21:33:54 +0800
Subject: [PATCH] The RTMP protocol extensions for H.265/HEVC
---
libavformat/flv.h | 1 +
libavformat/flvdec.c | 16 +++++++++++++---
libavformat/flvenc.c | 29 ++++++++++++++++++++---------
3 files changed, 34 insertions(+), 12 deletions(-)
@peerasan
peerasan / sysctl.conf
Created Aug 4, 2020
sysctl.conf for haproxy
View sysctl.conf
## tuning by patrickz ##
## inspire from https://klaver.it/linux/sysctl.conf
## inspire from https://gist.github.com/voluntas/bc54c60aaa7ad6856e6f6a928b79ab6c
fs.file-max = 209708
fs.suid_dumpable = 0
kernel.core_uses_pid = 1
kernel.exec-shield = 1
kernel.kptr_restrict = 1
kernel.maps_protect = 1
@peerasan
peerasan / sysctl.conf
Last active Jun 17, 2020
high performance tuning
View sysctl.conf
## tuning by patrickz ##
## inspire from https://klaver.it/linux/sysctl.conf
## inspire from https://gist.github.com/voluntas/bc54c60aaa7ad6856e6f6a928b79ab6c
fs.file-max = 209708
fs.suid_dumpable = 0
kernel.core_uses_pid = 1
kernel.exec-shield = 1
kernel.kptr_restrict = 1
kernel.maps_protect = 1
@peerasan
peerasan / nginx.conf
Created May 28, 2020
Nginx-php-multi-pool
View nginx.conf
upstream php-pools {
server 203.128.86.100:9000;
server 203.199.86.101:9000;
server 203.199.86.102:9000;
server 203.199.86.103:9000;
}
server {
listen 8080;
server_name patrickz.iiwnz.com;