Skip to content

Instantly share code, notes, and snippets.

View vincentjames501's full-sized avatar

Vincent Pizzo vincentjames501

  • Singlewire Software
View GitHub Profile
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import static java.util.AbstractMap.SimpleEntry;
public class Stocks {

Keybase proof

I hereby claim:

  • I am vincentjames501 on github.
  • I am vincentjames501 (https://keybase.io/vincentjames501) on keybase.
  • I have a public key whose fingerprint is CFD1 4886 5480 C3B4 8E7E C1FF F0C7 BFC3 1CD4 AEA2

To claim this, I am signing this object:

@vincentjames501
vincentjames501 / demo.cljts
Created January 11, 2020 00:29
TypeScript + Clojure
;; TypeScript + Clojure
(deftype User {
:id Num
:name Str
Optional<:age> Num ;; Key may be missing, but if present a Num value is present
:address <Str | Nil> ;; Key is present, but value can be Nil
:orders Seq<Order> ;; Seq is super type of Vec/ArrayList/etc
})
@vincentjames501
vincentjames501 / RetryDemo.java
Created December 16, 2020 22:52
JDK11+ HttpClient Retry
import javax.net.ssl.SSLException;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ConnectException;
import java.net.URI;
import java.net.UnknownHostException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
@vincentjames501
vincentjames501 / FastS3Signer.java
Created February 15, 2021 06:11
A lightweight Java method to generate presigned S3 GET URLs fast and with no dependencies
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;