Skip to content

Instantly share code, notes, and snippets.

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.function.Function;
class Scratch {
public static void main(String[] args) {
String[] letters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
ExecutorService executorService = Executors.newFixedThreadPool(4);
@jasontedor
jasontedor / log
Created February 13, 2019 21:11
Dealing with libcurl TLS 1.2 problems on Centos 6.6
16:06:01 [jason@totoro:~/src/elastic/elasticsearch] retention-lease-ccr(+53/-0)+ 1 ± docker run --rm -it centos:6.6 /bin/bash
[root@3d2b8c58426b /]# yum install wget
Loaded plugins: fastestmirror
Setting up Install Process
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:01
extras | 3.4 kB 00:00
extras/primary_db
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
@jasontedor
jasontedor / gist:1d81e8aeff7be870030fbdc24240a6bf
Created July 17, 2018 01:37
Building hsdis-amd64 for JDK 10.0.1
wget http://hg.openjdk.java.net/jdk-updates/jdk10u/archive/750eb3c6f356.zip
unzip 750eb3c6f356.zip
cd jdk10u-750eb3c6f356/src/utils/hsdis
wget https://ftp.gnu.org/gnu/binutils/binutils-2.19.1.tar.bz2
bunzip2 binutils-2.19.1.tar.bz2
tar xf binutils-2.19.1.tar
make CFLAGS="-fPIC -Wno-implicit-fallthrough -Wno-error=unused-value -Wno-error=cast-function-type -Wno-error=unused-but-set-parameter -Wno-error=unused-but-set-variable" BINUTILS=binutils-2.19.1 ARCH=amd64
@jasontedor
jasontedor / hsdis-jdk8.sh
Created May 22, 2017 20:53
Building the HotSpot Disassembly library from source
./clone-jdk8.sh # see https://gist.github.com/jasontedor/a1a38cfa646c186b8736#file-clone-jdk8-sh
cd hotspot/src/share/tools/hsdis
curl -L -O http://ftp.heanet.ie/mirrors/gnu/binutils/binutils-2.26.tar.gz
tar xf binutils-2.26.tar.gz
make BINUTILS=binutils-2.26 ARCH=amd64
sudo cp ./build/macosx-amd64/hsdis-amd64.dylib $JAVA_HOME/jre/lib/server/
@jasontedor
jasontedor / keybase.md
Created September 18, 2016 12:35
keybase.md

Keybase proof

I hereby claim:

  • I am jasontedor on github.
  • I am jasontedor (https://keybase.io/jasontedor) on keybase.
  • I have a public key ASALJ3HgnW1TZGuykEp_Fd3nvDDXKPPVrJlPjeoeWzGEAAo

To claim this, I am signing this object:

@jasontedor
jasontedor / clone-jdk10.sh
Last active August 24, 2019 14:51
Cloning the OpenJDK sources
#!/bin/bash
hg clone http://hg.openjdk.java.net/jdk10/jdk10 && cd jdk10 && chmod +x get_source.sh && ./get_source.sh
@jasontedor
jasontedor / InternalClusterService.java.diff
Created November 24, 2015 20:09
InternalClusterService.java synchronization
diff --git a/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java b/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java
index 3407a57..73d014e 100644
--- a/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java
+++ b/core/src/main/java/org/elasticsearch/cluster/service/InternalClusterService.java
@@ -90,7 +90,7 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
private final Collection<ClusterStateListener> priorityClusterStateListeners = new CopyOnWriteArrayList<>();
private final Collection<ClusterStateListener> clusterStateListeners = new CopyOnWriteArrayList<>();
private final Collection<ClusterStateListener> lastClusterStateListeners = new CopyOnWriteArrayList<>();
- private final Map<ClusterStateTaskExecutor, List<UpdateTask>> updateTasksPerExecutor = new HashMap<>();
+ private final ConcurrentMap<ClusterStateTaskExecutor, List<UpdateTask>> updateTasksPerExecutor = new
@jasontedor
jasontedor / ClusterFormationTasks.groovy
Created November 10, 2015 20:16
More robust handling of jps executable on Windows
File jps
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
jps = getJpsExecutableByName("jps.exe")
} else {
jps = getJpsExecutableByName("jps")
}
if (!jps.exists()) {
throw new GradleException("jps executable not found; ensure that you're running Gradle with the JDK rather than the JRE")
}
commandLine jps, '-l'
On branch emacs
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: core/src/main/java/org/apache/lucene/queries/BlendedTermQuery.java
modified: core/src/main/java/org/apache/lucene/search/postingshighlight/CustomPostingsHighlighter.java
modified: core/src/main/java/org/apache/lucene/search/suggest/analyzing/XFuzzySuggester.java
modified: core/src/main/java/org/apache/lucene/util/XGeoHashUtils.java
modified: core/src/main/java/org/apache/lucene/util/XGeoProjectionUtils.java