Skip to content

Instantly share code, notes, and snippets.

View xujiajun's full-sized avatar
🎯
Focusing

徐佳军 xujiajun

🎯
Focusing
View GitHub Profile

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@xujiajun
xujiajun / scopes.txt
Last active August 29, 2015 14:21 — forked from iambibhas/scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@xujiajun
xujiajun / supervisord.sh
Last active September 9, 2015 02:59 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@xujiajun
xujiajun / gist:d7a6e3f65ac34a10d448ac693987b4b9
Created September 20, 2016 06:40 — forked from cathyHuo/gist:309760b6d4c2d9d723bf
Nginx配置文件详细说明
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络.
#运行用户
user www-data;
#启动进程,通常设置成和cpu的数量相等
worker_processes 1;
#全局错误日志及PID文件
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
@xujiajun
xujiajun / gitlab-ce
Created September 21, 2016 03:36 — forked from sameersbn/gitlab-ce
gitlab-ce nginx load balance config
upstream gitlab {
server 172.17.42.1:10080;
}
## This is a normal HTTP host which redirects all traffic to the HTTPS host.
server {
listen 80;
server_name git.example.com;
server_tokens off;
root /dev/null;
@xujiajun
xujiajun / nginx-tuning.md
Created September 21, 2016 06:42 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

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 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (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.

@xujiajun
xujiajun / awscli.md
Created November 24, 2016 04:51 — forked from amowu/awscli.md
关于AWS CLI:十个你不知道的实用命令

摘要:本文阐述AWS CLI十个你不知道的实用命令,让您使用AWS Console可以让你轻松解决大部分工作, AWS CLI有时候还可以让事情处理起来更加简单容易。

事实上,AWS CLI应该是你最好的工具。时至今日,AWS控制台的布局已经非常完善。随着时间的推移,AWS控制台也越来越易用。就算如此,如果你忽略了AWS CLI(Command Line Interface,命令行界面),那么你很可能错过了很多实用的功能,以及事半功倍的机会。如果现在你还不太适应使用AWS Command Line Interface,Cloud Academy上有一个很棒 AWS CLI入门教程。

然而,即使你已经习惯了使用AWS CLI,我还是建议你看完下面的一些命令,它可以让你更深刻地认识到AWS CLI的强大,这些命令将帮助你节约大量时间。重要提示:在不同的版本和封装中,一些命令的语法可能出现些许不同。

  1. 只通过一条命令就可以删除指定的S3 bucket和其中的所有内容

有些时候,你可能需要关闭某个bucket并删除其储存的成百上千(或成千上万)个你不要的文件。如果你有删除大量存储在S3中内容的经历,那么你已经了解这是一个颇费时的操作。下面的命令将帮助你删除一个bucket,以及其储存的内容和目录:

//Exercise: Loops and Functions
package main
import (
"fmt"
"math"
)
const delta = 0.000000000001