Skip to content

Instantly share code, notes, and snippets.

View mdedetrich's full-sized avatar

Matthew de Detrich mdedetrich

View GitHub Profile
org.scalafmt.cli.FailedToFormat: /Users/mdedetrich/github/guardian-for-apache-kafka/core/src/test/scala/io/aiven/guardian/kafka/KafkaClusterTest.scala
Caused by: java.lang.NullPointerException: Cannot invoke "scala.meta.Tree.tokens(scala.meta.Dialect)" because "tree" is null
at org.scalafmt.internal.FormatTokens.getHeadOpt(FormatTokens.scala:194)
at org.scalafmt.internal.FormatTokens.tokenJustBeforeOpt(FormatTokens.scala:246)
at org.scalafmt.internal.FormatWriter$FormatLocations.getAlignContainerParent(FormatWriter.scala:1293)
at org.scalafmt.internal.FormatWriter$FormatLocations.getAlignContainer(FormatWriter.scala:1320)
at org.scalafmt.internal.FormatWriter$FormatLocations.$anonfun$getAlignContainer$1(FormatWriter.scala:1340)
at scala.Option.flatMap(Option.scala:283)
at org.scalafmt.internal.FormatWriter$FormatLocations.getAlignContainer(FormatWriter.scala:1336)
at org.scalafmt.internal.FormatWriter$FormatLocations.processLine$1(FormatWriter.sc
@mdedetrich
mdedetrich / sbt-github-actions-windows.txt
Created November 30, 2022 11:59
sbt-github-actions windows issue
PS C:\Users\mdede\github\sbt-github-actions> sbt test scripted
[info] welcome to sbt 1.5.5 (Eclipse Adoptium Java 11.0.17)
[info] loading global plugins from C:\Users\mdede\.sbt\1.0\plugins
[info] loading project definition from C:\Users\mdede\github\sbt-github-actions\project\project\project
[info] loading settings for project sbtGithubActionsSources from build.sbt,libraries.sbt ...
[info] loading project definition from C:\Users\mdede\github\sbt-github-actions\project\project
[info] compiling 4 Scala sources to C:\Users\mdede\github\sbt-github-actions\project\project\target\scala-2.12\sbt-1.0\classes ...
[warn] one feature warning; re-run with -feature for details
[warn] one warning found
[info] loading settings for project
[INFO ] 15:54:52.582 BackupClient - Committing kafka cursor for uploadId:7STWbEoanuVvi3FOULU0XGngFcVEXdwgVX_OH_OVTa8WOvJfGRSpho2D18fm2OoRSck7L2p94KW5MymTcKmeNeOgzV9KiM.LGWQ6r9UyB_dxriPo6nYtJy0.c2H2bjVH key: 2022-02-02T20:52:00Z.json and S3 part: 1
[INFO ] 15:54:52.651 BackupClient - Found current uploadId: 7STWbEoanuVvi3FOULU0XGngFcVEXdwgVX_OH_OVTa8WOvJfGRSpho2D18fm2OoRSck7L2p94KW5MymTcKmeNeOgzV9KiM.LGWQ6r9UyB_dxriPo6nYtJy0.c2H2bjVH and bucket: guardian-presentation with key: 2022-02-02T20:52:00Z.json
[INFO ] 15:54:52.726 BackupClient - Creating new upload with bucket: guardian-presentation and key: 2022-02-02T20:55:00Z.json
[INFO ] 15:54:52.761 BackupClient - Creating new upload with bucket: guardian-presentation and key: 2022-02-02T20:56:00Z.json
[WARN ] 15:54:52.856 BackupClient - Found multiple previously cancelled uploads for key: 2022-02-02T20:55:00Z.json and bucket: guardian-presentation, picking uploadId: XleL.OorVkuhLKOkknS9Pqd43U0840yt8alXI4RsZzm3xDd3ODWnVaLyrWAFpbLFiOlKS0KUuGfIEOKOMeonhXzClB.1YQ03a
<@guardian-for-apache-kafka>-<⎇ add-sbt-dependency-check>-<*>-> sbt
[info] welcome to sbt 1.6.2 (N/A Java 17.0.3)
[info] loading global plugins from /home/mdedetrich/.sbt/1.0/plugins
[info] loading project definition from /home/mdedetrich/github/guardian-for-apache-kafka/project/project/project
[info] loading project definition from /home/mdedetrich/github/guardian-for-apache-kafka/project/project
[info] loading settings for project guardian-for-apache-kafka-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /home/mdedetrich/github/guardian-for-apache-kafka/project
[info] loading settings for project guardian-for-apache-kafka from build.sbt ...
[info] resolving key references (20474 settings) ...
[info] set current project to guardian-for-apache-kafka (in build file:/home/mdedetrich/github/guardian-for-apache-kafka/)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
with pkgs;
let
# Import unstable channel.
# sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
@mdedetrich
mdedetrich / PostgresEncodings.scala
Created July 2, 2019 14:01
Common encodings for Postgres Scala
import java.time.OffsetDateTime
import enumeratum._
import io.circe.Json
import io.getquill.context.jdbc.PostgresJdbcContextBase
import org.postgresql.util.PGobject
trait PostgresEncodings {
val ctx: PostgresJdbcContextBase[_]
@mdedetrich
mdedetrich / FindToolsJar.java
Last active May 15, 2018 09:13
Find tools.jar if it exists on your system, translated from https://stackoverflow.com/a/25163628
import java.util.*;
import java.io.File;
class FindToolsJar {
static ArrayList<String> paths = new ArrayList<String>();
static ArrayList<File> files = new ArrayList<File>();
static final String suffix = "/lib/tools.jar";
private static final void addStringToArray(String value) {
try {
@mdedetrich
mdedetrich / ifmacros.scala
Created March 27, 2018 22:50
If macros example
```scala
implicit def decoder
#IF-SCALA < 2.13
[C[A] <: Traversable[A]](implicit cbf: MyCollection.CBF1[C],cbf2: MyCollection.CBF2[C]): Decoder[MyCollection[C]]
#ELSE
[C[A] <: Traversable[A]](implicit builder: Builder[C]): Decoder[MyCollection[C]]
#DONE
= new Decoder[MyCollection[C]] {
override def apply(c: HCursor): Decoder.Result[MyCollection[C]] = {
(
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- Put this pom.xml in your project directory -->
<!-- And run "mvn initialize" to download all dependencies -->
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
@mdedetrich
mdedetrich / ArrayExtensions.scala
Created November 17, 2016 16:35
Array Extensions for Quill 1.0.0
trait ArrayExtensions extends io.getquill.context.jdbc.JdbcEncoders with io.getquill.context.jdbc.JdbcDecoders {
this: JdbcContext[PostgresDialect, _] =>
implicit def arrayStringDecoder[T]: Decoder[Array[String]] =
new Decoder[Array[String]] {
def apply(index: Int, row: ResultRow) = {
row.getArray(index + 1).getArray.asInstanceOf[Array[String]]
}
}