Skip to content

Instantly share code, notes, and snippets.

!#/bin/sh
echo 1
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, requests, json, hcsr04
# you can specify interval(seconds) as first argument
interval=5 if len(sys.argv)==1 else int(sys.argv[1])
# inifinite loop
while True:
start_time = time.time()
[user]
name = kyonmm
email = kyon.mm@gmail.com
[core]
editor = emacsclient
quotepath = true
[difftool "sourcetree"]
cmd = /Applications/p4merge.app/Contents/MacOS/p4merge \"$LOCAL\" \"$REMOTE\"
path =
[merge]
@kyonmm
kyonmm / server.groovy
Created February 11, 2012 03:52
Groovyで簡易HTTPサーバー
import com.sun.net.httpserver.HttpExchange
import com.sun.net.httpserver.HttpHandler
import com.sun.net.httpserver.HttpServer
import groovy.xml.MarkupBuilder
def PORT = 6001
HttpServer server = HttpServer.create(new InetSocketAddress(PORT), 0);
server.createContext("/", new HttpHandler() {
@Override
public void handle(HttpExchange he) throws IOException {
@kyonmm
kyonmm / jggug-junit-groovy-summary.md
Last active January 4, 2016 21:19 — forked from anonymous/jggug-junit-groovy-summary.md
2/21(金)のG* ワークショップZ でのハンズオン概要

JUnit4を利用したテスティングフレームワーク開発

自己紹介

  • kyon_mm
  • 名古屋市内企業に勤務しているテストアーキテクト
  • CI, DVCS, ITSなどの開発環境サポート、テスト戦略策定、テスト自動化などがメイン業務
  • .NETアプリに対してGroovy, C#, F#, Scalaなどでテストコードを実装することが多い
  • SCMBootCamp, Nagoya.Testing, 基礎勉強会などを主催

開催概要

GroovyにはSpockというCoolなテスティングフレームワークが存在しますが、特定チームに最適であるかはまた別の話になります。今回はJUnit4のAPIを使ってオリジナルのテスティングフレームワークを作るハンズオンを行います。基本的にはxUnitでテストコードを書いたことがあり、JavaもしくはGroovyの基本文法を理解していれば大丈夫です。

#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
###### Ubuntu Main Repos
deb http://jp.archive.ubuntu.com/ubuntu/ precise main restricted universe
deb-src http://jp.archive.ubuntu.com/ubuntu/ precise main restricted universe
###### Ubuntu Update Repos
deb http://jp.archive.ubuntu.com/ubuntu/ precise-security main restricted universe
@kyonmm
kyonmm / HogeSpec.groovy
Last active December 22, 2015 15:39
Spockテンプレ。 curl -s get.gvmtool.net | bash でインストール。gvm install gradle.  projectディレクトリをつくって、そこにbuild.gradleをコピーして、gradle --daemon idea. open hoge.ipr. src/main/groovyとsrc/test/groovyを作成してsourceとtestとして指定する。あとは書く。 importとかの自動生成は赤線に合わせてAlt + Enterだった気がする。
import org.spock.*
class HogeSpec extends Specification {
@Unroll
def "sample #a #b #expected "(){
given:
println "$a $b $ expected"
when:
println "$a $b $ expected"
then:
@kyonmm
kyonmm / fsLineCounter.groovy
Created May 31, 2013 04:40
F# のコメントと空白行を除いた行数を出力します。ざっくり実装です。起動引数にディレクトリを指定すると、配下のフォルダ全てのfsファイルを対象に行数を出力します。
import groovy.io.FileType
def multiLineComment = false
new File(args[0])
.eachFileRecurse(FileType.FILES){
if(it.name.endsWith("fs") == false) { return }
println it.name + "\t" + it.grep{it.trim().startsWith("//") == false}
.grep{
if(it.trim().contains("(*")){
multiLineComment = true
@kyonmm
kyonmm / init.el
Created April 22, 2013 01:42
required skk 他はM-x list-packageで導入する。
(when (eq window-system 'mac)
(add-hook 'window-setup-hook
(lambda ()
;; (setq mac-autohide-menubar-on-maximize t)
(set-frame-parameter nil 'fullscreen 'fullboth)
)))
(defun mac-toggle-max-window ()
(interactive)
/**
パラメータの列挙と制約を書けば、組み合わせをするライブラリ書いた。
したみたいな感じで使います。
一番下のcombination(parameter, constraints)ってするとテストケースが入ったMapが返ってくる感じです。
今は全組み合わせから制約を抜いてくるだけなのですが、k-wayの導入をして、
combination(parameter, constraints, order)ってして組み合わせるようにすればすごくテストが効率化できる感じ。
**/