This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff-tree --no-commit-id --name-only -r fb587275b02b6ca5e4e12bef3dabfb7839039eb7 | grep ".php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ prlctl list --all | awk '{print $1}' | |
UUID | |
{e5e69367-7b17-4585-82a4-1e8d83813f09} | |
$ prlsrvctl net list | |
Network ID Type Bound To | |
Shared shared vnic0 | |
$ prlsrvctl net info Shared | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
$ shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @tables = NULL; | |
SELECT GROUP_CONCAT(table_schema, '.', table_name) | |
INTO @tables | |
FROM information_schema.tables | |
WHERE table_schema = 'ippart'; | |
SET @tables = CONCAT('DROP TABLE ', @tables); | |
PREPARE stmt FROM @tables; | |
EXECUTE stmt; | |
DEALLOCATE PREPARE stmt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mail | |
import "time" | |
type From []Mailbox | |
type Sender Mailbox | |
type ReplyTo []Address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func EqualWithDuration(t *testing.T, expected, actual interface{}, delta time.Duration) bool { | |
a := reflect.ValueOf(actual) | |
e := reflect.ValueOf(expected) | |
for i := 0; i < a.NumField(); i++ { | |
if a.Field(i).Type() == reflect.TypeOf(time.Time{}) { | |
assert.WithinDuration(t, e.Field(i).Interface().(time.Time), a.Field(i).Interface().(time.Time), delta) | |
} else { | |
assert.Equal(t, e.Field(i).Interface(), a.Field(i).Interface()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Spawn a command in the background, optionally redirecting stderr and stdout | |
-- | |
-- requiring this file returns a function(cmd_line, stdout_redirect, stderr_redirect) | |
-- | |
-- `cmd_line` is the command with possible arguments | |
-- optional `stdout_redirect` is io.stdout, io.stderr, or a filename. default/nil is io.stdout | |
-- optional `stderr_redirect` is io.stdout, io.stderr, or a filename. default/nil is io.stderr | |
-- | |
-- Example: | |
-- luajit -e 'require("spawn")("cat /etc/network/interfaces", "foo1", io.stdout)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 系统执行一条SQL,到底慢在哪里? | |
如何跟踪一个分布式事务的所有行为?使用 [opentracing](http://opentracing.io/)! opentracing 是一个标准的分布式 tracing 的协议。支持 Go, JavaScript, Java, Python, Ruby, PHP, Objective-C, C++, C# 等等许多的语言(暂时没看到 rust 的库)。 | |
[一些基本的概念](https://github.com/opentracing/specification/blob/master/specification.md#the-opentracing-data-model):一个 Trace 是由许多 Span 构成的一个有向无环图。Span 之间的边的关系叫做 Reference。 | |
Span 里面的信息包括:操作的名字,开始时间和结束时间,可以附带多个 key:value 构成的 Tags(key必须是string,value可以是 string, bool 或者数字),还可以附带 Logs 信息(不一定所有的实现都支持),也是 key:value形式。 | |
下面例子是一个 Trace,里面有8个 Span: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package grpc | |
import ( | |
"math" | |
"time" | |
"github.com/davecgh/go-spew/spew" | |
"github.com/facebookgo/stack" | |
"github.com/grpc-ecosystem/go-grpc-middleware" | |
grpclogrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" |
OlderNewer