Skip to content

Instantly share code, notes, and snippets.

@yusuke2255
yusuke2255 / SampleResource.java
Created August 27, 2015 10:00
画像を返すDropwizardリソース
package my.sample.resources;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@yusuke2255
yusuke2255 / HttpClientHttpsProxyTest.java
Created February 12, 2014 04:49
Java HttpClient4.3でProxy(https)を使うテスト
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
@yusuke2255
yusuke2255 / aws_vip_change.sh
Last active August 29, 2015 13:57
Mysql Master HAをソースからインストールするレシピ
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Illegal param count.count = $#"
exit 1
fi
# High Availability IP variables
# Other node's IP to ping and VIP to swap if other node goes down
VIP_ENI_ID=eni-xxxxxxxxx
package jp.test.runner;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@yusuke2255
yusuke2255 / build.gradle
Last active August 29, 2015 14:05
Exclude subproject's module
// OK
testCompile (project(':tests:common')){
exclude group: 'junit'
}
@yusuke2255
yusuke2255 / file1.java
Last active August 29, 2015 14:16
【メモ】Dropwizardのmigrationでmigration.xmlファイルを指定する ref: http://qiita.com/Kawata/items/87172148fc86431b49e4
package jp.hoge;
import org.skife.jdbi.v2.DBI;
import io.dropwizard.Application;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.jdbi.DBIFactory;
import io.dropwizard.migrations.MigrationsBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
@yusuke2255
yusuke2255 / file0.xml
Created February 25, 2015 05:34
【メモ】Dropwizardのmigrationでカラムにcharasetを指定する ref: http://qiita.com/Kawata/items/834dce601aacbef9cc67
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet id="1" author="y.hoge">
<createTable tableName="hoges">
<column name="id" type="int(11)" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
@yusuke2255
yusuke2255 / file0.txt
Created February 27, 2015 02:11
【メモ】Hibernateでinsert時にprimary keyでauto incrementを指定している時 ref: http://qiita.com/Kawata/items/62cbe83789b5a3c94bf7
ERROR [2015-02-27 11:01:38,781] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: ef46ad41b77903a3
! com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hoge.hibernate_sequence' doesn't exist
! at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_20]
@yusuke2255
yusuke2255 / aws-init-setting.yml
Created March 3, 2015 08:46
【メモ】ansibleでAWSのEC2インスタンスの基本設定をするplaybook ref: http://qiita.com/Kawata/items/d34dda5de93564873ae7
- hosts: '{{host_name}}'
sudo: yes
roles:
- common
- aws/common
- aws/amazon-linux-init
@yusuke2255
yusuke2255 / build.gradle
Created March 20, 2015 05:53
【メモ】DropwizardでCookieのsession idで認証してみる ref: http://qiita.com/Kawata/items/2e8453ac149e365f762a
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.0'
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'application'