Skip to content

Instantly share code, notes, and snippets.

View martijndwars's full-sized avatar

Martijn Dwars martijndwars

View GitHub Profile
2022-05-18T14:52:33.868+0200 [INFO] Terraform version: 1.1.9
2022-05-18T14:52:33.868+0200 [INFO] Go runtime version: go1.17.2
2022-05-18T14:52:33.868+0200 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/2.2.2/versions/1.1.9/terraform", "plan"}
2022-05-18T14:52:33.868+0200 [TRACE] Stdout is not a terminal
2022-05-18T14:52:33.868+0200 [TRACE] Stderr is not a terminal
2022-05-18T14:52:33.868+0200 [TRACE] Stdin is a terminal
2022-05-18T14:52:33.868+0200 [DEBUG] Attempting to open CLI config file: /Users/martijn/.terraformrc
2022-05-18T14:52:33.868+0200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-05-18T14:52:33.868+0200 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-05-18T14:52:33.868+0200 [DEBUG] ignoring non-existing provider search directory /Users/martijn/.terraform.d/plugins

Show all tasks in the root project:

./gradlew :tasks --all

Show all tasks in a subproject:

./gradlew :foo:tasks --all
@martijndwars
martijndwars / README.md
Last active March 27, 2020 11:02
JSON-B implementations
  • Yasson. Reference implementation of JSON-B.
  • dsl-json. High level support for JSON-B String and Stream API. Only minimal support for configuration.
  • Apache Johnzon. Apache Johnzon is an implementation of JSR-353 (JavaTM API for JSON Processing).
public class Main {
public enum Days {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY,
SATURDAY {
public String toString() {
return "Samstag";
}
};
}
@martijndwars
martijndwars / Main.java
Created March 16, 2020 13:33
Generics: why does this work?
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
ArrayConstructor<Integer> inner = new ArrayConstructor<Integer>();
inner.add("Foo");
inner.add("Bar");
inner.add("Baz");
inner.add(42);
@martijndwars
martijndwars / Arch Linux, Fedora
Created December 31, 2019 13:29 — forked from elvetemedve/Arch Linux, Fedora
Allow Vagrant usage without providing sudo password
sudo tee /etc/sudoers.d/vagrant > /dev/null << EOL
#
# Arch Linux, Fedora sudoers entries
#
# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
%sudo ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
@martijndwars
martijndwars / c2.asm
Last active December 28, 2019 20:59
Hottest Region with Random.nextInt(2)
....[Hottest Region 1]..............................................................................
C2, nl.martijndwars.jits.generated.Range_benchmark_jmhTest::benchmark_avgt_jmhStub, version 92 (285 bytes)
; - nl.martijndwars.jits.generated.Range_benchmark_jmhTest::benchmark_avgt_jmhStub@33 (line 192)
0x000000010ee39cf8: mov $0x1,%ebx
╭ 0x000000010ee39cfd: jmpq 0x000000010ee39e29
│ 0x000000010ee39d02: mov %r8,0x50(%rsp)
│ 0x000000010ee39d07: mov %rbx,0x10(%rsp) ;*lload_2
│ ; - java.util.Random::seedUniquifier@24 (line 115)
│ ; - java.util.Random::&lt;init&gt;@1 (line 105)
@martijndwars
martijndwars / Asm.scala
Created October 30, 2019 10:47
Rewrite assembly addresses
import scala.io.Source
import scala.collection.mutable.Map
object Asm {
def main(args: Array[String]): Unit = {
val lines = Source.fromFile("input.txt").getLines.toList
val map = Map.empty[String, Int]
// First, map all addresses to integers
lines.filter(_.startsWith("0x")).map(_.take(18)).zipWithIndex.foreach {
@martijndwars
martijndwars / build.gradle
Created September 25, 2019 12:07
Gradle exclusion
/*
* Depend on Spoofax and replace org.graalvm:graal-sdk by org.graalvm.skd:graal-sdk. The exclusion
* resolves a conflict during compilatin and also shows up in the generated .pom.
*/
plugins {
id 'java'
id 'maven-publish'
}
group = 'nl.martijndwars'
@martijndwars
martijndwars / Foo.java
Last active September 12, 2019 07:50
ThreadDeath example. The main thread starts a new thread, then stops the new thread. The new thread catches the ThreadDeath exception, giving it a chance to clean up, before rethrowing the exception and terminating.
package nl.martijndwars.oshell;
public class Foo {
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new Bar());
thread.start();
Thread.sleep(3000);
thread.stop();
}