Skip to content

Instantly share code, notes, and snippets.

View ksss's full-sized avatar
🏠
Working from home

Yuki Kurihara ksss

🏠
Working from home
View GitHub Profile
@ksss
ksss / favster.user.js
Created August 6, 2011 10:59
show favo count on twitter
// ==UserScript==
// @name Favstar
// @namespace https://gist.github.com/1129263
// @description show favo count from favstar.fm
// @include http://twitter.com/*
// @include https://twitter.com/*
// ==/UserScript==
(function () {
var IMG = "star";
@ksss
ksss / cspec.c
Created February 19, 2012 13:39
cspec
/*
cspec.c
*/
#include <stdio.h>
#include <time.h>
#include "cspec.h"
#define false 0
#define true (!0)
@ksss
ksss / file.c
Created February 19, 2012 13:46
file
/*
file.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#define FEED "\r\n" /* windows */
@ksss
ksss / appendHTML
Created January 19, 2013 08:54
Fast insert Text on HTML
function appendHTML(elm,htm) {
if (document.createRange) {
var rangeObj = document.createRange ();
rangeObj.selectNodeContents(document.body);
if (rangeObj.createContextualFragment) {
// all browsers, except IE
var documentFragment = rangeObj.createContextualFragment(htm);
elm.insertBefore (documentFragment, elm.firstChild);
} else {
// Internet Explorer from version 9

"why?" is refactoring

why?

why is a thinking framework writed by program.

Thinking "why?" is refactoring in your mind.

Refactoring is be organized and it becomes easier to respond to changes. And most important thing is to continue refactoring.

@ksss
ksss / bench_result
Created October 9, 2013 03:32
benchmark result of Asciipack/js. master and 0.1.0.
---master
[positive fixint]
AsciiPack.pack: 173ms
AsciiPack.unpack: 75ms
JSON.stringify: 8ms
JSON.parse: 10ms
{ ap: 'f0', json: '0' }
[uint 4]
AsciiPack.pack: 209ms
AsciiPack.unpack: 80ms
@ksss
ksss / ruby
Last active December 26, 2015 04:58
asciipack/ruby/bench.rb results
$ ruby spec/bench.rb
"[positive fixint]"
"AsciiPack.pack: 0.414077s"
"AsciiPack.unpack: 0.587369s"
"JSON.generate: 0.26551s"
"JSON.parse: 0.317427s"
"Marshal.dump: 0.28272s"
"Marshal.load: 0.212695s"
"MessagePack.pack: 0.087657s"
"MessagePack.unpack: 0.219514s"
@ksss
ksss / c.md
Created October 27, 2013 05:03
object AsciiPack.pack AsciiPack.unpack MessagePack.pack MessagePack.unpack JSON.generate JSON.parse Marshal.dump Marshal.load
positive fixint 10.5 9.0 10.2 34.5 34.2 41.0 27.1 17.3
uint 64 11.0 12.1 14.8 23.3 43.6 49.0 36.8 27.1
int 4 9.9 8.8 9.6 39.6 40.4 41.5 21.5 22.5
int 64 10.8 10.2 12.1 22.2 41.9 34.7 31.5 26.3
float 64 8.4 10.2 12.0 35.4 33.1 35.4 23.5 24.4
fixstr 10.5 14.8 11.4 24.0 39.5 27.8 35.8 27.9
str 32 1900.7 274.0 347.2 45.7 4386.7 1935.2 302.6 438.2
map 4 8.7 10.2 9.7 36.3 31.1 26.7 32.4 22.5
object AsciiPack.pack AsciiPack.unpack MessagePack.pack MessagePack.unpack JSON.generate JSON.parse Marshal.dump Marshal.load
float 64 0.010000 0.019000 0.005000 0.021000 0.146000 0.091000 0.017000 0.016000
str (1KB) 0.010000 0.006000 0.003000 0.009000 0.012000 0.013000 0.008000 0.006000
str (1MB) 0.615000 0.624000 0.620000 0.010000 6.930000 2.674000 0.684000 0.664000
str (100MB) 62.311000 38.908000 65.697000 0.008000 694.667000 365.372000 95.101000 21.771000
map 32 11.278000 113.378000 10.985000 50.425000 64.025000 73.425000 75.885000 130.176000
array 32 1.099000 1.885000 1.026000 2.316000 2.418000 6.733000 5.400000 4.099000

RUBY_VERSION:2.0.0

struct neuron {
bool status; // on or off
float e; // 電位
struct neuron* esy // 興奮性シナプス
struct neuron* isy // 抑制性シナプス
}