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
/* ************************************************************************** | |
* Copyright (C) 2012 BJoRFUAN. All Right Reserved | |
* ************************************************************************** | |
* This module, contains source code, binary and documentation, is in the | |
* BSD License, and comes with NO WARRANTY. | |
* | |
* takami torao <koiroha@gmail.com> | |
* http://www.moyo.biz/ | |
*/ |
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
/* | |
* description code for http://d.hatena.ne.jp/kuromoyo/20120115/1326621574 | |
*/ | |
import java.io.*; | |
import java.net.*; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.*; | |
import java.util.*; | |
public class AsyncIO1 { |
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
#!/usr/bin/python | |
# -*- encoding: UTF-8 -*- | |
# Script to dump Java VM stacktrace on all cluster. | |
# Please configure your unix account to sudo to each user of jvm processes without | |
# password on each server. | |
import commands | |
import re | |
import time | |
cluster = [ |
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
/* RandomAccessFile をストリームとして扱いたい時はあるけど、こんな書き方でも環境互換性は | |
* 保証されるんだっけ? org.apache.hadoop.hdfs.server.common.Storage より | |
*/ | |
public void read(File from) throws IOException { | |
RandomAccessFile file = new RandomAccessFile(from, "rws"); | |
FileInputStream in = null; | |
try { | |
in = new FileInputStream(file.getFD()); | |
file.seek(0); | |
Properties props = new Properties(); |
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
/** | |
* Simple program to produce "promotion failed" garbage collection on Oracle | |
* Java VM. For JDK 1.6, please execute with following extended options. | |
* | |
* java -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelGCThreads=8 | |
* -Xmx32m -XX:NewSize=20m -XX:MaxNewSize=20m -server -verbose:gc | |
* -XX:+PrintGCDetails -XX:+PrintGCDateStamps PromFailed | |
*/ | |
public class PromFailed { | |
private static class Watchdog extends Thread { |
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
2012-07-02 19:30:36 | |
Full thread dump Java HotSpot(TM) 64-Bit Server VM (23.0-b21 mixed mode): | |
"Attach Listener" daemon prio=10 tid=0x00007fe47488d800 nid=0x54b7 runnable [0x0000000000000000] | |
java.lang.Thread.State: RUNNABLE | |
"taskCleanup" daemon prio=10 tid=0x00007fe4749c5000 nid=0x6190 waiting on condition [0x00007fe465fa9000] | |
java.lang.Thread.State: WAITING (parking) | |
at sun.misc.Unsafe.park(Native Method) | |
- parking to wait for <0x00000000d0370f60> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) |
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
/** | |
* Copyright 2012 BJöRFUAN | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
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 twitter4j._ | |
import twitter4j.conf._ | |
import twitter4j.json._ | |
object Stream extends RawStreamListener { | |
def main(args:String):Unit = { | |
val conf = new ConfigurationBuilder() | |
.setDebugEnabled(true) | |
.setOAuthConsumerKey("xxxx") | |
.setOAuthConsumerSecret("xxxx") |
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
// ex., | |
// using(new FileInputStream("foo.txt")){ in => ... } | |
// using(DriverManager.getConnection("jdbc:db://localhost/foo")){ con => ... } | |
def using[T,U <% { def close():Unit }](c:U)(f:(U)=>T):T = try { f(c) } finally { c.close() } |
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
/* | |
* Copyright (c) 2013 koiroha.org. | |
* All sources and related resources are available under Apache License 2.0. | |
* http://www.apache.org/licenses/LICENSE-2.0.html | |
*/ | |
import java.io._ | |
import java.security.KeyStore | |
import java.util.Date | |
import javax.net.ssl._ | |
import scala.concurrent.duration.Duration |
OlderNewer