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
object Timing { | |
def measure[T](taskName:String)(exec: => T):Unit = { | |
val begin = System.currentTimeMillis() | |
val result = exec | |
val end = System.currentTimeMillis() | |
println(taskName + ": " + (end - begin).toFloat / 1000 + " sec") | |
return result | |
} | |
} |
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
*** script 2011-04-04 14:33:41.000000000 +0900 | |
--- script.proxy 2011-04-04 14:55:51.000000000 +0900 | |
*************** | |
*** 60,83 **** | |
'User-Agent' => UA | |
} | |
! Net::HTTP.start(HOST,80){|http| | |
res = http.post(CGI,data,header) | |
! url = res.response.to_ary[1] |
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
n = gets.to_i | |
prims = [] | |
list = (2..n).to_a | |
while true | |
head = list.shift | |
prims.push head | |
list.delete_if{ |i| i % head == 0 } |
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
;;;init.el | |
;; load-path追加関数 | |
(defun add-to-load-path (&rest paths) | |
(let (path) | |
(dolist (path paths paths) | |
(let ((default-directory (expand-file-name (concat user-emacs-directory path)))) | |
(add-to-list 'load-path default-directory) | |
(if (fboundp 'normal-top-level-add-subdirs-to-load-path) | |
(normal-top-level-add-subdirs-to-load-path)))))) |

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
proxy='http://proxy.ksc.kwansei.ac.jp:8080' | |
apply_proxy() | |
{ | |
export http_proxy=$1 | |
export ALL_PROXY=$1 | |
git config --global http.proxy "$1" | |
} |
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
//http://www29.atwiki.jp/tmiya/pages/55.html | |
import scala.annotation.tailrec | |
object Exercises { | |
def succ(n:Int) = n + 1 | |
def pred(n:Int) = n - 1 | |
@tailrec | |
def add(x:Int, y:Int):Int = |
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
#usage $ ruby generate_gemset.rb gemdir | |
path = ARGV[0] | |
gems = Dir.glob(path + '/*').map{ |i| File.basename(i)} | |
File.open('generated.gems','w'){ |f| | |
gems.each do |g| | |
gem = g.split(/(.*)-(.+)$/) | |
f.puts gem[1] + ' -v' + gem[2] | |
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
import java.sql.*; | |
public class SQLiteSample { | |
public static void main(String[] args) { | |
try { | |
Class.forName("org.sqlite.JDBC"); | |
Connection conn = DriverManager.getConnection("jdbc:sqlite:sensing.db"); | |
Statement stat = conn.createStatement(); | |
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.util.*; | |
import com.pokutuna.lifelog.db.model.SensingModel.BtDetected; | |
public class SetSample { | |
public static void main(String[] args) { | |
//もともとあるリスト | |
List<String> list = new LinkedList<String>(); | |
list.add("hoge"); | |
list.add("hoge"); |