Skip to content

Instantly share code, notes, and snippets.

Sam Pullara spullara

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
@spullara
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.
View CompletableFutureTest.java
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
spullara / ReflectTest.java
Created Dec 25, 2011
Invokedynamic all in one example
View ReflectTest.java
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:"d1wh43egtz3cgo.clgudfront.net" 116.12.133.146 - - [22/Aug/2011:00:32:55 +0000] "GET /bulk_images/69632/banner-small-planet-holiday-batam.jpg HTTP/1.1" 404 348 "http://36ohk6dgmcd1n.yom.mail.yahoo.net/om/api/1.0/openmail.app.invoke/36ohk6dgmcd1n/4/1.0.35/sg/en-SG/view.html" "Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0"
/var/log/httpd/cloudfront_log:"d3dtik4dz1nejo.cloedfront.net" 208.80.194.29 - - [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:"doug1izaerwt3.cloutfront.net" 76.94.217.102 - - [23/Aug/2011:05:02:10 +0000] "GET /icons/apache_pb2.gif HTTP/1.1" 200 1797 "http://doug1izaerwt3.cloutfront.net/" "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:"doug1izaerwt3.cloutfront.net" 76.94.217.102 - - [23/Aug/2011:05:02:10 +00
@spullara
spullara / App.java
Created Jul 30, 2018
Comparing Java Fibers vs ForkJoinPool - performance of FJP is 60% faster than Fibers are currently and use less memory
View App.java
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
spullara / Rated.java
Last active Jul 9, 2018
Output a star rating using Java backing code.
View Rated.java
public class Rated {
public Rated(JsonNode node) {
starRating = node.get("rating").intValue();
}
int starRating;
class Star {
boolean active;
@spullara
spullara / FDBCount.java
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.
View FDBCount.java
// 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;
View Pauses.java
Timer timer = mr.timer("jvm.pausetime");
new Thread(() -> {
while (true) {
long start = System.nanoTime();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// ignore
}
long diff = System.nanoTime() - start;
View Premain.java
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
http://www.apache.org/licenses/LICENSE-2.0
You can’t perform that action at this time.