Skip to content

Instantly share code, notes, and snippets.

@rtyley
rtyley / gist:53bec07c93ae4cd80ca1f768dc1f8b51
Created November 1, 2021 20:27
Finding release timestamps of npm package versions with `curl --silent https://registry.npmjs.org/ophan-tracker-js | jq .time`
{
"modified": "2021-09-28T15:42:41.957Z",
"created": "2016-12-06T14:05:06.859Z",
"0.1.0": "2016-12-06T14:05:06.859Z",
"0.2.0": "2016-12-06T14:09:10.619Z",
"0.3.0": "2016-12-07T12:16:53.583Z",
"0.4.0": "2016-12-08T15:03:58.445Z",
"0.5.0": "2017-01-25T11:35:58.309Z",
"1.0.0": "2017-02-01T12:39:17.759Z",
"1.1.0": "2017-02-01T15:59:17.411Z",
@rtyley
rtyley / gist:4887268880bc59e755f5a175248b55f7
Created August 17, 2021 21:40
IDEA 2021.2 error on switching git branch
2021-08-17 22:38:23,912 [ 901644] ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 2021.2 Build #IU-212.4746.92
2021-08-17 22:38:23,912 [ 901644] ERROR - aemon.impl.PassExecutorService - JDK: 11.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2021-08-17 22:38:23,912 [ 901644] ERROR - aemon.impl.PassExecutorService - OS: Linux
2021-08-17 22:38:23,912 [ 901644] ERROR - aemon.impl.PassExecutorService - Plugin to blame: Scala version: 2021.2.15
2021-08-17 22:38:23,912 [ 901644] ERROR - aemon.impl.PassExecutorService - Last Action: Back
2021-08-17 22:38:25,112 [ 902844] ERROR - aemon.impl.PassExecutorService - Stub is inconsistent with text in Language: Scala
com.intellij.psi.stubs.StubTextInconsistencyException: Stub is inconsistent with text in Language: Scala
at com.intellij.psi.stubs.StubTextInconsistencyException.checkStubTextConsistency(StubTextInconsistencyException.java:86)
at com.intellij.psi.stubs.StubProcessingHelperBase.inconsistencyDetected(StubProcessingHelperBase.ja
"pool-9-thread-13" #154 prio=5 os_prio=31 cpu=203855.82ms elapsed=397.24s tid=0x00007f9d97951000 nid=0x10807 runnable [0x0000700041d1c000]
java.lang.Thread.State: RUNNABLE
at scala.reflect.internal.Symbols$Symbol.caseFieldAccessors(Symbols.scala:2153)
at scala.tools.nsc.typechecker.SyntheticMethods.accessors$1(SyntheticMethods.scala:95)
at scala.tools.nsc.typechecker.SyntheticMethods.addSyntheticMethods(SyntheticMethods.scala:96)
at scala.tools.nsc.typechecker.SyntheticMethods.addSyntheticMethods$(SyntheticMethods.scala:70)
at scala.tools.nsc.Global$$anon$6.addSyntheticMethods(Global.scala:485)
at scala.tools.nsc.typechecker.Typers$Typer.finishMethodSynthesis(Typers.scala:1967)
at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1896)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5951)
case class Meal(
starter: Option[String],
main: String,
drinks: Seq[String],
tip: Option[Int]
)
val meals = Seq(
Meal(
starter = Some("Zucchini Fritters"),
$ sbt run
[info] welcome to sbt 1.5.2 (AdoptOpenJDK Java 11.0.11)
[info] loading settings for project global-plugins from plugins.sbt ...
[info] loading global plugins from /Users/roberto_tyley/.sbt/1.0/plugins
[info] loading settings for project ophan-geoip-db-refresher-build from plugins.sbt ...
[info] loading project definition from /Users/roberto_tyley/code/ophan-geoip-db-refresher/project
[info] loading settings for project ophan-geoip-db-refresher from build.sbt ...
[info] set current project to geoip-db-refresher (in build file:/Users/roberto_tyley/code/ophan-geoip-db-refresher/)
[info] compiling 1 Scala source to /Users/roberto_tyley/code/ophan-geoip-db-refresher/target/scala-3.0.0/classes ...
[info] running ophan.geoip.db.refresher.CLIMain
@rtyley
rtyley / gist:ee31ee962be024a5f71fb1ff836f8d72
Created May 16, 2021 17:05
Code compiled with Scala 3.0.0 throws NoClassDefFoundError/ClassNotFoundException when tests run
[info] Setting Scala version to 2.13.5 on 1 projects.
[info] Reapplying settings...
[info] set current project to scala-2-vs-3-noclassdeffounderror (in build file:/home/roberto/development/scala-2-vs-3-NoClassDefFoundError/)
[info] ExampleSpec:
[info] using Java Compress library
[info] - should not throw java.lang.NoClassDefFoundError
[info] Run completed in 302 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
roberto@kind:~/development/scaladex/scaladex$ docker -v
Docker version 20.10.6, build 370c289
roberto@kind:~/development/scaladex/scaladex$ docker-machine -v
docker-machine version 0.16.0, build 702c267f
roberto@kind:~/development/scaladex/scaladex$ sbt
[info] welcome to sbt 1.4.6 (Ubuntu Java 11.0.10)
[info] loading global plugins from /home/roberto/.sbt/1.0/plugins
[info] loading settings for project scaladex-build from plugins.sbt ...
[info] loading project definition from /home/roberto/development/scaladex/scaladex/project
[info] compiling 2 Scala sources to /home/roberto/development/scaladex/scaladex/project/target/scala-2.12/sbt-1.0/classes ...
@rtyley
rtyley / AppOnlyAuthentication.scala
Created February 19, 2019 15:35
Hack to make twitter4s support Application-only ('bearer') authentication for higher quota limits
package com.danielasfregola.twitter4s
import java.net.URLEncoder
import akka.actor.ActorSystem
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.headers._
import akka.stream.{ActorMaterializer, Materializer}
import com.danielasfregola.twitter4s
import com.danielasfregola.twitter4s.entities.{AccessToken, ConsumerToken}
$ sbt
[info] Loading global plugins from /home/roberto/.sbt/0.13/plugins
[info] Loading project definition from /home/roberto/guardian/marley/project
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
> release
[info] Starting release process off commit: d4f62deee5bb5dc8c10b741d2f0f069e90e48340
[info] Checking remote [origin] ...
[info] Setting scala version to 2.12.4
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
[info] Setting scala version to 2.11.12
@rtyley
rtyley / gist:5f9f832fabe2bdcfc2d561a36c29f993
Created February 9, 2018 10:37
Log of sbt-release - cross-build not being uploaded/released
$ sbt
[info] Loading global plugins from /home/roberto/.sbt/0.13/plugins
[info] Loading project definition from /home/roberto/guardian/marley/project
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
> release
[info] Starting release process off commit: 8aaa0454d4af2ae6ea610d1b540a166d022895c0
[info] Checking remote [origin] ...
[info] Setting scala version to 2.12.4
[info] Set current project to root (in build file:/home/roberto/guardian/marley/)
[info] Updating {file:/home/roberto/guardian/marley/}thriftExample...