Skip to content

Instantly share code, notes, and snippets.

View lacoski's full-sized avatar
😀
An Introvert Engineer

Nguyễn Bá Thành lacoski

😀
An Introvert Engineer
View GitHub Profile
@lacoski
lacoski / nginx-tuning.md
Created June 5, 2019 07:22 — 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.

@lacoski
lacoski / gist:9974c0a26686fb50f93ae3a0a64c12c3
Created June 5, 2019 16:57 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@lacoski
lacoski / DemoGatlingRecorder.scala
Created August 11, 2019 09:46
Cách sử dụng Gatling Recorder
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="style/favicon.ico"/>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<link href="style/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class DemoGatlingRecorder extends Simulation {
val httpProtocol = http
@lacoski
lacoski / axios-response-interceptor.js
Created February 4, 2020 04:02 — forked from FilipBartos/axios-response-interceptor.js
Axios response interceptor for access token refresh supporting 1 to N async requests
let isAlreadyFetchingAccessToken = false
let subscribers = []
function onAccessTokenFetched(access_token) {
subscribers = subscribers.filter(callback => callback(access_token))
}
function addSubscriber(callback) {
subscribers.push(callback)
}
#!/bin/bash
set -o errexit
# This script is meant to be run once after running start for the first
# time. This script downloads a cirros image and registers it. Then it
# configures networking and nova quotas to allow 40 m1.small instances
# to be created.
ARCH=$(uname -m)
[root@nhmoodle ~]# sudo /usr/bin/php /var/www/html/moodle/admin/cli/install.php \
> --chmod=2777 --lang=en \
> --wwwroot=http://10.10.12.100 \
> --dataroot=/var/moodledata \
> --dbtype=mariadb --dbhost=localhost --dbname=moodle \
> --dbuser=moodleuser --dbpass=Cloud365a@123 \
> --fullname=MoodleNH --shortname=MNH \
> --adminuser=admin --adminpass=Cloud365a@123 \
> --adminemail=bathanhtlu@gmail.com \
> --agree-license
@lacoski
lacoski / index.html
Created April 20, 2020 17:19
Tích hợp jitsi web đơn giản
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
@lacoski
lacoski / docker_debugging.md
Created May 11, 2020 09:27 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this: