Skip to content

Instantly share code, notes, and snippets.

@mszczygiel
mszczygiel / arch-linux-install.md
Created October 27, 2020 08:22 — forked from kylemanna/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
@mszczygiel
mszczygiel / arch-linux-install
Created October 27, 2020 08:22 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@mszczygiel
mszczygiel / EnumerateSubtypes.scala
Created April 13, 2020 10:11
Enumerate ADT subtypes in Scala
package playground.subtypes
import shapeless._
import scala.reflect.runtime.universe._
final case class SubtypeName(value: String) extends AnyVal
trait EnumerateSubtypes[A] {
def subtypeNames: List[SubtypeName]
}
@mszczygiel
mszczygiel / mybacklight.sh
Created March 19, 2019 19:56
backlight control for intel cards
#!/bin/bash
#controls backlight on intel cards,
STEP=50
function usage() {
echo "usage: " `basename $0` " [--inc|--dec]"
}
@mszczygiel
mszczygiel / batcheck.sh
Last active March 19, 2019 20:20
battery check for i3
#!/bin/bash
# example crontab entry:
# */5 * * * * mszczygiel /usr/local/bin/batcheck.sh
BAT_PATH="/sys/class/power_supply/BAT0"
ON_BATTERY=$(cat $BAT_PATH/status)
BATTERY_LEVEL=$(cat $BAT_PATH/charge_now)
BATTERY_FULL=$(cat $BAT_PATH/charge_full)

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation:

@mszczygiel
mszczygiel / ReverseState.scala
Created August 24, 2018 19:01
ReverseState scalaz
import scalaz._
import Scalaz._
// https://functional.works-hub.com/learn/reverse-state-monad-in-scala-is-it-possible-62a2f
object Playground extends App {
final case class ReverseState[S, A](run: S => (S, A)) {
def map[B](f: A => B): ReverseState[S, B] = ReverseState((s: S) => {
val (next, a) = run(s)
(next, f(a))
})