Skip to content

Instantly share code, notes, and snippets.

View ibaca's full-sized avatar
🐄
cowding

Ignacio Baca Moreno-Torres ibaca

🐄
cowding
View GitHub Profile
@ibaca
ibaca / DriverDownloadService.java
Created April 13, 2020 17:13
Intendia - Driver files download example - Java 11 no dependencies
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
import static java.nio.file.StandardOpenOption.WRITE;
import static java.util.stream.Collectors.toList;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse.BodyHandlers;
package org.fundamentals.latency;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.joining;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.WireMockServer;
@ibaca
ibaca / GcProfiler.java
Created August 10, 2019 16:01
Memory profiling extension for JMH.
package com.intendia.jmh;
import static java.lang.Double.NaN;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.openjdk.jmh.results.AggregationPolicy.AVG;
import static org.openjdk.jmh.results.AggregationPolicy.MAX;
import static org.openjdk.jmh.results.AggregationPolicy.SUM;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
@ibaca
ibaca / SunSse.kt
Last active August 1, 2019 07:05
Minimal SSE server using SUN HttpServer + Kotlin.
import com.sun.net.httpserver.HttpExchange
import com.sun.net.httpserver.HttpServer
import java.io.InputStream
import java.io.OutputStream
import java.net.InetSocketAddress
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
import java.util.logging.Logger
import kotlin.collections.ArrayList
import kotlin.text.Charsets.UTF_8
@ibaca
ibaca / DtoArchTest.java
Created January 14, 2019 21:21
JsInterop-DTO-strategy checks
package com.intendia.igestion.shared;
import static com.tngtech.archunit.core.domain.JavaModifier.FINAL;
import static com.tngtech.archunit.core.domain.JavaModifier.PUBLIC;
import static com.tngtech.archunit.core.domain.JavaModifier.STATIC;
import static com.tngtech.archunit.lang.SimpleConditionEvent.violated;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static java.lang.String.format;
import static jsinterop.annotations.JsPackage.GLOBAL;
@ibaca
ibaca / nmc-assignment1.js
Created October 28, 2018 19:29
NodeJS master class - Assignment 1
const http = require('http');
const url = require('url');
const StringDecoder = require('string_decoder').StringDecoder;
http.createServer((req, res) => service(req, res)).listen(4000, () => {
console.log("The server is listening on port " + 4000)
});
const service = (req, res) => {
const parseUrl = url.parse(req.url, true);
@ibaca
ibaca / DefaultLoggingRestService.java
Last active July 24, 2020 06:00
JAX-RS GWT Logging service
package com.intendia.igestion.server.util;
import static com.intendia.igestion.shared.util.ToolsRestService.logRecordFromDto;
import com.google.gwt.core.server.StackTraceDeobfuscator;
import com.intendia.igestion.shared.util.ToolsRestService;
import io.reactivex.Completable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
package com.intendia.igestion.common.util;
import elemental2.dom.Blob;
import elemental2.dom.File;
import javax.annotation.Nullable;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsPackage;
public class FileSaver {
@ibaca
ibaca / GeoJson.java
Last active June 7, 2018 12:22
GWT JsInterop DTOs inheritance
import static com.fasterxml.jackson.annotation.JsonTypeInfo.As.EXISTING_PROPERTY;
import static com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME;
import static jsinterop.annotations.JsPackage.GLOBAL;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.annotation.Nullable;
import jsinterop.annotations.JsOverlay;

Keybase proof

I hereby claim:

  • I am ibaca on github.
  • I am ibaca (https://keybase.io/ibaca) on keybase.
  • I have a public key ASDZ92PqagL6DXjDYc8m-IojtZNjvYIGkG-xFCweciohPQo

To claim this, I am signing this object: