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 java.io._ | |
import java.util.zip.ZipEntry | |
import java.util.zip.ZipOutputStream | |
import java.util.zip.ZipInputStream | |
def encode(zos: ZipOutputStream, files: Seq[File]) { | |
for (f <- files) { | |
if (f.isDirectory) { | |
encode(zos, f.listFiles) | |
} else { |
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 java.io._ | |
import java.util.zip._ | |
val pi = new PipedInputStream | |
val po = new PipedOutputStream(pi) | |
val zo = new GZIPOutputStream(po) | |
val zi = new GZIPInputStream(pi) | |
val w = new PrintWriter(zo) | |
val r = new BufferedReader(new InputStreamReader(zi)) |
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 scala.util.parsing.combinator._ | |
abstract class XML | |
case class Element(name: String, attributes: Map[String, String], contents: Seq[XML]) extends XML | |
case class Letter(c: Char) extends XML | |
case class CDATA(text: String) extends XML | |
case class CharEntity(c: Char) extends XML | |
case class Entity(c: Char) extends XML | |
case class Comment(text: String) extends XML |
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
class Turtle { | |
float x = 0; | |
float y = 0; | |
float dir = 0; | |
boolean pen_down = false; | |
int weight = 1; | |
color pen_color = #000000; | |
Turtle(float x, float y, float dir) { | |
this.x = 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
float r; | |
void setup() { | |
size(500, 500); | |
r = min(width, height) * 7 / 16; | |
frameRate(1); | |
smooth(); | |
} | |
void draw() { |
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
size(500, 500); | |
float r = min(width, height) / 2; | |
translate(width / 2, height / 2); | |
strokeCap(SQUARE); | |
strokeWeight(10); | |
for (int i = 0; i < 12; i++) { | |
line(0.88 * r * cos(radians(30 * i)), 0.88 * r * sin(radians(30 * i)), | |
0.98 * r * cos(radians(30 * i)), 0.98 * r * sin(radians(30 * i))); | |
} |
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
size(500, 500); | |
int font_px = min(width, height) / 16; | |
float r = min(width, height) / 2 - font_px; | |
textSize(font_px); | |
textAlign(CENTER, CENTER); | |
translate(width / 2, height / 2); | |
fill(0); | |
for (int i = 1; i <= 12; i++) { |
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
size(500, 500); | |
int font_px = min(width, height) / 16; | |
float r = min(width, height) / 2 - font_px; | |
String[] hs = { "XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI" }; | |
PFont font = createFont("Serif", font_px); | |
textFont(font); | |
textSize(font_px); | |
textAlign(CENTER, CENTER); |
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
# | |
# zsh login script | |
# (c) 2016 sasaki-shigeo@acm.org | |
# | |
# Setting Terminal | |
eval `tset -s` | |
stty -istrip | |
bindkey -em |
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
float angle = radians(20); | |
PGraphics aTree; | |
class Snow { | |
float x; | |
float y; | |
float z; | |
float sz; | |
Snow(float x0, float y0, float z0, float sz0) { |