従来の Upstart/daemontools 等の init系プロセスでは、
- double forking による自身を デーモン化するプロセス
- Puma/Unicorn 等の Hot restart
$ echo HOST1 HOST2 | xargs -d ' ' -P2 -I{} ssh {} 'tail -F LOG_PATH | xargs -L 1 echo $(hostname): $1' |
user system total real | |
String#scan 1.774321 0.007220 1.781541 ( 1.799350) | |
String.unpack 0.665138 0.003861 0.668999 ( 0.678201) | |
String#chars.each_slice.map(join) 10.444911 0.023717 10.468628 ( 10.521092) | |
String#[] slice with times iteration 2.244066 0.006614 2.250680 ( 2.264310) | |
String#slice with times iteration 2.271120 0.005431 2.276551 ( 2.290473) |
#!/usr/bin/env ruby | |
# usage: setusergroups [-h|--help] username child | |
# | |
# setuidgid w. support for supplementary groups | |
# ruby porting of https://gist.github.com/kazuho/6181648 | |
# | |
# see: http://d.hatena.ne.jp/hirose31/20130808/1375965331 | |
# see: https://gist.github.com/kazuho/6181648 |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
public class Main { | |
public static void main(String[] args) { | |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 E曜日", Locale.JAPAN); | |
Date now = new Date(); |
#!/bin/bash | |
if [[ -z "${PACKAGE}" ]]; then | |
echo "error: PACKAGE is not assagined." | |
echo " usage) export PACKAGE=com.example; $(basename ${0})" | |
exit 1 | |
fi | |
while : | |
do |
class ClassA(val label: String) | |
implicit val arg1:ClassA = new ClassA("ぼくは暗黙的パラメータ") // implicit def foo のための暗黙的パラメータ定義 | |
implicit def foo(implicit a: ClassA):String = { // 引数の implicit 消すと 暗黙的パラメータ見つからないってエラーになる | |
println("fooだよ") | |
a.label | |
} | |
def bar()(implicit argStr:String):String = { |
implicit def session(implicit request: RequestHeader) = request.session |
$ scaladoc -d doc/ -s src/main/scala/**/*.scala |
trait SlickDBSessionElement extends StackableController { | |
self: Controller => | |
import play.api.db.slick | |
type Session = slick.Session | |
case object DBSessionKey extends RequestAttributeKey[Session] | |
override def proceed[A](req: RequestWithAttributes[A])(f: RequestWithAttributes[A] => Result): Result = { | |
val session:Session = play.api.db.slick.DB.createSession() |