Skip to content

Instantly share code, notes, and snippets.

View kazupon's full-sized avatar
🦋
Focusing vue-i18n and Intlify

kazuya kawaguchi kazupon

🦋
Focusing vue-i18n and Intlify
View GitHub Profile
(function () {
// imports
//var _ = this._ || require('underscore');
// common function 1
var add = function (a, b) {
return a + b;
};
// common function 2
macbook-2:kyotocabinet-1.2.76 kazupon$ time make check > macbook_bench_log.txt
real 20m34.652s
user 3m12.845s
sys 4m11.813s
.DS_Store
node_modules
*~
*.swp
*.bak
*.log
'use strict';
var log = console.log.bind(console);
var format = require('util').format;
var kv = require('kv')('./kv');
var ps = kv.put('hello/there');
var rnd = Math.random();
ps.write({ hello: rnd });
'use strict';
var log = console.log.bind(console);
var format = require('util').format;
var Model = require('scuttlebutt/model');
var net = require('net');
var m = new Model();
var ms = m.createStream();
@kazupon
kazupon / buffering.js
Created November 6, 2012 14:24
stream through samples
var through = require('through');
var log = console.log.bind(console);
var ts = through(function (data) { // data pre event
this.queue(data);
}, function () { // end pre event
this.queue(null);
});
var data = [];
@kazupon
kazupon / mach_semaphore.c
Created October 6, 2012 00:52
Using mach_semaphore on Mac OS X to mutually signaling between two threads. This could be extended to work with different processes.
//
// Created by Yogesh Swami on 2/24/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
//
// clang -Wall -Wextra -Wall -o mach_semaphore mach_semaphore.c
//
// using mach semaphore for mutually signalling between two threads.
@kazupon
kazupon / Makefile
Created October 5, 2012 16:23
semaphore multi process sample for Mac OSX
CC=gcc
all: multi-process-counter
build: multi-process-counter
multi-process-counter:
${CC} -std=c99 -o multi-process-counter multi-process-counter.c
#${CC} -std=c99 -arch x86_64 -o multi-process-counter multi-process-counter.c
local fs = lev.fs
local co = _coroutine
t1 = co.create(function (...)
p(t1)
local err1, fd1 = fs.open('AUTHORS', 'r', '0666')
fs.close(fd1)
lev.exit()
end)
co.resume(t1)
@kazupon
kazupon / Makefile
Created September 25, 2012 17:16
lua: native C-API coroutine sample
INCDIR = $(HOME)/opt/local/include/luajit-2.0
LIBDIR = $(HOME)/opt/local/lib
LIB = -lluajit-51
all: native
native:
cc --std=c99 -o native-co native.c -I$(INCDIR) -L$(LIBDIR) $(LIB) -pagezero_size 10000 -image_base 100000000
clean: