Skip to content

Instantly share code, notes, and snippets.

View trantrongbinh's full-sized avatar
😎
Pending!

Trần Trọng Bình trantrongbinh

😎
Pending!
View GitHub Profile
Can I Remove MySQL Binary Log Yes, as long as the data is replicated to Slave server, it’s safe to remove the file. It’s recommend only remove MySQL Binary Log older than 1 month.
Besides, if Recovery of data is the main concern, it’s recommend to archive MySQL Binary Log.
There are several ways to remove or clean up MySQL Binary Log, it’s not recommend to clean up the file manually, manually means running the remove command.
Remove MySQL Binary Log with RESET MASTER Statement Reset Master statement is uses for new database start up during replication for Master and Slave server. This statement can be used to remove all Binary Log.
To clean up Binary Log on Master Server
@trantrongbinh
trantrongbinh / rd-class-text-extraction.php
Created December 16, 2021 04:59 — forked from nickrouty/rd-class-text-extraction.php
Class for extraction the text from doc, docx, xlsx, pptx and wrapper for 3rd party pdf to text library.
<?php
/**
* Class RD_Text_Extraction
*
* Example usage:
*
* $response = RD_Text_Extraction::convert_to_text($path_to_valid_file);
*
* For PDF text extraction, this class requires the Smalot\PdfParser\Parser class.
@trantrongbinh
trantrongbinh / nginx.conf
Created October 14, 2021 16:53 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@trantrongbinh
trantrongbinh / nginx.conf
Created October 14, 2021 15:30 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@trantrongbinh
trantrongbinh / nginx-tuning.md
Created October 13, 2021 10:03 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@trantrongbinh
trantrongbinh / haproxy-config-2-1.cfg
Created October 7, 2021 09:28 — forked from haproxytechblog/haproxy-config-2-1.cfg
HAProxy 2.1 Sample Config
#
# This is the ultimate HAProxy 2.0 "Getting Started" config
# It demonstrates many of the features available which are now available
# While you may not need all of these things, this can serve
# as a reference for your own configurations.
#
# Have questions? Check out our community Slack:
# https://slack.haproxy.org/
#
@trantrongbinh
trantrongbinh / ffmpeg_3.4.2_full_help.txt
Created July 22, 2021 15:11 — forked from maheshgawali/ffmpeg_3.4.2_full_help.txt
ffmpeg 3.4.2 full help / all options / all flags / all commands , refer https://www.ffmpeg.org/ffmpeg-all.html for detailed explanation of all options
root@f827ea48f84f:/code# ffmpeg -h full
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --e
@trantrongbinh
trantrongbinh / ffmpeg_tuts.md
Created July 21, 2021 15:27 — forked from tingplenting/ffmpeg_tuts.md
ffmpeg cli for youtube

Extract audio from a YouTube video file

ffmpeg -i INPUT.mp4 -ab 256k OUTPUT.mp3

Cut 3s length

ffmpeg -y -ss 00:00:03 -i INPUT.mp4 -codec copy OUTPUT.mp4
@trantrongbinh
trantrongbinh / Kernel.php
Created July 6, 2021 03:12 — forked from JuanDMeGon/Kernel.php
A small Laravel command to collect the sessions garbage if applicable to the current session driver
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
//...
@trantrongbinh
trantrongbinh / bash_move_file.md
Created June 10, 2021 01:39
Bash find file and move
#!/bin/bash

FORDER_M3U8="/data2/upload2/process/video/*"
FORDER_MP4="/data2/upload2/[email protected]/video"
FOLDER_MOVE="/backup/backup_m3u8/upload2_data2"
LOG="/backup/backup_m3u8/logs.txt"

for f in $FORDER_M3U8; do
 if test -f "$FORDER_MP4/raw-file-$(basename $f).mp4"; then