Skip to content

Instantly share code, notes, and snippets.

View chai2010's full-sized avatar

柴树杉 chai2010

View GitHub Profile
@chai2010
chai2010 / main.go
Created August 29, 2014 06:58 — forked from icub3d/main.go
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"github.com/golang/groupcache"
"github.com/ha/doozer"
"io"
@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>
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 / Gearman-Windows.md
Last active August 29, 2015 14:26 — forked from mnapoli/Gearman-Windows.md
Installing Gearman on windows

Gearman can be installed on Windows through cygwin.

Install Cygwin packages

Install cygwin packages (through setup.exe):

  • gcc
  • make
  • libuuid1-devel
  • libiconv
@chai2010
chai2010 / c.h
Created May 1, 2016 18:50 — forked from lorepozo/c.h
Golang cgo objective-c cocoa button callback
#include <Cocoa/Cocoa.h>
extern void ButtonClick(void);
@interface GoPasser : NSObject
+ (void)buttonClick:(id)sender; // this should call the cgo function defined in main.go
@end
void StartApp(void);
@chai2010
chai2010 / example.go
Created May 1, 2016 18:50 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@chai2010
chai2010 / GIF-Screencast-OSX.md
Created May 30, 2016 08:52 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@chai2010
chai2010 / openapi_specification_fka_swagger_specification_tutorial.md
Created September 28, 2017 02:07 — forked from arno-di-loreto/openapi_specification_fka_swagger_specification_tutorial.md
OpenAPI Specification (fka Swagger Specification) tutorial files from [API Handyman blog](http://apihandyman.io)
@chai2010
chai2010 / request.sh
Created December 1, 2017 09:58 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@chai2010
chai2010 / golang.lark
Created March 24, 2021 03:33 — forked from grihabor/golang.lark
Lark ebnf grammar for golang
go_file: decl_package [imports] ([decl_type] [decl_func])*
decl_package: "package" ident
imports: "import" single_import
| "import" multiple_imports
single_import: ["("] ESCAPED_STRING [")"]
multiple_imports: "(" ESCAPED_STRING+ ")"
stmt: stmt_var
| stmt_for
| stmt_if