Skip to content

Instantly share code, notes, and snippets.

View oaustegard's full-sized avatar
mostly lurking

Oskar Austegard oaustegard

mostly lurking
View GitHub Profile
oaustegard / private.xml
Last active May 26, 2020 18:28 — forked from rootscript/private.xml
Karabiner private.xml for non-Apple keyboard to toggle Target Display Mode
<?xml version="1.0"?>
<productname>Dell USB Keyboard</productname>
oaustegard / scalding_alice.scala
Last active August 29, 2015 14:27 — forked from johnynek/scalding_alice.scala
Learn Scalding with Alice
Get the last line of text in Alice in Wonderland that contains each of the top 20 frequent words in the book
NOT ACTUALLY TESTED, just logically combined. See fork source for original version that is mulch ore likely to work.
val alice = Source.fromURL("").getLines.zipWithIndex.toList
val aliceWords = TypedPipe.from(alice).flatMap { case (text, _) => text.split("\\s+").toList }
val wordCount = { word => (word, 1L) }.group.sum
val top20 = wordCount.groupAll.sortBy { case (word, count) => -count }.take(20).values
val lastLine = alicePipe.flatMap { case (text, line) => text.split("\\s+") { word => (word, line) }}.group.max