Skip to content

Instantly share code, notes, and snippets.

View alexcrownus's full-sized avatar

Adesegun Adeyemo alexcrownus

View GitHub Profile
@tylertreat
tylertreat / GCPAuthenticationInterceptor.java
Created January 25, 2019 16:45
Spring RestTemplate interceptor which can make HTTP requests to Google OIDC-authenticated resources using a service account
package com.realkinetic.gcp.spring.oidc;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.api.client.http.*;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.GenericData;
@Bartman250
Bartman250 / CordaNotaryTransactionApi.png
Last active November 16, 2018 10:27
Design proposal for notary transaction api and other enablers for metering
CordaNotaryTransactionApi.png

AD-XX: <TOPIC - short, concise summary>

  • Date: <DATE - when the decision was made>
  • Driver: <DRIVER - list a single person driving consenus and decision making>
  • Stakeholders: <STAKEHOLDERS - list all relevant stakeholders affected by this decision>
  • Status: [PROPOSED | DECIDED | SUPERSEDED]
  • Categories: <CATEGORIES - use a simple grouping to help organize the set of decisions (e.g. backend, payment, user management, ...)>
  • Outcome: <OUTCOME - once decided, provide a short summary of the decision outcome here>

Context

@fuyufjh
fuyufjh / TestArrayBlockingQueuePerf.java
Last active February 2, 2020 20:46
Performance Test: BlockingQueue (Java) vs. Channel (Go)
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
public class TestArrayBlockingQueuePerf {
private static final int CHANNEL_NUM = 8;
private static final int CHANNEL_BUFFER_SIZE = 65536;
@rafaeltuelho
rafaeltuelho / camel-raw-oauth.java
Created January 18, 2017 12:47
camel snippet using oauth to get an auth token and use it to request a secured rest service
from("timer://scheduler?period=30s")
.log("get access token")
.to("direct:authService");
from("direct:authService").tracing()
.setHeader(Exchange.HTTP_PATH)
.simple("<auth service context>/oauth2/token")
.setHeader("CamelHttpMethod")
.simple("POST")
.setHeader("Content-Type")
@marianogappa
marianogappa / ordered_parallel.go
Last active February 12, 2024 09:27
Parallel processing with ordered output in Go
/*
Parallel processing with ordered output in Go
(you can use this pattern by importing https://github.com/MarianoGappa/parseq)
This example implementation is useful when the following 3 conditions are true:
1) the rate of input is higher than the rate of output on the system (i.e. it queues up)
2) the processing of input can be parallelised, and overall throughput increases by doing so
3) the order of output of the system needs to respect order of input
- if 1 is false, KISS!
@marianogappa
marianogappa / backpressure.go
Created December 4, 2016 04:53
Example backpressure implementation in Go
/*
This snippet is an example of backpressure implementation in Go.
It doesn't run in Go Playground, because it starts an HTTP Server.
The example starts an HTTP server and sends multiple requests to it. The server starts denying
requests by replying an "X" (i.e. a 502) when its buffered channel reaches capacity.
This is not the same as rate-limiting; you might be interested in https://github.com/juju/ratelimit
or https://godoc.org/golang.org/x/time/rate.
@evantoli
evantoli / GitConfigHttpProxy.md
Last active November 14, 2024 06:03
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@jamtur01
jamtur01 / ladder.md
Last active November 4, 2024 08:05
Kickstarter Engineering Ladder