Skip to content

Instantly share code, notes, and snippets.

@ifels
ifels / hugo_nginx
Created November 24, 2015 09:57
hugo_nginx config
server {
listen 80;
charset utf-8;
server_name ifels.cn www.ifels.cn 121.40.133.140;
access_log /home/ifels/log/ifels.blog/access.log;
error_log /home/ifels/log/ifels.blog/error.log info;
root /home/ifels/work/github/ifels.blog/public/;
}
@ifels
ifels / golang_nginx.txt
Last active November 20, 2020 03:59
通过nginx反向代理go语言写的http服务器
通过nginx反向代理go语言写的http服务器
1. nginx 配置
#列出所有服务器地址,nginx 自动均衡分发请求到各个服务器。
upstream frontends {
ip_hash;
server 192.168.199.1:8088;
server 192.168.199.2:8089;
}
server {
listen 80;
@ifels
ifels / vim_NERDTree
Last active October 22, 2024 03:07
vim NERDTree 快捷键
ctrl + w + h 光标 focus 左侧树形目录
ctrl + w + l 光标 focus 右侧文件显示窗口
ctrl + w + w 光标自动在左右侧窗口切换
ctrl + w + r 移动当前窗口的布局位置
o 在已有窗口中打开文件、目录或书签,并跳到该窗口
go 在已有窗口 中打开文件、目录或书签,但不跳到该窗口
t 在新 Tab 中打开选中文件/书签,并跳到新 Tab
T 在新 Tab 中打开选中文件/书签,但不跳到新 Tab
i split 一个新窗口打开选中文件,并跳到该窗口
gi split 一个新窗口打开选中文件,但不跳到该窗口
@ifels
ifels / centos6.5_mongodb
Created October 18, 2014 07:11
centos6.5_mongodb
第一步,在/etc/yum.repos.d/目录下创建一个源配置文件mongodb.repo:
cd /etc/yum.repos.d/
vim mongodb.repo
填写如下内容:
[mongodb]
name=MongoDB Repository
@ifels
ifels / centos6.5_nginx
Last active September 7, 2023 01:57
centos 6.5 nginx安装与配置
第一步,在/etc/yum.repos.d/目录下创建一个源配置文件nginx.repo:
cd /etc/yum.repos.d/
vim nginx.repo
填写如下内容:
[nginx]
name=nginx repo
@ifels
ifels / vim_text_objects
Last active August 29, 2015 14:07
Vi 文本对象
分隔符文本对象
a) or ab | A pair of (parentheses)
i) or ib | Inside of (parentheses)
a} or aB | A pair of {braces}
i} or iB | Inside of {braces}
a] | A pair of [brackets]
i] | Inside of [brackets]
a> | A pair of <angle brackets>
i> | Inside of <angle brackets>
a’ | A pair of 'single quotes'
@ifels
ifels / filelist.go
Created August 16, 2014 15:11
golang file list
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"strings"
)
@ifels
ifels / lua-pipe.lua
Last active August 29, 2015 14:01
lua pipe sample
function receive (prod)
local status, value = coroutine.resume(prod)
return value
end
function send (x)
coroutine.yield(x)
end
function producer ()
@ifels
ifels / golang_pipe_http_response.go
Last active February 1, 2023 19:19
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024