Skip to content

Instantly share code, notes, and snippets.

View narita1980's full-sized avatar
🎯
Focusing

narita1980 narita1980

🎯
Focusing
View GitHub Profile
@narita1980
narita1980 / gist:bf58f99b170a6f15c35d
Created July 23, 2014 00:55
dockerでプロクシを使う方法
http_proxy=http://hoge:1234 docker -d &
@narita1980
narita1980 / gist:0116a13464e51410c1b3
Last active August 29, 2015 14:04
Boot2Docker初期導入時に行う作業(proxy設定)
# 参考URL
# https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md
root@boot2docker:~# cat /var/lib/boot2docker/profile
export http_proxy=http://host:port/
export https_proxy=http://host:port/
root@boot2docker:~#
@narita1980
narita1980 / helloworld.go
Created March 27, 2015 05:21
Hello, World!
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
@narita1980
narita1980 / gist:49065611b3618445a7a7
Last active August 29, 2015 14:17
言語処理100本ノック 2015_第1章: 準備運動_00. 文字列の逆順
package main
func Reverse(s string) string {
runes := []rune(s)
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i]
}
return string(runes)
@narita1980
narita1980 / gist:66467901e0fe3b2ab7dd
Created March 27, 2015 06:35
言語処理100本ノック 2015_第1章: 準備運動_01. 「パタトクカシーー」
package main
func Substring(s string, i int) string {
runes := []rune(s)
return string(runes[i])
}
func main() {
str := "パタトクカシーー"
println(Substring(str, 1) + Substring(str, 3) + Substring(str, 5) + Substring(str, 7))
@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();