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 main | |
import ( | |
"code.google.com/p/go-tour/pic" | |
) | |
func Pic(dx, dy int) [][]uint8 { | |
top := make([][]uint8, dy) | |
for i := range top { | |
top[i] = make([]uint8, dx) |
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 main | |
import ( | |
"code.google.com/p/go-tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
array := strings.Fields(s) | |
m := make(map[string]int) |
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 main | |
import "fmt" | |
func fibonacci() func() int { | |
n1 := 1 | |
n2 := 0 | |
return func() int { | |
n1, n2 = n2, n1+n2 | |
return n1 |
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 main | |
import "fmt" | |
import "math/cmplx" | |
func Cbrt(x complex128, z complex128) complex128 { | |
for i := 0; i < 10; i++ { | |
z = z - (cmplx.Pow(z, 3)-x)/(3*cmplx.Pow(z, 2)) | |
} | |
return z |
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 main | |
import ( | |
"fmt" | |
"math" | |
) | |
type ErrNegativeSqrt float64 | |
func (e ErrNegativeSqrt) Error() string { |
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 main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
type String string | |
type Struct struct { | |
Greeting string |
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 main | |
import ( | |
"code.google.com/p/go-tour/pic" | |
"image" | |
"image/color" | |
) | |
const DIM = 1024 |
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 main | |
import ( | |
"io" | |
"os" | |
"strings" | |
"unicode" | |
) | |
type rot13Reader struct { |
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 main | |
import ( | |
"code.google.com/p/go-tour/tree" | |
"fmt" | |
) | |
func Walk(t *tree.Tree, ch chan int) { | |
if t.Left != nil { | |
Walk(t.Left, ch) |
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
#!/bin/bash | |
# アクセス数を抽出するスクリプト | |
# yyyy/dd/*.log.bz2 しか対応しない | |
# アクセスログから月単位でユーザID(整数5桁)毎にアクセス数をCSVファイルに提出 | |
declare -A USERS | |
# 6月から8月まで | |
months=( 6 7 8 ) | |
output=~/access_count_per_user.csv | |
for month in ${months[@]};do |
OlderNewer