I hereby claim:
- I am ogregoire on github.
- I am ogregoire (https://keybase.io/ogregoire) on keybase.
- I have a public key ASA0h2SBHE-twB-WbT-Pp4aimGzSWu5wNo-dDSxhskHpjgo
To claim this, I am signing this object:
| package replacer; | |
| import static com.google.common.base.Preconditions.checkArgument; | |
| import static com.google.common.base.Preconditions.checkNotNull; | |
| import com.google.common.base.Function; | |
| import com.google.common.base.Functions; | |
| import com.google.common.collect.ImmutableMap; | |
| import com.google.common.collect.ImmutableSet; | |
| import com.google.common.collect.Iterables; |
| Not empty content |
I hereby claim:
To claim this, I am signing this object:
| OkHttpClient client = new OkHttpClient.Builder() | |
| // Logging | |
| .addInterceptor(new HttpLoggingInterceptor(System.err::println).setLevel(HttpLoggingInterceptor.Level.BODY)) | |
| // Timeout | |
| .connectTimeout(60, TimeUnit.SECONDS) | |
| .writeTimeout(60, TimeUnit.SECONDS) | |
| .readTimeout(60, TimeUnit.SECONDS) | |
| // Proxy | |
| .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)) | |
| .proxyAuthenticator(($, response) -> response.request().newBuilder() |
| public class Strings { | |
| // From https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Java | |
| public int levenshteinDistance (CharSequence lhs, CharSequence rhs) { | |
| int len0 = lhs.length() + 1; | |
| int len1 = rhs.length() + 1; | |
| // the array of distances | |
| int[] cost = new int[len0]; | |
| int[] newcost = new int[len0]; | |
| public class DhondtMethod { | |
| public int[] partition(int totalSeats, int[] votes) { | |
| int[] seats = new int[votes.length]; | |
| if (totalSeats == 0) { | |
| return seats; | |
| } | |
| if (votes.length == 0) { | |
| return seats; | |
| } |
| import bisect | |
| class NFA(object): | |
| EPSILON = object() | |
| ANY = object() | |
| def __init__(self, start_state): | |
| self.transitions = {} | |
| self.final_states = set() | |
| self._start_state = start_state |
| import org.apache.commons.math3.analysis.interpolation.NevilleInterpolator; | |
| public class WtfCreator { | |
| public static void main(String[] args) { | |
| var text = "Hello, world!\n"; | |
| double[] x = new double[text.length() + 1]; | |
| double[] y = new double[text.length() + 1]; | |
| for(var i = 0; i < text.length(); i++) { | |
| x[i] = i; |