Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

long nguyen nguyentienlong

I may be slow to respond.
Block or report user

Report or block nguyentienlong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nguyentienlong /
Created Aug 24, 2019 — forked from denji/
NGINX tuning for best performance

Moved to git repository:

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.

nguyentienlong / gist:5fb50629d51d91345f22ba5d6be05638
Created Dec 13, 2018
good enough - index setting for full text search
View gist:5fb50629d51d91345f22ba5d6be05638
"index": {
"analysis": {
"analyzer": {
"lala_analyzer": {
# "tokenizer": "vi_tokenizer",
"tokenizer": "standard",
"char_filter": ["html_strip"],
"filter": [
#!/usr/bin/env bash
# install awscli
python2 -m pip install awscli
# create aws sym link if any issue
ln -s /usr/local/bin/aws /var/awslogs/bin/aws
# install awscli-cwlogs
nguyentienlong / gist:7b0c899fcd664e5dc78268436dc8ec8f
Created Aug 3, 2018
aws cli - copy and flatten nested s3 files structure
View gist:7b0c899fcd664e5dc78268436dc8ec8f
aws s3 ls source-bucket-name - recursive | grep -E "\w+\.+" | awk -F" " '{for(i=4; i<=NF; i++){printf "s3://%s", $i}; printf "\n"}' | head -n5 | xargs -I$ aws s3 cp $ s3://destination-bucket-name/
nguyentienlong / server tricks
Last active May 3, 2018
sudo without password
View server tricks
## sudo without pwd
## disable ssh with pass
nguyentienlong / wordpress_sub_dir.conf
Last active Jan 28, 2019
wordpress subdir on nginx with anther nodejs web app
View wordpress_sub_dir.conf
server {
root /home/thixanvat/prod/web;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
location /assets/ {
PYTHONPATH=. python test/
nguyentienlong / wp sub dir config
Created Apr 16, 2018
wordpress url rewrite for blog sub dir
View wp sub dir config
rewrite ^/blog/wp-admin/$ /blog/wp-admin/options-general.php permanent;
rewrite ^/blog/(.*)/$ /blog/index.php?$1 last;
server {
root /home/example/stag/web;
location /assets/ {
alias /home/example/stag/web/build/public/assets/;
add_header Cache-Control public;
location /blog {
nguyentienlong /
Last active Mar 26, 2018
Booking Resource refactoring 1
from app import log
logger = log.get_logger()
class BookingResource(object):
def __init(self):
def on_put(self, req, resp, booking_id):
You can’t perform that action at this time.