This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec jq '[. | del(.payload), if .payload | type == "string" then .payload | fromjson | .[] else .payload[] end] | |
| .[0] + .[1]' $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
import $ivy.{ | |
`software.amazon.awssdk:apache-client:2.2.0`, | |
`software.amazon.awssdk:netty-nio-client:2.2.0`, | |
`software.amazon.awssdk:sts:2.2.0`, | |
`software.amazon.awssdk:kinesis:2.2.0`, | |
`org.slf4j:slf4j-nop:1.7.25`, | |
`io.monix::monix:3.0.0-RC2`, | |
`org.typelevel::cats-core:1.5.0`, | |
`org.typelevel::cats-effect:1.1.0` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import $ivy.`software.amazon.awssdk:apache-client:2.2.0` | |
import $ivy.`software.amazon.awssdk:sts:2.2.0` | |
import $ivy.`software.amazon.awssdk:dynamodb:2.2.0` | |
val client = software.amazon.awssdk.services.dynamodb.DynamoDbClient.create() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fastparse1 | |
> bench/jmh:run -i 1 -r 1s -wi 1 -w 1s | |
[info] Benchmark Mode Cnt Score Error Units | |
[info] HandyUriTemplatesBench.expandTemplate thrpt 5 273134.812 ± 14481.192 ops/s | |
[info] HandyUriTemplatesBench.parseFail thrpt 5 282972.904 ± 11961.796 ops/s | |
[info] HandyUriTemplatesBench.parseSuccess thrpt 5 308294.189 ± 82112.451 ops/s | |
[info] Uritemplate4sBench.expandTemplate thrpt 5 75346.587 ± 13802.235 ops/s | |
[info] Uritemplate4sBench.parseFail thrpt 5 262814.309 ± 56332.194 ops/s | |
[info] Uritemplate4sBench.parseSuccess thrpt 5 136334.699 ± 6510.463 ops/s | |
# fastparse2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gubbns | |
import cats.data.{Kleisli, OptionT} | |
import cats.effect._ | |
import cats.implicits._ | |
import com.github.blemale.scaffeine.{Cache, Scaffeine} | |
import org.http4s._ | |
import org.http4s.headers._ | |
import org.http4s.server.Middleware |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import $ivy.{ | |
`org.typelevel::cats-effect:1.0.0-RC2`, | |
`org.typelevel::cats-core:1.1.0` | |
} | |
val scalacOptions = List("-Ypartial-unification") | |
interp.preConfigureCompiler(_.processArguments(scalacOptions, true)) | |
// reload compiler | |
@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
import ammonite.ops._, ImplicitWd._ | |
case class Version(major: Int, minor: Int, patch: Int, label: String) { | |
def tag = s"v$major.$minor.$patch$label" | |
} | |
def parseVersion(s: String) = { | |
val VersionPattern = "^v(\\d+).(\\d+).(\\d+)(-.+)?$".r | |
val VersionPattern(major, minor, patch, labelNullable) = s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ue | |
readonly roleArn="$1" | |
readonly durationSeconds="3600" # 1 hours | |
readonly roleSessionName="$USER-local" | |
# Use default profile to log in | |
unset AWS_ACCESS_KEY_ID | |
unset AWS_SECRET_ACCESS_KEY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalacheck._ | |
import play.api.libs.json._ | |
val genJsArray: Gen[JsArray] = | |
for { | |
n <- Gen.chooseNum(0, 10) | |
arr <- Gen.containerOfN[IndexedSeq, JsValue](n, genJsValue).map(JsArray) | |
} yield arr | |
val genJsObject: Gen[JsObject] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This guide outlines how to: | |
# 1. Generate a AWS KMS data key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys). | |
# 2. Encrypt a secret using the generated data key. | |
# 3. Decrypt the encrypted secret. | |
# generate a kms data key | |
aws kms generate-data-key-without-plaintext \ | |
--key-id <key-id> \ | |
--key-spec AES_256 \ |