Skip to content

Instantly share code, notes, and snippets.

View nguyentienlong's full-sized avatar
💭
I may be slow to respond.

lk nguyentienlong

💭
I may be slow to respond.
  • Vietnam
View GitHub Profile
@nguyentienlong
nguyentienlong / main.go
Last active August 13, 2020 02:50
Open close principle implemented in golang
// https://longka.info/blog/2020/08/13/solid-open-close-principle-implemented-in-golang/
package main
import (
"fmt"
"math"
)
type Shape interface {
@nguyentienlong
nguyentienlong / install.sh
Created August 11, 2020 09:35
Install ImageMagick's MagickWand on fedora 32
sudo yum install GraphicsMagick GraphicsMagick-devel
sudo dnf install /usr/bin/MagickWand-config
@nguyentienlong
nguyentienlong / remove_special_char_in_file_name
Created May 18, 2020 10:19
remove special char in filename
for file in *; do mv "$file" $(echo "$file" | sed -e 's/[^A-Za-z0-9._-]/_/g'); done
@nguyentienlong
nguyentienlong / index.js
Created April 24, 2020 07:07 — forked from miguelmota/index.js
Node.js Winston logger wrapper to display filename
var log = require('./lib/logger')(module);
log.info('foo');
@nguyentienlong
nguyentienlong / Instructions.sh
Created February 28, 2020 04:12 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@nguyentienlong
nguyentienlong / php72
Created February 28, 2020 04:05
php72 installation centos
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum install yum-utils
$ sudo subscription-manager repos --enable=rhel-7-server-optional-rpms
$ sudo yum-config-manager --enable remi-php72
$ sudo yum update
$ sudo yum search php72 | more
$ sudo yum install php72 php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
@nguyentienlong
nguyentienlong / coredns.yaml
Created October 9, 2019 18:43 — forked from rothgar/coredns.yaml
CoreDNS for Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
log stdout
health
@nguyentienlong
nguyentienlong / ecr-cred-updater.sh
Created September 29, 2019 15:44 — forked from cablespaghetti/ecr-cred-updater.sh
Automatic Updating Amazon ECR Credentials in Kubernetes
#!/bin/bash
# Get directory of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $# -ne 1 ]]
then
echo "ERROR: This script expects the namespace name to be given as an argument"
echo "e.g. ./ecr-cred-updater.sh my-namespace"
exit 1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-tutorial
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
backend:
serviceName: default-http-backend
servicePort: 80
@nguyentienlong
nguyentienlong / nginx-tuning.md
Created August 24, 2019 12:42 — 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.