I hereby claim:
- I am benhardy on github.
- I am benhardy (https://keybase.io/benhardy) on keybase.
- I have a public key whose fingerprint is F313 68B9 32AA 2C12 E021 D863 0A6F DC0E DF9F EB9C
To claim this, I am signing this object:
public List<String> randomDictionaryWords() throws IOException { | |
try (InputStream is = new FileInputStream(new File("/usr/share/dict/words"))) { | |
BufferedReader br = new BufferedReader(new InputStreamReader(is)); | |
return br.lines() | |
.filter(line -> line.length() >= MIN_WORD_LENGTH && line.length() <= MAX_WORD_LENGTH) | |
.filter(word -> word.equals(word.toLowerCase())) | |
.filter(word -> random() < DICTIONARY_SAMPLING_RATE) | |
.limit(50) | |
.collect(Collectors.toList()); |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env sh | |
TARBALL_URL=$1 | |
APP_NAME=$2 | |
echo "Cleaning up any previous $APP_NAME directory" | |
rm -rf $APP_NAME | |
echo "curling $TARBALL_URL -> $APP_NAME.tgz" | |
curl $TARBALL_URL -o $APP_NAME.tgz |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: imklog 5.8.6, log source = /proc/kmsg started. | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Initializing cgroup subsys cpuset | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Initializing cgroup subsys cpu | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Linux version 3.2.0-67-generic (buildd@brownie) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #101-Ubuntu SMP Tue Jul 15 17:46:11 UTC 2014 (Ubuntu 3.2.0-67.101-generic 3.2.60) | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-67-generic root=UUID=02102d06-ff39-4079-899f-c3ec91691ea3 ro quiet splash | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] KERNEL supported cpus: | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Intel GenuineIntel | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] AMD AuthenticAMD | |
Aug 21 00:14:10 ci-na-frontdoor-03 kernel: [ 0.000000] Centaur CentaurHauls | |
Aug 21 00:14:10 ci |
I hereby claim:
To claim this, I am signing this object:
public static <T> Iterable<T> asIterable(final Enumeration<T> anotherHorribleEnumeration) { | |
return () -> new Iterator<T>() { | |
@Override | |
public boolean hasNext() { | |
return anotherHorribleEnumeration.hasMoreElements(); | |
} | |
@Override | |
public T next() { | |
return anotherHorribleEnumeration.nextElement(); |
public static <T> Stream<T> asStream(final Enumeration<T> horror) { | |
if (horror.hasMoreElements()) { | |
return Stream.concat(Stream.of(horror.nextElement()), asStream(horror)); | |
} else { | |
return Stream.empty(); | |
} | |
} |
// I probably should make a Maven plugin that generates this code. | |
public final class AddressBuilder { | |
public interface Street2 { | |
City street2(String street2); | |
} | |
public interface City { | |
State city(String city); | |
} | |
public interface State { |
#!/bin/sh | |
# | |
# Show resource usage as reported by Singularity | |
# | |
# author: github.com/benhardy | |
set -o errexit -o nounset | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 singularity-resource-usage.sh SINGULARITY_SERVER" |
package monty; | |
import static com.google.common.collect.ImmutableSet.of; | |
import static com.google.common.collect.Sets.difference; | |
import static java.util.stream.Collectors.toList; | |
import static org.junit.Assert.assertEquals; | |
import java.util.List; | |
import java.util.Set; |