Skip to content

Instantly share code, notes, and snippets.

View ymnk's full-sized avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
import java.net.{InetAddress, Socket, InetSocketAddress}
import java.io._
import scala.collection.mutable._
import scala.io.Source
import scala.concurrent.ops.spawn
/**
* This program expects to be comipled with ARCFour.scala[1] .
* [1] http://gist.github.com/28462
*/
/*
Copyright (c) 2008 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
/*
Copyright (c) 2008 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
import swing._
import swing.event._
/**
* http://d.hatena.ne.jp/xibbar/20081203#1228294818
*/
object SimpleGui1B extends SimpleGUIApplication {
def top = new MainFrame {
title = "SimpleGui1B"
contents = new Button {
@ymnk
ymnk / README
Created January 29, 2009 02:22 — forked from hsak/beep.scala
This program is a 2D shooting game written in Scala by
@h_sakurai(http://twitter.com/h_sakurai),
and has been originally hosted at https://gist.github.com/46448 .
@ymnk(http://twitter.com/ymnk) has slightly modified that code
to run it on scala 2.8 with sbt.
$ sbt
> run
import scala.io.Source
/**
* http://www.facebook.com/jobs_puzzles/index.php?puzzle_id=7
*/
object HoppityHop{
def main(arg:Array[String]){
val line = Source.fromFile(arg(0)).getLine(1)
// val Array(n) = line.split(" ").filter(_.length!=0)
/**
Copyright (c) 2009 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
object RomanNumerals{
class RomanNumeralsException extends Exception
private val rn="IVXLCDM ".toList
def apply(n:Int):String={
type LS = List[String]
def n2ivx(n:Int, i:String, v:String, x:String):String = n match{
case 4 => i+v
/**
Copyright (c) 2009 ymnk, JCraft,Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
/**
* This trait is the Packrat parser[1] library based on kmizu[2]'s parser
* combinators[3] for PEG[4].
*
* [1] http://pdos.csail.mit.edu/~baford/packrat/
* [2] http://d.hatena.ne.jp/kmizushima/
* [3] http://d.hatena.ne.jp/kmizushima/20090226/1235619468
* [4] http://en.wikipedia.org/wiki/Parsing_expression_grammar
**/
trait PackratParser[+A]{