Skip to content

Instantly share code, notes, and snippets.

View peerasan's full-sized avatar

Patrickz peerasan

View GitHub Profile
@peerasan
peerasan / nginx.conf
Created May 28, 2020 09:40
Nginx-php-multi-pool
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;
@peerasan
peerasan / Nginx-check-cache-rate
Last active May 25, 2020 02:59
nginx log HIT and MISS status
log_format rt_cache '$remote_addr - $upstream_cache_status [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
server {
access_log /var/log/nginx/domain.cache.log rt_cache;
}
# OUTPUT domain.cache.log
# xxx.xxx.xxx.xxx - HIT [25/May/2020:07:13:49 +0700] "GET /mediacache/........."
@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;
@peerasan
peerasan / IncompatibleAppsList.plist
Created October 13, 2019 14:21
235 Incompatible apps on MacOS Catalina
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IncompatiblePaths</key>
<array>
<dict>
<key>Application Name</key>
<string>Sxs Memory Card Driver</string>
<key>Blurb</key>
@peerasan
peerasan / ms-diff.pl
Last active July 23, 2020 03:42
millisecond diff
# Millisecond Difference
# keyword: Millisecond, ms, diff, time, timediff
# Online Perl: https://rextester.com/l/perl_online_compiler, https://www.onlinegdb.com/online_perl_compiler
my $t1 = "00:01:25.652";
my $t2 = "00:01:22.932";
print to_milli($t2) - to_milli($t1);
sub to_milli {
my @components = split /[:\.]/, shift;
@peerasan
peerasan / mailgun with curl
Created June 12, 2019 04:42
send email by mailgun API
curl -s --user 'api:key-##############################' \
https://api.mailgun.net/v3/{YOUR-DOMAIN}/messages \
-F from='Monitor <postmaster@{YOUR-DOMAIN}>' \
-F to=peerasan@{DOMAIN} \
-F subject='Hello' \
-F text='Testing some Mailgun awesomness!'
@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 / patrickz.yml
Created June 11, 2019 04:10
docker-compose with system environment
version: '3'
services:
patrickz:
image: patrickz/ubuntu
container_name: patrickz
restart: always
hostname: $HOSTNAME
ports:
- 19999:19999
environment:
@peerasan
peerasan / sysctl.conf
Created June 8, 2019 14:38
Tweaked sysctl.conf (Ubuntu)
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
@peerasan
peerasan / nginx-rtmp.sh
Created June 8, 2019 14:36
compile nginx + rtmp
#compile nginx
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
mkdir /root/src
cd /root/src
wget https://nginx.org/download/nginx-1.13.8.tar.gz
tar -xvf nginx-1.13.8.tar.gz
cd nginx-1.13.8
./configure