code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The lzma package implements reading and writing of LZMA format compressed data. // Reference implementation is LZMA SDK version 4.65 originaly developed b...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma type lenCoder struct { choice []uint16 lowCoder []*rangeBitTreeCoder midCoder []*rangeBitTreeCoder highCoder *rangeBitTreeCoder } fun...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma type rangeBitTreeCoder struct { models []uint16 // length(models) is at most 1<<8 numBitLevels uint32 // min 2; max 8 } func newRang...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma import ( "io" "fmt" "strconv" "strings" ) const ( BestSpeed = 1 BestCompression = 9 DefaultCompression = 5 ) // local erro...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma type litSubCoder struct { coders []uint16 } func newLitSubCoder() *litSubCoder { return &litSubCoder{ coders: initBitModels(0x300), } } ...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma import ( "io" ) type lzOutWindow struct { w io.Writer buf []byte winSize uint32 pos uint32 streamPos uint32 //unp...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma import ( "bufio" "io" ) const ( kTopValue = 1 << 24 kNumBitModelTotalBits = 11 kBitModelTotal = 1 << kNumBitModelTotal...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma import "io" const ( kHash2Size = 1 << 10 kHash3Size = 1 << 16 kBT2HashSize = 1 << 16 kStartMaxLen = 1 kHa...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "code.google.com/p/lzma" //"lzma.googlecode.com/hg" "flag" "fmt" "log" "io" "os" "path" "runtime" "strings" ) var ( stdout...
Go
// Copyright (c) 2010, Andrei Vieru. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lzma func minInt32(left int32, right int32) int32 { if left < right { return left } return right } func minUInt32(left uint32, right uint32) u...
Go
// Copyright 2012 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. // Package crypt provides simple, password-based encryption and decryption of data blobs. package crypt import ( "bytes" "crypto/aes" "crypto/cipher" "cry...
Go
// Copyright 2012 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. package main import ( "flag" "fmt" "log" "os" "regexp/syntax" "runtime/pprof" ) var maxState = flag.Int("m", 1e5, "maximum number of states to explore"...
Go
// Copyright 2011 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. // Copy of code.google.com/p/codesearch/regexp/utf.go. package main import ( "regexp/syntax" "unicode" "unicode/utf8" ) const ( instFail = syntax.I...
Go
// Copyright 2011 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. // Copied from code.google.com/p/codesearch/regexp/copy.go // and adapted for the problem of finding a matching string, not // testing whether a particular str...
Go
// Copyright 2011 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. // Code to merge (join) multiple regexp progs into a single prog. // New code; not copied from anywhere. package main import "regexp/syntax" func joinProgs(...
Go
// Copyright 2011 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. // Copied from code.google.com/p/codesearch/regexp/copy.go. // Copied from Go's regexp/syntax. // Formatters edited to handle instByteRange. package main im...
Go
// Copyright 2011 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. // Copied from code.google.com/p/codesearch/sparse/set.go, // tweaked for better inlinability. package main // For comparison: running cindex over the Linux ...
Go
// Copyright 2012 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. // Copy of go/src/pkg/sort/sort.go, specialized for []int // and to remove some array indexing. package main func min(a, b int) int { if a < b { return a ...
Go
package app import ( "fmt" "net/http" "appengine" "appengine/memcache" _ "code.google.com/p/rsc/appfs/server" _ "code.google.com/p/rsc/blog/post" ) func init() { http.HandleFunc("/admin/", Admin) } func Admin(w http.ResponseWriter, req *http.Request) { c := appengine.NewContext(req) switch req.FormValue("...
Go
// Copyright 2012 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. // Package plist implements parsing of Apple plist files. package plist import ( "bytes" "fmt" "reflect" "strconv" ) func next(data []byte) (skip, tag, r...
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. // Package gf256 implements arithmetic over the Galois Field GF(256). package gf256 import "strconv" // A Field represents an instance of GF(256) defined by ...
Go
// Copyright 2011 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. package main import ( // "flag" "bufio" "fmt" "log" "net" "net/rpc" "os" "strings" "syscall" "code.google.com/p/rsc/google" "code.google.com/p/rsc...
Go
// Copyright 2011 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. // TODO: Add ChatHangup. // TODO: Auto-hangup chats that are gone. package main import ( "fmt" "code.google.com/p/rsc/google" "code.google.com/p/rsc/xmpp...
Go
// Copyright 2011 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. // TODO: Something about redialing. package google import ( // "flag" "encoding/json" "fmt" "io/ioutil" "log" "net" "net/rpc" "os" "os/exec" "sysca...
Go
package main import ( "bufio" "bytes" "flag" "fmt" "io" "log" "os" "os/exec" "os/signal" "regexp" "sort" "strings" "time" "code.google.com/p/rsc/google" "code.google.com/p/rsc/imap" ) var cmdtab = []struct { Name string Args int F func(*Cmd, *imap.MsgPart) *imap.MsgPart TF func(*Cmd, []*imap....
Go
package main import ( "bufio" "bytes" "encoding/base64" "flag" "fmt" "io" "net/smtp" "os" "regexp" "strings" "code.google.com/p/rsc/google" ) func enc(s string) string { // TODO =? .. ?= return s } type Addr struct { Name string Email string } func (a Addr) enc() string { if a.Name == "" { retur...
Go
// Copyright 2011 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. package google import "code.google.com/p/rsc/xmpp" type ChatID struct { ID string Email string Status xmpp.Status StatusMsg string } type ...
Go
// Copyright 2011 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. package main /* TODO: - Del of main window should move to other window. - Editing main window should update status on \n or something like that. - Make use...
Go
package main import ( "io/ioutil" "log" "os" "code.google.com/p/goprotobuf/proto" "code.google.com/p/rsc/gtfs" ) func main() { log.SetFlags(0) if len(os.Args) != 2 { log.Fatal("usage: mbta file.pb") } pb, err := ioutil.ReadFile(os.Args[1]) if err != nil { log.Fatal(err) } var feed gtfs.FeedMessage ...
Go
package fuse import ( "time" ) type attr struct { Ino uint64 Size uint64 Blocks uint64 Atime uint64 Mtime uint64 Ctime uint64 Crtime_ uint64 // OS X only AtimeNsec uint32 MtimeNsec uint32 CtimeNsec uint32 CrtimeNsec uint32 // OS X only Mode uint32 Nlink u...
Go
package fuse import "time" type attr struct { Ino uint64 Size uint64 Blocks uint64 Atime uint64 Mtime uint64 Ctime uint64 AtimeNsec uint32 MtimeNsec uint32 CtimeNsec uint32 Mode uint32 Nlink uint32 Uid uint32 Gid uint32 Rdev uint32 // Blksize uint32...
Go
// Copyright 2012 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. // Hellofs implements a simple "hello world" file system. package main import ( "log" "os" "code.google.com/p/rsc/fuse" ) func main() { c, err := fuse.M...
Go
// Copyright 2012 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. // FUSE service loop, for servers that wish to use it. package fuse import ( "runtime" ) func stack() string { buf := make([]byte, 1024) return string(bu...
Go
// Copyright 2011 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. // Derived from FUSE's fuse_kernel.h /* This file defines the kernel interface of FUSE Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu> T...
Go
// Copyright 2012 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. package fuse import ( "fmt" "net" "os" "os/exec" "syscall" ) func mount(dir string) (fusefd int, errmsg string) { fds, err := syscall.Socketpair(syscal...
Go
// Copyright 2011 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. // Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, // which carries this notice: // // The files in this directory are subject to the following li...
Go
package fuse
Go
// Copyright 2012 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. // FUSE directory tree, for servers that wish to use it with the service loop. package fuse import ( "os" pathpkg "path" "strings" ) // A Tree implements...
Go
// Copyright 2012 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. // FUSE service loop, for servers that wish to use it. package fuse import ( "fmt" "hash/fnv" "io" "log" "os" "path" "sync" "syscall" "time" ) // T...
Go
// Copyright 2011 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. // TODO: Rewrite using package syscall not cgo package fuse /* // Adapted from Plan 9 from User Space's src/cmd/9pfuse/fuse.c, // which carries this notice:...
Go
// Copyright 2012 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. // S3get fetches a single object from or lists the objects in an S3 bucket. package main import ( "flag" "fmt" "log" "os" "code.google.com/p/rsc/keychai...
Go
// Copyright 2012 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. // Crypt is a simple password-based encryption program, // demonstrating how to use code.google.com/p/rsc/crypt. // // Encrypt input to output using password: ...
Go
// Copyright 2012 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. // jfmt reads JSON from standard input, formats it, and writes it to standard output. package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "lo...
Go
// Copyright 2013 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. // Dump Github top languages. package main import ( "bytes" "fmt" "io/ioutil" "log" "net/http" "regexp" "sort" "strconv" ) var ( langRE = regexp.Mu...
Go
// Asmlint looks for errors in and sometimes rewrites assembly source files. package main import ( "bytes" "flag" "fmt" "go/ast" "go/build" "go/token" "go/parser" "go/printer" "io/ioutil" "log" "os" "os/exec" "path/filepath" "regexp" "strconv" "strings" ) var ( warnCall = flag.Bool("warncall", false,...
Go
package main import ( "bytes" "encoding/json" "encoding/xml" "flag" "fmt" "html" "html/template" "io/ioutil" "log" "net/http" "net/url" "os" "sort" "strconv" "strings" "time" ) func usage() { fmt.Fprintf(os.Stderr, `usage: issue [-p project] query If query is a single number, prints the full history...
Go
package main import ( "flag" "log" "os" "os/exec" "strings" "sync" "syscall" "time" "code.google.com/p/goplan9/plan9/acme" ) var args []string var win *acme.Win var needrun = make(chan bool, 1) var kq struct { fd int dir *os.File m map[string]*os.File name map[int]string } func kadd(fd int) { kbuf :=...
Go
// Uploadbot uploads tgz snapshots of Mercurial repositories to the download // section of a Google Code project. // // Usage // // Synopsis: // // uploadbot [-f] [-pw=pwfile] [-root=rootdir] [project...] // // Uploadbot reads from pwfile (default $HOME/codebot.pw) an email address // and code.google.com-generated pas...
Go
package imap // NOTE(rsc): These belong elsewhere but the existing charset // packages seem too complicated. var tab_iso8859_1 = [256]rune{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x...
Go
package imap import ( "bytes" "encoding/base64" "strings" "unicode" ) func decode2047chunk(s string) (conv []byte, rest string, ok bool) { // s is =?... // and should be =?charset?e?text?= j := strings.Index(s[2:], "?") if j < 0 { return } j += 2 if j+2 >= len(s) || s[j+2] != '?' { return } k := stri...
Go
package imap import ( "bufio" "bytes" "crypto/md5" "crypto/tls" "fmt" "io" "log" "net" "os" "os/exec" "strconv" "strings" "sync" ) var Debug = false const tag = "#" // A Mode specifies the IMAP connection mode. type Mode int const ( Unencrypted Mode = iota // unencrypted TCP connection StartTLS ...
Go
package imap import ( "bytes" "fmt" "log" "regexp" "sort" "strings" "time" ) type Flags uint32 const ( FlagJunk Flags = 1 << iota FlagNonJunk FlagReplied FlagFlagged FlagDeleted FlagDraft FlagRecent FlagSeen FlagNoInferiors FlagNoSelect FlagMarked FlagUnMarked FlagHasChildren FlagHasNoChildren ...
Go
package imap import ( "bufio" "bytes" "fmt" "io" "log" "strings" "time" ) type sxKind int const ( sxNone sxKind = iota sxAtom sxString sxNumber sxList ) type sx struct { kind sxKind data []byte number int64 sx []*sx } func rdsx(b *bufio.Reader) (*sx, error) { x := &sx{kind: sxList} for { ...
Go
// Copyright 2011 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. package main import ( "code.google.com/p/rsc/devweb/slave" _ "code.google.com/p/rsc/blog/post" ) func main() { slave.Main() }
Go
// Copyright 2009 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. // Adapted from encoding/xml/read_test.go. // Package atom defines XML data structures for an Atom feed. package atom import ( "encoding/xml" "time" ) typ...
Go
// Copyright 2011 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. package post import ( "bytes" "encoding/json" "encoding/xml" "fmt" "html/template" "net/http" "os" "path" "runtime/debug" "sort" "strings" "time" ...
Go
package post import ( "fmt" "net/http" "runtime/debug" qrweb "code.google.com/p/rsc/qr/web" ) func carp(f http.HandlerFunc) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { defer func() { if err := recover(); err != nil { w.Header().Set("Content-Type", "text/plain...
Go
// Copyright 2012 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. // Smugup uploads a collection of photos to SmugMug. // // Run 'smugup -help' for details. package main import ( "crypto/md5" "flag" "fmt" "io/ioutil" "l...
Go
// Copyright 2012 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. // Package smugmug uses the SmugMug API to manipulate photo albums // stored on smugmug.com. package smugmug import ( "bytes" "crypto/md5" "encoding/json" ...
Go
// Copyright 2011 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. // Devweb is a simple environment for developing a web server. // It runs its own web server on the given address and proxies // all requests to the http serve...
Go
// Copyright 2011 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. package slave import ( "fmt" "log" "net" "net/http" "os" ) func Main() { if len(os.Args) != 2 || os.Args[1] != "LISTEN_STDIN" { fmt.Fprintf(os.Stderr...
Go
// Copyright 2012 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. /* QR data layout qr/ upload/ id.png id.fix flag/ id */ // TODO: Random seed taken from GET for caching, repeatability. // TODO: Flag for abuse butto...
Go
package web import ( "bytes" "fmt" "image" "image/color" "image/draw" "image/png" "net/http" "strconv" "strings" "code.google.com/p/freetype-go/freetype" "code.google.com/p/rsc/appfs/fs" "code.google.com/p/rsc/qr" "code.google.com/p/rsc/qr/coding" ) func makeImage(req *http.Request, caption, font string...
Go
// Copyright 2011 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. package resize import ( "image" "image/color" ) // average convert the sums to averages and returns the result. func average(sum []uint64, w, h int, n uint6...
Go
// Copyright 2011 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. // Package coding implements low-level QR coding details. package coding import ( "fmt" "strconv" "strings" "code.google.com/p/rsc/gf256" ) // Field is ...
Go
// +build ignore package main import "fmt" // tables from qrencode-3.1.1/qrspec.c var capacity = [41]struct { width int words int remainder int ec [4]int }{ {0, 0, 0, [4]int{0, 0, 0, 0}}, {21, 26, 0, [4]int{7, 10, 13, 17}}, // 1 {25, 44, 7, [4]int{10, 16, 22, 28}}, {29, 70, 7, [4]int{15, 26, ...
Go
// Copyright 2011 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. package qr // PNG writer for QR codes. import ( "bytes" "encoding/binary" "hash" "hash/crc32" ) // PNG returns a PNG image displaying the code. // // PN...
Go
// Copyright 2011 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. /* Package qr encodes QR codes. */ package qr import ( "errors" "image" "image/color" "code.google.com/p/rsc/qr/coding" ) // A Level denotes a QR error ...
Go
// Copyright 2011 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. // Package libqrencode wraps the C libqrencode library. // The qr package (in this package's parent directory) // does not use any C wrapping. This code is he...
Go
// Copyright 2013 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. package webdriver import ( "bytes" "encoding/json" "fmt" "io" "io/ioutil" "net/http" "strings" "time" ) type Conn struct { prefix string } type Ses...
Go
// Copyright 2013 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. // Package webdriver implements a client for the Selenium WebDriver wire protocol. // It can be used with the ChromeDriver server and perhaps with the Selenium...
Go
// Copyright 2011 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. // TODO(rsc): // More precise error handling. // Presence functionality. // TODO(mattn): // Add proxy authentication. // Package xmpp implements a simple Goo...
Go
// Copyright 2012 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. // Package client implements a basic appfs client. package client import ( "bytes" "encoding/json" "fmt" "io" "io/ioutil" "net/http" "strings" "time" ...
Go
// Copyright 2012 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. // Package fs is an indirection layer, allowing code to use a // file system without knowing whether it is the host file system // (running without App Engine)...
Go
// Copyright 2012 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. package fs import ( "io/ioutil" "net/http" "os" "path/filepath" "code.google.com/p/rsc/appfs/proto" ) type context struct{} type cacheKey struct{} fu...
Go
// Copyright 2012 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. // appmount mounts an appfs file system. package main import ( "bytes" "encoding/gob" "flag" "fmt" "log" "os" "os/exec" "path" "strings" "syscall" ...
Go
// Copyright 2012 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. // Package server implements an appfs server backed by the // App Engine datastore. package server import ( "bytes" "crypto/sha1" "encoding/base64" "enco...
Go
// Copyright 2012 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. // appfile is a command-line interface to an appfs file system. package main import ( "flag" "fmt" "io/ioutil" "log" "os" "code.google.com/p/rsc/appfs/...
Go
// Copyright 2012 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. // Package proto defines the protocol between appfs client and server. package proto import "time" // An Auth appears, JSON-encoded, as the X-Appfs-Auth head...
Go
// Copyright 2012 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. // Parsing of Arq's binary data structures. package arq import ( "bytes" "encoding/binary" "fmt" "reflect" "time" ) var errMalformed = fmt.Errorf("malf...
Go
// Copyright 2012 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. /* Hist shows the history of a given file, using Arq backups. usage: hist [-d] [-h host] [-m mtpt] [-s yyyy/mmdd] file ... The -d flag causes it to show ...
Go
// Copyright 2012 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. // Package arq implements read-only access to Arq backups stored on S3. // Arq is a Mac backup tool (http://www.haystacksoftware.com/arq/) // but the package c...
Go
// Copyright 2012 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. package arq import ( "crypto/aes" "crypto/cipher" "crypto/sha1" "hash" "log" "bitbucket.org/taruti/pbkdf2.go" // TODO: Pull in copy ) type cryptoState...
Go
// Copyright 2012 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. /* Arqfs implements a file system interface to a collection of Arq backups. usage: arqfs [-m mtpt] Arqfs mounts the Arq backups on the file system direct...
Go
// Copyright 2012 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. // On-cloud data structures package arq import ( "fmt" "os" "time" ) // plist data structures type computerInfo struct { UserName string `plist:"userNa...
Go
// Copyright 2011 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. // Simple demonstration of a graph interface and // Dijkstra's algorithm built on top of that interface, // without using inheritance. package graph import "...
Go
// Copyright 2011 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. // Rosetta Code-inspired maze generator and solver. // Demonstrates use of interfaces to separate algorithm // implementations (graph.ShortestPath, heap.*) fro...
Go
// Copyright 2012 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. package keychain /* #include <CoreFoundation/CoreFoundation.h> #include <Security/Security.h> #include <CoreServices/CoreServices.h> #cgo LDFLAGS: -framework...
Go
// Copyright 2012 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. // Package keychain implements access to the passwords and other keys // stored in the system-provided keychain. package keychain // BUG(rsc): Package keychai...
Go
// Copyright 2009 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. // Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer // object, creating another object (Reader or Writer) that also implements // the ...
Go
// Copyright 2009 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. package testing import ( "bytes" "fmt" "io" "os" "strings" "time" ) type InternalExample struct { Name string F func() Output string } func R...
Go
// Copyright 2009 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. package testing import ( "flag" "fmt" "os" "runtime" "time" ) var matchBenchmarks = flag.String("test.bench", "", "regular expression to select benchmark...
Go
// Copyright 2009 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. package iotest import "io" // TruncateWriter returns a Writer that writes to w // but stops silently after n bytes. func TruncateWriter(w io.Writer, n int64) ...
Go
// Copyright 2009 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. package iotest import ( "io" "log" ) type writeLogger struct { prefix string w io.Writer } func (l *writeLogger) Write(p []byte) (n int, err error) ...
Go
// Copyright 2009 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. // Package iotest implements Readers and Writers useful mainly for testing. package iotest import ( "errors" "io" ) // OneByteReader returns a Reader that i...
Go
// Copyright 2009 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. // Package quick implements utility functions to help with black box testing. package quick import ( "flag" "fmt" "math" "math/rand" "reflect" "strings" ...
Go
// Copyright 2009 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. // Package testing provides support for automated testing of Go packages. // It is intended to be used in concert with the ``go test'' command, which automates ...
Go
// Copyright 2012 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. package flate // forwardCopy is like the built-in copy function except that it always goes // forward from the start, even if the dst and src overlap. func for...
Go
// Copyright 2009 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. package flate const ( // 2 bits: type 0 = literal 1=EOF 2=Match 3=Unused // 8 bits: xlength = length - MIN_MATCH_LENGTH // 22 bits xoffset = off...
Go
// Copyright 2009 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. package flate var reverseByte = [256]byte{ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48,...
Go