Skip to content

Instantly share code, notes, and snippets.

View esammer's full-sized avatar

Eric Sammer esammer

View GitHub Profile
// The MR contract says we're guaranteed to get:
// 1. each key exactly once.
// 2. keys in sorted order.
// 3. all values for each key.
//
// We are not guaranteed to get values in any particular order, however.
// Let's fix that.
void reduce(Text key, Iterator<LongWritable> values, Context<Text, LongWritable> context) {
// Create a copy buffer and slurp all values out of the iterator.
python -c 'import random
r = random.Random()
ops = [ "fuck", "shit", "stack", "put it in a glass bowl", "take it off the wall" ]
for i in range(0, 10):
for j in range(0, 10):
print ops[int(round(r.uniform(0, len(ops) - 1)))],
print "\n"
'
@esammer
esammer / OptionBuilder.java
Created November 3, 2013 20:11
The lack of a good way to build (full featured) Option instances with Apache Commons CLI kills me. I use this.
/*
* Copyright 2013 Cloudera Inc.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@esammer
esammer / dist.xml
Last active August 29, 2015 14:00
How to set up a maven project for sane docbook generation.
<!--
~ Copyright (c) 2014 Scaling Data. All rights reserved. This gist is licensed under the Apache Software License v2.0.
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
RequiredAcks

The level of acknowledgement you wish to receive before the message is to be considered delivered. There is a performance/reliability trade off inherent in choosing a value for this setting. Defaults to WaitForLocal.

Required.

Example

requiredNumAck

An integer indicating the acknowledgement mode for messages sent to Kafka. This setting affects the durability of messages.

0

The producer never waits for an acknowledgement from the broker. This option provides the lowest latency but the weakest durability guarantees (some data will be lost when a server fails).

1
syntax on
filetype plugin on
set ts=2
set sw=2
set et
set number
set ai
set si
set nowrap
48 [WARNING] Found duplicate and different classes in [commons-beanutils:commons-beanutils:1.8.3, commons-collections:commons-collections:3.2.1]:
49 [WARNING] org.apache.commons.collections.ArrayStack
50 [WARNING] org.apache.commons.collections.Buffer
51 [WARNING] org.apache.commons.collections.BufferUnderflowException
52 [WARNING] org.apache.commons.collections.FastHashMap
// What data type is `hello` and `intro`?
task hello << {
println 'Hello world!'
}
task intro(dependsOn: hello) << {
println "I'm Gradle"
}
esammer$ jekyll
/Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler/rubygems_ext.rb:23:in `source': uninitialized constant Gem::Source (NameError)
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.0/lib/bundler/rubygems_ext.rb:65:in `extension_dir'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:322:in `have_file?'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:79:in `contains_requirable_file?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1082:in `block (2 levels) in find_in_unresolved_tree'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:2621:in `[]'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:2621:in `block (2 levels) in traverse'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:2616:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:2616:in `block in traverse'