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
#!/bin/sh | |
# | |
# hbase - this script starts and stops the hbase-standalone daemon | |
# | |
# chkconfig: - 85 15 | |
# description: hbase-standalone daemon | |
# processname: hbase-standalone | |
# Source function library. | |
. /etc/rc.d/init.d/functions |
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) TextIncrementer("abc123efg456hij").++() // abc124efg457hij | |
* ex) TextIncrementer("あいう1 2 3えお").++() // あいう2 3 4えお | |
* @param t インクリメントしたい文字列 | |
* @param incrValue いくつインクリメントするか | |
* @return インクリメントした文字列 | |
*/ | |
case class TextIncrementer(t: String, incrValue: Int = 1) { | |
def ++(i: Int = 0, n: String = ""): String = { |
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 java.nio.file.{ FileSystem, FileSystems, WatchKey, WatchService, StandardWatchEventKinds } | |
import java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY | |
import scala.collection.JavaConverters._ | |
import scala.concurrent._ | |
import ExecutionContext.Implicits.global | |
object Main { | |
def main(args: Array[String]) { | |
FileWatcher("/tmp/build/classes", "hoge.html").watch { | |
println("change") |
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
# ~/.oh-my-zsh/custom/git-stash.zsh | |
function show_git_stash() { | |
$(git --no-pager log -1 > /dev/null 2>&1) | |
if [ "$?" -eq 0 ]; then | |
ZSH_THEME_GIT_PROMPT_SUFFIX="{@${$(git --no-pager stash list 2>/dev/null | wc -l | sed "s/ //g")}}" | |
else | |
ZSH_THEME_GIT_PROMPT_SUFFIX="" | |
fi | |
} |
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
object Main extends App { | |
val a = (1 to 1000000) | |
// map2個 | |
println("map2個-------------") | |
util.b { a.map(_+1).map(_+1) }.map(println) | |
util.b { a.map(_+1).map(_+1) }.map(println) | |
util.b { a.view.map(_+1).map(_+1).force }.map(println) | |
util.b { a.view.map(_+1).map(_+1).force }.map(println) |
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
case class A { | |
val now = System.currentTimeMillis | |
} | |
// for UnitTest | |
val a1 = new A { override val now = new DateTime("2013-01-01") } | |
println(a1.now) |
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
#!/bin/bash | |
set -ex | |
RUBY_VERSION="1.9.3-p484" | |
## rbenv | |
### preinstall | |
sudo yum -y install git gcc gcc-c++ kernel-devel zlib-devel openssl-devel readline-devel curl-devel libyaml-devel sqlite-devel |
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
#!/bin/bash | |
set -ex | |
cat << CONF > /etc/yum.repos.d/nginx.repo | |
[nginx] | |
name=nginx repo | |
baseurl=http://nginx.org/packages/centos/6/\$basearch/ | |
gpgcheck=0 | |
enabled=1 |
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
#!/bin/bash | |
set -ex | |
cd | |
mkdir mysql | |
cd mysql | |
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.14-1.el6.x86_64.rpm/from/http://cdn.mysql.com/ -O MySQL-client-5.6.14-1.el6.x86_64.rpm |
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
// map(Seq(1,2,3)) { i => i + "?" } = Seq(1?, 2?, 3?) | |
def map[A, B](l: Seq[A])(f: (A) => B): Seq[B] = l match { | |
case h :: t => f(h) +: map(t)(f) | |
case _ => Nil | |
} | |
// find(Seq(1,2,3)) { i => i == 2 } = Some(2) | |
def find[T](l: Seq[T])(f: (T) => Boolean): Option[T] = l match { | |
case h :: t => if (f(h)) Option(h) else find(t)(f) | |
case _ => None |