Skip to content

Instantly share code, notes, and snippets.

View steinybot's full-sized avatar

Jason Pickens steinybot

View GitHub Profile
@steinybot
steinybot / Errors.scala
Created January 16, 2022 21:04
Better Scala.js Stack Traces
package errors
import scala.concurrent.{ExecutionContext, Future}
import scala.language.{implicitConversions, reflectiveCalls}
import scala.scalajs.js
object Errors {
def mapJsError(
message: String,
@steinybot
steinybot / !README.md
Last active February 17, 2021 22:53
Boo for Boopickle
@steinybot
steinybot / benchmark.sh
Created January 28, 2021 10:44
Benchmark script
#!/usr/bin/env bash
set -euo pipefail
REPEATS=100
OUTPUT_FILE='results.csv'
run_tests() {
echo "Benchmarking ${COMMAND[@]}"
import pulumi_aws as aws
import ssh
temporary_key = ssh.GenerateSSHKey(
'GeneratedTemporaryPlatformSSHKey'
)
temporary_key_pair = aws.ec2.KeyPair(
'TemporaryPlatformSSHKey',
@steinybot
steinybot / __main__.py
Last active October 11, 2020 21:35
Pulumi Unknown Error
temporary_key = ssh.GenerateSSHKey(
'GeneratedTemporaryPlatformSSHKey'
)
platform_connection = ssh.ConnectionInputs(
host=platform_record.name,
username='ec2-user',
private_key=temporary_key.private_key,
private_key_passphrase=temporary_key.passphrase
)
@steinybot
steinybot / README.md
Last active June 9, 2025 06:02
GPG Commands

GPG Commands

Miscellaneous

HP laptop boot loader menu key: F9

List

Listing keys:

@steinybot
steinybot / RefinedBoxed.scala
Last active August 20, 2020 00:48
Boxed refined types to work with Play.
import eu.timepit.refined.api.{Refined, RefinedType, RefType, Validate}
import scala.reflect.macros.blackbox
final case class RefinedBoxed[FTP](value: FTP) {
override def toString: String = value.toString
}
object RefinedBoxed {
@steinybot
steinybot / ReadOps.scala
Created August 19, 2020 04:58
Play JSON Helpers
import play.api.libs.functional._
import play.api.libs.json.Reads._
import play.api.libs.json._
import scala.collection.GenTraversableOnce
trait ReadOps {
def updateFieldValues[A <: JsValue](reads: Reads[A]): Reads[JsObject] = {
of[JsObject].flatMap { obj =>
@steinybot
steinybot / README.md
Created August 5, 2020 03:53
Debugging Akka Streams

How to debug Akka Streams:

  1. Put a breakpoint in akka.stream.impl.PhasedFusingActorMaterializer#materialize where it has the built in printing.
  2. Add the following to "evaluate and log":
    println("\n\nTraversal:")
    TraversalBuilder.printTraversal(current);
    println("\nWiring:")
    TraversalBuilder.printWiring(current);
@steinybot
steinybot / README.md
Last active June 11, 2020 21:09
Diagnosing implicit resolution errors in a single file.

First set the sources to a single file

sbt> set `integration-tests`/Test/sources ~= (_.filter(_.name == "UploadsControllerSpec.scala"))

Then enable implicit logging

sbt&gt; set `integration-tests`/scalacOptions += "-Xlog-implicits"