Skip to content

Instantly share code, notes, and snippets.

@mfzl
mfzl / embedded.go
Created February 8, 2018 06:44 — forked from joshrotenberg/embedded.go
embedded nsqd
package main
// This is a basic example of running an nsqd instance embedded. It creates
// and runs an nsqd with all of the default options, and then produces
// and consumes a single message. You are probably better off running a
// standalone instance, but embedding it can simplify deployment and is
// useful in testing.
// See https://github.com/nsqio/nsq/blob/master/nsqd/options.go and
// https://github.com/nsqio/nsq/blob/master/apps/nsqd/nsqd.go for
@mfzl
mfzl / dot_git_dir.go
Last active August 29, 2015 14:08 — forked from adamhjk/dot_git_dir.go
var errNotFound = errors.New("Cannot find a .git directory")
func dotGitDir(dir string) (string, error) {
gitDir := filepath.Join(dir, ".git")
if gitDir == "/.git" {
return "", errNotFound
}
if _, err := os.Stat(gitDir); err != nil {
return dotGitDir(path.Dir(dir))
}
// Copyright 2012 Junqing Tan <[email protected]> and The Go Authors
// Use of this source code is governed by a BSD-style
// Part of source code is from Go fcgi package
// Fix bug: Can't recive more than 1 record untill FCGI_END_REQUEST 2012-09-15
// By: wofeiwo
package fcgiclient
import (
@mfzl
mfzl / about.md
Created August 31, 2012 03:18 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer