Skip to content

Instantly share code, notes, and snippets.

public class MajorCompactServersJob extends AbstractJob {
public static final String SHORT_OPT = "majorCompactServers";
public static final String LONG_OPT = "majorCompactServers";
public static final String DESCRIPTION = "Major compact all regions on a server or list of servers";
private final HBaseAdminWrapper wrapper;
private final SlowCompactionManager compactor;
private final RegionLoadEstimation regionLoadEstimation;
private final HdfsLocalityInfo hdfsLocalityInfo;
public class MergeIterables {
private MergeIterables() {}
public static <T extends Comparable<T>> Iterable<T> mergeIterables(final List<? extends Iterable<? extends T>> iterables) {
return mergeIterables(iterables, Ordering.<T>natural());
}
public static <T> Iterable<T> mergeIterables(final List<? extends Iterable<? extends T>> iterables, final Comparator<T> comparator) {
if (iterables.isEmpty()) {
return Collections.emptyList();
#!/usr/bin/env python
import sys
import mmh3
import math
import random
import struct
try:
import numpy as np
from matplotlib import pyplot
public class CommandHelloWorld extends HystrixCommand<String> {
private final String name;
public CommandHelloWorld(String name) {
super(HystrixCommandGroupKey.Factory.asKey("ExampleGroup"));
this.name = name;
}
@Override
// Before
Optional<Widget> maybeWidget = ...
if (maybeWidget.isPresent()) {
return maybeWidget.get();
} else {
throw new WidgetNotFoundException(widgetId);
}
// After
// All over the place
if (maybeWidget.isPresent()) {
return maybeWidget.get();
} else {
throw new WidgetNotFoundException(id);
}
// Maybe instead?
return maybeWidget.orThrow(new WidgetNotFoundException(id));
#!/bin/bash
if [[ -z $1 ]]; then
cd ~/Documents
find . -maxdepth 1 -type d -print0 | xargs -P8 -n1 -0 $0
rm -f /tmp/*.git.log
exit 0
fi
cd "$1"
if [[ -e ".git" ]]; then
return unless Modernizr.svg
return if Blog.isPhone()
return if /\#novine/.test(location.href)
return if not (/\#leavesdammit/i.test(window.location.href) or not $.browser.mozilla)
class NavVisualization
@links = [
source: "_root"
target: "_s11"
thickness: 5
@axiak
axiak / gist:3902068
Created October 16, 2012 21:07
Determine which portals have broken intelligence models
We couldn’t find that file to show.
require "rubygems"
require "net/https"
require "json"
require "uri"
require "pp"
request_url = "https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo"
url = URI.parse(request_url)