Skip to content

Instantly share code, notes, and snippets.

@huydoanq
huydoanq / nginx-tuning.md
Created April 11, 2018 16:02 — 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.

@huydoanq
huydoanq / twitter-auth.md
Created January 18, 2018 09:41 — forked from brandur/twitter-auth.md
Twitter auth

Easy Twitter API OAuth 2 Access

  1. Go to your applications. Create a new one, and find the values in the Consumer Key and Consumer Secret fields.

  2. Use OAuth client information to produce an OAuth 2 access token:

    curl -i --user <consumer_key>:<consumer_secret> -X POST https://api.twitter.com/oauth2/token -d "grant_type=client_credentials"
    
    {"access_token":"<oauth2_token>","token_type":"bearer"}% 
    
@huydoanq
huydoanq / 1.mongodb-aws-setup-guide.md
Created August 3, 2017 03:43 — forked from calvinh8/1.mongodb-aws-setup-guide.md
MongoDB Setup Guide for AWS EC2 Instances with Auth Enabled
@huydoanq
huydoanq / nginx.default.conf
Created July 11, 2017 03:36 — forked from santoshachari/nginx.default.conf
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap
@huydoanq
huydoanq / server-validation.component.js
Created February 16, 2017 17:19 — forked from avilaj/server-validation.component.js
AngularJS Server-side validation directive
/*
* Let’s assume that the server returns validation errors using
* the following format:
*
* [{
* "field": "code",
* "type": "unique",
* "value": 123,
* "message": "this field is unique"
* }]