This file contains 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
data "aws_iam_policy_document" "do_not_delete_important_stuff" { | |
statement { | |
effect = "Deny" | |
actions = [ | |
// cognito | |
"cognito-idp:AdminDeleteUser", | |
"cognito-idp:DeleteGroup", | |
"cognito-idp:DeleteIdentityProvider", |
This file contains 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
[ | |
{ | |
"code": 200, | |
"request": {}, | |
"headers": { | |
"content-type": "application/json; charset=utf-8", | |
"cache-control": "no-cache", | |
"content-length": "52", | |
"date": "Wed, 13 Apr 2022 23:53:11 GMT", | |
"connection": "close" |
This file contains 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
const accountResponse = { | |
balance: 25.3, | |
name: 'My checking account', | |
}; | |
const transactions = [ | |
{ | |
amount: -10.2, | |
date: 1583266558054, | |
category: 'food', |
This file contains 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 packaging | |
import ( | |
"archive/zip" | |
"io" | |
) | |
type PackageContents struct { | |
Data io.Reader | |
FileName string |
This file contains 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
/** | |
* Encoding for "A is not a subtype of B" | |
* @note original credit: https://gist.github.com/milessabin/c9f8befa932d98dcc7a4 | |
*/ | |
trait NotTypeOf[A, B] | |
trait NotTypeImplicits { | |
// Uses ambiguity to rule out the cases we're trying to exclude | |
implicit def allowedType[A, B] : A NotTypeOf B = null | |
implicit def typeSuperTypeOfInvalid[A, B >: A] : A NotTypeOf B = null |
This file contains 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
object EditDistance { | |
def within(s1: String, s2: String, n: Int = 1): Boolean = { | |
if (s1 != s2 && Math.abs(s1.length - s2.length) > 1) { | |
return false | |
} | |
var s1Idx = 0 | |
var s2Idx = 0 | |
def withinN() = Math.abs(s1Idx - s2Idx) <= n |
This file contains 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
trait BigIntegerTypesComponent extends RelationalTypesComponent { | |
self: JdbcProfile => | |
implicit def bigIntType = new BigIntegerJdbcType | |
implicit val bigIntSetParam = new SetParameter[BigInteger] { | |
override def apply(v1: BigInteger, v2: PositionedParameters): Unit = v2.setObject(v1, java.sql.Types.BIGINT) | |
} | |
class BigIntegerJdbcType extends DriverJdbcType[BigInteger] with NumericTypedType { |
This file contains 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
object BitGroup { | |
def zero(max: Int): BitGroup = { | |
val bytesRequired = max / 8 | |
new BitGroup(new Array[Byte](bytesRequired + 1), max) | |
} | |
def filled(max: Int): BitGroup = { | |
val bytesRequired = max / 8 |
This file contains 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 ruby | |
require 'octokit' | |
require 'pp' | |
Octokit.auto_paginate = true | |
org=ARGV[0] | |
client = Octokit::Client.new(:access_token => "#{ENV['GIT_ACCESS_TOKEN']}") |
This file contains 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
case class StringAnyVal @JsonCreator()(@(JsonValue@getter) value: String) extends AnyVal | |
case class AnyValHolder(anyVal: StringAnyVal) | |
class Jackson extends FlatSpec with Matchers { | |
val finatra = FinatraObjectMapper.create().objectMapper | |
val jackson = { | |
val o = new ObjectMapper with ScalaObjectMapper | |
o.registerModule(DefaultScalaModule) |
NewerOlder