Skip to content

Instantly share code, notes, and snippets.

View kaneshin's full-sized avatar
💡

Shintaro Kaneko kaneshin

💡
View GitHub Profile
@kaneshin
kaneshin / init.go
Last active October 18, 2016 10:51
package app
import (
"net/http"
"github.com/gorilla/mux"
)
func init() {
r := mux.NewRouter()
// goodName reports whether the function name is a valid identifier.
func goodName(name string) bool {
if name == "" {
return false
}
for i, r := range name {
switch {
case r == '_':
case i == 0 && !unicode.IsLetter(r):
return false
@kaneshin
kaneshin / main.go
Last active November 8, 2020 15:14
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"runtime"
"sync"
)
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"runtime"
"sync"
)
package main
import (
"fmt"
"sync"
"time"
)
type (
// Dispatcher represents a management workers.
package main
import (
"fmt"
"os"
"strconv"
"sync"
"time"
)
var jsonData = []byte(`{"foo":true,"bar":1,"hoge":"hogehoge"}`)
var data map[string]interface{}
func BenchmarkUnmarshal(b *testing.B) {
for n := 0; n < b.N; n++ {
json.Unmarshal(jsonData, &data)
}
}
var buf bytes.Buffer
package main
import (
"fmt"
"io/ioutil"
"os"
"syscall"
"golang.org/x/crypto/ssh/terminal"
)
package main
import (
"fmt"
"sync"
"time"
)
const (
maxConcurrency = 10
package main
import (
"flag"
"fmt"
"os/exec"
"sync"
)
var (