text stringlengths 3.08k 10.4k |
|---|
package dhcpv6
import (
"bytes"
"net"
"testing"
"github.com/stretchr/testify/require"
)
func TestDHCPv6Relay(t *testing.T) {
ll := net.IP{0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb, 0xcc, 0xff, 0xfe, 0xdd, 0xee, 0xff}
ma := net.IP{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00... |
package utils
import (
"bytes"
"encoding/json"
"fmt"
"os"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/servic... |
package cat
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
kikiBirthday = nook.Birthday{
Day: 8,
Month: ti... |
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/clientv3/concurrency"
etcdnaming "github.com/coreos/etcd/clientv3/naming"
"github.com/qingsong-he/ce"
"github.com/qingsong-he/some/golang/t_grpc_lb/consistentlb"
"github.com/qingsong-he/some/golang/... |
/*
Copyright AppsCode Inc. and 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 writing... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package metrics
// TODO remove this package once the Fabric copy is imported
import (
"errors"
"net/http"
"time"
"net"
"sort"
"github.com/cactus/go-statsd-client/statsd"
"github.com/hyperledger/fabric-sdk-go/pkg/common/logg... |
/*
* Copyright 2020-2021 the original author(https://github.com/wj596)
*
* <p>
* 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
*
* U... |
package fda
import (
"encoding/json"
"fmt"
"image"
"image/color"
"image/draw"
"image/jpeg"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/golang/freetype/truetype"
"github.com/mkideal/cli"
"golang.org/x/image/font"
"golang.org/x/image/font/gofont/gobold"
"golang.org/x/image/math/fixed"
"... |
// DO NOT EDIT THIS FILE. GENERATED BY svdxgen.
// +build stm32h7x3
// Package adc_common provides access to the registers of the ADC3_Common peripheral.
//
// Instances:
// ADC12_Common ADC12_Common_BASE - ADC1_2 Analog-to-Digital Converter
// ADC3_Common ADC3_Common_BASE - - Analog-to-Digital Conve... |
package main
import (
"context"
"fmt"
"log"
"time"
ionoscloud "github.com/ionos-cloud/sdk-go/v6"
)
// apiService - a wrapper to have access to the computeEngine client and context
type apiService struct {
computeEngine *ionoscloud.APIClient
ctx context.Context
}
func main() {
err := createDataCent... |
package photo
import (
"context"
"fmt"
"github.com/rwcarlsen/goexif/exif"
"github.com/schollz/progressbar/v3"
"github.com/vfoucault/goPhoto/config"
"github.com/vfoucault/goPhoto/logger"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"sync"
"time"
)
var (
regexImage, _ = regexp.Compile(`^.+(?i)(j... |
// Package cmd implements access-cli commands
package cmd
/*
Copyright © 2020 Barracuda Networks, Inc.
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.... |
package main
import (
"context"
"errors"
"fmt"
"github.com/andersfylling/discordgateway"
"github.com/andersfylling/discordgateway/event"
"github.com/andersfylling/discordgateway/log"
event2 "github.com/germanoeich/nirn/proto/discord/v1/event"
_ "github.com/joho/godotenv/autoload"
"github.com/nats-io/nats.go"
... |
package main
import (
"context"
"github.com/Cretezy/dSock/common"
"github.com/Cretezy/dSock/common/protos"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v7"
"github.com/google/uuid"
"github.com/gorilla/websocket"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
"net/http"
"os"
"os/signal"
"str... |
// c3 stands for common containers collection and
// provides a few simple to use containers.
//
// The containers provided:
// - Iterable: a container that allow iterating over its items.
// - Bag: an unordered container that allows duplicate items.
// - Set: an unordered container that does not allow duplica... |
// Copyright 2019 Dolthub, Inc.
//
// 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 i... |
// Copyright 2016 <NAME>. All Rights Reserved.
// See LICENSE for licensing terms.
package configmap_test
import (
"flag"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"testing"
"time"
"fortio.org/fortio/dflag"
"fortio.org/fortio/dflag/configmap"
)
const (
firstGoodDir = "..9989_09_09_07_... |
package adapter
import (
"fmt"
"github.com/wesovilabs/beyond/adapter/internal"
"github.com/wesovilabs/beyond/advice"
"github.com/wesovilabs/beyond/joinpoint"
"go/ast"
"strings"
)
func hasAnyReturning(definitions map[string]*advice.Advice) bool {
for _, d := range definitions {
if d.HasReturning() {
return... |
// Package telegram contains the Telegram network experiment.
//
// See https://github.com/ooni/spec/blob/master/nettests/ts-020-telegram.md.
package telegram
import (
"context"
"strings"
"time"
"github.com/ooni/probe-engine/experiment/urlgetter"
"github.com/ooni/probe-engine/model"
"github.com/ooni/probe-engin... |
// 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, software
// distributed... |
package cmd
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strings"
"github.com/coreos/go-semver/semver"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
"github.com/twpayne/chezmoi/internal/chezmoi"
)
var keePassXCCmd = &cobra.Command{
Use: "keepassxc [args...]",... |
package main
/// Leetcode 102. Binary Tree Level Order Traversal
/// https://leetcode.com/problems/binary-tree-level-order-traversal/description/
/// 二叉树的层序遍历
///
/// 二叉树的层序遍历是一个典型的可以借助队列解决的问题。
/// 该代码主要用于使用Leetcode上的问题测试我们的ArrayQueue。
/// 对于二叉树的层序遍历,这个课程后续会讲到。
/// 届时,同学们也可以再回头看这个代码。
/// 不过到时,大家应该已经学会自己编写二叉树的层序遍历啦:)
... |
/*
* keys.go - Functions and readers for getting passphrases and raw keys via
* the command line. Includes ability to hide the entered passphrase, or use a
* raw key as input.
*
* Copyright 2017 Google Inc.
* Author: <NAME> (<EMAIL>)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may no... |
/*Copyright [2019] housepower
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, software
dist... |
// Copyright 2018 Google LLC
//
// 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 to in w... |
// Copyright 2019 Yunion
//
// 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 writi... |
package kre
import (
"crypto/ed25519"
"encoding/base64"
"encoding/binary"
"strings"
"time"
"cloud.google.com/go/bigquery"
"github.com/kinecosystem/agora-common/kin"
"github.com/kinecosystem/agora-common/solana"
"github.com/kinecosystem/agora-common/solana/memo"
"github.com/mr-tron/base58"
"github.com/kine... |
package pulseaudio
import (
"encoding/binary"
"fmt"
"io"
)
type tagType byte
const (
invalidTag tagType = 0
stringTag tagType = 't'
stringNullTag tagType = 'N'
uint32Tag tagType = 'L'
uint8Tag tagType = 'B'
uint64Tag tagType = 'R'
int64Tag tagType = 'r'
sampleSpecTag tagType = 'a'... |
package main
import (
"bufio"
"log"
"os"
"sync"
"unsafe"
"github.com/go-redis/redis"
"github.com/google/flatbuffers/go"
cli "gopkg.in/urfave/cli.v1"
"github.com/transactional-cloud-serving-benchmark/tcsb/serialization_util"
"github.com/transactional-cloud-serving-benchmark/tcsb/serialized_messages"
)
func... |
package simplewlru
import (
"container/list"
"errors"
)
// EvictCallback is used to get a callback when a cache entry is evicted
type EvictCallback func(key interface{}, value interface{})
// Cache implements a non-thread safe fixed size/weight LRU cache
type Cache struct {
maxSize int
weight uint
maxWeigh... |
package collector
import (
"regexp"
"strings"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
)
const (
TELEMETRY_UID_SETTING = "telemetry-uid"
SERVER_VERSION_SETTING = "server-version"
UI_DEFAULT_LANDING_SETTING = "ui-default-landing"
UI_LANDING_EXPLORER = "vue"
UI_LANDING... |
package k8s
import (
"fmt"
"io/ioutil"
"net"
"net/http"
"strings"
"sync"
"time"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"gopkg.in/resty.v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
// all auth types are supported
_ "k8s.io/client-go/plugin/pkg/client/... |
package thorchain
import (
"fmt"
"github.com/blang/semver"
se "github.com/cosmos/cosmos-sdk/types/errors"
"gitlab.com/thorchain/thornode/common"
cosmos "gitlab.com/thorchain/thornode/common/cosmos"
"gitlab.com/thorchain/thornode/constants"
keeper "gitlab.com/thorchain/thornode/x/thorchain/keeper"
)
// Errata... |
package install
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"os/exec"
"path"
"strings"
)
type packageInfo struct {
ImportPath string
Name string
Imports []string
GoFiles []string
Standard bool
Stale bool
StaleReason string
}
// IsStdPkg returns whether the packa... |
// Copyright 2022 Google LLC
//
// 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 to in... |
package csv
// only comma-separated now. Changing that means setting RecordStream.r.Coma
// .csv reader trims leading white space(s)
import (
"context"
"encoding/csv"
"fmt"
"io"
"os"
"unicode/utf8"
"github.com/pkg/errors"
"github.com/cube2222/octosql"
"github.com/cube2222/octosql/config"
"github.com/cube2... |
package dns
import (
"encoding/binary"
"github.com/eacha/aps/util"
"strings"
)
func newHeader(QR, Opcode, AA, TC, RD, RA, Qdcount, Ancount, Nscount, Arcount uint16) *Header {
var h Header
h.Id = 1
h.Bits = completeBits(QR, Opcode, AA, TC, RD, RA)
h.Qdcount = Qdcount
h.Ancount = Ancount
h.Nscount = Nscount
... |
/*
Copyright 2018-2021 Polyaxon, Inc.
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, soft... |
// Copyright 2018 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... |
package main
import (
"fmt"
"strconv"
"strings"
sdk "github.com/GoogleContainerTools/kpt-functions-catalog/thirdparty/kyaml/fnsdk"
"sigs.k8s.io/kustomize/api/filters/imagetag"
"sigs.k8s.io/kustomize/api/konfig/builtinpluginconsts"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/filtersutil"
"s... |
// Copyright 2021 iLogtail 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 ... |
package main
import (
"time"
"fmt"
)
func main(){
// timeTest()
// timestapTest()
compareTime()
// timeTickTest()
// timeAfterFuncTest()
// timeTickTest()
}
//时间包time基本使用
func timeTest(){
now := time.Now()
fmt.Println(now)
fmt.Printf("%02d-%02d-%02d\n",now.Year(),now.Month(),now.Day())
fmt.Printf("%02d-%... |
package starry
import (
"testing"
"bytes"
)
func TestParser(t *testing.T) {
ps := []struct {
Text string
Inst string
}{
{ Text: " +",
Inst: "dup", },
{ Text: " +",
Inst: "swap", },
{ Text: " +",
Inst: "rotate", },
{ Text: " +",
Inst: "pop", },
{ Text:... |
// Copyright 2016 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 ... |
// TODO: Change Copyright to your company if open sourcing or remove header
//
// Copyright (c) 2021 Intel Corporation
//
// 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://ww... |
package measurement
import (
"regexp"
"sort"
"strconv"
"strings"
"github.com/wayn3h0/gop/decimal"
"github.com/wayn3h0/gop/errors"
)
// DimensionUnit represents the unit of dimension.
type DimensionUnit int
// Dimension Units.
const (
Millimeter DimensionUnit = 1 // base
Centimeter DimensionUnit = 10
Meter ... |
package syslog
import (
"bytes"
"errors"
"fmt"
"log"
"log/syslog"
"net"
"os"
"strconv"
"syscall"
"text/template"
"time"
"github.com/gliderlabs/logspout/router"
)
const defaultRetryCount = 10
var (
hostname string
retryCount uint
econnResetErrStr string
)
func init() {
hostname, _ = os... |
package controller
import (
"fmt"
"time"
"github.com/solo-io/go-utils/log"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
)
// This custom Kubernetes controller is used to provide a shared caching mechanism for the s... |
package dnet
import (
"log"
"net/http"
"time"
"github.com/gorilla/websocket"
)
// By <NAME><<EMAIL>>
// wwww.axismedium.com
// twitter: @dilungasr
// Ctx is a middleman between the websocket connection and the Hub.
// Ctx is stored in the dnet hub and hence it is an inside and persistent context.
type Ctx struc... |
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/arbourd/concourse-slack-alert-resource/concourse"
"github.com/arbourd/concourse-slack-alert-resource/slack"
)
func buildMessage(alert Alert, m concourse.BuildMetadata, path string) *... |
package authproxy
import (
"crypto/tls"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"path"
"strings"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
)
// wsReverseProxy is a layer 7 websocket reverse proxy.
//
// The proxy doesn't support other protocols and will reject HTTP requests not
// explicit... |
package age
import (
"bytes"
"fmt"
"math/big"
"reflect"
)
// GTYPE representing entity types for AGE result data : Vertex, Edge, Path and SimpleEntity
type GTYPE uint8
const (
G_OTHER GTYPE = 1 + iota
G_VERTEX
G_EDGE
G_PATH
G_MAP_PATH
G_STR
G_INT
G_INTBIG
G_FLOAT
G_BOOL
G_MAP
G_ARR
)
var _TpV = refl... |
package filter
import (
"sort"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestParseSeriesByTag(t *testing.T) {
type ValidSeriesByTagCase struct {
pattern string
tagSpecs []TagSpec
}
Convey("Given valid seriesByTag patterns, should return parsed tag specs", t, func(c C) {
validSeriesB... |
package day_10
import (
"adventofcode_2016/errutil"
"adventofcode_2016/readutil"
"fmt"
"sort"
"strings"
"github.com/pkg/errors"
)
func Part1() {
fac, err := Parse(input)
errutil.ExitOnErr(err)
fac.Process()
}
func Part2() {
fac, err := Parse(input)
errutil.ExitOnErr(err)
fac.Process()
var cs []int
cs... |
// Command ww moves files and other data over WebRTC.
//
// Install using:
// go get -u webwormhole.io/cmd/ww
package main
import (
crand "crypto/rand"
"flag"
"fmt"
"io"
"net/url"
"os"
"strconv"
"rsc.io/qr"
"webwormhole.io/wordlist"
"webwormhole.io/wormhole"
)
var subcmds = map[string]func(args ...string){... |
// Copyright 2016 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... |
package fs
import (
"easy-copy/common"
"errors"
"io/fs"
"path/filepath"
"strings"
"time"
)
type MockFS struct {
Root *MockFolder
}
// Resolve resolves the path.
// Currently all paths are assumed to either be
// a) absolute (incl. leading "/")
// b) relative to the root directory (excl. leading "/")
// This... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/protobuf/transport_options.proto
package for_core_protos_go_proto
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var ... |
package checkntpoffset
import (
"bufio"
"fmt"
"io"
"math"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/beevik/ntp"
"github.com/jessevdk/go-flags"
"github.com/mackerelio/checkers"
)
var opts struct {
Crit float64 `short:"c" long:"critical" default:"100" description:"Critic... |
package localpinning
import (
"bytes"
"context"
"errors"
"fmt"
"math/rand"
"time"
"github.com/ethersphere/beekeeper/pkg/bee"
"github.com/ethersphere/beekeeper/pkg/beeclient/api"
"github.com/ethersphere/beekeeper/pkg/random"
"github.com/prometheus/client_golang/prometheus/push"
"github.com/prometheus/common... |
package groups
import (
"github.com/chnsz/golangsdk"
"github.com/chnsz/golangsdk/pagination"
)
// CreateOpts is a struct which will be used to create a new security group.
type CreateOpts struct {
// Specifies the security group name. The value can contain 1 to 64 characters, including letters, digits,
// undersc... |
package users
import (
"errors"
"github.com/rackspace/gophercloud"
db "github.com/rackspace/gophercloud/openstack/db/v1/databases"
os "github.com/rackspace/gophercloud/openstack/db/v1/users"
"github.com/rackspace/gophercloud/pagination"
)
// List will list all available users for a specified database instance.
... |
package httphandlers
import (
"archive/zip"
"encoding/binary"
"encoding/hex"
"io"
"log"
"mime"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
)
type contentRecord struct {
zipFile *zip.File
modifyTime time.Time
eTag string
contentType string
l sync.Mutex
}
/... |
// Copyright © 2017 <NAME> <<EMAIL>>
//
// 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... |
/*
Copyright Hitachi, Ltd. 2020 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 o... |
package endpoints
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"sync"
"time"
"github.com/Sirupsen/logrus"
uuid "github.com/gofrs/uuid"
"github.com/julienschmidt/httprouter"
"github.com/prebid/prebid-cache/backends"
backendDecorators "github.com/prebid/prebid-cache/backends/decorators"
)... |
package medusa
import (
"context"
"crypto/sha256"
"encoding/base64"
"time"
"github.com/go-logr/logr"
cassdcapi "github.com/k8ssandra/cass-operator/apis/cassandra/v1beta1"
api "github.com/k8ssandra/k8ssandra-operator/apis/medusa/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/ap... |
/*
Copyright 2019-2020 The Tekton 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, softw... |
package main
import (
"errors"
"strings"
"github.com/kataras/iris/v12"
)
type ResponseBean struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
var dirOptions = iris.DirOptions{
IndexName: "index.html",
// The `Compress` field is ignored
// when the file is... |
package mocka
import (
"fmt"
"reflect"
"strings"
)
// mapToInterfaces maps a slice of reflection values to interface values
func mapToInterfaces(values []reflect.Value) []interface{} {
interfaces := make([]interface{}, len(values))
for index, value := range values {
if value.IsValid() {
interfaces[index] =... |
package proxy
import (
"context"
"strconv"
"sync"
"testing"
"github.com/coinbase/redisbetween/messenger"
"github.com/go-redis/redis/v8"
"github.com/stretchr/testify/assert"
)
// assumes a redis cluster running with 6 nodes on 127.0.0.1 ports 7000-7005, and
// a standalone redis on port 7006. see docker-compos... |
package govader_test
import (
"testing"
"github.com/tehzwen/govader"
"gonum.org/v1/gonum/floats"
)
type PolarityTestCase struct {
Text string
Scores govader.Sentiment
}
// the python reference implementation rounds scores to 3 or 4 decimal
// places. so we test to that tolerance.
const matchEpsilon = 0.5e-3... |
package dyld
import (
"encoding/binary"
"fmt"
"io"
"sort"
"strings"
"github.com/blacktop/go-arm64"
"github.com/blacktop/go-macho"
"github.com/blacktop/ipsw/internal/demangle"
)
// GetSymbolAddress returns the virtual address and possibly the dylib containing a given symbol
func (f *File) GetSymbolAddress(sym... |
package main
import (
"flag"
"fmt"
"html/template"
"os"
"os/exec"
"strings"
)
var version = "0.0.0"
func main() {
var help bool
var h bool
var ver bool
var v bool
var outPkg string
flag.BoolVar(&help, "help", false, "Show help.")
flag.BoolVar(&h, "h", false, "Show help.")
flag.BoolVar(&ver, "version", ... |
package viewservice
import "net"
import "net/rpc"
import "log"
import "time"
import "sync"
import "fmt"
import "os"
import "sync/atomic"
type ViewServer struct {
mu sync.Mutex
l net.Listener
dead int32 // for testing
rpccount int32 // for testing
me string
// Your declarations ... |
package service
import (
"binance-proxy/internal/tool"
"context"
"sync"
log "github.com/sirupsen/logrus"
spot "github.com/adshao/go-binance/v2"
)
type TickerSrv struct {
rw sync.RWMutex
ctx context.Context
cancel context.CancelFunc
initCtx context.Context
initDone context.CancelFunc
si *sy... |
package servicequotas
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/ec2"
awsservicequotas "github.com/aws/aws-sdk... |
package keeper
import (
"time"
"github.com/aliworkshop/terra-sdk/codec"
codectypes "github.com/aliworkshop/terra-sdk/codec/types"
storetypes "github.com/aliworkshop/terra-sdk/store/types"
sdk "github.com/aliworkshop/terra-sdk/types"
db "github.com/tendermint/tm-db"
)
const (
DefaultEpochActionID = 1
DefaultE... |
package client
import (
"context"
"errors"
"fmt"
"reflect"
"testing"
"github.com/milvus-io/milvus-sdk-go/v2/entity"
"github.com/milvus-io/milvus-sdk-go/v2/internal/proto/common"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
)
func TestHandleRespStatus(t *testing.T) {
assert.NotNil(t, handle... |
/*
Copyright 2022 TriggerMesh Inc.
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, softwar... |
package ft232h
import (
"fmt"
"math"
"math/rand"
"strconv"
"strings"
"time"
)
var (
numberRunes = []rune("0123456789")
letterRunes = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
rng = rand.New(rand.NewSource(time.Now().UnixNano()))
)
type runeSeq func() rune
func randRune(alpha []rune) func() rune {
retur... |
package ssh
import (
"fmt"
"os"
"os/exec"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
"github.com/spf13/cobra"
"github.com/craftcms/nitro/pkg/config"
"github.com/craftcms/nitro/pkg/containerlabels"
"github.com/craftcms/nitro/pkg/proxyc... |
// 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 (
"errors"
"flag"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
"runtime/pprof"
"sort"
"github.com/andrewarchi/codesearch/index"
"gi... |
package web
import (
"io"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
"go.uber.org/zap"
)
type (
echoLogger struct {
l *zap.SugaredLogger
}
// EmptyWriter struct
EmptyWriter struct{}
)
// Null is /dev/null emulation
var Null = new(EmptyWriter)
// Write /dev/null emulation
func (EmptyW... |
// Copyright (C) 2019-2020 Zilliz. 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 l... |
package gmcrypto
import (
"crypto"
"hash"
"strconv"
)
// Hash2 identifies a cryptographic hash function that is implemented in another
// package.
type Hash2 uint
func NewHash2(h crypto.Hash) Hash2 {
return Hash2(h)
}
func (h Hash2) ToHash() crypto.Hash {
return crypto.Hash(h)
}
// HashFunc simply returns the ... |
// Copyright (c) 2017 The Bitum developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package merkle
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"testing"
)
const (
leftVectorS = "360f84035942243c6a36537ae2f8673485e6c04455a0a85a0db1... |
// +build !js
package websocket
import (
"bufio"
"context"
"errors"
"fmt"
"io"
"runtime"
"strconv"
"sync"
"sync/atomic"
)
// Conn represents a WebSocket connection.
// All methods may be called concurrently except for Reader and Read.
//
// You must always read from the connection. Otherwise control
// fram... |
/*
Copyright 2019 The Crossplane 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 tenantmapping
import (
"context"
"encoding/json"
"fmt"
"net/http"
"github.com/kyma-incubator/compass/components/director/pkg/authenticator"
"github.com/kyma-incubator/compass/components/director/pkg/log"
"github.com/sirupsen/logrus"
"github.com/kyma-incubator/compass/components/director/internal/mo... |
package cnv
import (
"bytes"
"encoding/binary"
"fmt"
"strconv"
"strings"
"github.com/pkg/errors"
)
type ConversionRequest struct {
Type string `json:"type"`
Field string `json:"field"`
Endian string `json:"endian"`
NumBytes uint `json:"num_bytes"`
Value string `json:"value"`
}
type Conversi... |
package cmd
import (
"fmt"
"os"
"github.com/cppforlife/go-cli-ui/ui"
"github.com/ghodss/yaml"
regname "github.com/google/go-containerregistry/pkg/name"
cmdcore "github.com/k14s/kbld/pkg/kbld/cmd/core"
ctlimg "github.com/k14s/kbld/pkg/kbld/image"
regtarball "github.com/k14s/kbld/pkg/kbld/imagetarball"
ctlres ... |
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func doLines(filename string, do func(line string) error) error {
f, err := os.Open(filename)
if err != nil {
return err
}
defer f.Close()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
line := scanner.Text()
if err := do(line); err... |
// Copyright 2020 IBM Corp.
// SPDX-License-Identifier: Apache-2.0
package utils
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"runtime"
"sort"
"strings"
app "github.com/ibm/the-mesh-for-data/manager/apis/app/v1alpha1"
dc "github.com/ibm/the-mesh-for-data/pkg/connectors/protobuf"
... |
package prompt
import (
"bytes"
"fmt"
"log"
"os"
"regexp"
"text/template"
"github.com/josledp/goprompt/prompt/plugin"
"github.com/josledp/termcolor"
)
var availablePlugins = []Plugin{
&plugin.Aws{},
&plugin.Git{},
&plugin.LastCommand{},
&plugin.Path{},
&plugin.Python{},
&plugin.User{},
&plugin.Hostnam... |
package dnet_test
import (
"context"
"fmt"
"net"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
"testing"
"time"
"github.com/sirupsen/logrus"
"golang.org/x/net/nettest"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/kubernetes"
"github.com/datawire/dlib/dcontext"
"github.com/datawi... |
package api
import (
"errors"
"fmt"
"net/http"
"regexp"
"strings"
"time"
log "github.com/sirupsen/logrus"
)
type logRequest struct {
channel string
user string
channelid string
userid string
time logTime
reverse bool
responseType string
re... |
// Copyright 2019 Yunion
//
// 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 writi... |
package beeinstant_go_sdk
import (
"sync"
"strings"
"time"
"math"
)
type MetricCollector interface {
IncCounter(metricName string, value int)
Record(metricName string, value float64, unit string)
}
type MetricLogger interface {
MetricCollector
ExtendDimensions(dimensions string) Metri... |
package config
import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"encoding/pem"
"io/ioutil"
"log"
"net/http"
"net/url"
"path"
"time"
)
// Config holds a top-level configuration of an instance of Multikube. It is used to
// pass around configuration used by different packages within the project.
type Confi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.