Skip to content

Instantly share code, notes, and snippets.

View shtratos's full-sized avatar
🦄

Dmitry Stratiychuk shtratos

🦄
View GitHub Profile
@shtratos
shtratos / fetch-dev-secrets-from-vault.sh
Last active April 10, 2024 07:38
Bash script to fetch and store secrets from Azure KeyVault
#!/usr/bin/env bash
#
# Fetch secrets for local development from Azure KeyVault
# and print them to stdout as a bunch of env var exports.
# These secrets should be added to your local .env file
# to enable running integration tests locally.
#
KEY_VAULT=$1
function fetch_secret_from_keyvault() {
import com.google.common.base.Strings;
import com.google.common.io.CharStreams;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
@shtratos
shtratos / sh2ju.sh
Last active January 29, 2017 00:53
junit bash commands
#!/bin/bash
### Copyright 2010 Manuel Carrasco Moñino. (manolo at apache.org)
### Copyright 2016 Patrick Double (pat at patdouble.com)
###
### Licensed under the Apache License, Version 2.0.
### You may obtain a copy of it at
### http://www.apache.org/licenses/LICENSE-2.0
###
### A library for shell scripts which creates reports in jUnit format.
@shtratos
shtratos / Benchmarks.java
Created February 12, 2016 16:28
hashmap copy benchmark
import org.openjdk.jmh.annotations.Benchmark;
import java.util.HashMap;
import java.util.Map;
public class Benchmarks {
private static final Map<String, String> STRINGS;
static {
STRINGS = new HashMap<>();
@shtratos
shtratos / graph.json
Last active December 21, 2015 02:18 — forked from norrs/graph.json
{"nodes":[{"group":1,"name":"A"},{"group":1,"name":"C"},{"group":1,"name":"B"},{"group":1,"name":"E"},{"group":1,"name":"D"},{"group":1,"name":"G"},{"group":1,"name":"F"},{"group":1,"name":"I"},{"group":1,"name":"H"},{"group":1,"name":"K"},{"group":1,"name":"J"},{"group":1,"name":"M"},{"group":1,"name":"L"},{"group":1,"name":"O"},{"group":1,"name":"N"},{"group":1,"name":"Q"},{"group":1,"name":"P"},{"group":1,"name":"S"},{"group":1,"name":"R"},{"group":1,"name":"U"},{"group":1,"name":"T"},{"group":1,"name":"W"},{"group":1,"name":"V"},{"group":1,"name":"Y"},{"group":1,"name":"X"}],"links":[{"source":13,"target":16,"value":1},{"source":8,"target":13,"value":1},{"source":19,"target":2,"value":1},{"source":22,"target":7,"value":1},{"source":7,"target":0,"value":1},{"source":18,"target":3,"value":1},{"source":16,"target":19,"value":1},{"source":9,"target":23,"value":1},{"source":3,"target":24,"value":1},{"source":3,"target":21,"value":1},{"source":10,"target":13,"value":1},{"source":14,"target":4,"value":1},{"sourc