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 / .tmux.conf
Created July 21, 2022 06:42 — forked from v-yarotsky/.tmux.conf
Mac OS X tmux config
### INSTALLATION NOTES ###
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
# Character Encoding: Unicode (UTF-8)
# Report Terminal Type: xterm-256color
# 7. Put itunesartist and itunestrack into PATH
#!/bin/bash
clion() {
find ~/.config/JetBrains -mindepth 2 -maxdepth 2 -type d -wholename '*CLion*/eval' -exec rm -rf {} \;
find ~/ -mindepth 3 -maxdepth 3 -type d -wholename '*.CLion*/eval' -exec rm -rf {} \;
sed --quiet -i -E -e 's/.*<property.*evlsp.*//g' -e '/^$/d' ~/.config/JetBrains/CLion*/options/other.xml ~/.CLion*/config/options/other.xml 2>/dev/null
}
webstorm() {
find ~/.config/JetBrains -mindepth 2 -maxdepth 2 -type d -wholename '*WebStorm*/eval' -exec rm -rf {} \;
@nguyentienlong
nguyentienlong / main.go
Created December 1, 2020 17:45 — forked from montanaflynn/main.go
Gin request timeout middleware and handler
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@nguyentienlong
nguyentienlong / add_swap.sh
Created September 6, 2020 06:12 — forked from mommi84/add_swap.sh
Add swap memory on Ubuntu
#!/usr/bin/env bash
#
# USAGE:
# sudo ./add_swap.sh 4G
#
# SOURCE:
# https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/
#
fallocate -l $1 /swapfile
chmod 600 /swapfile
@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 / 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

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.