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);
@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
@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
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
@hossman
hossman / gist:ee45f0e11736b0d1681e
Last active August 29, 2015 14:22
Subject: Recommender Systems
Mass Email sent to every Apache committer I know, from
some dude i've never heard of.
Apparently this is how big consulting companies make money?
Ask Open Source developers to provide free research?
14:47 <+hoss> oh man ... i'm so dissapointed by this....
14:47 <+hoss> http://todogroup.org/
14:47 <+hoss> i saw a tweet about this website, and clicked on it on my iPad.
14:47 <+hoss> main page says "For companies committed to open source."
14:48 <+hoss> with a header of "// TODO"
14:48 <+hoss> ever link in the footer (About, Members, Join, Q&A), went to a blank page with nothing on
it except that header "// TODO"
14:48 <+hoss> for 5 minutes i thought this was the greatest 1 note joke website since Zombo.com
14:49 <+hoss> aparently it's just a bug in their javascript/css on iOS5 safari.
14:49 <+hoss> the site actaully has some useful content and is a real thing
@hossman
hossman / gist:11ca11d3385c21ffe7fb
Created July 15, 2014 21:04
Spammers Appear To Have Equifax Customer Contact Data
Twitter exchange with equifax regarding apparent leak of customer contact info begins here...
https://twitter.com/_hossman/status/486558700019007489
@hossman
hossman / How *not* to recruit on IRC
Last active January 4, 2016 07:09
How *not* to recruit on IRC
=== How *not* to recruit on IRC
--- #solr on freenode
--- Wed Jan 22 2014
13:36 -!- syncsys [~syncsys@202.166.165.50] has joined #solr
13:36 < syncsys:#solr> any one knowing solr, databases good enough and can do a job in Washington. please contact me
13:37 < syncsys:#solr> any one knowing solr, databases good enough and can do a job in Washington. please contact masood@syncsysllc.com