Skip to content

Instantly share code, notes, and snippets.

Jorge jvican

Block or report user

Report or block jvican

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jvican
jvican / RuntimeUtils.scala
Last active Oct 14, 2019
Some Scala code that uses Java APIs present in tools.jar (only JDKs) to programmatically produce a jstack-like thread dump. Useful to debug application and test deadlocks.
View RuntimeUtils.scala
object RuntimeUtils {
def requestThreadDump: String = {
// Get the PID of the current JVM process
val selfName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName()
val selfPid = selfName.substring(0, selfName.indexOf('@'))
// Attach to the VM
import com.sun.tools.attach.VirtualMachine
import sun.tools.attach.HotSpotVirtualMachine;
val vm = VirtualMachine.attach(selfPid);
View herringbone-impala.json
{
"version" : "1.1.2",
"project" : {
"name" : "herringbone-impala",
"directory" : "/home/jvican/Code/herringbone/herringbone-impala",
"workspaceDir" : "/home/jvican/Code/herringbone",
"sources" : [
"/home/jvican/Code/herringbone/herringbone-impala/src/main/scala"
],
"dependencies" : [
@jvican
jvican / gist:0f4778e809331ecf15a53b4bb8f381b5
Created Sep 25, 2019
coursier-graalvm-native-error.txt
View gist:0f4778e809331ecf15a53b4bb8f381b5
➜ bloop git:(topic/bloopgun) ✗ coursier fetch org.scalameta:sbt-mdoc_2.12:1.3.2 --sbt-plugin --sbt-version 1.0
Exception in thread "main" scala.MatchError: [Ljava.lang.String;@7fa34bbb3580 (of class [Ljava.lang.String;)
at coursier.parse.DependencyParser$.javaOrScalaDependencyParams(DependencyParser.scala:176)
at coursier.parse.DependencyParser$.$anonfun$javaOrScalaDependenciesParams$1(DependencyParser.scala:351)
at coursier.util.Traverse$TraverseOps.$anonfun$validationNelTraverse$1(Traverse.scala:33)
at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:126)
at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:122)
at scala.collection.immutable.List.foldLeft(List.scala:89)
at coursier.util.Traverse$TraverseOps.validationNelTraverse(Traverse.scala:26)
at coursier.parse.DependencyParser$.javaOrScalaDependenciesParams(DependencyParser.scala:350)
View bloopgun.sbt
lazy val bloopgunNative: Project = project
.dependsOn(bloopgun)
.disablePlugins(ScriptedPlugin)
.enablePlugins(SbtProguard)
.enablePlugins(GraalVMNativeImagePlugin)
.settings(testSuiteSettings)
.settings(
name := "bloopgun-native",
proguardOptions in Proguard ++=
Seq("-dontnote", "-dontwarn", "-ignorewarnings", "-dontoptimize"),
View exception-bloop
[E] java.nio.file.FileSystemException: /var/folders/8z/cdtg5zv95t92h32y30_pdh5c0000gn/T/bloop-test-workspace1019801879423377160/target/A/bloop-bsp-clients-classes: Invalid argument
[E] at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
[E] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[E] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[E] at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
[E] at java.nio.file.Files.createDirectory(Files.java:674)
[E] at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
[E] at java.nio.file.Files.createDirectories(Files.java:767)
[E] at bloop.data.ClientInfo$BspClientInfo.$anonfun$getUniqueClassesDirFor$1(ClientInfo.scala:144)
[E] at bloop.data.ClientInfo$BspClientInfo.$anonfun$getUniqueClassesDirFor$1$adapted(ClientInfo.scala:132)
View frontend-test.json
{
"version" : "1.1.2",
"project" : {
"name" : "frontend-test",
"directory" : "/home/jvican/Code/bloop/frontend",
"sources" : [
"/home/jvican/Code/bloop/frontend/src/test/scala-2.12",
"/home/jvican/Code/bloop/frontend/src/test/scala",
"/home/jvican/Code/bloop/frontend/src/test/java",
"/home/jvican/Code/bloop/frontend/target/scala-2.12/src_managed/test"
@jvican
jvican / Cli.scala
Created Jun 26, 2019
Nailgun CLI implementation **prototype** via Caseapp for Sailgun (Scala based client)
View Cli.scala
package sailgun.caseapp
import _root_.caseapp.core.Parser
import _root_.caseapp.core.Messages
import _root_.caseapp.core.WithHelp
import java.io.PrintStream
import java.io.InputStream
import sailgun.protocol.Defaults
import sailgun.protocol.Streams
@jvican
jvican / frontend.json
Created Jun 15, 2019
An example of a real-world config file for one of the main bloop modules
View frontend.json
{
"version" : "1.1.2",
"project" : {
"name" : "frontend",
"directory" : "/Users/jvican/Code/bloop/frontend",
"sources" : [
"/Users/jvican/Code/bloop/frontend/src/main/scala-2.12",
"/Users/jvican/Code/bloop/frontend/src/main/scala",
"/Users/jvican/Code/bloop/frontend/src/main/java",
"/Users/jvican/Code/bloop/frontend/target/scala-2.12/src_managed/main"
View machine-benchmark-data.log
➜ ~ uname -a
Linux lamppc8 4.4.0-109-generic #132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
➜ ~ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
stepping : 3
microcode : 0x1c
View metals-connection-error.log
code navigation does not work for the file '/Users/jvican/Code/bloop/integrations/gradle-bloop/src/test/scala/bloop/integrations/gradle/ConfigGenerationSuite.scala' because the build target gradleBloop212-test is being compiled. Wait until compilation is finished and try again.
build shutdown: bloop
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.JsonRpcException: java.io.IOException: com.sun.jna.LastErrorException: [32] Broken pipe
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
at scala.meta.internal.metals.BuildServerConnection.$anonfun$shutdown$1(BuildServerConnection.scala:41)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:658)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
You can’t perform that action at this time.