Skip to content

Instantly share code, notes, and snippets.

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.
Block or report user

Report or block spullara

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
package spullara.util.concurrent;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean;
spullara / profile.svg
Last active Sep 3, 2019
Profile of javac 11 compiling 155 classes, 42000 loc
View profile.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
spullara /
Created Dec 25, 2011
Invokedynamic all in one example
package indy;
import java.lang.invoke.CallSite;
import java.lang.invoke.ConstantCallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Constructor;
import org.objectweb.asm.ClassWriter;
View jlink
View bitsquatting.log
/var/log/httpd/cloudfront_log:"" - - [22/Aug/2011:00:32:55 +0000] "GET /bulk_images/69632/banner-small-planet-holiday-batam.jpg HTTP/1.1" 404 348 "" "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0"
/var/log/httpd/cloudfront_log:"" - - [22/Aug/2011:17:27:58 +0000] "GET /75.html HTTP/1.0" 404 300 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YPC 3.0.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
/var/log/httpd/cloudfront_log:"" - - [23/Aug/2011:05:02:10 +0000] "GET /icons/apache_pb2.gif HTTP/1.1" 200 1797 "" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1"
/var/log/httpd/cloudfront_log:"" - - [23/Aug/2011:05:02:10 +00
spullara /
Created Jul 30, 2018
Comparing Java Fibers vs ForkJoinPool - performance of FJP is 60% faster than Fibers are currently and use less memory
package com.sampullara.fibers;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
public class App {
public static final int NUM = 100_000_000;
spullara /
Last active Jul 9, 2018
Output a star rating using Java backing code.
public class Rated {
public Rated(JsonNode node) {
starRating = node.get("rating").intValue();
int starRating;
class Star {
boolean active;
spullara /
Last active Jun 13, 2018
Server-side count of keys for FoundationDB. Still has to scan the complete database. Modified with input from the FDB team to use getKey.
// 1) Stride through the database using KeySelectors until you pass the end of the database
// 2) Then, back off until you find the last key
final AtomicBoolean retry = new AtomicBoolean();
Function<Transaction, Long> function = new Function<Transaction, Long>() {
private long start = System.currentTimeMillis();
private long count = 0;
private int offset = 1000000;
private KeySelector keySelector = KeySelector.firstGreaterOrEqual(new byte[0]);
private boolean narrowing = false;
Timer timer = mr.timer("jvm.pausetime");
new Thread(() -> {
while (true) {
long start = System.nanoTime();
try {
} catch (InterruptedException e) {
// ignore
long diff = System.nanoTime() - start;
package preloadagent;
Copyright 2010 Sam Pullara
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
You can’t perform that action at this time.