This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext.javaBinary = "/usr/lib/jvm/java-8-openjdk/bin/java" | |
def inStream = new java.io.BufferedReader(new java.io.InputStreamReader(new java.lang.ProcessBuilder(ext.javaBinary, "-version").start().getErrorStream())); | |
try { | |
String line = inStream.readLine(); | |
while (line != null) { | |
if (line.contains("Runtime Environment (build ")) { | |
int ib = line.indexOf(" (build "); | |
if (ib != -1) { | |
String ver = line.substring(ib + 8, line.size() - 1); | |
project.ext.set("jdkRuntimeVersion", ver); |
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TTTфTфTффффTTTффTфффффTTTTфTTTффTTфTTфTTTфTффффT | |
ффTфTTTTTTфTTTTффффTTTфTффTTфффTфTTTфTфффTTTTTTT | |
фффTфTTTфффTфTфффффTффTффTTTфффTTфTффффTTTфффTфф | |
TTTфффTTффTфTфффTфффффффTTффTTфTфффTTффффTTфTффT | |
ффTTфTTфTфTTTфTфффффффффTфTTTффTфTTTTTфTTTTTTфTT | |
фффTфTффTфффTTTTффTTTфффTффTфTффTффTфTффTTфTTTфф | |
ффTфTфTTTTффTфTфффTTфффTфTфффTTTTффTTTTфTффTфффT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
range_min = int(sys.argv[1]) | |
range_max = int(sys.argv[2]) | |
def calculate_square_depth(range_min, range_max): | |
if range_max <= 3: | |
return 0 | |
min_bound = math.ceil(range_min**0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GetProperties { | |
public static void main(String[] args) { | |
System.out.println(System.getProperties()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; input is from https://adventofcode.com/2015/day/6 | |
(def W 1000) | |
(def input (clojure.string/split-lines (slurp "d06.txt"))) | |
(defmacro control-lights [lights x1 y1 x2 y2 f] | |
(let [i (gensym)] | |
`(doseq [ x# (range ~x1 (inc ~x2)) | |
y# (range ~y1 (inc ~y2)) | |
:let [ ~i (+ (* y# W) x#) ] ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def W 1000) | |
(def input (clojure.string/split-lines (slurp "d06.txt"))) | |
(let [lights (boolean-array (* W W))] | |
(doseq [s input] | |
(let [ m (re-matches #"(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)" s) | |
command (get m 1) | |
x1 (Integer/parseInt (get m 2)) | |
y1 (Integer/parseInt (get m 3)) | |
x2 (Integer/parseInt (get m 4)) | |
y2 (Integer/parseInt (get m 5)) ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.rogach.scallop._ | |
import java.io.{Serializable, ByteArrayOutputStream, ByteArrayInputStream, ObjectOutputStream, ObjectInputStream} | |
trait PropsArgument extends ScallopConf { | |
@transient val p: Map[String, String] = props[String]('D') | |
} | |
class TestConf(args: List[String]) extends ScallopConf(args) with Serialization with PropsArgument { | |
val apples = opt[Int]("apples") | |
verify() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alad commented on 2018-03-28 20:11 | |
Thanks :) | |
runical commented on 2018-03-27 07:39 | |
I'll probably have some time tomorrow evening. If that isn't a problem, | |
I'll be happy to apply the patches. | |
E: Currently updating and testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Test { | |
def main(args: Array[String]) { | |
val conf = new TestClass(args) | |
} | |
} | |
import org.rogach.scallop.{ScallopConf, ScallopOption, Serialization, ValueConverter, singleArgConverter} | |
class TestClass(args: Seq[String]) extends ScallopConf(args) with Serialization { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.rogach.scallop._ | |
import java.io.{Serializable, ByteArrayOutputStream, ByteArrayInputStream, ObjectOutputStream, ObjectInputStream} | |
val args = Array("--apples", "33") | |
private class ConfSerializationProxy(@transient private var orig: Conf) extends Serializable { | |
private def writeObject(out: ObjectOutputStream) { | |
out.defaultWriteObject() | |
out.writeObject(orig.args.toArray) | |
} |
NewerOlder