Collaborate with your classmates on a conceptual level but do not share code. Submit individually.
- Get started with Git source code management
#!/bin/bash | |
# Copyright 2024 Konstantin Läufer <laufer AT cs.luc.edu> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
[ | |
{ | |
"breed": "Abyssinian", | |
"country": "Ethiopia", | |
"origin": "Natural\/Standard", | |
"coat": "Short", | |
"pattern": "Ticked" | |
}, | |
{ | |
"breed": "Aegean", |
#!/bin/bash | |
PRIVATE_IP=$(ip addr show wlp0s20f3 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/') | |
curl https://freedns.afraid.org/dynamic/update.php?MY_FREEDNS_API_KEY\&address=$PRIVATE_IP |
// see also https://www.implicitdef.com/2015/11/19/comparing-scala-http-client-libraries.html | |
// task: use the prime checker webservice | |
// https://github.com/LoyolaChicagoCode/primenumbers-spray-scala | |
// to count the number of primes within a given range | |
/* instructions: create a build.sbt file in your project root folder containing the following lines: | |
scalaVersion := "3.3.1" |
gsed -i 's/https:\/\/x-access-token:.*@github.com\//git@github.com:/' ./*/.git/config |
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 = |
def p(s: String) = | |
for (i <- 1 to 10) { | |
Thread.sleep(500) | |
println(i + ": " + s) | |
} | |
// running two tasks sequentially | |
// about 20 seconds by design | |
val t0 = System.currentTimeMillis | |
p("a") |
object KLSigPipeFun { | |
def main(args: Array[String]) = { | |
val lines = scala.io.Source.stdin.getLines() | |
val lineNumbers = Iterator.from(1) | |
val numberedLines = lineNumbers.zip(lines) | |
val okLines = numberedLines takeWhile { _ => !scala.sys.process.stdout.checkError() } | |
val outLines = okLines map { case (number, line) => println(number + ":" + line) } | |
println(outLines.length + " lines counted") | |
} | |
} |
This brief howto discusses several ways to copy a GitHub Java project into your own workspace so you can edit, compile, and run/test it.
This method is highly discouraged because it is tedious and error-prone.