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.jsoup.Jsoup; | |
import org.jsoup.nodes.Document; | |
import org.jsoup.select.Elements; | |
import twitter4j.Twitter; | |
import twitter4j.TwitterException; | |
import twitter4j.TwitterFactory; | |
import twitter4j.UserList; | |
import java.io.IOException; | |
import java.net.URL; |
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
import com.fasterxml.jackson.core.JsonGenerator; | |
import com.fasterxml.jackson.core.PrettyPrinter; | |
import java.io.IOException; | |
import java.util.Arrays; | |
import java.util.Stack; | |
/** | |
* Google Chrome における JSON.stringify() に近い pretty print を実現します。 | |
* <p> |
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
import com.google.gson.Gson; | |
import org.apache.http.HttpEntity; | |
import org.apache.http.client.methods.CloseableHttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.StringEntity; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClientBuilder; | |
import java.io.BufferedReader; | |
import java.io.IOException; |
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
/** | |
* 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
{ | |
"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
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; |