Skip to content

Instantly share code, notes, and snippets.

@saicologic
saicologic / platform.sh
Created June 7, 2011 09:42 — forked from unakatsuo/gist:537584
fork of s3-bash
#!/bin/bash
if [ `uname` = "SunOS" ]; then
alias grep='/usr/gnu/bin/grep'
fi
@saicologic
saicologic / gist:1170287
Created August 25, 2011 09:04 — forked from unakatsuo/gist:1165990
Simple state transition check code.
class StateTrack
def initialize
@state = :initialized
end
# Expected state transition:
# :initialized -> :starting -> :running -> :shuttingdown -> :terminated
def process_event(ev, *args)
case [ev, @state]
when [:on_start, :initialized]
@saicologic
saicologic / dozens.rb
Created March 31, 2012 02:28 — forked from chsh/dozens.rb
Ruby class to access Dozens API.
require 'net/http'
require 'uri'
require 'json'
class Dozens
API_BASE = 'http://dozens.jp/api/'
ZONE_BASE = API_BASE + 'zone'
RECORD_BASE = API_BASE + 'record'

#NoSQLデータモデリング技法

原文:NoSQL Data Modeling Techniques « Highly Scalable Blog

I translated this article for study. contact matope[dot]ono[gmail] if any problem.

NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。

本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う

@saicologic
saicologic / app.rb
Created May 14, 2012 07:16 — forked from mfojtik/app.rb
sinatra with simple worker and queue
require 'rack'
require 'sinatra/base'
require 'uuidtools'
require 'rest-client'
require 'eventmachine'
require 'json'
require_relative './cache'
class Worker < EM::Connection
attr_reader :query
@saicologic
saicologic / latency.txt
Created July 26, 2012 05:10 — forked from rtomayko/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@saicologic
saicologic / 00.md
Created March 20, 2014 08:34 — forked from hayajo/00.md
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
import os.path
import bz2
from gensim.corpora import WikiCorpus
from gensim.corpora.wikicorpus import filterWiki
require 'rake'
require 'rspec/core/rake_task'
require 'yaml'
require 'highline/import'
properties = YAML.load_file('properties.yaml')
ENV['SSH_USER'] = ask("Enter ssh user: ") { |q| q.echo = true }
ENV['SSH_PASSWORD'] = ask("Enter ssh password: ") { |q| q.echo = false }
@saicologic
saicologic / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console