Skip to content

Instantly share code, notes, and snippets.

@hung119
hung119 / nginx.conf
Created September 13, 2019 17:01 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
<!--
Tutorial code for: http://www.binpress.com/tutorial/generating-nice-movie-previews-with-ffmpeg/138
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
<a href="https://www.youtube.com/watch?v=v1uyQZNg2vE" target="_blank" class="video-preview" data-frames="100" data-source="http://i.imgur.com/BX0pV4J.jpg"></a>
@hung119
hung119 / compile-ffmpeg-nvenc.sh
Last active April 5, 2019 11:00
This bash script will compile a static Ffmpeg build with NVENC and VAAPI hardware-accelerated support on Ubuntu in your home directory. You can modify the script to customize the build options as you see fit.
#!/bin/bash
#This script will compile and install a static ffmpeg build with support for nvenc un ubuntu.
#See the prefix path and compile options if edits are needed to suit your needs.
#install required things from apt
installLibs(){
echo "Installing prerequisites"
sudo apt-get update
sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
#https://github.com/sameersbn/docker-mysql
#https://hub.docker.com/_/mysql/
#https://dev.mysql.com/doc/mysql-installation-excerpt/5.5/en/docker-mysql-getting-started.html
#https://hub.docker.com/r/mysql/mysql-server/
#https://hub.docker.com/r/_/mysql/
#Docker Pull Command
docker pull mysql
mkdir -p /var/lib/mysql/mysql_docker
docker run --name mysql-5.7.24 -v /var/lib/mysql/mysql_docker:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --restart always -p 3307:3306 -d mysql:5.7.24
@hung119
hung119 / nginx-tuning.md
Created October 12, 2018 05:39 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.

@hung119
hung119 / nodejs-tcp-example.js
Created September 18, 2018 16:52 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@hung119
hung119 / video-thumbnails.sh
Created September 12, 2018 08:47 — forked from tomoe-mami/video-thumbnails.sh
Simple Video Thumbnail/Screencap Generator
#!/bin/sh
#
# video-thumbnails: A simple shell script to generate video thumbnails/screencaps
#
# Author: rumia <https://github.com/rumia>
# License: WTFPL
#
function quit {
rm -rf "$1"