This file contains hidden or 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 collection.JavaConversions._ | |
import java.net.URL | |
import org.apache.commons.io.IOUtils | |
object scalatest | |
{ | |
final class CloseableLike[T1 <: {def close(): Unit}](val a: T1) { | |
def withClose[T2](f: T1 => T2): T2 = { | |
try { | |
f(a) |
This file contains hidden or 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 collection.JavaConversions._ | |
import java.net.URL | |
import org.apache.commons.io.IOUtils | |
object scalatest | |
{ | |
def closing[T <: {def close(): Unit}, R](a: T)(f: T => R): R = { | |
try { | |
f(a) | |
} finally { |
This file contains hidden or 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 com.espertech.esper.client.{Configuration, EventBean, UpdateListener, EPServiceProviderManager} | |
import java.util.HashMap | |
import scala.collection.JavaConversions._ | |
object Sandbox | |
{ | |
def main(args: Array[String]) { | |
val config = new Configuration(); | |
val eventType = new HashMap[String, AnyRef]() | |
eventType.put("itemName", classOf[String]) |
This file contains hidden or 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.sql.DriverManager | |
import org.apache.commons.io.IOUtils | |
import org.h2.jdbcx.JdbcDataSource | |
import org.squeryl.adapters.H2Adapter | |
import org.squeryl.{KeyedEntity, Session, SessionFactory, Schema} | |
import scala.collection.JavaConversions._ | |
import org.squeryl.PrimitiveTypeMode._ | |
class User(val id: Long, val name: String) extends KeyedEntity[Long] |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="scalatest" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> | |
<description> | |
Scala test code. | |
</description> | |
<property name="bin" location="out/production/scalatest"/> | |
<property name="src" location="src"/> | |
<property name="lib" location="lib"/> | |
<property name="version" value="dev"/> |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import requests | |
import re | |
from BeautifulSoup import BeautifulSoup | |
MASTER_URL = "http://www.skyperfectv.co.jp/search/sky/S5_1/InfoInput.html" | |
PROGRAM_URL = "http://www.skyperfectv.co.jp/search/sky/S9_1/Program.html" | |
NAME_EXTRACTOR = re.compile(r'name\s*:\s*"([^"]+)"') | |
CHANNEL_EXTRACTOR = re.compile(r'chAr\[(\d+)\]\s*=\s*"([^"]+)"') |
This file contains hidden or 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
/* | |
** The author disclaims copyright to this source code. | |
** In place of a legal notice, here is a blessing: | |
** | |
** May you do good and not evil. | |
** May you find forgiveness for yourself and forgive others. | |
** May you share freely, never taking more than you give. | |
*/ | |
/* | |
** Any feedback would be appreciated. |
This file contains hidden or 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
begin | |
BaseDir = "C:/opt/erllibs", | |
lists:foreach( | |
fun(Dir) -> | |
Ebin = filename:join([BaseDir, Dir, "ebin"]), | |
case filelib:is_dir(Ebin) of | |
true -> code:add_patha(Ebin); | |
false -> ok | |
end | |
end, |
This file contains hidden or 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
from aspen import resources, Response | |
from aspen.resources.negotiated_resource import NegotiatedResource | |
from aspen.testing import assert_raises, attach_teardown, handle, mk, StubRequest | |
from aspen.website import Website | |
from aspen.renderers.tornado import Factory as TornadoFactory | |
def get(**_kw): | |
kw = dict( website = Website([]) | |
, fs = '' |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import collectd | |
import logging | |
import time | |
from logging.handlers import RotatingFileHandler | |
TIME_FORMAT = "%Y-%m-%d %H:%M:%S" | |
LOGFILE_PATH = "/var/log/collectd/values.log" | |
OlderNewer