text stringlengths 3.08k 10.4k |
|---|
/*
Package kucoin provides two kinds of APIs: `RESTful API` and `WebSocket feed`.
The official document: https://docs.kucoin.com
*/
package kucoin
import (
"bytes"
"errors"
"fmt"
"log"
"os"
"strings"
"time"
)
const (
REQUESTS_PER_SECOND = 30 // 1800 reqs per minute
)
var (
lastRequest time.Time
BeforeReq... |
package serialnumbernoprivacy
import (
"fmt"
"github.com/incognitochain/go-incognito-sdk-v2/crypto"
"github.com/incognitochain/go-incognito-sdk-v2/privacy/v1/zkp/utils"
)
// SerialNumberNoPrivacyStatement represents the statement of an SNNoPrivacyProof.
type SerialNumberNoPrivacyStatement struct {
sn *crypto.... |
package migrate
import (
"errors"
"io"
"sync"
"go.uber.org/zap"
"golang.org/x/time/rate"
)
const (
TASK_PARALLEL_MAX = 24
)
var (
ErrTaskDuplicated = errors.New("Shard migration task has already existed")
)
// Task holds the task info
type Task struct {
// State
Started bool
Finished bool
StartTime i... |
package keeper
import (
"encoding/binary"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/peggyjv/gravity-bridge/module/v2/x/gravity/types"
)
// createSendToE... |
package main
import (
"fmt"
argParser "github.com/alexflint/go-arg"
"github.com/google/logger"
"github.com/sevlyar/go-daemon"
"github.com/skiloop/servicemon/monitor"
"io"
"os"
"path/filepath"
"strings"
"syscall"
"time"
)
type args struct {
Verbose bool `arg:"-v" help:"verbose"`
Foregrou... |
/*
* Copyright The Dragonfly 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 agr... |
// Copyright 2019 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
/*
Copyright 2019 The Skaffold 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, sof... |
package collector_mongos
import (
"time"
"strings"
"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
var (
balancerIsEnabled = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: Namespace,
Subsystem: "sharding",
Name: "balancer_enab... |
// package idletiming provides mechanisms for adding idle timeouts to net.Conn
// and net.Listener.
package idletiming
import (
"net"
"sync/atomic"
"time"
"github.com/getlantern/golog"
)
var (
epoch = time.Unix(0, 0)
log = golog.LoggerFor("idletiming")
)
// Conn creates a new net.Conn wrapping the given net... |
package framework
import (
"context"
"encoding/json"
"fmt"
"log"
"time"
"github.com/golang/glog"
"github.com/pkg/errors"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"
)
func (... |
package record
import (
"go.mau.fi/libsignal/ecc"
"go.mau.fi/libsignal/groups/ratchet"
"go.mau.fi/libsignal/util/bytehelper"
)
const maxMessageKeys = 2000
// SenderKeyStateSerializer is an interface for serializing and deserializing
// a Signal State into bytes. An implementation of this interface should be
// us... |
package domain
import (
"fmt"
"io"
"github.com/fastly/cli/pkg/cmd"
"github.com/fastly/cli/pkg/config"
"github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/manifest"
"github.com/fastly/go-fastly/v5/fastly"
)
// NewValidateCommand returns a usable command registered under the parent.
func NewValidateCo... |
package jbd2
import (
"fmt"
"time"
)
type JournalCommonBlockType struct {
header *JournalHeader
}
func (jcbt *JournalCommonBlockType) SetHeader(jh *JournalHeader) {
jcbt.header = jh
}
func (jcbt *JournalCommonBlockType) Header() *JournalHeader {
return jcbt.header
}
const (
// JBD2_CHECKSUM_BYTES
Jbd2Checks... |
// Package lfucache implements LFU (Least Frequently Used) cache
package lfucache
import (
"encoding/json"
"github.com/arazmj/gerdu/cache"
"github.com/arazmj/gerdu/dlinklist"
"github.com/arazmj/gerdu/metrics"
"github.com/hashicorp/raft"
"github.com/inhies/go-bytesize"
"io"
"sync"
)
// LFUCache data structure
... |
package servicebus
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenera... |
// Copyright 2021 The Starship Troopers Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// cmdWorker is the Golang library wrapping github.com/go-cmd/cmd adding timeouts,
// periodic output parsing using callback function and ability... |
package parser
import (
"context"
"strings"
)
type AtomKind int
const (
KindAlpha AtomKind = iota + 1
KindBit
KindChar
KindCR
KindLF
KindCtl
KindDigit
KindDQuote
KindHTab
KindOctet
KindSP
KindVChar
KindOption
KindAtomList
KindRefResult
)
var atomKindString = map[AtomKind]string{
KindAlpha: "Ki... |
package events
import (
"context"
"errors"
"fmt"
"sync"
"time"
"github.com/confluentinc/confluent-kafka-go/kafka"
)
var ErrShutdownTimeout = errors.New("shutdown timeout: not all handlers finished, not closing kafka client")
var ErrConsumerAlreadyShutdown = errors.New("consumer already shutdown")
type Consume... |
package getproviders
import (
"fmt"
svchost "github.com/hashicorp/terraform-svchost"
disco "github.com/hashicorp/terraform-svchost/disco"
"github.com/hashicorp/terraform/addrs"
)
// RegistrySource is a Source that knows how to find and install providers from
// their originating provider registries.
type Regist... |
package scanner
import (
"strconv"
"github.com/maleksiuk/golox/errorreport"
"github.com/maleksiuk/golox/srccode"
"github.com/maleksiuk/golox/toks"
)
var keywords = map[string]toks.TokenType{
"and": toks.And,
"class": toks.Class,
"else": toks.Else,
"false": toks.False,
"for": toks.For,
"fun": t... |
package device
import (
"github.com/satori/go.uuid"
"log"
)
//EdgeNodeState determinate state of EdgeNode
type EdgeNodeState int
var (
//NotOnboarded EdgeNode
NotOnboarded EdgeNodeState
//Onboarded EdgeNode
Onboarded EdgeNodeState = 1
)
//Ctx is base struct for EdgeNode
type Ctx struct {
onboardKey ... |
package transport
import (
"bytes"
"errors"
"github.com/ClessLi/bifrost/api/protobuf-spec/bifrostpb"
"github.com/ClessLi/bifrost/internal/pkg/bifrost/endpoint"
"github.com/go-kit/kit/transport/grpc"
"golang.org/x/net/context"
"google.golang.org/grpc/health/grpc_health_v1"
"io"
"time"
)
var (
ChunkSize = 102... |
package integration
import (
"encoding/json"
"fmt"
"path/filepath"
"strings"
"github.com/ActiveState/cli/internal/testhelpers/e2e"
"github.com/ActiveState/cli/internal/testhelpers/tagsuite"
)
func (suite *PushIntegrationTestSuite) TestInitAndPush_VSCode() {
suite.OnlyRunForTags(tagsuite.Init, tagsuite.Push, t... |
package chat
import (
"context"
"fmt"
"log"
"time"
"github.com/shirasudon/go-chat/chat/action"
"github.com/shirasudon/go-chat/chat/queried"
"github.com/shirasudon/go-chat/domain/event"
)
//go:generate mockgen -destination=../internal/mocks/mock_query_service.go -package=mocks github.com/shirasudon/go-chat/cha... |
// Copyright 2019 Intel Corporation. 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 app... |
package sdk
import (
"context"
"encoding/json"
"math/rand"
"net"
"strconv"
"strings"
"sync"
"time"
"github.com/apache/thrift/lib/go/thrift"
"github.com/binhgo/go-sdk/sdk/thriftapi"
)
// ThriftClient Client for call Thrift service
type ThriftClient struct {
adr string
timeout time.Duratio... |
package gocbcore
import (
"encoding/json"
"errors"
"io/ioutil"
"strings"
"time"
)
// N1QLRowReader providers access to the rows of a n1ql query
type N1QLRowReader struct {
streamer *queryStreamer
}
// NextRow reads the next rows bytes from the stream
func (q *N1QLRowReader) NextRow() []byte {
return q.streame... |
/*
Copyright © 2020 Dell Inc. or its subsidiaries. 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 ... |
// Copyright 2015 beego Author. 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 applica... |
// Package cmd defines commands for the DC/OS CLI.
package cmd
import (
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"github.com/sirupsen/logrus"
"github.com/dcos/dcos-cli/api"
"github.com/dcos/dcos-cli/pkg/cmd/auth"
"github.com/dcos/dcos-cli/pkg/cmd/cluster"
"github.com/dcos/dcos-cli/pk... |
// Copyright 2019 The mqtt-go 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 agre... |
package loopback_transport
import (
"io"
"sync"
"time"
"github.com/sirupsen/logrus"
"github.com/PeerXu/meepo/pkg/transport"
msync "github.com/PeerXu/meepo/pkg/util/sync"
)
type LoopbackDataChannel struct {
c1Rd *io.PipeReader
c1Wr *io.PipeWriter
c2Rd *io.PipeReader
c2Wr *io.PipeWriter
left *LoopbackDat... |
// Code generated by protoc-gen-go.
// source: pin_delete.proto
// DO NOT EDIT!
package service
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not ot... |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v1
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Returns the specified NotificationEndpoint resource in the given regi... |
/*
* Copyright 2022 The Dragonfly 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 la... |
package alert
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"strings"
"HFish/error"
"HFish/utils/cache"
"HFish/utils/geo"
"HFish/utils/log"
"HFish/utils/passwd"
"HFish/utils/send"
"HFish/utils/try"
"HFish/view/data"
)
func AlertSyslog(model string, projectName string, typex string, agent string, ipx ... |
// Copyright (c) 2018-present <NAME> (<EMAIL>).
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
package internal
var fieldTypes = map[string]string{
"bool": "bool",
"boolean": "bool",
"tinyint": "int8",
"smallint": "in... |
package bitbucketcloud
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"strings"
"github.com/mitchellh/mapstructure"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/log"
)
type statusData struct {
pipName string
desc string
status string
repoFullName string
hash ... |
package client
import (
"avrilko-rpc/protocol"
"context"
"golang.org/x/sync/singleflight"
"io"
"net/url"
"sync"
)
// key value 键值对
type KVPair struct {
Key string
Value string
}
type XClient interface {
SetPlugins(plugins PluginContainer)
GetPlugin() PluginContainer
SetSelector(s Selector)
Auth(auth st... |
package roll
import (
"context"
"dndroller/internal/logger"
"dndroller/internal/model"
"dndroller/internal/repo"
"dndroller/internal/service/common"
"fmt"
"math"
"time"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
)
type Roll struct {
logger *logger.Zap
repo *repo.Repo
rm *rollMap
}
fun... |
// Code generated by go-swagger; DO NOT EDIT.
package storage
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime... |
package subscribe
import (
"context"
"fmt"
"github.com/golang/protobuf/proto"
"github.com/xuperchain/xuper-sdk-go/config"
"github.com/xuperchain/xuper-sdk-go/pb"
"github.com/xuperchain/xuper-sdk-go/xchain"
"io"
"log"
)
type Watcher struct {
xchain.Xchain
eventConsumerBufferSize uint
SkipEmptyTx ... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package stack
import (
"flag"
"io/ioutil"
"log"
"os"
"path/filepath"
"testing"
)
func TestCallPkg1(t *testing.T) {
c := Call{
SrcPath: "/gopat... |
//Package parser lexer.go is mainly referenced from github.com/golang/go/src/text/template/parse/lex.go
package parser
import (
"fmt"
"strings"
"unicode/utf8"
)
//lex create a new scanner for the input string
func lex(name, input string) *lexer {
l := &lexer{
name: name,
input: input,
items: make(chan toke... |
package generator
import (
"bytes"
"fmt"
"go/ast"
"go/format"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
"golang.org/x/tools/go/packages"
)
// Generator holds the state of the analysis. Primarily used to buffer
// the output for format.Source.
type Generator struct {
buf bytes.Buffer // Accumulated ... |
package services
import (
"github.com/TimeForCoin/Server/app/models"
"github.com/TimeForCoin/Server/app/utils"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// MessageService 消息服务
type MessageService interface {
GetSessions(userID primitive.ObjectID, page, size int64) (res []SessionListDetail)
GetSession(userID... |
package main
import (
"bufio"
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
"strings"
"github.com/GreenLightning/zigbee-conductor/controller/conbee"
"github.com/GreenLightning/zigbee-conductor/pkg/slip"
"github.com/GreenLightning/zigbee-conductor/zcl"
"github.com/GreenLightning/zigbee-conductor/zdp"
"github.com/... |
// Copyright IBM Corp. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
package consensus
import (
"time"
algorithm "github.com/SmartBFT-Go/consensus/internal/bft"
bft "github.com/SmartBFT-Go/consensus/pkg/api"
"github.com/SmartBFT-Go/consensus/pkg/types"
protos "github.com/SmartBFT-Go/consensu... |
package ui
import (
"math"
"github.com/gpayer/pixelext/nodes"
"github.com/faiface/pixel"
)
type Grid struct {
UIBase
bbox *nodes.Canvas
cols int
uichildren []UINode
recalc bool
}
func NewGrid(name string, cols int) *Grid {
g := &Grid{
UIBase: *NewUIBase(name),
cols: cols,
recalc: t... |
package dreck
import (
"context"
"fmt"
"os"
"os/exec"
"regexp"
"strings"
"syscall"
"github.com/miekg/dreck/log"
"github.com/google/go-github/v28/github"
)
// sanitize checks the exec command s to see if a respects our white list.
// It is also check for a maximum length of 64, allow what isExec matches, bu... |
/*
* Copyright 2019-2020 VMware, 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 w... |
package cli
import (
"context"
"fmt"
"os"
"path"
"strings"
"github.com/hashicorp/go-multierror"
"github.com/mctofu/homekit/client"
"github.com/mctofu/velux"
"github.com/mctofu/velux/cmd/velux/cli/config"
"github.com/spf13/cobra"
)
var rootCommand = &cobra.Command{
Use: "velux",
}
func init() {
rootComma... |
package ssh
import (
"crypto/dsa"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"reflect"
"strings"
"testing"
)
var (
ecdsaKey Signer
ecdsa384Key Signer
ecdsa521Key Signer
testCertKey Signer
)
type testSigner struct {
Signer
pub PublicKey
}
func (ts *testSigner) PublicKey() PublicKey ... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package main
import (
"context"
"log"
"os"
"sync"
"sync/atomic"
"time"
eventhub "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/internal"
"github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/i... |
package job
import (
"strconv"
"strings"
log "github.com/coreos/fleet/third_party/github.com/golang/glog"
"github.com/coreos/fleet/resource"
"github.com/coreos/fleet/unit"
)
type JobState string
const (
JobStateInactive = JobState("inactive")
JobStateLoaded = JobState("loaded")
JobStateLaunched = JobStat... |
package main
import (
"card/mail"
"card/request"
"card/response"
"encoding/json"
"fmt"
"github.com/parnurzeal/gorequest"
"github.com/robfig/cron"
"io/ioutil"
"log"
"os"
"regexp"
"time"
)
var mailTemplate = "尊敬的%s,您今天的打卡结果为%s"
func main() {
log.Println("Starting...")
c := cron.New() // 新建一个定时任务对象
// 每... |
package mqtt
import (
"log"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/ppacher/envel/pkg/callback"
"github.com/ppacher/envel/pkg/loop"
lua "github.com/yuin/gopher-lua"
)
const mqttTypeName = "mqtt"
func createMQTTTypeTable(L *lua.LState, t *lua.LTable) {
typeMT := L.NewTypeMetatable(mqttTypeName)
... |
package mediaenc
import (
"fmt"
"os/exec"
"runtime"
"strings"
"github.com/cloudencode/common"
"github.com/cloudencode/configure"
log "github.com/cloudencode/logging"
)
type MediaEnc struct {
notify common.FileNotification
chanFilename chan *common.EncodeFileInfo
chanConcurrence chan int
}
func... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: status.proto
package events
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 compile-... |
package tasker
import (
"context"
"errors"
"time"
"github.com/astaxie/beego/orm"
"github.com/rs/zerolog"
)
const (
TaskStatPending = "pending"
TaskStatRunning = "running"
TaskStatRetry = "retry"
TaskStatFailed = "failed"
TaskStatSuccess = "success"
)
const (
TaskCtxKeyLog = "stdout" // ... |
package util
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPasreUnit(t *testing.T) {
amount, err := ParseUnit("1 aergo")
assert.NoError(t, err, "parsing aergo")
t.Log(amount)
amount, err = ParseUnit("101 Aergo")
assert.NoError(t, err, "parsing Aergo")
t.Log(amount)
amount, e... |
package zonefile
import (
"fmt"
"io/ioutil"
"strings"
log "github.com/inconshreveable/log15"
"github.com/netsec-ethz/rains/internal/pkg/query"
"github.com/netsec-ethz/rains/internal/pkg/section"
)
const (
TypeAssertion = ":A:"
TypeShard = ":S:"
TypePshard = ":P:"
TypeZone = ":Z... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: pb/race.proto
package pb
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 compile-tim... |
/*
Copyright 2021. The KubeVela 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 writ... |
package main
import (
"io"
"log"
"math/rand"
"os"
"os/exec"
"sync"
"time"
)
func timerChannel(timer *time.Timer) <-chan time.Time {
if timer != nil {
return timer.C
}
return nil
}
func disableTimer(timer *time.Timer) *time.Timer {
if timer != nil {
timer.Stop()
}
return nil
}
// ScatterWait avoids ... |
package storage
import (
"context"
"errors"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"
cbor "github.com/ipfs/go-ipld-cbor"
format "github.com/ipfs/go-ipld-format"
ipld "github.com/ipfs/go-ipld-format"
"github.com/sbwtw/go-filecoin/intern... |
package git
import (
"io/ioutil"
"os"
"path"
"sync"
"time"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
// NewNoMirrorClientFactory creates a client factory which does not use mirroring
func NewNoMirrorClientFactory(opts ...ClientFactoryOpt) (ClientFactory, error) {
o := ClientFactoryOpts{}
defaul... |
package app
import (
"flag"
"github.com/betacraft/yaag/irisyaag"
"github.com/betacraft/yaag/yaag"
"github.com/iris-contrib/middleware/prometheus"
"github.com/jimersylee/iris-seed/commons/api_token"
"github.com/jimersylee/iris-seed/commons/db"
"github.com/jimersylee/iris-seed/commons/redis_manager"
"github.com/... |
package main
import (
"bytes"
"fmt"
"io/ioutil"
)
type Coordinate struct {
x int
y int
area int
isInfinite bool
distance int
}
func (c *Coordinate) UnmarshalText(text []byte) error {
str := string(text)
_, err := fmt.Sscanf(str, "%d, %d", &c.x, &c.y)
return err
}
type Distance s... |
/*
* Licensed to 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. Apache Software Foundation (ASF) licenses this file to you under
* the Apache License, Version 2.0 (the ... |
/*
* Copyright (c) 2021 THL A29 Limited, a Tencent company. All rights reserved
*
* This source code file is licensed under the MIT License, you may obtain a copy of the License at
*
* http://opensource.org/licenses/MIT
*
*/
package types
import (
"context"
"time"
dcProtocol "github.com/Tencent/bk-ci/src/b... |
package fasttext
// #cgo LDFLAGS: -L${SRCDIR}/lib -lfasttext -lstdc++
//
// #include <stdlib.h>
//
// struct PredictRecord {
// float predict;
// const char* word;
// };
//
// struct WrapperFastText* FastText();
// const int FT_LoadModel(struct WrapperFastText*, const char*);
// const int FT_LoadVectors(... |
package iso20022
// Set of characteristics that apply to the debit side of the payment transactions included in the credit transfer initiation.
type PaymentInstructionInformation3 struct {
// Unique identification, as assigned by a sending party, to unambiguously identify the payment information group within the mes... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: rsync/receive.proto
package rsync // import "github.com/RokyErickson/doppelganger/pkg/rsync"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
const _ = proto.Proto... |
package security
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func BenchmarkParseChannelWithOptions(b *testing.B) {
in := "xm54Sj0srWlSEctra-yU6ZA6Z2e6pp7c/a/roman/is/da/best/?opt1=true&opt2=false"
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = ParseChannel([]byte(in)... |
package config
import (
"errors"
"os"
"path/filepath"
"time"
"github.com/kvark128/OnlineLibrary/internal/log"
"github.com/kvark128/OnlineLibrary/internal/util"
daisy "github.com/kvark128/daisyonline"
"gopkg.in/yaml.v3"
)
var (
ServiceNotFound = errors.New("service not found")
LocalStorageID = "localstorag... |
package blockchain
import (
"bytes"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"encoding/gob"
"encoding/hex"
"fmt"
"log"
"math/big"
)
const subsidy = 10
type Transaction struct {
ID []byte
Vin []TxInput
Vout []TxOutput
}
func (tx Transaction) Hash() []byte {
var hash [32]byte
t... |
package sentry
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"strings"
)
// Protocol Docs (kinda)
// https://github.com/getsentry/rust-sentry-types/blob/master/src/protocol/v7.rs
// Level marks the severity of the event
type Level string
const (
LevelDebug Level = "debug"
LevelInfo Level = "inf... |
package tagconv
import (
"fmt"
"github.com/imdario/mergo"
"reflect"
"strings"
)
var tagName = "" // initialise the struct tag value
// getMapOfAllKeyValues builds a map of the fully specified key and the value from the struct tag
// the struct tags with the full dot notation will be used as the key, and the valu... |
package manager
import (
"context"
"eventrigger.com/operator/common/consts"
"eventrigger.com/operator/common/event"
"eventrigger.com/operator/pkg/actor"
"eventrigger.com/operator/pkg/actor/k8s"
v1 "eventrigger.com/operator/pkg/api/core/v1"
"eventrigger.com/operator/pkg/target"
"eventrigger.com/operator/pkg/tri... |
// Copyright 2021 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... |
package vnet
import (
"encoding/xml"
"fmt"
"github.com/megamsys/opennebula-go/api"
"strconv"
"strings"
)
type VNETemplate struct {
Template *Vnet `xml:"TEMPLATE"`
T *api.Rpc
}
type VNetPool struct {
Vnets []*Vnet `xml:"VNET"`
T *api.Rpc
}
type Vnet struct {
Id int `json:"id" xm... |
// You can edit this code!
// Click here and start typing.
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"time"
"github.com/leegggg/GBT19056-2020Gen/gbt19056"
)
func jsonToBinary() {
// Open our jsonFile
jsonFile, err := os.Open("data/example.json... |
// DO NOT EDIT THIS FILE. GENERATED BY svdxgen.
// +build stm32l4x6
// Package quadspi provides access to the registers of the QUADSPI peripheral.
//
// Instances:
// QUADSPI QUADSPI_BASE - QUADSPI QuadSPI interface
// Registers:
// 0x000 32 CR control register
// 0x004 32 DCR device configuration reg... |
package main
import (
"reflect"
"fmt"
)
type ExecutionServiceServer interface {
Create(string, string) (string, error)
Start(string, string) (string, error)
Update(string, string) (string, error)
Pause(string, string) (string, error)
Resume(string, string) (string, error)
Delete(string, string) (... |
package ptr
import (
"errors"
"fmt"
"reflect"
"strconv"
"strings"
)
var (
prefixErr = errors.New("a JSON Pointer is prefixed by a '/' (%x2F) character")
)
// New creates a JSON Pointer based on the given string.
//
// A JSON Pointer can be represented in a JSON string value. All
// instances of quotation mark ... |
package committed_test
import (
"context"
"testing"
"github.com/treeverse/lakefs/pkg/catalog/testutils"
"github.com/treeverse/lakefs/pkg/graveler"
"github.com/stretchr/testify/require"
"github.com/golang/mock/gomock"
"github.com/treeverse/lakefs/pkg/graveler/committed"
"github.com/treeverse/lakefs/pkg/grave... |
package main
//
// Dependencies
//
import (
"encoding/json"
"fmt"
"os"
"strings"
"strconv"
"regexp"
"log"
"github.com/scaleway/go-scaleway"
"github.com/scaleway/go-scaleway/logger"
"github.com/scaleway/go-scaleway/types"
)
//
// Global variables
//
var (
scwApi api.Scaleway... |
package peering
import (
"fmt"
"net"
"time"
"github.com/loveandpeople-DAG/goHive/iputils"
"github.com/loveandpeople-DAG/goHive/network"
"github.com/pkg/errors"
"github.com/loveandpeople-DAG/goBee/pkg/config"
"github.com/loveandpeople-DAG/goBee/pkg/peering/peer"
"github.com/loveandpeople-DAG/goBee/pkg/protoc... |
package readline
import "golang.org/x/text/width"
// updateHelpers is a key part of the whole refresh process:
// it should coordinate reprinting the input line, any Infos and completions
// and manage to get back to the current (computed) cursor coordinates
func (rl *Instance) updateHelpers() {
// Load all Infos &... |
package main
/*
Index: (((A & 0x88) >> 1) | ((VAL & 0x88) >> 2) | ((RESULT) & 0x88) >> 3)) & 0x7
Depending on the operation, RESULT may be either A+VAL or A+VAL+C
This is based on the implementation of i8080-core
A|VAL|RES|INDEX| Meaning
:--|:--|:--|:--|:--
0 | 0| 0| 0| A+Val < 8 (so no carry)
0 ... |
package app
import (
"flag"
"fmt"
"os"
"strings"
"time"
"github.com/TIBCOSoftware/flogo-cli/cli"
"github.com/nareix/curl"
"github.com/olekukonko/tablewriter"
toml "github.com/pelletier/go-toml"
)
var optSearch = &cli.OptionInfo{
Name: "search",
UsageLine: "search [-type type][-string search]",
Short... |
/*
Entry point class for the CLIv2 version.
*/
package cliv2
import (
_ "embed"
"fmt"
"log"
"os"
"os/exec"
"strings"
"github.com/snyk/cli/cliv2/internal/embedded"
"github.com/snyk/cli/cliv2/internal/embedded/cliv1"
"github.com/snyk/cli/cliv2/internal/utils"
)
type Handler int
type CLI struct {
DebugLogger... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"time"
)
//const (
//livescoreapi = "https://api.fifa.com/api/v1/live/football/2000000078/2000011052/2000230810/300434989"
// )
type LivescoreData struct {
Stadium struct {
IDStadium string `json:"IdStadium"`
Name []struct {
Locale string ... |
package terminal
import (
"fmt"
"sort"
"strconv"
"time"
"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/eliostvs/lembrol/internal/flashcard"
)
... |
package catfile
import (
"bufio"
"context"
"fmt"
"io"
"os"
"sync/atomic"
"github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
"gitlab.com/gitlab-org/gitaly/v14/internal/command"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
)
// ObjectReader is a reader for Git objects... |
// Copyright 2021 <NAME>. All rights reserved. Use of this
// source code is governed by an Apache License 2.0 that can be found
// in the LICENSE file.
package httppredicate
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"github.com/jsautret/genapid/ctx"... |
package main
import (
"archive/zip"
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
"strings"
"time"
)
// MaxMind - GeoBase compatible generator for geolite.maxmind.com
type MaxMind struct {
archive []*zip.File
OutputDir string
ErrorsChan chan Error
maxMindConfig
}
func (maxm... |
package cli
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"time"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/allinbits/cosmos-cash/v3/x/di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.