Skip to content

Instantly share code, notes, and snippets.

View objectx's full-sized avatar

Masashi Fujita objectx

View GitHub Profile
wait-free/lock-free/obstruction-freeの定義について
▲全てに共通する概念
スレッドが他のスレッドの進行を禁止する事がないので、どれかのスレッドが
ロックを確保したままプリエンプションなどで全体の処理が停止する事態が発生しな
い。
これは必ずしもロックベースのアルゴリズムより高速であることを意味し
ない(現にロックの方が早い場合もある
wait-freeが一番強い条件で、それを弱める度に
@kanemu
kanemu / charset.groovy
Created October 10, 2010 10:28
[groovy]文字コード判定。icu4j使用。
// g100pon #32 文字コード判定
import com.ibm.icu.text.CharsetDetector
@Grab(group='com.ibm.icu', module='icu4j', version='4.0.1')
def detector = new CharsetDetector()
//ファイルは先に用意してあります...
//ISO-2022-JP
def bytes1 = new File('/works/test/iso2022-jp.txt').getBytes()
def name1 = detector.setText(bytes1).detect().getName()
@fcy
fcy / objectivec.def
Created December 2, 2010 14:01
Syntax highlight definition for Atlassian Fisheye and Crucible. Save the file in <FISHEYE_INST>/syntax and update <FISHEYE_INST>/syntax/filemap to objective-c file extensions.
# Objective-C Syntax Highliht for Atlassian Fisheye and Crucible
# Based on Atlassian's C syntax highlight
# Author: Felipe Cypriano <fmcypriano@gmail.com>
# Copyright 2010 Felipe Cypriano
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@taichi
taichi / code_reading.md
Last active April 10, 2024 13:04
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる
@jboner
jboner / latency.txt
Last active July 20, 2024 12:55
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
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 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@voluntas
voluntas / gist:73efe2f36ac1513c02a8
Created August 5, 2012 16:13
レビューのススメ?

レビューのススメ?

typo 死ぬほど多いので突っ込みまってます

バージョン:0.2.3
作者:@voluntas

考え方はコロコロ変わるタイプなのですが、最近はレビューが実はとても大事でとにもかくにもレビューなのでは?と思い始めてきています。

@yingtai
yingtai / brainfuck.hs
Created August 10, 2012 23:08
Brainfuck Interpreter
import Control.Applicative ((<$>))
import Control.Monad (liftM2)
import Data.Char (chr, ord)
import Data.List (group)
import System.Environment (getArgs)
import Text.Parsec
import Text.Parsec.String
data Inst = Inc | Dec | R | L | In | Out
deriving Show