Skip to content

Instantly share code, notes, and snippets.

@poad
poad / 修正前
Created March 13, 2013 13:20
Java6でのリソースと例外処理 ref: http://qiita.com/items/4cb9b0791e2f882cefff
InputStream in = null;
try {
in = new FileInputStream("test.txt");
// stream操作
} catch (IOException e) {
// error処理
} finally {
try { // 必要に応じて
if (in != null) {
in.close();
package learning.client.cassandra
import org.apache.cassandra.thrift.Cassandra
import org.apache.cassandra.thrift.Column
import org.apache.cassandra.thrift.ColumnParent
import org.apache.cassandra.thrift.ConsistencyLevel
import org.apache.thrift.protocol.TBinaryProtocol
import org.apache.thrift.transport.TFramedTransport
import org.apache.thrift.transport.TSocket
import java.nio.ByteBuffer
// Option型(Optionモナド)を返す側
public class Configuration {
public Option<String> get(String key) {
final String value = System.getProperty(key);
if (value == null) {
return new None<String>();
} else {
return new Some<String>(value);
}
}
@poad
poad / file0.txt
Created December 1, 2013 10:04
Ubuntu ServerへのVirtualBox Guest additionsインストール ref: http://qiita.com/poad1010/items/333198e9400802534a64
sudo apt-get install xserver-xorg xvfb
sudo mount /dev/cdrom /media/cdrom
cd /media/cdrom
sudo sh VBoxLinuxAdditions.run
@poad
poad / file0.txt
Last active May 6, 2017 13:18
Vagrant base boxをいちから手動で構築する ref: http://qiita.com/poad1010/items/98672357772350a470ec
sudo sed -i -e '/Defaults\s\+env_reset/a Defaults\tenv_keep="SSH_AUTH_SOCK"' /etc/sudoers
sudo sed -i -e '/Defaults\s\+env_reset/a Defaults:vagrant !requiretty' /etc/sudoers
sudo sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=sudo' /etc/sudoers
sudo sed -i -e '/%sudo\s\ALL=(ALL:ALL) ALL/a %vagrant ALL=(ALL) NOPASSWD: ALL' /etc/sudoers
@poad
poad / file0.java
Created May 24, 2014 18:39
Selenium2 WebDriverを使ってみる ref: http://qiita.com/poad1010/items/77512f4c629b5985c16b
package com.github.poad.example.selenium;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
@poad
poad / .bashrc
Last active January 12, 2016 13:13
【メモ】Git for Windows + MinGWな環境の.bashrc ref: http://qiita.com/poad1010/items/d79a244e661b5d0e12c3
# less コマンド等のエラー回避
export TERM=msys
# lsで日本語を表示する
alias ls='ls --color=auto --show-control-chars'
alias ll='ls -l'
alias l='ls -CF'
# gettext用
export OUTPUT_CHARSET=UTF-8
@poad
poad / file0.txt
Created May 31, 2014 03:33
Mac OS X MavericksでNTFSを読み書きする(まとめメモ) ref: http://qiita.com/poad1010/items/703ba37868e4298f9cf5
brew upgrade
brew install fuse4x
brew install ntfs-3g
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.orig
sudo ln -s /usr/local/Cellar/ntfs-3g/2014.2.15/sbin/mount_ntfs /sbin/mount_ntfs
sudo /bin/cp -RfX /usr/local/opt/osxfuse/Library/Filesystems/osxfusefs.fs /Library/Filesystems
sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs
@poad
poad / file0.java
Created July 6, 2014 01:07
jMockit 1.9にしたらえらく変わってた ref: http://qiita.com/poad1010/items/7ac314ad79beb996d408
@MockClass(realClass=Hoge.class) // MockClassアノテーション廃止されてるせいで、コンパイラーさんがOKOKO
public class HogeMock {
}
@poad
poad / file0.txt
Last active September 13, 2015 06:11
【メモ】【まとめ】Ubuntu 14.04をインストールしたらやること ref: http://qiita.com/poad1010/items/c483be84df16ed1459a9
sudo aptitude update
sudo aptitude full-upgrade