Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile

log2N = a

2^a = 2N

2^(a-1) = N

1=N * (1/2) ^(a-1)

package me.masahito
import com.google.common.cache.CacheBuilder
import java.util.concurrent.TimeUnit
import scala.collection.mutable.ConcurrentMap
import scala.collection.JavaConversions._
/**
*
* @param maximumSize
@masahitojp
masahitojp / line.html
Last active August 29, 2015 14:05
temper visualize
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script src="http://www.chartjs.org/assets/Chart.min.js"></script>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<div style="width:30%">
<div>
package me.masahito
import scala.annotation.tailrec
object Main {
def getConsecutiveIndexes[T](t: (List[T], List[T])): List[Int] = {
pullConsecutiveNumbers(getSameElementsIndexList(t))
}
def getSameElementsIndexList[T] (t: (List[T], List[T])): List[Int] = {
package me.masahito;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.CompletionHandler;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
object Main extends App {
def swap[A](l: List[A], topElement: A) = {
l match {
case l0:List[A] if l0.nonEmpty => {
val (l1, l2 :: l3) = l0.splitAt(l0.indexOf(topElement))
l2 :: l1 ::: l3
}
case _ => l
}
}
import akka.actor._
import akka.actor.SupervisorStrategy._
import java.util.concurrent.TimeUnit
import scala.concurrent.duration._
import akka.util.Timeout
import akka.pattern.{ ask, pipe }
import com.typesafe.config.ConfigFactory
/**_
* FirstErrorActor用のエラーフラグ
diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb
index 591676b..3f9fbc4 100644
--- a/Library/Formula/emacs.rb
+++ b/Library/Formula/emacs.rb
@@ -17,6 +17,7 @@ class Emacs < Formula
option "with-x", "Include X11 support"
option "use-git-head", "Use Savannah (faster) git mirror for HEAD builds"
option "keep-ctags", "Don't remove the ctags executable that emacs provides"
+ option "japanese", "Patch for Japanese input methods"
@masahitojp
masahitojp / build.gradle
Created November 19, 2014 09:19
Java8+Lombok+IntellijIdea+Gradleの環境用の最小のbuild.gradle
apply plugin: 'java'
apply plugin: 'idea'
group = 'me.masahito'
version = "0.1.0-SNAPSHOT"
sourceCompatibility = targetCompatibility = '1.8'
repositories.mavenCentral()
configurations {
provided
package me.masahito;
import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.server.handlers.PathHandler;
import io.undertow.servlet.Servlets;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.servlet.api.DeploymentManager;
import javax.servlet.ServletException;