text stringlengths 3.08k 10.4k |
|---|
package cli
import (
"context"
"fmt"
"strings"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/version"
authtx "github.com/cosmos/cosmo... |
// Copyright 2022 Douyu
//
// 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 2022.
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 un... |
package amorph
// Copyright 2021 <NAME> and Scalability
// Labs LLC. All rights reserved. Use of this source
// code is governed by a BSD-style
// license that can be found in the LICENSE file.
import (
"sort"
)
// A WalkPos contains a Position within an Amorph.
type WalkPos interface {
Key() interface{}
Value() ... |
package main
import (
"context"
"flag"
"fmt"
"os"
"sync"
"github.com/thijzert/chesseract/chesseract"
"github.com/thijzert/chesseract/chesseract/client"
"github.com/thijzert/chesseract/chesseract/client/httpclient"
"github.com/thijzert/chesseract/chesseract/game"
)
var consoleMutex sync.Mutex
func consoleGa... |
package zcl
func bytesMarshalZcl(ln int, o []byte) ([]byte, error) {
if len(o) < ln {
return nil, ErrNotEnoughData
}
if len(o) > ln {
return nil, ErrTooMuchData
}
return o, nil
}
func bytesUnmarshalZcl(ln int, o []byte) ([]byte, []byte, error) {
if len(o) < ln {
return make([]byte, ln), nil, ErrNotEnoughD... |
/*
Copyright 2016 The Fission 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 memstore
import (
"database/sql"
"github.com/go-gorp/gorp"
"goslib/gen_server"
"goslib/logger"
"sync"
"time"
)
const PERSISTER_SERVER = "__PERSISTER_SERVER__"
var queueSummary = &sync.Map{}
type SchemaPersistance struct {
Uuid string `db:"uuid"`
Version int `db:"version"`
}
type PersistTask s... |
//go:generate protoc -I . ./state_service.proto --go_out=plugins=grpc:.
package escrow
import (
"bytes"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/singnet/snet-daemon/authutils"
"github.com/singnet/snet-daemon/blockchain"
log "github.com/... |
package plant_life_game
import (
"github.com/TrashPony/Veliri/src/mechanics/gameObjects/coordinate"
"github.com/TrashPony/Veliri/src/mechanics/gameObjects/map"
"github.com/TrashPony/Veliri/src/mechanics/globalGame/game_math"
"math/rand"
"time"
)
type lifeObject struct {
life bool
futureLife ... |
// Copyright (c) 2017 Tigera, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
package environ
import (
"fmt"
"strings"
"github.com/zbiljic/sicc/store"
)
// Environ is a slice of strings representing the environment,
// in the form "key=value".
type Environ []string
// Unset an environment variable by key.
func (e *Environ) Unset(key string) {
for i := range *e {
if strings.HasPrefix((*... |
/*
* Copyright 2019, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package v1beta1
import (
enmassev1beta1 "github.com/enmasseproject/enmasse/pkg/apis/enmasse/v1beta1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
m... |
// Copyright 2017 clair 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 i... |
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
package main
import (
"flag"
"fmt"
"github.com/fogleman/gg" // 需要安装这个包
"github.com/golang/freetype/truetype"
"io/ioutil"
"log"
"math"
)
var (
dpi = flag.Float64("dpi", 72, "screen resolution in Dots Per Inch")
fontfile = flag.String("fontfile", "./Alibaba-PuHuiTi-Regular.ttf", "filename of the ttf font"... |
// Copyright 2020 <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 writing, sof... |
/* Copyright (c) 2016-2017 - CloudPerceptions, LLC. 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... |
package substrate
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: LGPL-3.0-only
/*
The substrate package contains the logic for interacting with substrate chains.
The current supported transfer types are Fungible, Nonfungible, and generic.
There are 3 major components: the connection, the listener, an... |
package backend
import (
"sync"
"testing"
"time"
"github.com/square/beancounter/deriver"
"github.com/square/beancounter/utils"
"github.com/stretchr/testify/assert"
)
func TestNonExistantFixtureFile(t *testing.T) {
b, err := NewFixtureBackend("testdata/badpath")
assert.Nil(t, b)
assert.Error(t, err)
}
func ... |
// Copyright 2017 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package report
import (
"bufio"
"bytes"
"fmt"
"path/filepath"
"regexp"
"strconv"
"strings"
"github.com/google/syzkaller/pkg/symbolizer"
"github.... |
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation and Dapr Contributors.
// Licensed under the MIT License.
// ------------------------------------------------------------
package s3
import (
"bytes"
"encoding/json"
"fmt"
"net/url"
"github.com/aws/aws-sdk-go/... |
// Copyright (c) 2017 Uber Technologies, 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 a... |
//
// (C) Copyright 2018-2022 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
package main
import (
"bytes"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"github.com/daos-stack/daos/src/control/common/test"
. "github.com/daos-stack/daos/src/control/common... |
package builder
import (
"context"
"time"
"github.com/reearth/reearth-backend/pkg/property"
"github.com/reearth/reearth-backend/pkg/scene"
"github.com/reearth/reearth-backend/pkg/tag"
)
type sceneJSON struct {
SchemaVersion int `json:"schemaVersion"`
ID string ... |
package config_test
import (
"testing"
"github.com/go-chassis/go-chassis/core/config"
"github.com/go-chassis/go-chassis/core/config/model"
"github.com/go-chassis/go-chassis/core/loadbalancer"
"github.com/go-chassis/go-chassis/pkg/util/fileutil"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
"io"
"os... |
/*
Copyright © 2021 <NAME> <EMAIL>
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... |
// Copyright 2019 PingCAP, 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... |
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// 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 require... |
package tips
import (
"errors"
"context"
"io"
"log"
"net/http"
"os"
"runtime"
"strings"
"time"
"golang.org/x/sync/semaphore"
)
func producer(ctx context.Context, strings []string) (<-chan string, error) {
outChannel := make(chan string)
go func() {
defer close(outChannel)
for _, s := range strings ... |
/*
* Copyright (c) 2015-2018 Nexenta Systems, Inc.
*
* This file is part of EdgeFS Project
* (see https://github.com/Nexenta/edgefs).
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional informat... |
package main
import (
"flag"
"fmt"
"log"
_ "net/http/pprof"
"os"
"os/signal"
"path"
"path/filepath"
"strconv"
"syscall"
"time"
)
import (
"github.com/AlexStocks/goext/log"
"github.com/AlexStocks/goext/net"
"github.com/AlexStocks/goext/time"
)
const (
APP_CONF_FILE string = "APP_CONF_FILE"
APP_LOG... |
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
package hypervisors
import (
"bufio"
"fmt"
"net/http"
"sort"
"github.com/Symantec/Dominator/lib/constants"
"github.com/Symantec/Dominator/lib/json"
"github.com/Symantec/Dominator/lib/url"
proto "github.com/Symantec/Dominator/proto/fleetmanager"
)
const (
showOK = iota
showConnected
showAll
showOff
)
typ... |
package clusterinstallation
import (
"context"
"fmt"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
mattermostv1alpha1 "github.com/mattermost/mattermost-operator/pkg/apis/mattermost/v1alpha1"
mattermostMinio "github.com/matte... |
package types
import (
chain "github.com/eoscanada/eos-go"
)
type switcher2EOSIO struct {
}
func (s switcher2EOSIO) Type() ClientType {
return EOSIO
}
func (s switcher2EOSIO) NameFromCommon(n string) interface{} {
return chain.Name(n)
}
func (s switcher2EOSIO) Checksum256FromCommon(c Checksum256) interface{} {
... |
// Copyright 2021 The Chromium 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 handlers
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
"google.golang.org/genproto/protobuf/field_mask"
"go.ch... |
package tracker
import (
"bytes"
"encoding/json"
"github.com/leighmacdonald/mika/config"
"github.com/leighmacdonald/mika/store"
log "github.com/sirupsen/logrus"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
)
var (
testRoles []*store.Role
testUsers []*store.User
testTorrents []*store.T... |
// Package report reports statistics about TSM files.
package report
import (
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"text/tabwriter"
"time"
"github.com/adinesh10/influxdb/models"
"github.com/adinesh10/influxdb/tsdb/engine/tsm1"
"github.com/retailnext/hllpp"
)
// Co... |
//
// Copyright 2019 Insolar Technologies GmbH
//
// 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... |
package pcap
import (
"encoding/binary"
"fmt"
"io"
"time"
)
// FileHeader is the parsed header of a pcap file.
// http://wiki.wireshark.org/Development/LibpcapFileFormat
type FileHeader struct {
MagicNumber uint32
VersionMajor uint16
VersionMinor uint16
TimeZone int32
SigFigs uint32
SnapLen u... |
//
// Modified BSD 3-Clause Clear License
//
// Copyright (c) 2019 Insolar Technologies GmbH
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted (subject to the limitations in the disclaimer below) provided that
// the following conditions a... |
package output
import (
"context"
"fmt"
"log"
"math/rand"
"time"
"github.com/olivere/elastic"
"github.com/zartbot/goflow/datarecord"
)
//NewElasticClient is a construct function for Client
func NewElasticClient(url string) (*elastic.Client, error) {
var (
err error
elasticClient *elastic.Client... |
// Code generated by go-swagger; DO NOT EDIT.
package search
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/g... |
/*
Copyright 2019 The Vitess 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 cmn
import (
"flag"
"fmt"
"math/rand"
"net"
"os"
"os/signal"
"syscall"
"time"
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/crypto"
"github.com/scionproto/scion/go/lib/overlay"
"github.com/scionproto/scion/go/lib/sciond"
"github.com/scionproto/scion/go/lib/scmp"
... |
// Package feed describes RSS format and provides parsing
package feed
// based on http://siongui.github.io/2015/03/03/go-parse-web-feed-rss-atom/
import (
"bufio"
"bytes"
"encoding/xml"
"fmt"
"html/template"
"io"
"net/http"
"strings"
"time"
log "github.com/go-pkgz/lgr"
"github.com/pkg/errors"
)
// Rss2 ... |
/*
Copyright 2017 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
// Copyright (c) 2020-2021 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// Package dcrdata provides a plugin for querying the dcrdata block explorer.
package dcrdata
const (
// PluginID is the unique identifier for this plugin.
PluginID = "... |
package main
import (
"context"
"database/sql"
"flag"
"fmt"
"log"
"net/http"
"time"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
"github.com/rubenv/sql-migrate"
"golang.org/x/crypto/bcrypt"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
pb "github.com/tehwalris/coffee-random/pb"
"... |
/*
Copyright 2018 BlackRock, 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, software
di... |
//
// Copyright 2018 <NAME> -- All rights reserved.
// https://github.com/MalinYamato
//
// MIT License
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the abov... |
/*
Package env loads environment variables into Go types, with fallback values.
Installation
Just go get the package:
go get -u github.com/TV4/env
Usage
A small usage example
package main
import (
"fmt"
"net/url"
"github.com/TV4/env"
)
func main() {
fmt.Println(
e... |
package edn
import "fmt"
import "strings"
import "unicode"
import re "regexp"
// A lot of this is based on: http://cuddle.googlecode.com/hg/talk/lex.html
type tokenType int
const (
tEOF tokenType = 1 << iota
tOpenList
tCloseList
tOpenMap
tCloseMapOrSet
tOpenVector
tCloseVector
tQuoteNextForm
tOpenSet
tStr... |
package commands
import (
"context"
"fmt"
"os"
"os/signal"
"sync/atomic"
"syscall"
"time"
"github.com/sirupsen/logrus"
"github.com/jackc/pglogrepl"
"github.com/jackc/pgproto3/v2"
"github.com/go-gulfstream/connector/internal/postgres"
"github.com/jackc/pgconn"
"github.com/Shopify/sarama"
"github.com... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package mocks
import "time"
// MetricsProvider implements a mock ActivityPub metrics provider.
type MetricsProvider struct{}
// OutboxPostTime records the time it takes to post a message to the outbox.
func (m *Met... |
// PROJECT: GoGUI
//
// MAINTAINED BY: hkdb <<EMAIL>>
//
// SPONSORED BY: 3DF OSI - https://osi.3df.io
//
// This application is maintained by volunteers and in no way
// do the maintainers make any guarantees. Use at your own risk.
package main
import (
"fmt"
"log"
"net"
"net/http"
"os/exec"
"strconv"
"strings... |
// Copyright 2018 Tetrate, 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 applicab... |
// Copyright (c) <NAME> 2017
// Copyright (c) 2018 OpenFaaS Author(s)
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package metrics
import (
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"path"
"time"
"log"
"github.com/openfaas/faas-pr... |
package capacity
import (
"fmt"
"math"
"sort"
"github.com/golang/glog"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/tools/cache"
shipper "github.com/bookingcom... |
package agent
import (
"sort"
"time"
"github.com/Sirupsen/logrus"
"github.com/arlert/ymir/model"
"github.com/arlert/ymir/task"
_ "github.com/arlert/ymir/taskset"
"github.com/arlert/ymir/utils"
utilhttp "github.com/arlert/ymir/utils/http"
)
// TaskRunner ...
type TaskRunner struct {
config *model... |
// Copyright 2014-Present Couchbase, Inc.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
// in that file, in accordance with the Business Source License, use of this
// software will be governed by the Apach... |
package main
import (
"debug/pe"
"encoding/binary"
"fmt"
"io"
"log"
"os"
)
func main() {
f, err := os.Open("Telegram.exe") // Modify for binary or change to accept args
check(err)
pefile, err := pe.NewFile(f)
check(err)
defer f.Close()
defer pefile.Close()
dosHeader := make([]byte, 96... |
package stagedperiodic
import (
"time"
"fortio.org/fortio/log"
"fortio.org/fortio/stats"
heypstats "github.com/uluyol/heyp-agents/go/stats"
)
type clockInterface interface {
Now() time.Time
Sleep(time.Duration)
}
type clock struct {
stub *clockInterface
}
func (c clock) Now() time.Time {
if c.stub != nil {... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package machinelearning
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/machinelearning/types"
smithy "github.com/awslabs/smithy-go"
"github.com/a... |
/*******************************************************************************
* Copyright © 2017-2018 VMware, 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 a... |
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kafka
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
// Request body for CreateConfiguration.
// Please also see https://d... |
// Copyright (c) 2017 <NAME> <<EMAIL>>
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package xlsx
import (
"github.com/miscoler/xlsx/format/styles"
"github.com/miscoler/xlsx/types"
)
//Range is a object that provides some functionality for cells inside of r... |
package main
import "fmt"
type foo struct {
A int
B string
}
//make 只能创建 slice,map 和 channel;分配了一个有初始值(非零)的T类型(我这里打印的为空,个人理解为空值)返回值 当slice cap无法满足需要,则在初始大小cap(即第三个参数,这里为6),成倍增长
//new 分配了零值填充的T类型的内存空间,并返回其地址(指针) 当slice cap无法满足需要,则以16为基数,成倍增长
func main() {
a := make([]int, 2, 6)
b := new([]int)
c := new(foo)
fmt... |
package log
import (
"io"
"os"
"time"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
)
type Level = zapcore.Level
const (
InfoLevel Level = zap.InfoLevel // 0, default level
WarnLevel Level = zap.WarnLevel // 1
ErrorLevel Level = zap.ErrorLevel // 2
DPanicLevel Le... |
package main
import (
"fmt"
"path/filepath"
"strings"
"testing"
awsSdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
"github.com/gruntwork-io/terratest/modules/aws"
"github.com/gruntwork-io/terratest/modules/random"
"github.com/gruntwork-io/... |
/*
* [2013] - [2018] Avi Networks Incorporated
* 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 ... |
package api_server
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"github.com/Kong/kuma/pkg/config/mode"
"github.com/Kong/kuma/pkg/clusters/poller"
"github.com/emicklei/go-restful"
"github.com/pkg/errors"
"github.com/Kong/kuma/pkg/api-server/definitions"
"github.com/Kong/kuma/pkg/conf... |
package fxpakpro
import (
"fmt"
"go.bug.st/serial"
"go.bug.st/serial/enumerator"
"log"
"net/url"
"runtime"
"sni/protos/sni"
"sni/snes"
"sni/util"
"sni/util/env"
"strconv"
)
const (
driverName = "fxpakpro"
)
var driver *Driver
var (
baudRates = []int{
921600, // first rate that works on Windows
4608... |
package tenantfetchersvc
import (
"context"
"fmt"
"github.com/kyma-incubator/compass/components/director/pkg/resource"
labelutils "github.com/kyma-incubator/compass/components/director/internal/domain/label"
"github.com/kyma-incubator/compass/components/director/internal/domain/tenant"
"github.com/kyma-incubat... |
package goliday
import (
"encoding/json"
"io/ioutil"
"log"
"strconv"
"time"
"github.com/JayceChant/goliday/dateutil"
)
const (
customDir = "custom/"
festivalConfig = customDir + "festival.json"
)
type (
// DateToDayType ...
DateToDayType map[string]dateutil.DayType
yearCounter map[string]int
co... |
// Copyright 2016 The Cockroach 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 ag... |
package util
import (
goctx "context"
"fmt"
"testing"
"time"
"github.com/blang/semver"
monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
framework "github.com/operator-framework/operator-sdk/pkg/test"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/... |
package internal
import (
"context"
"encoding/json"
"fmt"
"github.com/dgraph-io/dgo/v200"
"github.com/dgraph-io/dgo/v200/protos/api"
"github.com/mitchellh/mapstructure"
"io/ioutil"
"log"
"path/filepath"
"strings"
)
const implementationDirName = "implementation"
func MustPopulateImplementations(cli *dgo.Dgr... |
// BSD 3-Clause License
//
// Copyright (c) 2020, Kingsgroup
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, thi... |
package kcp
import (
"context"
"crypto/cipher"
"crypto/tls"
"io"
"sync"
"time"
"github.com/whatedcgveg/v2ray-core/app/log"
"github.com/whatedcgveg/v2ray-core/common"
"github.com/whatedcgveg/v2ray-core/common/buf"
"github.com/whatedcgveg/v2ray-core/common/net"
"github.com/whatedcgveg/v2ray-cor... |
// Copyright © 2019 <NAME> <<EMAIL>>
//
// 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 nuts
import (
"context"
"encoding/hex"
"fmt"
"net"
"time"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/schmurfy/sniffit/index_encoder"
"github.com/schmurfy/sniffit/models"
"github.com/xujiajun/nutsdb"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/label"
"go.... |
package main
import (
"fmt"
"log"
"net/http"
"path/filepath"
"strings"
"golang.org/x/net/html"
"github.com/bmaupin/go-epub"
"github.com/bmaupin/go-htmlutil"
)
const (
effectiveGoCoverImg = "assets/covers/effective-go.png"
effectiveGoFilename = "Effective Go.epub"
effectiveGoSectionTag = "h2"... |
// MIT License
//
// Copyright (c) 2021 <NAME>
//
// 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, merg... |
package fax
// Test the decoding.
import (
"bytes"
"fmt"
"image"
"io"
"strings"
"testing"
)
type goldenDecode struct {
base2 string
pixels string
}
func TestDecode(t *testing.T) {
var tests = [...]goldenDecode{
{verticalCodes[-1] + verticalCodes[0], "wwb"},
{passCode + verticalCodes[-2] + passCode, "w... |
/*
Copyright 2016 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 gatewayws
import (
"runtime"
"sync/atomic"
"time"
"cdr.dev/slog"
"golang.org/x/xerrors"
"nhooyr.io/websocket"
)
type Op struct {
Op int `json:"op"`
D interface{} `json:"d"`
}
func (s *Session) writer() {
var (
ctx = s.ctx
wch = s.wch
prioch = s.prioch
isPrio bool
)
for {
... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package opsgenie
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages existing heartbeat within Opsgenie.
//
... |
package music
import (
"context"
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"net/url"
"strconv"
"strings"
"time"
ytdl "github.com/kkdai/youtube/v2"
"google.golang.org/api/option"
"google.golang.org/api/youtube/v3"
)
func getDuration(stringRawFull, stringRawOffset string) (stringRemain string) {
va... |
// Copyright ©2013 The bíogo 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 norm_test
import (
"fmt"
"math"
"math/rand"
"os"
"testing"
"github.com/biogo/rnaseq/norm"
)
func random(n int, m, s float64) []float64 {
v... |
// Copyright 2015 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.
// Incomplete std lib sources on Android.
//go:build !android
// +build !android
package importgraph_test
import (
"fmt"
"go/build"
"os"
"sort"
"strings... |
// 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... |
/*
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 under the License... |
package models
import (
"errors"
"fmt"
"reflect"
"strconv"
"strings"
"github.com/astaxie/beego/orm"
)
type Game struct {
Id int64 `orm:"auto"`
Type string `orm:"type(longtext)"`
Name string `orm:"type(longtext)"`
SteamAppid int
RequiredAge i... |
package main
/*
This file contains code to deal with parameters/configuration, including:
- command line arguments
- ini file
*/
import (
"errors"
"flag"
"fmt"
"log"
"os"
"os/user"
"path/filepath"
"strings"
)
type Params struct {
ConfigPath string // path to a config file
ApiKey string
Api... |
package rgba
import (
"encoding/binary"
"fmt"
"image/color"
)
// NewRGBPrecacheIndexer creates an indexer which can build slightly inaccurate
// pre-computed mappings of 5-bit RGB values to their nearest neighbour in the provided
// palette, discarding alpha.
//
// It is at least an order of magnitude faster than ... |
package main
import (
"bufio"
"log"
"os"
"regexp"
"strings"
"sync"
)
type FileResult struct {
language string
filename string
Lines int
CodeLines int
Comments int
Keywords int
}
type LanguageResult struct {
TotalFiles int
TotalResults FileResult
Files SingleFileResult
}
type Analysis... |
package files
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
"sync"
"github.com/harrybrwn/go-canvas"
"github.com/pkg/errors"
)
// Download will download a canvas file and write it to
// a file named by filename if it does not already exist.
func Download(
file io.WriterTo,
filename ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.