Skip to content

Instantly share code, notes, and snippets.

View ymnk's full-sized avatar

Atsuhiko Yamanaka ymnk

View GitHub Profile
import java.io.{ByteArrayOutputStream, IOException, OutputStream, File}
import java.io.{File, FileInputStream, DataInputStream}
import java.net.{URL, URLConnection, HttpURLConnection}
import java.util.Random
abstract sealed class Param
case class FieldParam(key:String, value:String) extends Param
case class DataParam(key:String, filename:String,
data:Array[Byte], typ:Option[String]) extends Param
case class FileParam(key:String, file:File, typ:Option[String]) extends Param
import scala.actors._
import scala.actors.Actor._
object ActorInSingleThread {
class MyActor(n:Int, single:Boolean) extends Actor{
override def scheduler: IScheduler =
if(single) new SingleThreadedScheduler else super.scheduler
def act = {
package net.liftweb.example.model
import javax.persistence._
import com.google.appengine.api.datastore.Key
@Entity
class Author {
@Id
@GeneratedValue(){val strategy = GenerationType.IDENTITY}
var id : Key = _
/**
* This program has come from http://gist.github.com/18268 .
*/
import java.net.{Authenticator, PasswordAuthentication}
import java.net.{URL, HttpURLConnection}
import scala.xml.{XML, Node}
import scala.collection.mutable.Map
class FriendOrFollow (screen_name:String) {
import scala.util.parsing.combinator._
/**
* expr :: CREATE TABLE tbl_name ( create_definition,...)
*
* create_definition:
* col_name column_definition
*
* column_definition:
* data_type
@ymnk
ymnk / README
Created September 16, 2009 07:58
A simple Liftweb app: Clock with CometActor
The included pom.xml expects wave-robot-api-20090916.jar is stored in the repository.
* Donwload that jar file from its donwload site[1],
* Install that file into your repository with following command,
mvn install:install-file \
-Dfile=wave-robot-api-20090916.jar \
-DgroupId=com.google.wave \
-DartifactId=wave-robot-api \
-Dversion=20090916 \
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hello</groupId>
<artifactId>hello</artifactId>
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
import java.net.*;
public class StreamForwarding{
public static void main(String[] arg){
int port;
/**
Copyright (c) 2010 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