Skip to content

Instantly share code, notes, and snippets.

@zcox
zcox / gist:38072d0e3d66f779e552
Created June 27, 2014 20:06
jank shell script to extract dynamic hbase master port from zookeeper
#!/bin/bash
hostname=`hostname`
regex="${hostname}${hostname},([0-9]+),"
out=`/usr/lib/zookeeper/bin/zkCli.sh <<EOF
get /hbase/master
quit
EOF`
[[ $out =~ $regex ]]
@zcox
zcox / gist:6827796
Last active December 24, 2015 16:28
scala> val m = Map("a" -> 1, "b" -> 2)
m: scala.collection.immutable.Map[String,Int] = Map(a -> 1, b -> 2)
type StringIntMap = scala.collection.immutable.Map[String, Int]
val m: StringIntMap = Map("a" -> 1)
val m: Map[String, Int] = Map[String, Int]("a" -> 1)
val m: Map[String, Int] = Map("a" -> 1)
val m = Map[String, Int]("a" -> 1)
val m = Map("a" -> 1)
val m = Map("a" -> 1, "b" -> 2)
m = { :a => 1, :b => 2 }
{:a 1, :b 2}
def m = [a:1, b:2]
import java.util.*;
Map<String, Integer> m = new HashMap<String, Integer>();
m.put("a", 1);
m.put("b", 2);
@zcox
zcox / gist:6826931
Last active December 24, 2015 16:19
val talk = Map(
"title" -> "Scala Map Literals are not Syntactic Sugar",
"presenter" -> "Zach Cox",
"twitter" -> "@zcox",
"meetup" -> "iascala",
"date" -> "2013-10-09")
@zcox
zcox / Main.scala
Created August 29, 2013 14:44
titan-server-cassandra-es.properties shows how to set up Titan Server's ElasticSearch to accept remote connections (local-mode=false allows remote connections on port 9300). Main.scala shows how to configure TitanGraph to use the Titan Server's ElasticSearch.
val conf = new BaseConfiguration()
conf.setProperty("storage.backend","cassandra")
conf.setProperty("storage.hostname","127.0.0.1")
conf.setProperty("storage.index.search.backend", "elasticsearch")
conf.setProperty("storage.index.search.hostname", "127.0.0.1")
val graph = TitanFactory.open(conf)
@zcox
zcox / gist:6377426
Last active December 21, 2015 22:48
val conf = new BaseConfiguration()
conf.setProperty("storage.backend","cassandra")
conf.setProperty("storage.hostname","127.0.0.1")
conf.setProperty("storage.index.search.backend", "elasticsearch")
conf.setProperty("storage.index.search.hostname", "127.0.0.1:9200")
conf.setProperty("storage.index.search.client-only", true)
conf.setProperty("storage.index.search.local-mode", false)
val graph = TitanFactory.open(conf)