Skip to content

Instantly share code, notes, and snippets.

View klaeufer's full-sized avatar
:octocat:

Konstantin Läufer klaeufer

:octocat:
View GitHub Profile
import scala.util.Random
import java.util.concurrent.locks.ReentrantLock
def dinner(number: Int, delayInMs: Int) =
val forks = Array.fill(number)(new ReentrantLock)
// warning: running each philosopher in their own explicit Java thread
def phil(i: Int) = new Thread {
override def run(): Unit =
object Q extends App { val s = "object Q extends App { val s = %c%s%c ; printf(s, 0x22, s, 0x22) }" ; printf(s, 0x22, s, 0x22) }
@klaeufer
klaeufer / README.md
Last active September 6, 2018 14:21
cs2-lab1-fizzbuzz-java

Loyola COMP 271 Lab 1

Individual project

Collaborate with your classmates on a conceptual level but do not share code. Submit individually.

Objectives

An understanding of the following concepts and techniques:

@klaeufer
klaeufer / README.md
Last active November 29, 2018 13:56
cs2-lab10-graphs-java

Loyola COMP 271 Lab 10 (FALL 2017)

Individual project

Collaborate with your classmates on a conceptual level but do not share code. Submit individually.

Objectives

An understanding of the following concepts and techniques:

@klaeufer
klaeufer / TODO.md
Last active November 6, 2018 16:35
cs2-lab7-linkedstack-recursive-java

Loyola COMP 271 Lab 7

Individual project

Collaborate with your classmates on a conceptual level but do not share code. Submit individually.

Objectives

An understanding of the following concepts and techniques:

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@klaeufer
klaeufer / README.md
Last active February 2, 2017 20:20
sbt-scalariform local configuration files

Instructions

  • local.sbt goes in the project root
  • project-local.sbt goes in project/local.sbt
  • also add local.sbt to .gitignore

Purpose

Install sbt-scalariform in such a way that formatting taking place only on demand. This does not seem to work with a global plugin installation.

// simple example illustrating how to replace
// https://github.com/LoyolaChicagoCode/scalamu
// with https://github.com/slamdata/matryoshka
//
// libraryDependencies ++= Seq(
// "org.scalaz" %% "scalaz-core" % "7.2.8",
// "com.slamdata" %% "matryoshka-core" % "0.16.4",
// "com.slamdata" %% "matryoshka-scalacheck" % "0.16.4" % Test
// )
@klaeufer
klaeufer / extract-summary.py
Last active January 14, 2017 02:31
Basic testing metrics for Android and Maven
#!/usr/bin/env python
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("target/site/surefire-report.html"), "html.parser")
table = soup.find("table")
headings = [th.get_text() for th in table.find("tr").find_all("th")]
row = table.find_all("tr")[1]
dataset = [td.get_text() for td in row.find_all("td")]
@klaeufer
klaeufer / install-android.sh
Created January 14, 2017 01:59
install Android SDK on Codenvy (Ubuntu)
#!/bin/sh
export ANDROID_HOME=/projects/Android/sdk
mkdir -p $ANDROID_HOME
cd $ANDROID_HOME
wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
unzip -q tools_r25.2.3-linux.zip
$ANDROID_HOME/tools/bin/sdkmanager --update