Skip to content

Instantly share code, notes, and snippets.

View robdaemon's full-sized avatar

Robert Roland robdaemon

View GitHub Profile
@robdaemon
robdaemon / AbstractModelAdapter.java
Created August 22, 2012 03:17
rejected execution exception
@Override
public void persist(Map<String, Object> data) throws Exception {
Map<String, List<Row>> databaseOperations = generateDatabaseOperations(data);
for(String table: databaseOperations.keySet()) {
List<Row> batch = databaseOperations.get(table);
PutHelper.writeToTable(connectionPool, table, batch);
}
}
@robdaemon
robdaemon / repl.txt
Created February 11, 2013 00:20
nREPL error within emacs
; nREPL 0.1.6
user> (use 'midje.repl)
CompilerException java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory, compiling:(cemerick/pomegranate/aether.clj:40:54)
user>
; nREPL 0.1.6
user> (use 'midje.repl)
CompilerException java.lang.NoClassDefFoundError: org/apache/http/client/AuthCache, compiling:(cemerick/pomegranate/aether.clj:40:54)
user> (pst)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: pst in this context, compiling:(NO_SOURCE_PATH:1:1)
user>
@robdaemon
robdaemon / region_counts.rb
Created March 8, 2013 21:25
Get region counts for an HBase service
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.client.HTable
import org.apache.hadoop.hbase.util.Bytes
conf = HBaseConfiguration.create()
admin = HBaseAdmin.new(conf)
tables = admin.listTables()
@robdaemon
robdaemon / KeyValueBuilder.java
Created March 20, 2013 23:46
Every once in a while you need to modify an HBase KeyValue in various ways depending on conditional logic. This is a simple builder pattern applied to a KeyValue with a copy constructor.
package com.simplymeasured.doormouse.mapreduce.utils;
import org.apache.hadoop.hbase.KeyValue;
/**
* Stupid-simple builder pattern applied to the HBase KeyValue class.
*
* Makes it easier to manipulate KeyValues in map/reduce jobs
*
* @author rob@simplymeasured.com
@robdaemon
robdaemon / sqlite-test-suite.dylan
Created August 8, 2013 05:32
Attempted macro for implementing a "with-sqlite-db"
define macro with-sqlite-db
{ with-sqlite-db (?db-location:expression) ?:body end }
=> {
let (result, sqlite3-db) = sqlite3-open(?db-location);
?body;
sqlite3-close(sqlite3-db);
}
end macro with-sqlite-db;
@robdaemon
robdaemon / built.sbt
Last active December 22, 2015 16:29
build.sbt that allows you to compile with the jersey-client 2.2 jar
name := "prefect"
version := "1.0"
scalaVersion := "2.10.2"
libraryDependencies ++= Seq(
"org.glassfish.jersey.core" % "jersey-client" % "2.2" excludeAll(
ExclusionRule(organization = "org.glassfish.hk2")
),
@robdaemon
robdaemon / gist:7363889
Created November 7, 2013 23:48
protoc compile in 10.9
google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParseFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_istream;
^
google/protobuf/message.cc:135:67: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParsePartialFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
@robdaemon
robdaemon / gist:7541259
Created November 19, 2013 06:46
default GC settings
-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSParallelRemarkEnabled

Keybase proof

I hereby claim:

  • I am robdaemon on github.
  • I am robdaemon (https://keybase.io/robdaemon) on keybase.
  • I have a public key whose fingerprint is CCA2 8FEA 219F 24CD 23C2 8249 5E92 B664 427E 1A4B

To claim this, I am signing this object: