Skip to content

Instantly share code, notes, and snippets.

@holys
holys / latency.txt
Created August 28, 2014 07:13 — forked from jboner/latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
filter {
# strip the syslog PRI part and create facility and severity fields.
# the original syslog message is saved in field %{syslog_raw_message}.
# the extracted PRI is available in the %{syslog_pri} field.
#
# You get %{syslog_facility_code} and %{syslog_severity_code} fields.
# You also get %{syslog_facility} and %{syslog_severity} fields if the
# use_labels option is set True (the default) on syslog_pri filter.
grok {
type => "syslog-relay"
input {
file {
type => "nginx"
path => "/var/log/nginx/localhost.access.log"
format => 'plain'
}
}
# We need to tell the filters (grok, date) that we want to act on the nginx
# type otherwise it won't do anything
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import re, sys, os, random, datetime, time, json, urllib2, logging
from mutagen.id3 import ID3,TRCK,TIT2,TALB,TPE1,APIC
from HTMLParser import HTMLParser
parser = HTMLParser()
s = u'\x1b[1;%dm%s\x1b[0m' # terminual color template

长度

每行不超过79个字符。

缩进

保持相同缩进方式,TAB或者空格。 采用4个空格。

缩进的基本情形:

  • 函数体
  • if语句体
60.28.250.194:82
121.15.167.231:8080
122.72.0.6:80
114.80.240.6:808
202.112.114.17:3128
221.176.14.73:80
122.113.28.52:3128
218.247.138.40:80
211.144.76.7:8181
60.190.129.52:3128
# test environment
server{
listen 80;
server_name example.com;
access_log /home/david/Gone/Work/zcms/logs/access_log;
error_log /home/david/Gone/Work/zcms/logs/error_log;
# root /home/david/Gone/Work/zcms/contents/viewer;
location / {
proxy_set_header HOST $host;
## RPC
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许非外部访问
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
#rpc-listen-port=6800
@holys
holys / exam
Last active December 11, 2015 00:29 — forked from anonymous/exam.txt
#!/bin/bash
main() {
clear
while true
do
cat <<- MENU
1) select
2) command