code stringlengths 10 1.34M | language stringclasses 1
value |
|---|---|
package queue
import (
"fmt"
)
type Node struct {
host string
gpus []*GPU
}
func NewNode(host string) *Node {
n := new(Node)
n.host = host
n.gpus = make([]*GPU, 0)
return n
}
func (n *Node) AddGPU(g *GPU) {
n.gpus = append(n.gpus, g)
}
func (n *Node) String() string {
return n.host + ":" + fmt.Sprint(n.gp... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator
// Copyright 2010 Arne Vansteenkiste
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// Note that you are welcom... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2010 Arne Vansteenkiste
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// Note that you are welco... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-perfomrance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2010 Arne Vansteenkiste
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// Note that you are welco... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator
// Copyright 2010 Arne Vansteenkiste, Ben Van de Wiele
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// Note t... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2010 Arne Vansteenkiste
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// Note that you are welco... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// This file is part of MuMax, a high-performance micromagnetic simulator.
// Copyright 2011 Arne Vansteenkiste and Ben Van de Wiele.
// Use of this source code is governed by the GNU General Public License version 3
// (as published by the Free Software Foundation) that can be found in the license.txt file.
// N... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
// Generic expression parser/evaluator
type Value interface {
String() ... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
// This code differs from the slides in that it handles errors.
package main
import (
"compress/gzip"
"crypto/aes"
"crypto/cipher"
"io"
... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
package main
import (
"container/heap"
"flag"
"fmt"
"math/rand"
"time"
)
const nRequester = 100
const nWorker = 10
var roundRobin = fla... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
// This code differs from the slides in that it handles errors.
package main
import (
"compress/gzip"
"crypto/aes"
"crypto/cipher"
"io"
... | Go |
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build OMIT
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
// Generic expression parser/evaluator
type Value interface {
String() ... | Go |
// +build ignore,OMIT
package main
import (
"log"
"net/http"
"os"
"path/filepath"
)
func main() {
log.Printf("Running...")
log.Fatal(http.ListenAndServe(
"127.0.0.1:8080",
http.FileServer(http.Dir(
filepath.Join(os.Getenv("HOME"), "go", "doc")))))
}
| Go |
// +build ignore,OMIT
package main
import (
"bytes"
"net/http"
"time"
"github.com/golang/groupcache"
)
func main() {
// STARTINIT OMIT
me := "http://10.0.0.1"
peers := groupcache.NewHTTPPool(me)
// Whenever peers change:
peers.Set("http://10.0.0.1", "http://10.0.0.2", "http://10.0.0.3")
// ENDINIT OMIT
... | Go |
// +build ignore,OMIT
package main
import (
"io"
"log"
"net/http"
"sort"
"strings"
"time"
)
var modTime = time.Unix(1374708739, 0)
// START OMIT
func part(s string) SizeReaderAt {
return io.NewSectionReader(strings.NewReader(s), 0, int64(len(s)))
}
func handler(w http.ResponseWriter, r *http.Request) {
sra... | Go |
// +build ignore,OMIT
package main
import (
"io"
)
func main() {
var dst io.Writer
var src io.Reader
// START OMIT
n, err := io.Copy(dst, src)
// END OMIT
_ = n
_ = err
}
| Go |
// +build ignore,OMIT
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(os.Stdout, "%s details: %+v\n", r.URL.Path, r)
fmt.Fprintf(w, "Hello, world! at %s\n", r.URL.Path)
}
func main() {
log.Printf("Running...")
log.Fatal(http.ListenAndSer... | Go |
// +build ignore,OMIT
package main
import "io"
type SizeReaderAt interface {
io.ReaderAt
Size() int64
}
// START_DOC OMIT
// NewChunkAlignedReaderAt returns a ReaderAt wrapper that is backed
// by a ReaderAt r of size totalSize where the wrapper guarantees that
// all ReadAt calls are aligned to chunkSize boundar... | Go |
// +build ignore,OMIT
package download
func (s *Server) handleDownload(w http.ResponseWriter, r *http.Request) {
s.addActiveDownloadTotal(1)
defer s.addActiveDownloadTotal(-1)
if !isGetOrHead(w, r) {
return
}
uctx, err := s.newUserContext(r)
// ...
pl, cacheable, err := s.chooseValidPayloadToDownload(uctx)
... | Go |
// +build ignore,OMIT
package sizereaderat
import (
"io"
"sort"
)
// START_1 OMIT
// A SizeReaderAt is a ReaderAt with a Size method.
//
// An io.SectionReader implements SizeReaderAt.
type SizeReaderAt interface {
Size() int64
io.ReaderAt
}
// NewMultiReaderAt is like io.MultiReader but produces a ReaderAt
// ... | Go |
// +build ignore,OMIT
package main
import "net/http"
func main() {
http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeContent(w, r, "foo.txt", time.Now(),
strings.NewReader("I am some content.\n"))
}))
}
| Go |
// +build ignore,OMIT
package main
import (
"log"
"net/http"
"strings"
"time"
)
func main() {
log.Printf("Running...")
err := http.ListenAndServe("127.0.0.1:8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeContent(w, r, "foo.txt", time.Now(),
strings.NewReader("I am some co... | Go |
// +build OMIT
package main
import (
"fmt"
)
func main() {
in, out := make(chan int), make(chan int)
go buffer(in, out)
for i := 0; i < 10; i++ {
in <- i
}
close(in)
for i := range out {
fmt.Println(i)
}
}
// buffer provides an unbounded buffer between in and out. buffer
// exits when in is closed and ... | Go |
// +build OMIT
// fakemain runs the Subscribe example with a fake RSS fetcher.
package main
import (
"fmt"
"math/rand"
"time"
)
// STARTITEM OMIT
// An Item is a stripped-down RSS item.
type Item struct{ Title, Channel, GUID string }
// STOPITEM OMIT
// STARTFETCHER OMIT
// A Fetcher fetches Items and returns t... | Go |
// +build OMIT
// realmain runs the Subscribe example with a real RSS fetcher.
package main
import (
"fmt"
"math/rand"
"time"
rss "github.com/jteeuwen/go-pkg-rss"
)
// STARTITEM OMIT
// An Item is a stripped-down RSS item.
type Item struct{ Title, Channel, GUID string }
// STOPITEM OMIT
// STARTFETCHER OMIT
/... | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.