Skip to content

Instantly share code, notes, and snippets.

Avatar

Johannes Rudolph jrudolph

View GitHub Profile
@delitescere
delitescere / bootstrap.md
Last active May 8, 2019
Portola (OpenJDK using musl) on Alpine
View bootstrap.md

Get the JDK source (per the OpenJDK instructions):

hg clone http://hg.openjdk.java.net/portola/portola
cd portola
bash ./get_source.sh

You need an existing Alpine with an already-built JDK. I have a Docker image of Alpine with glibc-based Zulu JDK:

@jkullick
jkullick / headless-luks-encrypted-ubuntu-server.md
Last active May 21, 2020
Headless LUKS encrypted Ubuntu Server on Hetzner
View headless-luks-encrypted-ubuntu-server.md
# stop active raid
mdadm --stop /dev/md[01]

# destroy partition table on hdds
dd if=/dev/zero of=/dev/sda bs=1M count=512
dd if=/dev/zero of=/dev/sdb bs=1M count=512

# create new partition table
sgdisk -og /dev/sda
@jimmycuadra
jimmycuadra / cloud-config.yml
Last active Feb 1, 2019
CoreOS cloud-config for DigitalOcean with iptables firewall
View cloud-config.yml
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: https://discovery.etcd.io/<token>
# multi-region deployments, multi-cloud deployments, and droplets without
# private networking need to use $public_ipv4
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
@retronym
retronym / namespace-management.md
Last active Dec 21, 2015
namespace-management.md
View namespace-management.md

Namespace Management (DRAFT)

Purpose

This document describes the guidelines for managing two important namespaces: the package scala._, and the Maven group org.scala-lang.

These questions become more important as we modularize the distribution, and as we publish new modules (such as ScalaJS, scala-async, scala-pickling.)

@mmoulton
mmoulton / README.md
Last active Nov 7, 2020
Docker Container Stats Collection Using Collectd
View README.md

Docker stats collection for collectd

This script can be used to feed collectd with cpu and memory usage statistics for running docker containers using the collectd exec plugin.

This script will report the used and cached memory as well as the user and system cpu usage by inspecting the appropriate cgroup stat file for each running container.

Usage

This script is intented to be executed by collectd on a host with running docker containers. To use, simply configure the exec plugin in collectd to execute the collectd-docker.sh script. You may need to adjust the script to match your particulars, such as the mount location for cgroup.

@gkossakowski
gkossakowski / MemoryProbe.java
Created Jun 3, 2013
YourKit probe class that allows one to capture memory snapshots after certain phases has run in the Scala compiler.
View MemoryProbe.java
import com.yourkit.probes.*;
import com.yourkit.api.*;
@MethodPattern("scala.tools.nsc.Global$Run:advancePhase()")
public class MemoryProbe {
public static void onEnter(@This scala.tools.nsc.Global.Run run) {
scala.reflect.internal.Phase patmatPhase = run.phaseNamed("patmat");
scala.reflect.internal.Phase postErasurePhase = run.phaseNamed("posterasure");
scala.reflect.internal.Phase icodePhase = run.phaseNamed("icode");
@vmarquez
vmarquez / TxMapTest.scala
Last active Sep 4, 2016
A mini STM if you will. I've made a'Transactional' map that mutates in a referentially transparent way.
View TxMapTest.scala
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.CountDownLatch
import scala.concurrent.Future
import scala.concurrent.ExecutionContext
import ExecutionContext.Implicits.global
object TxMapTest {
/*
* Example Usage
* We want to show two threads working with the same data source having both of their effects succeed
@paulp
paulp / test.scala
Created Feb 1, 2013
statically typed companion objects
View test.scala
package s
object Test {
// Observe that x.companion is statically typed such that foo is callable
def f1() = {
val x = new Foo
println(x) // Foo instance
println(x.companion) // Foo companion
println(x.companion.foo) // I'm foo!
@gkossakowski
gkossakowski / specialization-mh.md
Created Jan 11, 2013
Random ideas from Scala compiler hacker (@gkossakowski) on how we could improve specialization scheme by exploiting MethodHandles. What you read below is not a plan or a commitment of any kind. I just wanted to get it out from my head and hear what other people think while I'm busy with other things.
View specialization-mh.md

Specialization with method handles

Two canonical examples for specialization:

  • Function1
  • Tuple2

Function1 specialization

Specializing Function1 is a lot easier because functions do not have specialized fields.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 — forked from jboner/latency.txt
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs
You can’t perform that action at this time.