Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View peerasan's full-sized avatar

Patrickz peerasan

View GitHub Profile
@peerasan
peerasan / ffmpeg-build.sh
Last active February 2, 2024 23:43
Build FFmpeg
# 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 / set-env.sh
Created November 8, 2023 09:35
add ssh key with passphrase without ask
#!/bin/bash
eval `ssh-agent -s`
{ sleep .1; echo PASSPHRASE } | script -q /dev/null -c 'ssh-add'
@peerasan
peerasan / log4j.properties
Created June 11, 2019 10:59
wowza with goaccess
Prepare wowza logs (log4j.properties)
log4j.rootCategory=INFO, stdout, serverAccess, serverError, serverStats
...
...
...
# Statistics appender (to use this appender add "serverStats" to the list of appenders in the first line of this file)
log4j.appender.serverStats=org.apache.log4j.DailyRollingFileAppender
log4j.appender.serverStats.encoding=UTF-8
log4j.appender.serverStats.DatePattern='.'yyyy-MM-dd
@peerasan
peerasan / CPUs-monitor.sh
Created June 7, 2021 07:18
Monitor CPU per Core
#!/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"
@peerasan
peerasan / show-ms.html
Created January 22, 2021 06:05
OBS - display milliseconds time
<!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 / ffmpeg_v3.3_flv_hevc.patch
Created November 27, 2020 15:54
FFmpeg 3.3 HEVC over RTMP
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 / simple-php-load-test.php
Last active December 12, 2020 22:01
php performance quick test
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
for ($i=0 ; $i<1000000 ; $i++) {
serialize($list);
}
@peerasan
peerasan / web-backup.sh
Last active December 12, 2020 22:00
simple folder backup
#!/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 / Redis benchmark - 2vCPU 4GB (CPU-Optimized)
Last active December 12, 2020 21:59
redis performance on DigitalOcean
# 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 / default.conf
Created November 19, 2019 08:07
nginx-rtmp
# /etc/nginx/sites-available
# Patrickz
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;