Skip to content

Instantly share code, notes, and snippets.

@chai2010
chai2010 / README-Template.md
Created August 19, 2022 03:15 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@chai2010
chai2010 / main.go
Created June 11, 2021 03:14 — forked from tsandall/main.go
package main
// #include <stdlib.h>
//
// extern void opa_abort(void *context, int32_t addr);
// extern int32_t opa_builtin0(void *context, int32_t builtin_id, int32_t ctx);
// extern int32_t opa_builtin1(void *context, int32_t builtin_id, int32_t ctx, int32_t arg0);
// extern int32_t opa_builtin2(void *context, int32_t builtin_id, int32_t ctx, int32_t arg0, int32_t arg1);
// extern int32_t opa_builtin3(void *context, int32_t builtin_id, int32_t ctx, int32_t arg0, int32_t arg1, int32_t arg2);
// extern int32_t opa_builtin4(void *context, int32_t builtin_id, int32_t ctx, int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3);
@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
@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 / 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 / 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 / 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 / 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 / gist:32e2733e180096e32221
Created August 11, 2015 02:08
Windows命令行提示符
prompt $$
@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