Skip to content

Instantly share code, notes, and snippets.

@sirmax
sirmax / Leak.java
Created March 22, 2022 13:58
OpenJDK 17.0.2 native memory leak in Tracing area
import javax.management.MBeanServer;
import javax.management.ObjectName;
// Run with `-XX:NativeMemoryTracking=detail`.
// Use `jcmd Leak VM.native_memory detail | fgrep -B4 -A2 Tracing`,
// observe the changes in `Tracing` area and related details. E.g.:
//
//- Tracing (reserved=1089KB, committed=1089KB)
// (malloc=2KB #43)
// (arena=1087KB #34)
@sirmax
sirmax / build.properties
Last active June 26, 2018 15:51
Changes in one module triggers `~` in another. E.g. changes in `sub2.scala` trigger `~sub1/compile`.
# build.properties
sbt.version=1.1.6
import com.twitter.concurrent.{Offer, Broker}
import com.twitter.conversions.time._
import com.twitter.finagle._
import com.twitter.util._
object Reeval {
/** Given a function `mkVar => Var[A]` and a time interval create another `Var[A]` that:
* - initially has a value equal to the value of evaluated `mkVar`
* - passes all updates of created var to the observers
@sirmax
sirmax / fix-wifi.sh
Last active December 11, 2015 15:28
#! /usr/bin/env bash
function nEnabled {
system_profiler -detailLevel mini SPAirPortDataType | grep -e 'Supported PHY Modes: .*n'
}
until nEnabled && sleep 2 && nEnabled;
do
echo 'resetting airport'
networksetup -setairportpower en1 off; networksetup -setairportpower en1 on