CombinedText
stringlengths
4
3.42M
package manager import ( "fmt" "strings" "sync" "time" "github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/common/log" "github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/common/poller" "github.com/apache/incubator-trafficcontrol/traffic_monitor/experimental/traffic_mo...
package backend import ( "bytes" "errors" "io" "sort" "sync" "github.com/restic/restic/debug" ) type entry struct { Type Type Name string } type memMap map[entry][]byte // MemoryBackend is a mock backend that uses a map for storing all data in // memory. This should only be used for tests. type MemoryBacke...
// Package swift provides an interface to the Swift object storage system package swift import ( "bufio" "bytes" "context" "fmt" "io" "net/url" "path" "strconv" "strings" "time" "github.com/ncw/swift" "github.com/pkg/errors" "github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs/config" "github.com...
package main import ( "fmt" "net/http" "strconv" "time" . "github.com/Deleplace/programming-idioms/pig" "google.golang.org/appengine/log" ) func implSave(w http.ResponseWriter, r *http.Request) error { idiomIDStr := r.FormValue("idiom_id") existingIDStr := r.FormValue("impl_id") username := r.FormValue("us...
package main import ( "flag" "fmt" "net" "net/http" _ "net/http/pprof" "os" "os/signal" "syscall" "time" pb "github.com/viru/berrybot/proto" log "github.com/Sirupsen/logrus" "github.com/kidoman/embd" _ "github.com/kidoman/embd/host/rpi" // This loads the RPi driver "google.golang.org/grpc" ) // server...
package concordances import ( "encoding/json" "fmt" "os" "reflect" "sort" "testing" cmneo4j "github.com/Financial-Times/cm-neo4j-driver" "github.com/Financial-Times/concepts-rw-neo4j/concepts" "github.com/Financial-Times/neo-utils-go/v2/neoutils" "github.com/Financial-Times/go-logger/v2" "github.com/stret...
package pingbeat import ( "errors" "github.com/davecgh/go-spew/spew" "github.com/elastic/beats/libbeat/beat" "github.com/elastic/beats/libbeat/cfgfile" "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/libbeat/publisher" cfg "github.com/joshuar/pingbeat...
/* * MIT License * * Copyright (c) 2017 SmartestEE Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, ...
// TODO : need to change to api package main import ( "bytes" "encoding/json" "encoding/binary" "fmt" "html" "io" "io/ioutil" "os/exec" "errors" "strconv" "log" "net/http" "github.com/gorilla/mux" "time" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/mem" "github.com/shirou/gopsutil/di...
// Copyright 2019 Authors of Cilium // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
// Copyright 2018 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. // Package build contains helper functions for building kernels/images. package build import ( "bytes" "fmt" "path/filepath" "regexp" "strings" "tim...
package castled import ( "encoding/json" "fmt" "io/ioutil" "log" "os" "os/user" "path/filepath" "regexp" "strconv" "syscall" "time" "github.com/google/uuid" "github.com/quantum/castle/pkg/cephd" "github.com/quantum/clusterd/pkg/orchestrator" "github.com/quantum/clusterd/pkg/proc" ) const ( DevicesVal...
package cli import ( "errors" "fmt" "io" "os" "github.com/apprenda/kismatic/pkg/data" "github.com/apprenda/kismatic/pkg/install" "github.com/apprenda/kismatic/pkg/util" "github.com/spf13/cobra" ) type upgradeOpts struct { generatedAssetsDir string verbose bool outputFormat string skipPre...
package client import ( "bytes" "fmt" "github.com/Aptomi/aptomi/pkg/config" "github.com/Aptomi/aptomi/pkg/lang" "github.com/Aptomi/aptomi/pkg/object" "github.com/Aptomi/aptomi/pkg/object/codec/yaml" "github.com/gosuri/uitable" "io/ioutil" "net/http" "time" ) // Show method retrieves current policy from apto...
/* * Copyright 2018 The original author or authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicabl...
/* * Copyright 2018 The original author or authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicabl...
package domain import ( "errors" "io/ioutil" "net/http" "github.com/vardius/go-api-boilerplate/pkg/http/response" "github.com/vardius/gorouter" ) // ErrEmptyRequestBody is when an request has empty body. var ErrEmptyRequestBody = errors.New("Empty request body") // ErrInvalidURLParams is when an request has in...
package install import ( "fmt" "io" "io/ioutil" "os" "path/filepath" "github.com/apprenda/kismatic-platform/pkg/tls" "github.com/cloudflare/cfssl/csr" ) // The PKI provides a way for generating certificates for the cluster described by the Plan type PKI interface { GenerateClusterCerts(p *Plan) error } // L...
package mount // import "github.com/docker/docker/pkg/mount" import ( "sort" "strconv" "strings" "github.com/sirupsen/logrus" ) // mountError records an error from mount or unmount operation type mountError struct { op string source, target string flags uintptr data string err...
// +build linux package mount import ( "errors" "fmt" "strings" "sync" "syscall" log "github.com/Sirupsen/logrus" "github.com/docker/docker/pkg/mount" ) // Ops defines the interface for keep track of volume driver mounts. type Ops interface { // String representation of the mount table String() string // ...
// Copyright 2017 The Kubernetes Authors All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by...
// Copyright 2014 Wandoujia Inc. All Rights Reserved. // Licensed under the MIT (MIT-LICENSE.txt) license. package proxy import ( "bytes" "encoding/json" "errors" "net" "net/http" "os" "path" "strconv" "strings" "sync" "time" "github.com/wandoulabs/codis/pkg/models" "github.com/wandoulabs/codis/pkg/prox...
// Copyright 2016 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. package repro import ( "bytes" "fmt" "os" "sort" "sync" "time" "github.com/google/syzkaller/pkg/csource" "github.com/google/syzkaller/pkg/log" "...
/* Copyright 2015 The Camlistore Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
package setup import ( "bytes" "crypto/sha256" "crypto/tls" "crypto/x509" "encoding/json" "encoding/pem" "errors" "fmt" "io" "io/ioutil" "net/url" "os" "path/filepath" "regexp" "runtime" "strings" "sync" "time" "github.com/dcos/dcos-cli/pkg/config" "github.com/dcos/dcos-cli/pkg/dcos" "github.com/...
package store import ( "os" "path" "strings" ) type Event struct { Type int Seqn uint64 Path string Value string } const ( Set = (1<<iota) Del Add Rem ) var ( BadPathError = os.NewError("bad path") ) type Store struct { applyCh chan apply reqCh chan req watchCh chan watch watches map[string][]watch...
package xpi import ( "archive/zip" "bytes" "crypto/sha1" "crypto/sha256" "encoding/base64" "fmt" "github.com/pkg/errors" "io" "io/ioutil" "strings" "unicode/utf8" ) // consts and vars for formatFilename const ( maxLineByteLen = 72 maxContinuedByteLen = 70 // -1 for leading space and -1 for trailing ...
package plugins import ( "bytes" "fmt" "log" "regexp" "time" "unicode" ) type AutobanMatches struct { Matcher *regexp.Regexp Time string `json:"time"` Regex string `json:"match"` Strip []string `json:"strip"` Reason string `json:"reason"` } type Autoban struct { plugin autobanStats autoBa...
package plugins import ( "os" "ircclient" "time" "container/list" "json" "sync" "fmt" "log" ) const notifyBefore = 12 // TODO: config type LecturePlugin struct { ic *ircclient.IRCClient notifications *list.List done chan bool update chan bool lock sync.Mutex } type n...
package plugins import ( "bytes" "context" "encoding/json" "fmt" "os" "os/exec" "path/filepath" "strings" "time" "github.com/pkg/errors" ) // List maps a Buffalo command to a slice of Command type List map[string]Commands // Available plugins for the `buffalo` command. // It will look in $PATH and the `./...
package main import ( "github.com/jmcvetta/neoism" "github.com/rcrowley/go-metrics" "log" "time" ) type CypherRunner interface { CypherBatch(queries []*neoism.CypherQuery) error } func NewBatchCypherRunner(cypherRunner CypherRunner, count int, duration time.Duration) CypherRunner { cr := BatchCypherRunner{cyph...
package main import ( "net/http" "github.com/spring1843/chat-server/src/chat" "github.com/spring1843/chat-server/src/config" "github.com/spring1843/chat-server/src/drivers/rest" "github.com/spring1843/chat-server/src/drivers/telnet" "github.com/spring1843/chat-server/src/drivers/websocket" "github.com/spring18...
package outputreport import ( "context" "fmt" "time" "github.com/tsaikd/gogstash/config" "github.com/tsaikd/gogstash/config/logevent" ) // ModuleName is the name used in config file const ModuleName = "report" // OutputConfig holds the configuration json fields and internal objects type OutputConfig struct { ...
// Copyright 2013 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicabl...
/* Copyright 2012 Sergey Cherepanov (https://github.com/cheggaaa) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applic...
package comm import ( "bytes" "encoding/binary" "fmt" "net" "time" "github.com/pkg/errors" "github.com/schollz/logger" ) const MAXBYTES = 1000000 // Comm is some basic TCP communication type Comm struct { connection net.Conn } // NewConnection gets a new comm to a tcp address func NewConnection(address str...
package boxstrapper_test import ( "testing" . "github.com/gaffo/boxstrapper" "github.com/stretchr/testify/assert" ) func TestReadEmptyRepo(t *testing.T) { assert := assert.New(t) storage := NewFilesystemStorage("/nonexistent") data, err := storage.ReadPackages() assert.NotNil(err) assert.Equal("", data) } ...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // Most of this is copied straight from heka's TOML config setup package simplepush import ( "fmt" "reflect" "...
package match import ( "fmt" "github.com/tisp-lang/tisp/src/lib/ast" ) type valueRenamer struct { nameMap map[string]string } func newValueRenamer(m map[string]string) valueRenamer { return valueRenamer{m} } func (r valueRenamer) rename(v interface{}) interface{} { switch x := v.(type) { case string: if n,...
// Copyright (c) 2017, 0qdk4o. 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 ( "fmt" ) // Tow array A and B have same count elements as N, elements come from A add elements // from B produce new array that having N*N ...
package main import ( "flag" "fmt" "github.com/hanwen/termite/termite" "log" "os" "path/filepath" "rpc" "strings" ) // TODO - this file is a mess. Clean it up. const _SHELL = "/bin/sh" func TryRunDirect(cmd string) { if cmd == ":" { os.Exit(0) } parsed := termite.ParseCommand(cmd) if len(parsed) == 0...
package croc import ( "bytes" "crypto/rand" "encoding/binary" "encoding/json" "fmt" "io" "io/ioutil" "math" "net" "os" "path" "path/filepath" "strings" "sync" "time" "github.com/denisbrodbeck/machineid" "github.com/pkg/errors" "github.com/schollz/croc/v8/src/comm" "github.com/schollz/croc/v8/src/co...
package parser import ( "github.com/Tamrin007/monkey/ast" "github.com/Tamrin007/monkey/lexer" "github.com/Tamrin007/monkey/token" ) type Parser struct { l *lexer.Lexer curToken token.Token peekToken token.Token } func New(l *lexer.Lexer) *Parser { p := &Parser{l: l} p.nextToken() p.nextToken() return p...
package main import ( "os" "log" "strconv" "database/sql" "encoding/json" _ "github.com/mattn/go-sqlite3" "github.com/mediocregopher/radix.v2/redis" ) func boolToInt(val bool) uint { if val { return 1 } return 0 } type Town struct { Id uint32 `json:"id"` ...
/* Copyright (c) 2010 Andrea Fazzi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, s...
package spruce import ( "regexp" yaml "gopkg.in/yaml.v2" "github.com/JulzDiverse/aviator" "github.com/JulzDiverse/aviator/filemanager" "github.com/geofffranks/simpleyaml" . "github.com/geofffranks/spruce" "github.com/starkandwayne/goutils/ansi" ) type SpruceClient struct { store aviator.FileStore } var con...
// // Copyright © 2012 Guy M. Allard // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
package croc import ( "bytes" "crypto/rand" "encoding/binary" "encoding/json" "fmt" "io" "io/ioutil" "math" "net" "os" "path" "path/filepath" "strings" "sync" "time" "github.com/denisbrodbeck/machineid" log "github.com/schollz/logger" "github.com/schollz/pake/v2" "github.com/schollz/peerdiscovery" ...
package parser import ( "bufio" "bytes" "fmt" "regexp" "strconv" "strings" "time" "github.com/czerwonk/bird_exporter/protocol" "github.com/prometheus/common/log" ) var ( protocolRegex *regexp.Regexp descriptionRegex *regexp.Regexp routeRegex *regexp.Regexp uptimeRegex *regexp.Regexp route...
package parser import ( "os" "strings" "sync" "github.com/dustinblackman/tidalwave/logger" "github.com/dustinblackman/tidalwave/sqlquery" "github.com/spf13/viper" "github.com/tidwall/gjson" ) // LogQueryStruct contains all information about a log file, including the matching entries to the query. type LogQuer...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package process import ( "gopkg.in/juju/charm.v6-unstable" ) // Status represents the status of a worload process. type Status string // Status values specific to workload processes. const ( StatusPending Status = "pendin...
// Copyright © 2017 Wei Shen <shenwei356@gmail.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify,...
package score import ( "encoding/json" "errors" "strings" ) // hiddenSecret is used to replace the global secret when parsing. var hiddenSecret = "hidden" // ErrScoreNotFound is returned if the parse string did not contain a // JSON score string. var ErrScoreNotFound = errors.New("score not found in string") // ...
package main import ( "math/rand" "strconv" "strings" "time" ) /* Diversity ruleset definitions */ var validDiversityActiveItems = [...]int{ // Rebirth items 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 47, 49, 56, 58, 65, 66, 77, 78, 83, 84, 85, 86, 93, 97, 102, 105, 107, 111, 123, 124, 126, 127, 130, ...
// vim: tabstop=2 shiftwidth=2 package keymgr import ( "bufio" "os" "time" "fmt" "strings" "encoding/hex" "crypto/sha256" //"github.com/codahale/blake2" ) type secret struct { keyid []byte // keyid sk []byte // Secret Key from time.Time // Valid from until time.Time // Valid Until } type Secring struct ...
// Copyright 2015 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package controller import ( "github.com/juju/errors" "github.com/juju/loggo" "github.com/juju/names" "github.com/juju/juju/api" "github.com/juju/juju/api/base" "github.com/juju/juju/apiserver/params" ) var logger = lo...
package model type personalisation struct { } Model work package model import "github.com/pkg/errors" // Personalisation - Represents information used to personalize a message sent through GovNotify service. type Personalisation interface { asMap() string } type personalisation struct { _store map[string]string...
// Package purchase enables purchase of goods and services within Ava. package main import ( "encoding/json" "errors" "flag" "fmt" "log" "math/rand" "reflect" "strconv" "strings" "time" "github.com/avabot/ava/Godeps/_workspace/src/github.com/renstrom/fuzzysearch/fuzzy" "github.com/avabot/ava/shared/dataty...
package sockaddr_test import ( "fmt" "math/rand" "testing" "github.com/hashicorp/consul/lib" "github.com/hashicorp/go-sockaddr" ) func init() { lib.SeedMathRand() } // NOTE: A number of these code paths are exercised in template/ and // cmd/sockaddr/ // sockAddrStringInputs allows for easy test creation by d...
package lib var Prims = map[string]int{} // func remove
package main import ( "fmt" "github.com/BurntSushi/bcbgo/cmd/util" "github.com/BurntSushi/bcbgo/rmsd" ) func init() { u := "pdb-file chain-id start stop pdb-file chain-id start stop" util.FlagParse(u, "") util.AssertNArg(8) } func main() { pdbf1, chain1, s1, e1 := util.Arg(0), util.Arg(1), util.Arg(2), util....
// Copyright 2015 The Vanadium 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 project import ( "bytes" "encoding/xml" "fmt" "io/ioutil" "net/url" "os" "path/filepath" "sort" "strings" "v.io/jiri/collect" "v.io/j...
/* A simple kafka consumer-group client Copyright 2016 MistSys */ package consumer import ( "fmt" "log" "sort" "sync" "time" "github.com/Shopify/sarama" ) const debug = true // set to true to see log messages // dbgf logs a printf style message to somewhere reasonable if debug is enabled, and as efficie...
// (c) 2019-2021, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package message import ( "errors" "github.com/ava-labs/avalanchego/ids" ) const ( // TODO choose a sensible value // MaxEthTxsLen must be updated inside of EthTxsNotify's struct definition // as well when change...
package consensus import ( "container/heap" "fmt" "github.com/jddixon/xlattice_go/rnglib" "io/ioutil" . "launchpad.net/gocheck" "os" "testing" "time" ) // gocheck tie-in ///////////////////// func Test(t *testing.T) { TestingT(t) } type XLSuite struct{} var _ = Suite(&XLSuite{}) // end gocheck setup //////...
// Copyright 2014 Prometheus Team // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in wri...
package gerrit import ( "fmt" "net/url" ) // GetCommit retrieves a commit of a project. // The commit must be visible to the caller. // // Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-commit func (s *ProjectsService) GetCommit(projectName, commitID string) (*Commi...
package api import ( "fmt" "sort" "strings" "github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/api/navlinks" "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/plugins" ac "github.com/grafana/grafana/pkg/services/accesscontrol" ...
/* Copyright 2014 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
package auth import ( "encoding/json" "fmt" "net/http" "strings" "time" "sync" jwt "github.com/dgrijalva/jwt-go" uuid "github.com/nu7hatch/gouuid" log "github.com/sirupsen/logrus" ) const ( sessionTokenName = "kuill" claimExpires = "exp" claimNotBefore = "nbf" claimCSRFToken = "csrf" claimUser...
package pkg import ( "encoding/json" "fmt" "io/ioutil" "log" "os" "path/filepath" ylib "github.com/ghodss/yaml" "k8s.io/helm/pkg/proto/hapi/chart" kapi "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/apps" "k8s.io/kubernetes/pkg/apis/batch" kext "k8s.io/kub...
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
package main import ( "fmt" "github.com/go-macaron/binding" //"github.com/go-macaron/cache" "github.com/go-macaron/session" "gopkg.in/macaron.v1" // "html/template" "net/http" ) //HTTPConfig has webserver config options type HTTPConfig struct { Port int `toml:"port"` AdminUser string `toml:"a...
package bitstream import ( "bytes" "encoding/binary" "io" "math" ) const ( bufferSize = (1024 * 1024) + sled sled = 4 kMaxVarintBytes = 10 kMaxVarint32Bytes = 5 ) type BitReader interface { LazyGlobalPosition() int ActualGlobalPosition() int ReadBit() bool ReadByte() byte ReadBytes...
package sparta import ( "encoding/json" "fmt" "strings" "github.com/mweagle/cloudformationresources" gocf "github.com/crewjam/go-cloudformation" "github.com/Sirupsen/logrus" ) const salt = "213EA743-A98F-499D-8FEF-B87015FE13E7" // PushSourceConfigurationActions map stores common IAM Policy Actions for Lambd...
package momos import ( "bytes" "errors" "io/ioutil" "net" "net/http" "strconv" "strings" "time" "github.com/PuerkitoBio/goquery" clientCache "github.com/gregjones/httpcache" ) var ( ErrRequest = errors.New("Request error") ErrTimeout = errors.New("Timeout error") ErrInvalidStatusCo...
package main import ( "context" "crypto/tls" "fmt" "net" "net/http" "net/http/pprof" "os" "strings" "time" "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" "github.com/grpc-ecosystem/go-grpc-middleware/tags" "github.com/grpc-ecosystem/go-grpc-pr...
package main import ( "encoding/base64" "flag" "fmt" "net" "net/http" "strconv" "github.com/gorilla/mux" "github.com/gorilla/websocket" ) var upgrader = websocket.Upgrader{ ReadBufferSize: 10240, WriteBufferSize: 10240, } var listenIp string var listenPort int func serveHome(w http.ResponseWriter, r *ht...
package main import ( "fmt" "io/ioutil" "log" "os" "github.com/dustin/go-jsonpointer" ) func main() { d, err := ioutil.ReadAll(os.Stdin) if err != nil { log.Fatalf("Error reading json from stdin: %v", err) } if len(os.Args) == 1 { l, err := jsonpointer.ListPointers(d) if err != nil { log.Fatalf("Er...
package weavedns import ( "github.com/miekg/dns" "log" "net" "sync" ) type Zone interface { AddRecord(string, string, net.IP, net.IP, *net.IPNet) error MatchLocal(string) (net.IP, error) } type Record struct { Ident string Name string Ip net.IP WeaveIp net.IP Subnet *net.IPNet } type ZoneDb st...
package veneur import ( "bytes" "compress/zlib" "crypto/tls" "crypto/x509" "encoding/json" "flag" "fmt" "io/ioutil" "sync" "math/rand" "net" "net/http" "net/http/httptest" "os" "path/filepath" "testing" "time" "github.com/golang/protobuf/proto" "github.com/sirupsen/logrus/hooks/test" "github.com/...
package syslog import ( "io" "net" "testing" "time" "github.com/jeromer/syslogparser" . "launchpad.net/gocheck" ) func Test(t *testing.T) { TestingT(t) } type ServerSuite struct { } var _ = Suite(&ServerSuite{}) var exampleSyslog = "<31>Dec 26 05:08:46 hostname tag[296]: content" func (s *ServerSuite) TestT...
package sweetiebot import ( "database/sql" "encoding/base64" "encoding/json" "fmt" "io/ioutil" "math/rand" "reflect" "regexp" "strconv" "strings" "time" "github.com/bwmarrin/discordgo" ) type ModuleHooks struct { OnEvent []ModuleOnEvent OnTypingStart []ModuleOnTypingStart OnMessageCr...
package restic_test import ( "crypto/rand" "encoding/json" "flag" "io" mrand "math/rand" "sync" "testing" "time" "github.com/restic/restic" "github.com/restic/restic/backend" ) var maxWorkers = flag.Uint("workers", 100, "number of workers to test BlobList concurrent access against") func randomID() []byte...
package main import ( "errors" "fmt" "github.com/ethereum/ethutil-go" "log" "math/big" ) type BlockChain struct { // Last block LastBlock *ethutil.Block // The famous, the fabulous Mister GENESIIIIIIS (block) genesisBlock *ethutil.Block // Last known total difficulty TD *big.Int } func NewBlockChain() *Bl...
// Copyright 2016 The Xorm 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 xorm import "database/sql" // Count counts the records. bean's non-empty fields // are conditions. func (session *Session) Count(bean interface{}) (...
package app import ( "errors" "fmt" "reflect" "strconv" "strings" json "github.com/mohae/customjson" "github.com/mohae/utilitybelt/deepcopy" ) // Builder constants const ( UnsupportedBuilder Builder = iota Common Custom AmazonChroot AmazonEBS AmazonInstance DigitalOcean Docker GoogleCompute Null Op...
package sftpd import ( "golang.org/x/crypto/ssh" "log" "net" "fmt" "os" "crypto/subtle" "io/ioutil" "crypto/rsa" "encoding/pem" "crypto/x509" "io" "crypto/rand" "github.com/pkg/sftp" "strconv" ) func NewSimpleSftpServer(homePath, listenAddress string, listenPort int, username, password string, pathMappe...
package chunk import ( "bytes" "compress/gzip" "context" "io" "path" "github.com/chmduquesne/rollinghash/buzhash64" "github.com/pachyderm/pachyderm/src/server/pkg/obj" "github.com/pachyderm/pachyderm/src/server/pkg/storage/hash" "golang.org/x/sync/errgroup" "golang.org/x/sync/semaphore" ) const ( // MB is...
package player import ( "github.com/lean-poker/poker-player-go/leanpoker" "strings" ) const VERSION = "Default Go folding player" const MAX_RANK = 30 const JQKA_RANK = 20 const LOW_RANK = 5 func BetRequest(state *leanpoker.Game) int { p := state.GetPlayer() if p == nil { return 1000 } if (state.IsCheck...
package span import ( "bytes" "fmt" "io/ioutil" "reflect" "testing" "github.com/davecgh/go-spew/spew" ) func bb(s string) []byte { return []byte(s) } type spanCase struct { fname string buf []byte blocks [][]byte spans []Span } type spans []Span const dir = `../testdata/tests/span_level/` func lin...
/* Copyright 2017 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
package filer2 import ( "context" "fmt" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" ) func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p FullPath, isRecursive bool, ignoreRecursiveError, shouldDeleteChunks bool) (err error) { if p == "/" { return nil...
// 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 flag implements command-line flag parsing. Usage Define flags using flag.String(), Bool(), Int(), etc. This declares an integer flag, -flagnam...
/** * Twist v0.1-dev * * (c) Harry Lawrence * * License: MIT * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package main import ( "fmt" "strings" "../vendor/gocui" ) func New(g *gocui.Gui, v *gocui.View) error { ...
package clui import ( term "github.com/nsf/termbox-go" ) // ThumbPosition returns a scrollbar thumb position depending // on currently active item(itemNo), total number of items // (itemCount), and length/height of the scrollbar(length) // including arrows. Returns position in interval of (1..lenght-2) // or -1 if t...
/* * Copyright (c) 2013 Dave Collins <dave@davec.name> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND TH...
package quiclatest import ( "net" "sync" "github.com/ami-GS/gQUIC/latest/qtype" ) type Server struct { conn net.PacketConn // TODO: replace to SessionStore sessions map[string]*Session //ConnectionID.String():Session addrSessions map[string]*Session //remoteAddr.String():Session, for identifing ...
package torrent import ( "github.com/anacrolix/missinggo/iter" "github.com/anacrolix/missinggo/v2/bitmap" pp "github.com/anacrolix/torrent/peer_protocol" ) // Provides default implementations for requestStrategy methods. Could be embedded, or delegated to. type requestStrategyDefaults struct{} func (requestStrate...
package layout import ( "fmt" "github.com/lysrt/bro/css" "github.com/lysrt/bro/style" ) type Dimensions struct { // Position of the content area relative to the document origin: Content Rect // Surrounding edges: padding, Border, margin EdgeSizes } // marginBox returns the area covered by the content area p...