Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#define IS_ARRAY(ary) ((void*)(ary) == (void*)&(ary))
#define TEST(ary, expected) \
printf( \
"%s:%u: expected %s, actually %s\n", \
__FILE__, \
__LINE__, \
expected, \
(IS_ARRAY(ary) ? "array" : "ptr"))
@yugui
yugui / keybase.md
Last active September 10, 2019 13:51

Keybase proof

I hereby claim:

  • I am yugui on github.
  • I am yugui (https://keybase.io/yugui) on keybase.
  • I have a public key ASAfseopmrn1MrW_aSjjSeTm_IjW98wEtRAO6LjvmGNAmAo

To claim this, I am signing this object:

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: custom-options.proto
/*
Package main is a generated protocol buffer package.
It is generated from these files:
custom-options.proto
It has these top-level messages:
On the 6th of May, 1709, I took a solemn leave of his majesty, and
all
my friends. This prince was so gracious as to order a guard to
conduct me to Glanguenstald, which is a royal port to the south-
west part of the island. In six days I found a vessel ready to
carry me to Japan, and spent fifteen days in the voyage.
@yugui
yugui / romantable.txt
Last active November 14, 2016 05:03
roman-kana mapping table for Google Japanese Input to type Japanese characters with ANSI keyboard
3 あ
e い
4 う
5 え
6 お
# ぁ
E ぃ
$ ぅ
% ぇ
^ ぉ
load("@com_github_gengo_rules_pypi//pypi:def.bzl", "pypi_universal_repository")
BUILD_FILE = """
py_library(
name = "library",
srcs = glob(["lib/python*/site-packages/**/*.py"]),
imports = [
"lib/python2.7/site-packages",
"lib/python3.5/site-packages",
],
package main
import (
"log"
"github.com/golang/protobuf/jsonpb"
)
func main() {
const input = `{"create_request": {"key": "Zm9v"}}`
syntax = "proto3";
package example;
message Example {
oneof oneof_field {
string string_value = 1;
int32 int32_value = 2;
}
}
@yugui
yugui / build.sh
Last active May 7, 2016 02:08
Objective C99++11
g++ -framework Foundation -std=gnu++14 -lobjc test.mm
@yugui
yugui / extension.ja.rdoc
Last active May 27, 2023 08:36
extension.ja.rdoc -- extension library

CのデータをRubyオブジェクトにする

Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして取り扱いたい場合がありえます.このような場合はTypedData_XXX マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互いに変換できます.

# 古い(非Typedな)Data_XXXマクロ群は非推奨になりました.

# 将来のバージョンのRubyでは古いマクロは動作しなくなる可能性があります.