Skip to content

Instantly share code, notes, and snippets.

View ymnk's full-sized avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
import scala.tools.nsc.{Interpreter, Settings, Global}
import scala.tools.nsc.util.{Position,NoPosition, ShowPickled}
import scala.reflect.generic.{PickleFormat, PickleBuffer}
import scala.tools.nsc.symtab.classfile.{ClassfileParser}
import scala.tools.nsc.io.AbstractFile
import java.io.{OutputStream, PrintStream, ByteArrayOutputStream}
object DumpGenericsSignature {
class MyParser extends ClassfileParser{
/*
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
@ymnk
ymnk / pdr.scala
Created November 13, 2008 06:24 — forked from anonymous/pdr.scala
package pdr;
import javax.swing._;
import java.awt._
import java.awt.geom._;
import java.awt.image._
import java.io._
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
import java.math.{BigDecimal => BD, MathContext}
import BD.{ZERO, ONE}
/**
* This program will calculate Pi with John Machin[1]'s formula[2].
* This is just a translation from Mr. Kishida's Java implementation[3] to
* Scala one.
*
* [1] http://en.wikipedia.org/wiki/John_Machin
* [2] http://upload.wikimedia.org/math/f/1/5/f15dc3d39c473c4bd718e3a98145da0d.png
/*
* ftdop2.scala
* Functional Top Down Operator Precedence
*/
package ftdop2
import scala.util.matching.Regex
import scala.collection.mutable.HashMap
object main {
def main(argv:Array[String]) {
class ARCFour{
private var x:Int = _
private var y:Int = _
private val state = new Array[Int](256)
def decrypt(src:Array[Byte], off:Int, length:Int):Array[Byte]={
encrypt(src, off, length)
}
def decrypt(src:Array[Byte], soff:Int,
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 {