text stringlengths 3.08k 10.4k |
|---|
// Copyright 2018 <NAME> (<EMAIL>)
// and <NAME> (github.com/pschou)
//
// 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
/... |
// Copyright 2018 Google 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 ... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: user_bet_made.proto
package v1
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marsh... |
// Copyright (c) 2021 Terminus, 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 agree... |
// Copyright 2017 <NAME>
//
// 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 writin... |
// Copyright 2020 YourBase 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
package pulse
import "github.com/jfreymuth/pulse/proto"
// A RecordStream is used for recording audio.
// When creating a stream, the user must provide a callback that will be called with the recorded audio data.
type RecordStream struct {
c *Client
index uint32
running bool
err error
w Writer
cre... |
package metadata
import (
"encoding/json"
"fmt"
"log"
"strings"
"github.com/bububa/opentaobao/metadata/util"
)
type ApiParamType = string
const (
STRING_PARAM_TYPE ApiParamType = "String"
NUMBER_PARAM_TYPE ApiParamType = "Number"
DATE_PARAM_TYPE ApiParamType = "Date"
FIELD_LIST_PARAM_TYPE Api... |
package auth
import (
"context"
"fmt"
"net/http"
"strings"
"github.com/aokoli/goutils"
oidc "github.com/coreos/go-oidc/v3/oidc"
"github.com/go-kit/kit/log"
errors "github.com/go-openapi/errors"
runtime "github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
flag "github.com/spf13/pflag"
... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"tgBot/mods"
"github.com/spf13/viper"
)
func main() {
// Инициализация конфига (токенов)
err := mods.InitConfig()
if err != nil {
fmt.Println("Config error: ", err)
return
}
// Url бота для отправки и... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016 Datadog, Inc.
// Package httpsec defines the HTTP operation that can be listened to using
// dy... |
package backend
import (
"fmt"
"log"
"sync"
"time"
"errors"
"strings"
"net/http"
"io/ioutil"
"math/rand"
"encoding/json"
)
type HostRule struct {
Rule string
Backend string
}
type ConfigData struct {
HostRules map[string]HostRule
BackendStruct map[string][]string
}
type Backends struct {
sync.RWMutex... |
package repl
import (
"bytes"
"fmt"
"io"
"testing"
"time"
"github.com/athos/trenchman/client"
"github.com/stretchr/testify/assert"
)
type (
mockClient struct {
step step
ins []string
outs *bytes.Buffer
errs *bytes.Buffer
interrupted bool
}
step struct {
expected st... |
package main
import (
"bufio"
"bytes"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
n, q := readTwoNums(reader)
A := readNNums(reader, n)
Q := make([][]int, q)
for i := 0; i < q; i++ {
Q[i] = readNNums(reader, 2)
}
res := solve(n, A, Q)
var buf bytes.Buffer
for i := 0; i < len(res);... |
package neural
import (
"fmt"
"math/rand"
"github.com/200sc/geva/pop"
)
var (
ngo NetworkGenerationOptions
crossover NeuralCrossover
fitness FitnessFunc
)
// A Body is what we would like to call the actual network -- it's
// just a 2d slice of neurons.
type Body [][]Neuron
// A Neural Network has a b... |
package aws
import (
"fmt"
"log"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/datasync"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)
func resourceAwsDataSyncLocationS3() *schema.Resource {
return &schema.Resource{
Create... |
package middleware
// BOLLON hugo / RODRIGUEZ Samuel
import (
"fmt"
"sync"
"time"
)
var (
ProcessPool []*Process
NbProcess int
)
// LetterBox est une liste de messages à partir d'un tableau d'interface
// (pseudo généricité)
type LetterBox chan interface{}
// Process est un processus comportant une instance... |
package breaker
import (
"sync/atomic"
"time"
"github.com/cuigh/auxo/errors"
"github.com/cuigh/auxo/log"
)
const PkgName = "auxo.apm.breaker"
var (
// ErrMaxConcurrency occurs when too many of the same named command are executed at the same time.
ErrMaxConcurrency = errors.New("breaker: max concurrency")
// ... |
package stresstest
import (
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"sync"
"time"
)
type Warship struct {
Target string
Workers int
HttpClient *http.Client
Debug bool
Stop chan bool
SuccessRequest int64
AmountRequests int64
sync.Mutex
}
func New(t... |
// Copyright 2017 FullStory, 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 ... |
package jaess
import (
"fmt"
"io"
"bytes"
)
// a scanner of tokens
type TokenScanner struct {
input io.RuneScanner
offset int64
Location Cursor
lastToken *Token
unToken *Token
capture *SourceCapture
Trace bool
}
// location within the source input
type Cursor struct {
line int
column in... |
package main
import (
"fmt"
"strings"
"time"
"unicode/utf8"
"github.com/bwmarrin/discordgo"
"github.com/sirupsen/logrus"
)
var currentSession *discordgo.Session
func startBot(botToken string) error {
var err error = nil
currentSession, err = discordgo.New("Bot " + botToken)
if err != nil {
return err
}... |
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"github.com/go-chi/chi/v5"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/mapper"
"github.com/rs/zerolog/log"
)
func proxyPat... |
package datatypes
import "github.com/guregu/null"
// Network holds configuration for a specific network.
type Network struct {
NameID
// DeploymentID is the deployment for which this network is defined.
DeploymentID int64 `json:"deployment_id"`
// Vlan is the VLAN that this network should run over.
Vlan int64 `j... |
package cmd
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strconv"
"time"
)
func (j *Jue) GetV1Data() (string, error) {
cursor := ""
haveMore := true
s := ""
t, _ := time.LoadLocation("Asia/Shanghai")
u, _ := base64.StdEncoding.DecodeString(jueV1Url)
p := string... |
package main
import (
"fmt"
"strings"
"github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
"github.com/go-openapi/spec"
"k8s.io/kube-openapi/pkg/builder"
"k8s.io/kube-openapi/pkg/common"
cdicorev1 "kubevirt.io/containerized-data-importer/pkg/apis/core/v1alpha1"
cdiuploadv1 "... |
package main
import (
"fmt"
"strings"
"github.com/gdamore/tcell/v2"
"github.com/gdamore/tcell/v2/views"
"github.com/pkg/errors"
)
type textField struct {
views.TextArea
symbols []rune
sbuilder strings.Builder
previous []rune
}
func (field *textField) HandleEvent(event tcell.Event) bool {
switch event := ... |
//go:generate statik -src=./webui/dist -include=*.jpg,*.png,*.json,*.html,*.css,*.js,*.xml,*.ico
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/signal"
"syscall"
"net/http"
petname "github.com/dustinkirkland/golang-petname"
"github.com/grandcat/zeroconf"
"github.com/hashicorp/memberlist"
... |
/*
Copyright 2021 The KodeRover 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, s... |
// Package scanner implements the library to handle the lexical-analysis.
package scanner
import (
"fmt"
"strings"
"github.com/pravj/glox/errors"
"github.com/pravj/glox/scanner/token"
"github.com/pravj/glox/utils"
)
/*
Scanner represents a lexical scanner that does lexical-analysis on the source.
It holds the ... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path"
"strings"
"github.com/PuerkitoBio/goquery"
"gopkg.in/yaml.v2"
)
type TCases []TCase
type TCase struct {
CaseNumber string `json:"casenumber" yaml:"casenumber"`
Name string `json:"name" yaml:"name"... |
package assert
// T reports when failures occur.
// testing.T implements this interface.
type T interface {
// Fail indicates that the test has failed but
// allowed execution to continue.
Fail()
// FailNow indicates that the test has failed and
// aborts the test.
// FailNow is called in strict mode (via New).
... |
package eventhandler
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
"github.com/pkg/errors"
)
// HeaderTokens contains general information about the event and supervisor
// Adopted from http://supervisord.org/events.html#header-tokens
type HeaderTokens struct {
Ver string
Server string
Se... |
package main
import "fmt"
import (
ds "github.com/ipfs/go-datastore"
modules "gitlab.com/NebulousLabs/Sia/modules"
//api "gitlab.com/NebulousLabs/Sia/node/api"
"bytes"
//dsq "github.com/ipfs/go-datastore/query"
client "gitlab.com/NebulousLabs/Sia/node/api/client"
"os"
"unicode/utf16"
"unicode/utf8"
)
const (... |
package xmlrpc
import (
"encoding/base64"
"encoding/xml"
"fmt"
"io"
"reflect"
"time"
)
// Encoder implementations are responsible for handling encoding of XML-RPC requests to the proper wire format.
type Encoder interface {
Encode(w io.Writer, methodName string, args interface{}) error
}
// StdEncoder is the ... |
package twitch
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
var (
authSignRegEx = regexp.MustCompile("/twitch/signin/([\\w]+)/*")
)
func (ah *Client) getRootToken(ua *UserAuth) error {
ua.Token = &authToken{}
tokenContain := &struct {
Token *authToke... |
package identifier
import (
"os"
"strconv"
"github.com/ti-community-infra/devstats/internal/pkg/lib"
)
type Ctx struct {
IDDbDialect string // From ID_DB_DIALECT, default "mysql"
IDDbHost string // From ID_DB_HOST, default "localhost"
IDDbPort int // From ID_DB_PORT, default "3306"
IDDbName string... |
// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package topic
import (
"fmt"
"reflect"
)
// Subscription node
type snode struct {
// If this is the end of the topic string, then add subscribers here
subs []interface{}
qos []byte
// Otherwise add the next topic level here
snodes map[string]*... |
package main
import (
"crypto/tls"
"flag"
"fmt"
"log"
"math/rand"
"net"
"os/exec"
"strings"
"sync/atomic"
"time"
"code.cloudfoundry.org/loggregator/plumbing"
"golang.org/x/net/context"
"code.cloudfoundry.org/loggregator/dopplerservice"
"google.golang.org/grpc"
"code.cloudfoundry.org/workpool"
noa... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
package difficulty
import (
"bytes"
"encoding/binary"
"fmt"
"math/big"
"time"
)
// 计算下一阶段区块难度
func CalculateNextTargetDifficulty_v1(
currentBits uint32,
currentHeight uint64,
prevTimestamp uint64,
lastTimestamp uint64,
eachblocktime uint64,
changeblocknum uint64,
printInfo *string,
) (*big.Int, uint32) {
... |
// 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 ... |
// Copyright 2020 Fairwinds
//
// 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 wr... |
// Copyright 2020 Intrinsec
// 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 buildcontrol
import (
"context"
"fmt"
"time"
"github.com/docker/distribution/reference"
"k8s.io/apimachinery/pkg/types"
"github.com/tilt-dev/tilt/internal/analytics"
"github.com/tilt-dev/tilt/internal/build"
"github.com/tilt-dev/tilt/internal/container"
"github.com/tilt-dev/tilt/internal/controllers... |
// Package testing provides test implementations of retieval market interfaces
package testing
import (
"context"
"errors"
"testing"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
"github.com/stretchr/testify/require"
rm "github.com/filecoin-project/go-fil-markets/retrievalmark... |
// +build js
package web
import (
"github.com/cadmean-ru/amphion/common/a"
"syscall/js"
)
type p5 struct {
clearJs js.Value
fillJs js.Value
strokeWeightJs js.Value
strokeJs js.Value
rectModeJs js.Value
rectModeCornerJs js.Value
pointJs js.Value
lineJs j... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
// Copyright 2021 <NAME>.
//
// 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 config
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"sync"
"testing"
"github.com/sirupsen/logrus"
vpr "github.com/spf13/viper"
"github.com/stretchr/testify/suite"
)
type TestSuite struct {
suite.Suite
}
func (s *TestSuite) SetupTest() {
os.Unsetenv("TF_TEAM_TOKEN")
os.Unsetenv... |
package organization
import (
"fmt"
"strings"
ldap "gopkg.in/ldap.v2"
)
type searchRequest struct {
dn string
filter string
sAttrs []string
mAttrs []string
size uint32
cookie []byte
}
// SearchResult ...
type SearchResult struct {
Size uint32
Cookie []byte
Data []map[string]interface{}
}
func... |
package html5
import (
"fmt"
"reflect"
"strings"
"github.com/the80srobot/html5/bindings"
"github.com/the80srobot/html5/safe"
)
type AttributeNode struct {
Name string
Value Value
RequiredTrust safe.TrustLevel
}
func Attribute(name string, value Value) *AttributeNode {
return &AttributeNode... |
// Copyright 2021 IBM 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://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
/*
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, ... |
package pool_test
import (
"crypto/sha256"
"crypto/sha512"
"fmt"
"hash"
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/fblaha/pool"
)
// hashFactory factory function for hashes
type hashFactory func() hash.Hash
// hashOutput contains a hashing output or an error
type hashOutput struct {
file string
... |
// Copyright Suneido Software Corp. All rights reserved.
// Governed by the MIT license found in the LICENSE file.
package builtin
import (
"io"
"os/exec"
"runtime"
"strings"
. "github.com/apmckinlay/gsuneido/runtime"
"github.com/apmckinlay/gsuneido/runtime/types"
)
type suRunPiped struct {
CantConvert
comm... |
package main
import (
"bytes"
"context"
"encoding/json"
"os"
"fmt"
"encoding/csv"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/sessio... |
// Copyright 2020 The Chromium OS 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 wifi
import (
"context"
"time"
remoteiw "chromiumos/tast/remote/network/iw"
"chromiumos/tast/remote/wificell"
"chromiumos/tast/services/... |
// Copyright (C) 2015 Space Monkey, 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 agre... |
// Copyright (c) 2021 rookie-ninja
//
// Use of this source code is governed by an Apache-style
// license that can be found in the LICENSE file.
// Package rkmidmeta is a middleware for metadata
package rkmidmeta
import (
"fmt"
"github.com/rookie-ninja/rk-common/common"
"github.com/rookie-ninja/rk-entry/entry"
"... |
package main
import (
bk "consensus/rbft/block"
"consensus/rbft/raft"
"crypto/rand"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"os"
"strconv"
"time"
)
var timeStart, timeEnd time.Time
func main() {
cmd := os.Args[1]
switch cmd {
case "runnode":
nodeid := os.Args[2]
fmt.Println("启动节点", nodeid)
r... |
package fscmds
import (
"errors"
"fmt"
"strings"
cmds "github.com/ipfs/go-ipfs-cmds"
"github.com/ipfs/go-ipfs/filesystem"
"github.com/ipfs/go-ipfs/filesystem/manager"
)
const (
mountParameter = "mount"
mountArgumentDescription = "Multiaddr style targets to bind to host. " + mountTargetExamples
//... |
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
)
// list of all usable spaceCommands
var spaceCommands = []string{
"new", // creates new databases provided
"del", // deletes an existing database
"list", // lists all existing databases
"rename", // ... |
package main
import (
"os"
"github.com/lendi-au/helm-janitor/cmd/delete"
"github.com/lendi-au/helm-janitor/cmd/scan"
"github.com/lendi-au/helm-janitor/internal/config"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
func init() {
// Log as JSON instead of the default ASCII formatter.
log.SetForma... |
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"strconv"
"github.com/gorilla/websocket"
"github.com/pion/rtwatch/gst"
"github.com/pion/webrtc/v2"
)
const homeHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<title>synced-playback</title>
</head>
<body id="body">
<video id="video1"... |
package ref
import (
"bytes"
"fmt"
"time"
"golang.org/x/exp/rand"
)
type Id int
type Set struct {
m map[Id]bool
}
func (set Set) Exist(id Id) bool {
_, exist := set.m[id]
return exist
}
func (set Set) Add(id Id) {
set.m[id] = true
}
func (set Set) Remove(id Id) {
delete(set.m, id)
}
func (set Set) Len(... |
package zdesk
import (
"bytes"
"fmt"
"net/http"
"net/url"
"os"
"runtime"
"strings"
"github.com/ajg/form"
"github.com/hashicorp/go-cleanhttp"
)
// APIUsernameEnvVar is the environment variable where the Zendesk username /
// email should be read from.
const APIEmailEnvVar = "ZDESK_EMAIL"
// APIKeyEnvVar is ... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: account.proto
package accountpb
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 _ = fmt.Errorf
var _ = math.Inf
// This is a comp... |
package http
import (
"strconv"
"strings"
"github.com/RediSearch/redisearch-go/redisearch"
"github.com/gofiber/fiber/v2"
"gitlab.xtc.home/xtc/redisearchd/conn/redis"
"gitlab.xtc.home/xtc/redisearchd/pkg/http"
"gitlab.xtc.home/xtc/redisearchd/pkg/json"
self "gitlab.xtc.home/xtc/redisearchd/pkg/redisearch"
)
/... |
package pdp
import (
"fmt"
"strconv"
"strings"
"github.com/google/uuid"
)
// PolicyStorage is a storage for policies.
type PolicyStorage struct {
tag *uuid.UUID
attrs map[string]Attribute
policies Evaluable
}
// NewPolicyStorage creates new policy storage with given root policy set
// or policy, symb... |
package model
// ArgGetQusBank 题库
type ArgGetQusBank struct {
QsBId int64 `form:"qb_id" validate:"required"`
Stat int64 `form:"idel" validate:"min=0"`
}
// ArgAddQusBank 添加题库
type ArgAddQusBank struct {
QBName string `json:"qb_name" validate:"required"`
CdTime int64 `json:"cd_time" validate:"require... |
/*
Copyright 2020 The Knative 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, soft... |
package test
// This file handles the consul service.
// 1) We generate a config file with the port generated dynamically with BookPorts().
// The reason is that the ports cannot be setup through the command line only.
// It needs to be setup with a config file.
// 2) It guarantees that both the service port is ... |
package distributor
import (
"context"
"encoding/json"
"github.com/YRXING/data-primitive/pkg/trace"
"github.com/opentracing/opentracing-go"
log "github.com/sirupsen/logrus"
"sync"
"time"
. "github.com/YRXING/data-primitive/pkg/constants"
"github.com/YRXING/data-primitive/pkg/util"
"github.com/YRXING/data-pr... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" fil... |
// Copyright 2020 Mavenir
//
// 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 (c) 2021 - Present. Blend Labs, Inc. All rights reserved
Use of this source code is governed by a MIT license that can be found in the LICENSE file.
*/
package db
import (
"database/sql"
"encoding/json"
"reflect"
"strings"
"github.com/blend/go-sdk/ex"
)
// ---------------------------------------... |
// Simple Syslog Server that
// supports UDP, TCP and TLS.
//
// <NAME>
// April 2018
package simplesyslog
import (
"crypto/tls"
"errors"
"fmt"
"net"
"os"
"time"
)
// ConnectionType defines wheather to connect via UDP or TCP (or TLS)
type ConnectionType string
const (
// ConnectionUDP connects via UDP
Conne... |
package createcluster
import (
//"fmt"
//"encoding/json"
//"fmt"
"github.com/emicklei/go-restful"
//"github.com/pkg/errors"
"kubeinstall/src/cluster"
//"kubeinstall/src/config"
"kubeinstall/src/logdebug"
"kubeinstall/src/msg"
//"kubeinstall/src/session"
//"kubeinstall/src/runconf"
"kubeinstall/src/config"... |
package main
import "os"
import "strconv"
import "flag"
import log "github.com/Sirupsen/logrus"
// codebeat:disable[TOO_MANY_IVARS]
type pdnsConfig struct {
device string
pcapFile string
bpf string
sensorName string
debug bool
cpuprofile string
quiet bool
gcAge string
gcInterval string
numprocs int
pfrin... |
// The iofl package provides configurable I/O filter chains.
package iofl
import (
"errors"
"fmt"
"io"
)
// Closed is returned by a filter that has been closed.
var Closed = errors.New("closed")
// Config configures a ChainSet.
type Config struct {
// Chains maps a name to a Chain.
Chains map[string]Chain
}
//... |
package resfile
import (
"errors"
"io"
"math"
"github.com/inkyblackness/res/chunk"
"github.com/inkyblackness/res/chunk/resfile/compression"
"github.com/inkyblackness/res/serial"
)
// Writer provides methods to write a new resource file from scratch.
// Chunks have to be created sequentially. The writer does no... |
// Copyright 2019 Thales UK Limited
//
// 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, di... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.21.0-devel
// protoc (unknown)
// source: recordprinter.proto
package recordprinter
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.or... |
package sh
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"sync"
"time"
)
const (
PlayerIDEngine = "engine"
PlayerIDAdmin = "admin"
PlayerIDAll = "all"
PolicyFascist = "fascist"
PolicyLiberal = "liberal"
PolicyMasked = "masked"
RoleFascist = "fascist"
RoleLiberal = "liberal"
RoleHitler ... |
package strhelper
import (
"testing"
"github.com/spf13/cast"
"github.com/stretchr/testify/assert"
)
func TestFormatPathChange(t *testing.T) {
t.Parallel()
cases := []struct {
src string
dst string
expected string
}{
{`abc`, `abc`, `"abc" -> "abc"`},
{`abc`, `123`, `"abc" -> "123"`},
{`abc... |
package lexer
import (
"lorikeet/token"
"unicode"
)
// Lexer struct
type Lexer struct {
input []rune
position int
readPosition int
linePosition int
ru rune
}
// New *Lexer
func New(input string) *Lexer {
l := &Lexer{input: []rune(input), linePosition: 1}
l.readRune()
return l
}
// Nex... |
package main
import (
"bufio"
"fmt"
"math"
"os"
"time"
)
type Point struct {
x int
y int
val rune
}
func check(e error) {
if e != nil {
panic(e)
}
}
func getLines(filename string) []string {
fh, err := os.OpenFile(filename, os.O_RDONLY, os.ModePerm)
check(err)
defer fh.Close()
lines := make([]s... |
// Copyright 2013 go-dockerclient 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 docker
import (
"encoding/json"
"net"
"strings"
"github.com/docker/docker/api/types/swarm"
)
// Version returns version in... |
// Copyright 2019 The UNICORE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file
//
// Author: <NAME> <<EMAIL>>
package buildtool
import (
"bufio"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
u "tools/srcs/common"
)
// -------... |
package pop
import (
"fmt"
"reflect"
"regexp"
"strconv"
"github.com/satori/go.uuid"
)
var rLimitOffset = regexp.MustCompile("(?i)(limit [0-9]+ offset [0-9]+)$")
var rLimit = regexp.MustCompile("(?i)(limit [0-9]+)$")
// Find the first record of the model in the database with a particular id.
//
// c.Find(&User{... |
package tools
import (
"os"
"os/exec"
"strings"
"github.com/dstmodders/mod-cli/dir"
)
// Tooler is the interface that wraps the Tool methods.
type Tooler interface {
exec(string, ...string) *exec.Cmd
execDocker(...string) *exec.Cmd
parseVersion(string) (string, error)
Name() string
Path() string
Version() ... |
// Copyright (c) 2018 Target Brands, Inc.
package pgsql
import (
"database/sql"
"encoding/json"
"regexp"
"github.com/pkg/errors"
"github.com/target/portauthority/pkg/commonerr"
"github.com/target/portauthority/pkg/datastore"
)
func (p *pgsql) GetContainerByID(id int) (*datastore.Container, error) {
var conta... |
package dumper
import (
"bufio"
"errors"
"fmt"
"net/http"
"os"
"strconv"
"strings"
"sync"
"time"
)
type MediaInfo struct {
}
type MediaGroup struct {
GroupId string
}
type VariantInfo struct {
Url string
Bandwidth int64
AvgBandwidth int64
Codecs string
Resolution string
FrameRate... |
package action
import "encoding/json"
// Command defines which command, and what details, are being specified.
// Only one of the contained fields will be set at any point in time.
type Command struct {
Name string
Generic *CommandGeneric
BrightnessAbsolute *CommandBrightnessAbsolute
BrightnessRelative *Comma... |
package controllers
import (
"context"
"fmt"
"time"
asdbv1beta1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1beta1"
"github.com/aerospike/aerospike-kubernetes-operator/pkg/utils"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
)
func (r *A... |
package jar
import (
"github.com/inconshreveable/go-update"
"github.com/cognusion/go-jar/aws"
"archive/zip"
"fmt"
"io"
"net/http"
"os"
"os/signal"
"path"
"path/filepath"
"syscall"
)
const (
// ErrUpdateConfigS3NoEC2 is returned when the s3 updatepath is set, but ec2 is not.
ErrUpdateConfigS3NoEC2 = Err... |
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"regexp"
"strings"
"github.com/bradleyfalzon/ghinstallation"
"github.com/google/go-github/v43/github"
"golang.org/x/sync/errgroup"
)
func main() {
var configFile string
var appID, installationID int64
flag.StringVar(&configFile, "f", "c... |
package activedirectory
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
log "github.com/sirupsen/logrus"
"strings"
)
// resourceADOUObject is the main function for ad ou terraform resource
func resourceADOUObject() *schem... |
package main
import (
"context"
"flag"
"fmt"
"go/parser"
"go/token"
"log"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"github.com/koron-go/srcdom"
)
func main() {
err := run(context.Background())
if err != nil {
log.Fatal(err)
}
}
func goEnvRoot(ctx context.Context) (string, error) {
c := exec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.