Skip to content

Instantly share code, notes, and snippets.

@shnjp
shnjp / tunnel.py
Created March 5, 2011 06:29
ssh tunnel for Fabric
"""
Fabric tunneling utilities
by shn@glucose.jp
class ForwardServer and relates things are refere Robey Pointer's paramiko example.
(http://bazaar.launchpad.net/~robey/paramiko/trunk/annotate/head%3A/demos/forward.py)
usage::
with make_tunnel('user@192.168.0.2:10022') as t:
@jorgeortiz85
jorgeortiz85 / FoldUnion.scala
Created June 9, 2011 17:11
Folding over Scala union types
type ¬[A] = A => Nothing
type ∨[T, U] = ¬[¬[T] with ¬[U]]
type ¬¬[A] = ¬[¬[A]]
type |∨|[T, U] = { type λ[X] = ¬¬[X] <:< (T ∨ U) }
class FoldUnion[T](t: T) {
def boxClass(x: java.lang.Class[_]): java.lang.Class[_] = x.toString match {
case "byte" => manifest[java.lang.Byte].erasure
case "char" => manifest[java.lang.Character].erasure
case "short" => manifest[java.lang.Short].erasure
trait Association {
type Item <: AbstractItem
trait AbstractItem {
def memberOf(): Group
}
type Group <: AbstractGroup
trait AbstractGroup {
def addItem(item: Item)
def removeItem(item: Item)
def items(): List[Item]
@yamkazu
yamkazu / architecture.png
Created September 8, 2011 03:48
Netty Architectural Overview
architecture.png
@xuwei-k
xuwei-k / README.md
Created September 15, 2011 14:07
"hello" を返すだけのサーバーを unfiltered で !

これ http://blog.twiwt.org/e/f835d9 がインストールされていれば、ファイルを保存して、実行権限与えておいて

./unfiltered-sample.scala

ってやるだけでローカルで、勝手に空いてるポートで、"hello" を返すだけのサーバー起動するお( ^ω^)

終了は、コンソールでなにかキーを入力すればいいはず

@FaKod
FaKod / gist:1331556
Created November 1, 2011 19:05
The Neo4j Matrix Example with Neo4j-Scala
/**
* The Matrix Example
* http://wiki.neo4j.org/content/The_Matrix
*/
case class Matrix(name: String, profession: String)
object TheMatrix extends App with Neo4jWrapper with EmbeddedGraphDatabaseServiceProvider {
ShutdownHookThread {
shutdown(ds)
@hishidama
hishidama / Sample1AppMstr.java
Created November 21, 2011 22:21
Hadoop0.23 YARN 最小限サンプル
package sample1;
import java.net.InetSocketAddress;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.yarn.api.AMRMProtocol;
@juno
juno / apache-zookeeper-memo.md
Created December 13, 2011 11:29
Apache Zookeeperメモ

Apache Zookeeperメモ

  • Apache Hadoopプロジェクトの1つ
  • GoogleのChubbyに関する論文がベース
  • 分散ロックサービス以上のもの
  • 高可用性の分散メタデータファイルシステム実装と考えたほうがよい
  • ツリーベースのファイルシステムAPI
    • クライアントはノードを作れる
  • ノードには1MBまでのデータを格納できる
OK, I understand what is not supported (now?).
In this case, hoop server should send response message means correct reason, like
'concurrent append not supported'.
But now, in fact, hoop send message as 'failed to create file'. We cannot know what is wrong
from this message. (request method? wrong path? or ...?)
This is wrong message, and i want to be fixed.
@arosien
arosien / gist:1712108
Created January 31, 2012 18:41
scalaz operator cheat sheet
F[A] // A is a Functor
M[A] // A is a Monad
fa: F[A], a: A // variables used below
fa1 |+| fa2 // binary append (SemiGroup)
fa1 >| fa2 // map (Functor)
fa1 >>= fa2 // flatmap (Bind)
fa1 |>| fa2 // foreach (Each)
fa <**> fb { (a, b) => c } // apply, produces F[C]