Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

#!/bin/bash
# fix for MacOS X users running out of ephemeral ports
# if network benchmark tools such as 'siege' or 'ab' freeze for several seconds:
# http://stackoverflow.com/questions/1216267/ab-program-freezes-after-lots-of-requests-why
# Enter sudo mode
sudo -i
# factory default as of Mac OS X 10.13.6; changing (lowering) this interferes with DNS resolution in most apps
def shingleFull(field: String, boost: Float, w: Array[String], fuzzyprefix: Int, maxShingle: Int, minShingle: Int = 1, fuzzy: Boolean = true) = {
val fieldQuery = boolQuery.minimumShouldMatch("33%")
(minShingle to math.min(maxShingle, w.length)).foreach { len =>
val lboost = boost * superBoost(len)
w.sliding(len).foreach { shingle =>
fieldQuery.should(fuzzyOrTermQuery(field, shingle.mkString(" "), lboost, fuzzyprefix, fuzzy))
}
}
nestIfNeeded(field, fieldQuery)
}