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 javax.swing.*; | |
import java.awt.*; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.awt.geom.*; | |
import java.awt.image.BufferedImage; | |
public class DemoViewer { | |
public static void main(String[] args) { |
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
package org.rogach.jopenvoronoi; | |
import java.io.*; | |
import java.util.*; | |
import java.awt.geom.Point2D; | |
import java.awt.Color; | |
// random polygon generator | |
// uses space partitioning algorithm, described here: http://www.geometrylab.de/applet-29-en#space | |
public class RandomPolygon { |
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
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) | |
} |
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() |
NewerOlder