CombinedText stringlengths 4 3.42M |
|---|
package main
import (
// stdlib packages
"encoding/json"
"flag"
"fmt"
"log"
"os"
"runtime"
"strconv"
"sync"
// custom packages
"config"
"modules/amqpmodule"
es "modules/elasticsearchmodule"
)
const rxQueue = "conn_scan_results_queue"
const rxRoutKey = "conn_scan_results"
const esIndex = "observer"
cons... |
/*
Copyright IBM Corp. 2017 All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package cluster_test
import (
"context"
"io"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric/common... |
/*
Copyright 2015 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 (
"os"
"path/filepath"
"strings"
"testing"
"github.com/urfave/cli"
"golang.org/x/xerrors"
)
func TestCommandList(t *testing.T) {
_, _, err := capture(func() {
app := cli.NewApp()
flagSet := flagSet("list", commandList.Flags)
c := cli.NewContext(app, flagSet, nil)
doList(c)
})
i... |
// Copyright (C) 2016 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package kafka
import (
"os"
"github.com/Shopify/sarama"
)
// NewClient returns a Kafka client
func NewClient(addresses []string) (sarama.Client, error) {
config ... |
package llvm
/*
#include <llvm-c/Core.h>
#include <stdlib.h>
*/
import "C"
import "unsafe"
import "errors"
// TODO: Add comments
// TODO: Use Go's reflection in order to simplify bindings?
// TODO: Add type safety?
type (
// I'm using these weird structs here, because *Ref types are pointers
// and Go's spec says ... |
package orm
import (
"context"
"database/sql"
"fmt"
"os"
"github.com/inconshreveable/log15"
"github.com/pkg/errors"
"github.com/rbastic/dyndao/object"
"github.com/rbastic/dyndao/schema"
)
// NOTE: For foreign key filling, we do not check to see if there are conflicts
// with regards to the uniqueness of prim... |
// Package pagination is usually used to compute the web pagination.
package pagination
import "math"
// Pagination is a struct used to get a pagination result.
type Pagination struct {
// The number of the current page
Current int
// The number of the elements in every page
Limit int
// The total number of th... |
package daemon
import (
"errors"
"fmt"
"os"
"syscall"
)
var (
// ErrWoldBlock indicates on locking pid-file by another process.
ErrWouldBlock = errors.New("Daemon: Resource temporarily unavailable")
)
// LockFile wraps *os.File and provide functions for locking of files.
type LockFile struct {
*os.File
}
// ... |
// This file definse the logOuter interface and several types of logOuter.
//
// emptyOuter = logOuter where both Out and Outf are noops
// lineOuter = logOuter where a newline is inserted after every call to
// Out and Outf
// fatalLineOuter = logOuter that logs message with inserted newline then
// exits wit... |
/*
Copyright 2021 The logr 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, softwa... |
package main
import (
"fmt"
"os"
"path/filepath"
"code.cloudfoundry.org/lager"
"github.com/concourse/baggageclaim/baggageclaimcmd"
concourseWorker "github.com/concourse/concourse/worker"
"github.com/concourse/concourse/worker/beacon"
workerConfig "github.com/concourse/concourse/worker/start"
"github.com/conc... |
package gcng
import (
"errors"
"time"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/garden/client"
"code.cloudfoundry.org/garden/client/connection"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc/dbng"
)
const HijackedContainerTimeout = 5 * time.Minute
//go:generate counterfeiter . containerF... |
package torrent
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"math/rand"
"net"
"sort"
"strconv"
"strings"
"sync/atomic"
"time"
"github.com/RoaringBitmap/roaring"
"github.com/anacrolix/log"
"github.com/anacrolix/missinggo/iter"
"github.com/anacrolix/missinggo/v2/bitmap"
"github.com/anacrolix/multiless... |
package borg
// Think of borg events like inotify events. We're interested in changes to
// them all. All events are sent to your instance of borg. The filtering
// is done once they've arrived. Let's make keys look like directories to
// aid this comparison.
//
// Example spec:
//
// /<slug_id>/proc/<type>/<u... |
// Copyright Istio 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 wri... |
package kiwitaxi
import (
"encoding/csv"
"github.com/gocarina/gocsv"
"io"
"net/http"
"net/url"
)
type KiwitaxiApi struct {
token string
log LoggerInterface
}
type LoggerInterface interface {
Debug(...interface{})
}
// NewKiwitaxiApi creates a new instance KiwitaxiApi.
func NewKiwitaxiApi(token string) *Ki... |
package twitch2go
import (
"encoding/json"
"time"
)
type Direction string
type SortBy string
type VideoSort string
const (
ASC Direction = "asc"
DESC Direction = "desc"
CreatedAt SortBy = "created_at"
LastBroadcast SortBy = "last_broadcast"
Login SortBy = "login"
Views... |
package tripeg
import (
"math"
"math/rand"
"time"
)
//Hole struct that contains information
//about a hole in the board, its location
//and whether or not it has a peg in it.
type Hole struct {
Row int //make of 5
Col int //max of 9
Peg bool
Links []*Hole //Other Holes the hole is connected to
}
//Jump ... |
// 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.
// Extended and bugfixes by Miek Gieben
package dns
import (
"encoding/base64"
"fmt"
"net"
"strconv"
"strings"
"time"
)
// Packet formats
// Wire const... |
package generator_test
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"github.com/wolfmetr/mock-ass/generator"
)
func ExampleRender() {
type testTplJson struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
EmptyField string `json:"empty_field"`
}
// *Chain fields is... |
// Copyright 2017, TCN Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the... |
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
// +build go1.3
package lxd_test
import (
"strings"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"github.com/juju/juju/environs"
envtesting "github.com/juju/juju/environs/testing"
"github.com/juju/juj... |
// Copyright (c) 2016 Pulcy.
//
// 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... |
// 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 bytes
// Simple byte buffer for marshaling data.
import (
"io";
"os";
)
// Copy from string to byte array at offset doff. Assume there's room.
fun... |
// 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 fmt_test
import (
"bytes"
. "fmt"
"io"
"math"
"runtime" // for the malloc count test only
"strings"
"testing"
"time"
)
type (
renamedBool ... |
// 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.
// This file implements scopes and the objects they contain.
package ast
import (
"bytes"
"fmt"
"go/token"
)
// A Scope maintains the set of named languag... |
// 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 reflect implements run-time reflection, allowing a program to
// manipulate objects with arbitrary types. The typical use is to take a value
// with... |
// Copyright (c) 2015-2019 Magnus Bäck <magnus@noun.se>
package main
import (
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
semver "github.com/Masterminds/semver/v3"
"github.com/alecthomas/kingpin"
"github.com/magnusbaeck/logstash-filter-verifier/logging"
"github.com/magnusbaeck/logstash-filter-v... |
// 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 sync
// An RWMutex is a reader/writer mutual exclusion lock.
// The lock can be held by an arbitrary number of readers
// or a single writer.
// RWMute... |
package update
import (
"fmt"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/args"
"github.com/BytemarkHosting/bytemark-client/cmd/bytemark/app/with"
cutil "github.com/BytemarkHosting/bytemark-client/cmd/bytemark/commands/util"
"github... |
package collectors
import (
"encoding/csv"
"fmt"
"reflect"
"strconv"
"strings"
"time"
"github.com/StackExchange/scollector/metadata"
"github.com/StackExchange/scollector/opentsdb"
"github.com/StackExchange/scollector/util"
)
func init() {
collectors = append(collectors, &IntervalCollector{F: c_netbackup_jo... |
// Copyright 2015 go-swagger maintainers
//
// 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 agr... |
// Copyright 2017 The Wuffs 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
package proxy
import (
"net/url"
"testing"
)
func TestEmptyBlacklist(t *testing.T) {
bl := NewEmptyBlacklist()
hostnames := []string{"http://localhost", "http://google.com"}
for i := range hostnames {
url, err := url.Parse(hostnames[i])
if err != nil {
t.Fatalf("error with parsing url '%s'", err)
}
... |
package protocol
import (
"io"
"github.com/v2ray/v2ray-core/common/alloc"
"github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/proxy"
"github.com/v2ray/v2ray-core/transport"
)
const (
socksVersion = byte(0x05)
socks4Version = byte(0x04)
AuthN... |
package medtronic
import (
"log"
)
// Carbs values are represented as either grams or 10x exchanges.
type Carbs int
const (
CarbUnits Command = 0x88
GlucoseUnits Command = 0x89
)
type CarbUnitsType byte
//go:generate stringer -type CarbUnitsType
const (
Grams CarbUnitsType = 1
Exchanges CarbUnitsType ... |
package instance
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
"bosh-google-cpi/api"
"bosh-google-cpi/util"
computebeta "google.golang.org/api/compute/v0.beta"
)
// The list of metadata key-value pairs that should be applied as labels
var labelList []string = []string{"director", "name", "id", "de... |
package main
import (
"encoding/json"
"errors"
"fmt"
"github.com/coreos/go-etcd/etcd"
logging "github.com/op/go-logging"
"koding/db/mongodb/modelhelper"
"koding/newkite/dnode"
"koding/newkite/kite"
"koding/newkite/kodingkey"
"koding/newkite/protocol"
"koding/newkite/token"
"koding/tools/config"
stdlog "lo... |
package mpb
import (
"bytes"
"container/heap"
"context"
"fmt"
"io"
"math"
"os"
"sync"
"time"
"github.com/vbauerster/mpb/v8/cwriter"
)
const (
prr = 150 * time.Millisecond // default RefreshRate
)
// DoneError represents an error when `*mpb.Progress` is done but its functionality is requested.
var DoneErr... |
package backup
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"gopkg.in/yaml.v2"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
)
// Config represents the config of a backup that can be stored in a backup.yaml file (or embedded in index.yaml).
type Config struct {
... |
package db
import (
"fmt"
"go/ast"
"net/url"
"reflect"
"sort"
"strings"
"github.com/lxc/lxd/lxd/db/generate/lex"
"github.com/pkg/errors"
)
// Packages returns the the AST packages in which to search for structs.
//
// By default it includes the lxd/db and shared/api packages.
func Packages() (map[string]*ast... |
/*
Copyright 2017 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 (
"crypto/rand"
"encoding/base64"
"log"
)
// Users in chat
type User struct {
UserName string
AuthCode string
IsAuthorized bool
}
type Users map[int]*User
// length of random code in bytes
const CODE_BYTES_LENGTH = 15
// add new user if not exists
func (users Users) AddNew(user_id... |
package main
/**
* Utility methods/classes for sysdash
*/
import (
"bytes"
"fmt"
"log"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"syscall"
"unicode/utf8"
ui "github.com/gizak/termui"
)
////////////////////////////////////////////
// Utility: Formatting
/////////////////////////////////////... |
package main
import (
"bytes"
"encoding/json"
"image"
"image/jpeg"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
_ "image/png"
"github.com/nfnt/resize"
"github.com/serbe/ncp"
)
type config struct {
Nnm struct {
Login string `json:"login"`
Password string `json:"password"`
} `json:"nnmclub"`
Db ... |
package GoSDK
import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"os"
"os/exec"
"strings"
"time"
cbErr "github.com/clearblade/go-utils/errors"
mqttTypes "github.com/clearblade/mqtt_parsing"
mqtt "github.com/clearblade/paho.mqtt.golang"
)
var (
//CB_ADDR i... |
package dukedb
import (
"encoding/json"
"errors"
"fmt"
"reflect"
"sort"
"strconv"
"strings"
"time"
"github.com/theduke/go-apperror"
)
/**
* String utils.
*/
func Pluralize(str string) string {
if str[len(str)-1] == 'y' {
str = str[1:len(str)-1] + "ie"
}
if str[len(str)-1] != 's' {
str += "s"
}
... |
package btrfs
import (
"fmt"
"github.com/dennwc/btrfs/mtab"
"os"
"path/filepath"
"strings"
"syscall"
"unsafe"
)
func isBtrfs(path string) (bool, error) {
var stfs syscall.Statfs_t
if err := syscall.Statfs(path, &stfs); err != nil {
return false, &os.PathError{Op: "statfs", Path: path, Err: err}
}
return ... |
package conduit
import (
"encoding/json"
"github.com/karlseguin/typed"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strings"
"testing"
)
// containsString checks whether s contains e.
func containsString(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
//... |
package osgridconverter
import (
"math"
)
// toDegrees converts radians to numeric degrees
func toDegrees(input float64) float64 {
return input * 180 / math.Pi
}
// toRadians converts numeric degrees to radians
func toRadians(input float64) float64 {
return input * math.Pi / 180
}
add comments
package osgridcon... |
/*
Copyright (c) 2015-2016 Christopher Young
Distributable under the terms of The "BSD New"" License
that can be found in the LICENSE file, herein included
as part of this header.
managementinterface.go: Web interfaces (JSON and websocket), web server for web interface HTML.
*/
package main
import (
"database/... |
// Package operations does generic operations on filesystems and objects
package operations
import (
"bytes"
"context"
"encoding/base64"
"encoding/csv"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/pkg... |
package anteater
import (
"net/http"
"fmt"
"time"
"sync"
"log"
)
const (
version = "0.03"
serverSign = "AE " + version
)
/**
* Path to index file
**/
var IndexPath string = "file.index"
/**
* Path to data files
**/
var DataPath string = "file.data"
/**
* Config object
*/
var Conf *Config
/**
* F... |
package state
import (
"errors"
"fmt"
"regexp"
"sort"
"strings"
"sync"
"time"
eventbus "github.com/Dataman-Cloud/swan/src/event"
"github.com/Dataman-Cloud/swan/src/manager/framework/connector"
"github.com/Dataman-Cloud/swan/src/manager/framework/event"
"github.com/Dataman-Cloud/swan/src/manager/framework/s... |
package lang
import (
"fmt"
"go/types"
)
type Object interface {
fmt.Stringer
Value() interface{}
isObject()
}
type ObjectNone struct{}
func (o ObjectNone) Value() interface{} { return nil }
func (o ObjectNone) String() string { return "<none>" }
func (o ObjectNone) isObject() {}
type ObjectInt s... |
/*
Copyright 2019 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 conditionalaccess
import (
"context"
"errors"
"fmt"
"log"
"net/http"
"time"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/ma... |
/*
Copyright 2022 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 engine
import "testing"
type idtest struct {
assertion string
valid bool
}
var idtests = []idtest{
{"t_alice", true},
{"t_bob", true},
{"t_charlie", true},
{"t_doug", true},
{"t_ellen", false},
{"t_ellen", false},
{"tacovontaco@twitter", false},
{"t_alice+tacovontaco@twitter", true},
{"t_alice... |
// Copyright 2012, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tabletmanager
import (
"fmt"
"time"
log "github.com/golang/glog"
"github.com/youtube/vitess/go/rpcwrap"
rpcproto "github.com/youtube/vitess/go/rpcwr... |
// 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 redirect provides hooks to register HTTP handlers that redirect old
// godoc paths to their new equivalents and assist in accessing the issue
// trac... |
// ----------------------------------------------------------------------------
//
// This file is copied here by Magic Modules. The code for building up a
// compute instance object is copied from the manually implemented
// provider file:
// third_party/terraform/resources/resource_compute_instance.go... |
// ----------------------------------------------------------------------------
//
// This file is copied here by Magic Modules. The code for building up a
// compute instance object is copied from the manually implemented
// provider file:
// third_party/terraform/resources/resource_compute_instance.go... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package state
import (
"bytes"
"errors"
"fmt"
"math/rand"
"sync"
"sync/atomic"
"testing"
"time"
pb "github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/conf... |
package main
import (
"os/user"
"testing"
"strconv"
"syscall"
"path"
"os"
)
func TestUserClean(t *testing.T) {
currentUser, _ := user.Current()
userConfig := &UserConfig{
UserName: currentUser.Username,
}
if err := userConfig.clean(nil); err != nil {
t.Error("User config clean fails for valid user:", ... |
package acsengine
import (
"strconv"
"strings"
"github.com/Azure/acs-engine/pkg/api"
"github.com/Azure/acs-engine/pkg/api/common"
"github.com/Azure/acs-engine/pkg/helpers"
)
func setKubeletConfig(cs *api.ContainerService) {
o := cs.Properties.OrchestratorProfile
cloudSpecConfig := getCloudSpecConfig(cs.Locati... |
/*
Copyright 2015 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 applicable law or ag... |
/*
Copyright 2017 the Heptio Ark contributors.
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 writ... |
/*
Copyright 2021 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, ... |
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Hubble
package tcp
import (
"context"
"github.com/prometheus/client_golang/prometheus"
flowpb "github.com/cilium/cilium/api/v1/flow"
"github.com/cilium/cilium/pkg/hubble/metrics/api"
)
type tcpHandler struct {
tcpFlags *prometheus.CounterVec
cont... |
/*
Copyright 2014 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 applicable law or ag... |
// Copyright 2020 The gVisor 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 agree... |
/*
Copyright 2015 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 applicable law or ag... |
package va
import (
"crypto/sha256"
"crypto/subtle"
"crypto/tls"
"crypto/x509"
"encoding/asn1"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net"
"net/http"
"net/url"
"os"
"runtime"
"strconv"
"strings"
"time"
"github.com/jmhodges/clock"
"github.com/letsencrypt/pebble/acme"
"github.com/le... |
/*
* This file is part of the KubeVirt project
*
* 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 la... |
package cfutil
import (
"errors"
cfenv "github.com/cloudfoundry-community/go-cfenv"
vault "github.com/hashicorp/vault/api"
)
type VaultClient struct {
vault.Client
Endpoint string
RoleID string
SecretID string
ServiceSecretPath string
ServiceTransitPath string
SpaceSecretPa... |
package main
import (
"os"
"os/signal"
"sync"
"syscall"
)
func main() {
var (
wg sync.WaitGroup
signalCh = make(chan os.Signal, 1)
opts = NewOptions()
)
signal.Notify(signalCh, os.Interrupt, syscall.SIGTERM)
sFlow := NewSFlow(opts)
go func() {
wg.Add(1)
defer wg.Done()
sFlow.run()
}... |
package chat
import (
"encoding/gob"
"errors"
"fmt"
"os"
"path/filepath"
"sync"
"time"
"github.com/keybase/client/go/chat/signencrypt"
"github.com/keybase/client/go/protocol/chat1"
"github.com/keybase/client/go/protocol/keybase1"
)
type AttachmentInfo struct {
ObjectKey string // s3 dest... |
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"github.com/danmane/abalone/go/api"
"github.com/danmane/abalone/go/game"
)
var (
playAgainstHuman = flag.Bool("playAgainstHuman", false, "play against human on frontend rather than AI vs AI")
humanPort = flag.String("humanPo... |
// Copyright (c) 2016 Tigera, 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 appli... |
package main
import (
"crypto/x509"
"log"
"github.com/gopherjs/gopherjs/js"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
)
type PlatformKeysBackend struct {
pk *PlatformKeys
}
func NewPlatformKeysBackend() *PlatformKeysBackend {
pk := js.Global.Get("chrome").Get("platformKeys")
return &Platform... |
package main
import (
"log"
"os"
"os/signal"
"syscall"
"time"
)
func dataPrinter(dataChan <-chan *EndpointData) {
for {
data, ok := <-dataChan
if !ok {
// channel closed
return
}
if data.Err == nil {
log.Println("Message=" + string(data.Content))
} else {
log.Println(data.Err)
}
}
}
fu... |
package vimeo
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
"reflect"
"github.com/google/go-querystring/query"
)
const (
libraryVersion = "0.8.0"
defaultBaseURL = "https://api.vimeo.com/"
defaultUserAgent = "go-vimeo/" + libraryVersion
mediaTypeVersi... |
// Copyright 2011 Google Inc. All Rights Reserved.
// This file is available under the Apache license.
// Package vm provides a compiler and virtual machine environment for executing
// mtail programs.
package vm
import (
"bytes"
"fmt"
"math"
"regexp"
"runtime/debug"
"strconv"
"strings"
"text/tabwriter"
"tim... |
// Copyright 2017 The go-vm 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 vmware
import (
"bytes"
"fmt"
"os/exec"
"syscall"
)
var vmrunPath = vmwareCmd("vmrun")
// VMRun run the vmrun command with the app name and ar... |
package main
import (
"fmt"
)
func main() {
code := "1 2 3 + eq? 'Hello World' \"Hello Josh\" [ dup inc ] 5 times"
fmt.Println(Parse(code))
BareEval("1 2 3 + *")
}
Added simple REPL
package main
import (
"fmt"
"os"
"bufio"
)
func toString(bytes []uint8) string {
str := ""
for _, c := range bytes {
str... |
package wipro
import (
"errors"
"io"
)
var (
ErrPrefix = "proto: "
ErrUnexpectedEOF = errors.New(ErrPrefix + "unexpected EOF")
ErrConn = errors.New(ErrPrefix + "network connection error")
)
type M interface {
Marshal(*Writer)
Unmarshal(*Reader)
}
func Send(m M, conn io.Writer) error {
var w ... |
package japanese
import "fmt"
/* === WORDS === */
type Word struct {
kanji string
kana string
english string
}
func (w *Word) Print() {
fmt.Println(w.kana, w.kanji)
}
func (w *Word) GetWord() Word {
return *w
}
func (w *Word) GetRoot() string {
return w.kana
}
func (w *Word) GetLastKana() string {
//... |
// Discordgo - Discord bindings for Go
// Available at https://github.com/bwmarrin/discordgo
// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file contains low level functions f... |
package terminal
import (
"fmt"
"strings"
)
type Table interface {
Print(rows [][]string)
}
type PrintableTable struct {
ui UI
header []string
headerPrinted bool
maxSizes []int
}
func NewTable(ui UI, header []string) Table {
return &PrintableTable{
ui: ui,
header: header,
... |
// Package xattr provides a simple interface to user extended attributes on Linux and OSX.
// Support for xattrs is filesystem dependant, so not a given even if you are running one of those operating systems.
//
// On Linux you have to edit /etc/fstab to include "user_xattr". Also, Linux extended attributes have a mand... |
package main
import (
"model"
"runner"
"runner/sshrunner"
"fmt"
"util"
"github.com/codegangsta/cli"
)
var (
// ErrCmdRequired require cmd option
ErrCmdRequired = fmt.Errorf("option -c/--cmd is required")
// ErrNoNodeToExec no more node to execute
ErrNoNodeToExec = fmt.Errorf("found no node to execute")
)... |
package handlers
import (
"net/http"
"code.cloudfoundry.org/bbs/events"
"code.cloudfoundry.org/bbs/models"
"code.cloudfoundry.org/lager"
)
type EventController interface {
Subscribe_r0(logger lager.Logger, w http.ResponseWriter, req *http.Request)
Subscribe_r1(logger lager.Logger, w http.ResponseWriter, req *h... |
/*
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, ... |
/*
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 deprecatedapirequest
import "k8s.io/apimachinery/pkg/runtime/schema"
var deprecatedApiRemovedRelease = map[schema.GroupVersionResource]string{
// Kubernetes APIs
{Group: "apps", Version: "v1beta1", Resource: "controllerrevisions"}: "1.16",
{Group: "apps", Version: "v1bet... |
// Copyright 2010 The GoGo Authors. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
// This file holds the basic scanning routines that separate a source file
// into the various tokens
package main
import "./libgogo/_obj/libgogo"
// Token str... |
// Copyright 2010 The GoGo Authors. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package main
import "./libgogo/_obj/libgogo"
import "fmt"
//
// Token struct holding the relevant data of a parsed token.
//
type Token struct {
id uint64; ... |
package server
import (
"context"
"strconv"
client "github.com/pachyderm/pachyderm/src/client"
"github.com/pachyderm/pachyderm/src/client/enterprise"
"github.com/pachyderm/pachyderm/src/client/pps"
"github.com/pachyderm/pachyderm/src/client/version"
"github.com/pachyderm/pachyderm/src/server/pkg/deploy/assets"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.