Skip to content

Instantly share code, notes, and snippets.

View daothanh's full-sized avatar

Thanh daothanh

  • Webvi Viet Nam
  • Hanoi, Vietnam
View GitHub Profile
@daothanh
daothanh / php-pools.md
Created December 15, 2023 16:47 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@daothanh
daothanh / Large-app-how-to.md
Created May 16, 2020 16:58 — forked from cuibonobo/Large-app-how-to.md
How to structure a large application in Flask. Taken from the Flask wiki: https://github.com/mitsuhiko/flask/wiki/Large-app-how-to

Here's an example application that uses the pattern detailed below: https://github.com/tantastik/talent-curator


This document is an attempt to describe the first step of a large project structure with flask and some basic modules:

  • SQLAlchemy
  • WTForms

Please feel free to fix and add your own tips.

{
"always_show_minimap_viewport": true,
"bold_folder_labels": false,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro Medium",
"font_options":
[
"no_round",
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"Alignment",
"All Autocomplete",
"ApacheConf",
@daothanh
daothanh / .eslintrc
Created July 12, 2019 05:17
Eslint + Prettier
{
"env": {
"browser": true
},
"extends": ["airbnb-base", "plugin:prettier/recommended"],
"parser": "babel-eslint",
"plugins": ["prettier"],
"rules": {
"class-methods-use-this": 0,
"import/no-named-as-default": 0
@daothanh
daothanh / app.js
Last active July 12, 2019 09:31
ExpressJs + Gulp + Browser Sync + SASS + JS
'use strict';
// simple express server
const express = require('express');
const app = express();
const router = express.Router();
const path = require('path');
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname+'/pages/index.html'))

Yêu cầu hệ thống

  • Webserver (nginx hoặc apache 2)
  • PHP >= 7.1.3
  • Mysql >= 5.7

Các extension của PHP:

  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "<policy>";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
add_header Public-Key-Pins 'pin-sha256="<primary>"; pin-sha256="<backup>"; max-age=5184000; includeSubDomains';
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy "no-referrer";
@daothanh
daothanh / install-dnsmasq.sh
Created December 17, 2018 07:08
Setup all domains *.test point 127.0.0.1
# Setup all domains *.test point 127.0.0.1
brew install dnsmasq
mkdir -pv $(brew --prefix)/etc/
echo 'address=/.test/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
@daothanh
daothanh / install-odoo.sh
Last active March 22, 2024 18:32
Install odoo 12 on Centos 7 with nginx
yum update
yum install epel-release -y
yum install centos-release-scl -y
yum install git wget ibxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel -y
sudo yum groupinstall 'Development Tools' -y
## Gist url
export GIST_URL="https://gist.githubusercontent.com/daothanh/2f9be5af944e7cb92c84ceb64c4bc3fd/raw"
export ODOO_DOMAIN=webcongty.pro
export ODOO_PASSWORD=abc@123