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
package biz.k11i.demo; | |
import biz.k11i.demo.CFnTemplateBuilder.Subnet; | |
import biz.k11i.demo.CFnTemplateBuilder.VPC; | |
import com.google.gson.Gson; | |
import com.google.gson.GsonBuilder; | |
import java.util.ArrayList; | |
import java.util.LinkedHashMap; | |
import java.util.List; |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Resources": { | |
"Vpc1": { | |
"Type": "AWS::EC2::VPC", | |
"Properties": { | |
"CidrBlock": "10.0.0.0/16" | |
} | |
}, | |
"Subnet1": { |
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
/** | |
* finally で発生する例外を抑制しようと思ったら、こんな実装になってしもた。 | |
*/ | |
public class HowToSupressExceptions { | |
public static void main(String[] args) throws Exception { | |
new Suppressible() { | |
@Override | |
public void doTry() throws Exception { | |
throw new Exception("本体処理にてなんかの例外が発生した。"); | |
} |
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.util.Iterator; | |
import java.util.NoSuchElementException; | |
import java.util.concurrent.ArrayBlockingQueue; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* Java で yield return っぽいことを実現する機能を提供します。 | |
* | |
* 以下は使い方の一例です。 |
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.util.stream.IntStream; | |
/** | |
* parallel() によるスレッド処理がどのようなものかを眺めてみる。 | |
*/ | |
public class ParallelDemo { | |
public static void main(String[] args) { | |
IntStream.range(0, 10) | |
.parallel() | |
.map(v -> { |
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
{ | |
"foo": "bar", | |
"hoge": "fuga" | |
} |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
PROVISION = <<SCRIPT | |
curl -s https://get.docker.io/ubuntu/ | sh | |
docker pull mysql |
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 org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; | |
import java.util.Base64; | |
import java.util.function.Function; | |
/** | |
* Java 8 と Commons Codec の Base64 エンコーディング・デコーディング性能を比較します。 | |
* | |
* 比較対象の Commons Codec と、パフォーマンス測定結果の統計処理のために Commons Math3 が必要になります。 | |
*/ |
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 javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.security.spec.InvalidKeySpecException; | |
import java.util.Base64; | |
/** | |
* パスワードハッシュのデモ。 | |
*/ |
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 org.apache.commons.math3.stat.interval.*; | |
import java.util.Arrays; | |
import java.util.List; | |
/** | |
* commons-math3 を使って二項比率の信頼区間を求めるデモプログラム。 | |
*/ | |
public class BinomialProportionDemo { | |
OlderNewer