Skip to content

Instantly share code, notes, and snippets.

@hossman
hossman / 1 Temp.java
Last active January 22, 2020 22:38
OOM Handling w/ThreadPools
import java.util.concurrent.*;
public final class Temp {
public static void triggerOOM(boolean real) {
if (real) {
final long[][] trash = new long[Integer.MAX_VALUE][Integer.MAX_VALUE];
// if we make it this far complain
System.err.println("Your JVM heap is too big for this test");
System.exit(-1);
bin/solr -e cloud -noprompt
curl -H 'Content-Type: application/json' 'http://localhost:8983/solr/gettingstarted/update/json/docs?commit=true' --data-binary '[{"id":"hoss", "features_t":"the quick brown fox jumped over the lazy dog"},{"id":"xxx","features_t":"the lazy dog hid from the quick brown fox"}]'
curl 'http://localhost:8983/solr/gettingstarted/select?q=features_t:%22brown+dog%22%7E100&indent=true'
{
"responseHeader":{
"zkConnected":true,
@hossman
hossman / gist:815032db878e898f63c1d90ff02f1b3f
Created March 28, 2018 16:45
why java float math is fun -- aka -- IEEE 754 and base2 rounding
public final class Temp {
public static void main(String[] args) throws Exception {
// why java float math is fun
// aka: IEEE 754 and base2 rounding
System.out.println("0.0 + 0.3 = " + (0.0F + 0.3F)); // 0.3
System.out.println("0.3 + 0.3 = " + (0.3F + 0.3F)); // 0.6
System.out.println("0.6 + 0.3 = " + (0.6F + 0.3F)); // 0.90000004
System.out.println("0.0 + 0.3 = " + (0.0D + 0.3D)); // 0.3
check-licenses:
[echo] License check under: /home/hossman/lucene/dev/solr
[licenses] MISSING sha1 checksum file for: /home/hossman/lucene/dev/solr/solr-ref-guide/lib/asciidoctor-ant-1.6.0-alpha.3.jar
[licenses] EXPECTED sha1 checksum file : /home/hossman/lucene/dev/solr/licenses/asciidoctor-ant-1.6.0-alpha.3.jar.sha1
[licenses] MISSING sha1 checksum file for: /home/hossman/lucene/dev/solr/solr-ref-guide/lib/json-20160810.jar
[licenses] EXPECTED sha1 checksum file : /home/hossman/lucene/dev/solr/licenses/json-20160810.jar.sha1
[licenses] MISSING sha1 checksum file for: /home/hossman/lucene/dev/solr/solr-ref-guide/lib/jsoup-1.8.2.jar
[licenses] EXPECTED sha1 checksum file : /home/hossman/lucene/dev/solr/licenses/jsoup-1.8.2.jar.sha1
[licenses] MISSING sha1 checksum file for: /home/hossman/lucene/dev/solr/solr-ref-guide/lib/slf4j-simple-1.7.7.jar
[licenses] EXPECTED sha1 checksum file : /home/hossman/lucene/dev/solr/licenses/slf4j-simple-1.7.7.jar.sha1
ADOC...
|retrieve contents | |truefootnoteref:[8,Stored content will be used by default, but docValues can alternatively be used. See <<docvalues.adoc#docvalues,DocValues>>] | | | | |truefootnoteref:[8]
HTML....
<tr>
@hossman
hossman / __README.txt
Last active September 9, 2016 01:51
adoc-multi-include-reldir-bug
Demonstration of https://github.com/asciidoctor/asciidoctor/issues/1866
Organize these files like so...
adoc-multi-include-reldir-bug
adoc-multi-include-reldir-bug/src
adoc-multi-include-reldir-bug/src/site
adoc-multi-include-reldir-bug/src/site/x.adoc
adoc-multi-include-reldir-bug/src/site/y.adoc
adoc-multi-include-reldir-bug/src/wrapper-ok.adoc
@hossman
hossman / __README.txt
Last active September 8, 2016 23:24
adoc-multi-include-anchors-bug
Gist for demonstrating https://github.com/asciidoctor/asciidoctor/issues/1865
Organize these files like so...
adoc-multi-include-anchors-bug/
adoc-multi-include-anchors-bug/src
adoc-multi-include-anchors-bug/src/wrapper.adoc
adoc-multi-include-anchors-bug/src/site
adoc-multi-include-anchors-bug/src/site/x.adoc
adoc-multi-include-anchors-bug/src/site/y.adoc
hossman@tray:~/lucene/dev/solr [master] $ find -name \*.java | xargs grep checkPeerName
./solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java: public static final String SYS_PROP_CHECK_PEER_NAME = "solr.ssl.checkPeerName";
hossman@tray:~/lucene/dev/solr [master] $ find -name \*.java | xargs grep SYS_PROP_CHECK_PEER_NAME
./test-framework/src/java/org/apache/solr/util/SSLTestConfig.java: boolean sslCheckPeerName = toBooleanDefaultIfNull(toBooleanObject(System.getProperty(HttpClientUtil.SYS_PROP_CHECK_PEER_NAME)), true);
./solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java: public static final String SYS_PROP_CHECK_PEER_NAME = "solr.ssl.checkPeerName";
@hossman
hossman / .bashrc.gitsanity.sh
Last active April 14, 2016 21:54
Life got so much better once i added this to my bashrc: git_sanity
# git sanity
function sane_git {
if [[ $1 == "pull" ]]; then
echo "Don't be a schmuck!";
echo
echo "Use 'git fetch' and then merge/rebase as appropriate like a sane person."
echo
else
"`which git`" $@
fi
Date: Fri, 16 Jul 2004 07:38:56 -0700 (PDT)
From: Heath Silverman
Subject: Re: old pics of some old legends...
you call that old? how about:
http://www.rescomp.berkeley.edu/resources/insight/archives/v3-issue1/centerfold/
&
http://www.rescomp.berkeley.edu/resources/insight/archives/v2-issue1/#RCC