Skip to content

Instantly share code, notes, and snippets.

void HandleRpcs() {
new CallData(&service_, cq_.get());
void* tag;
bool ok;
while (true) {
switch (cq_->AsyncNext(&tag, &ok, gpr_inf_past) {
case TIMEOUT:
doSomethingElseForALittleWhile();
continue;
case SHUTDOWN:
@chai2010
chai2010 / rust_udl.xml
Last active August 29, 2015 14:21 — forked from heimp/rust_udl.xml
<NotepadPlus>
<UserLang name="rust" ext="rs" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 00/// 01 02 03/* 03/** 03/*! 04*/</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2">0x 0b</Keywords>
@chai2010
chai2010 / local.md
Created May 15, 2015 02:37
golangdoc/local 新接口设计
package local

// Default is the translations dir.
const (
	DefaultDir = "translations"     // 默认: $(RootFS)/translations
	DefaultEnv = "GODOC_LOCAL_ROOT" // 优先取环境变量, 支持多个目录
)

// Init initialize the translations environment.
@chai2010
chai2010 / winsvc.go
Created May 12, 2015 05:44
Windows系统服务例子
// Copyright 2015 <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ingore
package main
import (
"flag"
@chai2010
chai2010 / test.md
Last active August 29, 2015 14:20
x/image/tiff: test

// golang/go#10597 // test

func TestDecodeInvalidDataType(t *testing.T) {
	b, err := ioutil.ReadFile("../testdata/bw-uncompressed.tiff")
	if err != nil {
		t.Fatal(err)
	}
@chai2010
chai2010 / gist:87b36b277209cdf91e22
Last active August 29, 2015 14:13
markdown comment
<!-- This is a comment. -->
[comment]: <> (This is a comment, it will not be included)
[comment]: <> (in  the output file unless you use it in)
[comment]: <> (a reference style link.)

[//]: <> (This is also a comment.)
@chai2010
chai2010 / gist:9095218191544251d5f8
Last active August 29, 2015 14:12
Tab和Space的缩进问题
@chai2010
chai2010 / eprintf.c
Created December 4, 2014 04:32
迷你printf实现
/* Copyright (C) 1999 Lucent Technologies */
/* Excerpted from 'The Practice of Programming' */
/* by Brian W. Kernighan and Rob Pike */
#include <stdio.h>
#include <stdlib.h>
#include "eprintf.h"
#include <stdarg.h>
#include <string.h>
#include <errno.h>
@chai2010
chai2010 / grep.c
Created December 4, 2014 04:31
迷你grep实现
/* Copyright (C) 1999 Lucent Technologies */
/* Excerpted from 'The Practice of Programming' */
/* by Brian W. Kernighan and Rob Pike */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "eprintf.h"
int grep(char*, FILE*, char*);
@chai2010
chai2010 / gist:350df12e19220fdbd014
Created October 17, 2014 05:32
[]T转[]*T类型
// http://play.golang.org/p/068n_JHmQU
package main
import (
"fmt"
"image"
"reflect"
)