Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
The mess cannot go into the program, it piles up around the programmer.

Sam Pullara spullara

💭
The mess cannot go into the program, it piles up around the programmer.
View GitHub Profile
View MaybeParallel.java
package spullara.streams;
import java.util.ArrayList;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
View ExceptionInferenceBug.java
package spullara;
public class ExceptionInferenceBug {
interface Function<T, V> extends PartialFunction<T, V> {
V apply(T paramT);
}
interface PartialFunction<T, V> {
V apply(T paramT) throws Exception;
}
@spullara
spullara / JavacBug.java
Last active Aug 29, 2015
Lambda Javac Bug
View JavacBug.java
package lambda;
public class JavacBug {
interface Function<T, V> extends PartialFunction<T, V> {
V apply(T paramT);
}
interface PartialFunction<T, V> {
V apply(T paramT) throws Exception;
}
View gist:5c34cd63cf2c2879763a
@Override
public <T> T run(final Function<? super Transaction, T> tFunction) {
return database.run(new Function<Transaction, T>() {
int tries = 0;
@Override
public T apply(Transaction tx) {
if (tries++ > 0) {
log.info("Retrying transaction: " + tries);
}
View keybase.md

Keybase proof

I hereby claim:

  • I am spullara on github.
  • I am spullara (https://keybase.io/spullara) on keybase.
  • I have a public key whose fingerprint is 68CB 3BDC 2346 AB6E 0BF7 58BC 7C13 E77B A6D1 A33E

To claim this, I am signing this object:

@spullara
spullara / nodyn.txt
Created Jan 7, 2015
Nodyn stack trace during compilation
View nodyn.txt
"user-tasks" #19 prio=5 os_prio=31 tid=0x00007f8bdc28b800 nid=0x4f03 runnable [0x000000011f631000]
java.lang.Thread.State: RUNNABLE
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
at java.util.regex.Pattern$Loop.matchInit(Pattern.java:4804)
at java.util.regex.Pattern$Prolog.match(Pattern.java:4741)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
at java.util.regex.Pattern$Curly.match1(Pattern.java:4287)
at java.util.regex.Pattern$Curly.match(Pattern.java:4236)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
at java.util.regex.Pattern$Begin.match(Pattern.java:3525)
View gist:266951
private static float search(final HTablePool pool, byte[] woeid, Position pos, Set<Integer> container, float smallestArea) throws IOException, JAXBException {
final HTable placesTable = getTable(PLACES);
Get get = new Get(woeid);
get.addFamily(CHILDREN);
Result children = placesTable.get(get);
searchCounter.getAndIncrement();
try {
NavigableMap<byte[], byte[]> map = children.getFamilyMap(CHILDREN);
ExecutorCompletionService<Result> service = new ExecutorCompletionService<Result>(es);
if (map != null) {
View gist:268178
Exception in thread "main" java.lang.IndexOutOfBoundsException: toIndex = 16557
at java.util.SubList.<init>(AbstractList.java:602)
at java.util.RandomAccessSubList.<init>(AbstractList.java:758)
at java.util.AbstractList.subList(AbstractList.java:468)
at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:607)
at com.sampullara.geoplanet.Loader.main(Loader.java:181)
View gist:269779
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TwitterFirehose</groupId>
<artifactId>TwitterFirehose</artifactId>
<version>0.1.0</version>
View gist:274437
package com.sampullara.survivor;
import java.security.SecureRandom;
import java.util.Random;
public class Simulator {
public static void main(String[] args) {
Random r = new SecureRandom();
double[] correct = new double[] {
.9525,
You can’t perform that action at this time.