- NL: new line 一般指
\r\n
- CR: 回车carriage return
\r
- LF: 换行line feed
\n
- ESB: Enterprise Service Bus 服务总线(SOA)
- RFC: Requests For Comments 征求意见稿
- SOA: service-oriented architecture 面向服务体系架构
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"strings" | |
) | |
# 1. list => dict | |
arr1,arr2 = ['a', 'b'],[1,2] | |
dic = dict(zip(arr1, arr2)) # {'a':1, 'b':2} |
# 字典排序: | |
# 1. 根据key排序 | |
items = dict.items() | |
items.sort() # list 的sort属性 | |
for key,value in items: | |
print key,value | |
'''or''' | |
print key, dict[key] for key in sorted(dict.keys()) # sorted方法:从小到大排列 |
<?php | |
function is_json_str($str) { | |
json_decode($str); | |
return json_last_error() === JSON_ERROR_NONE; | |
} |
<snippet> | |
<content><![CDATA[ | |
# -*- coding: utf-8 -*- | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>py.h</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
# -*- coding: utf-8 -*- | |
def dummy_decorator(injection): | |
print 'dummy' | |
return injection | |
def test_decorator(injection): | |
print 'foooo' | |
def wrapper(params): | |
print 'barrrr' |
# -*- coding: utf-8 -*- | |
class A(object): | |
def foo(self): | |
print 'hello A' | |
@classmethod | |
def demo(cls): | |
s = cls() | |
s.foo() |
<?php | |
/** | |
* stream解释: 将数据从开始位置传送到目的位置, 可以是大流量文件传输 | |
* 1. stream的过程: | |
* 开始通信 | |
* 读取数据 | |
* 写入数据 | |
* 结束通信 | |
* ## 可以说stream是这一过程的抽象 | |
* |
import http from 'http'; | |
import cluster from 'cluster'; | |
import os from 'os'; | |
const port = 3001; | |
// cpu核数 | |
const numCpus = os.cpus().length; | |
console.log(`The num of cpu: ` + numCpus); | |
// 实现Load balancer |