Skip to content

Instantly share code, notes, and snippets.

View xluffy's full-sized avatar
😶
&>/dev/null

xluffy xluffy

😶
&>/dev/null
View GitHub Profile
@xluffy
xluffy / NERDTree.mkd
Created June 15, 2016 07:21 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@xluffy
xluffy / gist:203214550524693dcd155582380c82d1
Created May 31, 2016 09:21 — forked from THemming/gist:2173037
init.d script to launch Play framework under CentOS/RedHat
#!/bin/bash
# chkconfig: 345 20 80
# description: Play start/shutdown script
# processname: play
#
# Instalation:
# copy file to /etc/init.d
# chmod +x /etc/init.d/play
# chkconfig --add /etc/init.d/play
# chkconfig play on
@xluffy
xluffy / benchmark+go+nginx.md
Created April 25, 2016 10:28 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@xluffy
xluffy / MySQL.md
Last active November 27, 2015 04:52
Describe in as much detail as possible how an SQL query is executed, from the time it is entered into the console to the time the output is printed out.

Query Execution Basic

Dưới đây là mô tả chuyện gì xảy ra khi ta gửi cho MySQL một câu truy vấn, xem hình dưới

  1. Client gửi một câu lệnh SQL cho server
  2. Server sẽ check trong query cache. Nếu có sẵn, trả về kết quả truy vấn lưu trong cache cho client. Nếu không thì chuyển câu lệnh SQL qua bước kế tiếp
  3. Server phân tích, tiền xử lí và tối ưu câu lệnh SQL vào một kế hoạch thực hiện.
  4. Phần query execution engine thực thi kế hoạch ở bước 3 bằng cách tạo một cuộc gọi tới phần storage engine API
  5. Server trả kết quả lại cho client
@xluffy
xluffy / nginx.conf
Last active April 24, 2016 04:07
Main config nginx for static server
# generate by ansible
user nginx nginx;
worker_processes 2;
worker_rlimit_nofile 8192;
events {
use epoll;
worker_connections 8192;
}
@xluffy
xluffy / nginx-ssl.conf
Created October 13, 2015 10:22
nginx-ssl.conf
add_header Strict-Transport-Security max-age=31536000;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_buffer_size 8k;
ssl_prefer_server_ciphers on;
@xluffy
xluffy / install_funtoo.md
Created October 9, 2015 07:09
install_funtoo

Basic install Funtoo

  1. Download and boot the live CD of your choice.
  2. Prepare your disk.
  3. Create and mount filesystems.
  4. Install the Funtoo stage tarball of your choice.
  5. Chroot into your new system.
  6. Download the Portage tree.
  7. Configure your system and network.
@xluffy
xluffy / gist:adde9a0a663803e07a94
Created September 24, 2015 13:04 — forked from stran12/gist:1394757
Step-by-step installation of cGit with Nginx

How to install cGit on Nginx (Ubuntu server)

Step-by-step installtion of cGit on nginx without funky rewrite rules.

Pre-requisites

This is for

@xluffy
xluffy / vpnserver
Last active August 29, 2015 14:27
vpnserver init-script
#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/home/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x $DAEMON || exit 0
case "$1" in
@xluffy
xluffy / supervisord.md
Last active February 21, 2021 09:08
supervisord

Supervisord

1. Giới thiệu

Supervisord là công cụ quản lý unix process

Một trong những ứng dụng của Supervisor là quản lý background process dạng Worker.