This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import mmh3 | |
import math | |
import random | |
import struct | |
try: | |
import numpy as np | |
from matplotlib import pyplot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CommandHelloWorld extends HystrixCommand<String> { | |
private final String name; | |
public CommandHelloWorld(String name) { | |
super(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")); | |
this.name = name; | |
} | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before | |
Optional<Widget> maybeWidget = ... | |
if (maybeWidget.isPresent()) { | |
return maybeWidget.get(); | |
} else { | |
throw new WidgetNotFoundException(widgetId); | |
} | |
// After |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All over the place | |
if (maybeWidget.isPresent()) { | |
return maybeWidget.get(); | |
} else { | |
throw new WidgetNotFoundException(id); | |
} | |
// Maybe instead? | |
return maybeWidget.orThrow(new WidgetNotFoundException(id)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |