Skip to content

Instantly share code, notes, and snippets.

View narita1980's full-sized avatar
🎯
Focusing

narita1980 narita1980

🎯
Focusing
View GitHub Profile
@narita1980
narita1980 / Category.java
Created May 9, 2012 00:58
Categoryのサンプル
public class Category {
String name;
Map element;
List childCategory;
public Category(String name) {
this.name = name;
element = new HashMap();
childCategory = new ArrayList();
@narita1980
narita1980 / SampleWebDriver.java
Created June 5, 2012 09:32
WebDriverを使ったGoogle検索結果画面の取得方法
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
@narita1980
narita1980 / gist:2880031
Created June 6, 2012 05:06
【Linux】プロセスのファイルディスクリプタ確認方法
$ ls -la /proc/23109/fd/
lrwx------ 1 kotaro kotaro 64 1月 8 17:30 0 -> /dev/pts/1
lrwx------ 1 kotaro kotaro 64 1月 8 17:30 1 -> /dev/pts/1
lr-x------ 1 kotaro kotaro 64 1月 8 17:30 10 -> /home/kotaro/script/input.txt
lr-x------ 1 kotaro kotaro 64 1月 8 17:30 11 -> /home/kotaro/script/input.txt
lr-x------ 1 kotaro kotaro 64 1月 8 17:30 12 -> /home/kotaro/script/input.txt
lr-x------ 1 kotaro kotaro 64 1月 8 17:30 13 -> /home/kotaro/script/input.txt
@narita1980
narita1980 / gist:2901916
Created June 9, 2012 17:41
Googleドキュメントの表計算で曜日を入力させる方法
=IF(A1="", "", IF(WEEKDAY(A1, 2)=1, "月", IF(WEEKDAY(A1, 2)=2, "火", IF(WEEKDAY(A1, 2)=3, "水", IF(WEEKDAY(A1, 2)=4, "木", IF(WEEKDAY(A1, 2)=5, "金", IF(WEEKDAY(A1, 2)=6, "土", IF(WEEKDAY(A1, 2)=7, "日"))))))))
@narita1980
narita1980 / Utils.java
Created June 15, 2012 07:18
InputStreamをStringに変換するプログラム
/*
* 参考サイト
* http://d.hatena.ne.jp/gungnir_odin/20091129/1259333223
*/
public class Utils {
public static String inputStreemToString(InputStream in) throws IOException{
BufferedReader reader =
new BufferedReader(new InputStreamReader(in, "UTF-8"/* 文字コード指定 */));
StringBuffer buf = new StringBuffer();
@narita1980
narita1980 / gist:2942010
Created June 16, 2012 17:22
Rackhubの初期ログイン情報
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
@narita1980
narita1980 / gist:2942017
Created June 16, 2012 17:26
Rackhubのサーバ情報
rackhuber@takashi209:~$ uname -a
Linux takashi209.rackbox.net 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
rackhuber@takashi209:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz
stepping : 11
microcode : 0x1
@narita1980
narita1980 / gist:2942024
Created June 16, 2012 17:29
Rackhubのホームディレクトリ情報
rackhuber@takashi209:~$ pwd
/home/rackhuber
rackhuber@takashi209:~$ ls -l
total 4
drwxrwxr-x 3 rackhuber rackhuber 4096 Apr 24 01:42 perl
@narita1980
narita1980 / HelloWorld.java
Created June 21, 2012 01:04
TodaSpec用サンプルソース
public class HelloWorld {
public static void main(String args[]) {
new HelloWorld().getMessage();
}
public void getMessage(){
System.out.println("HelloWorld!");
}
}
@narita1980
narita1980 / SampleGetMacAddress.java
Created July 6, 2012 02:22
NetworkInterfaceを使いMACアドレスを取得する(要JDK1.6以上)
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class SampleGetMacAddress {
public static void main(String args[]) {
try {