text stringlengths 3.08k 10.4k |
|---|
/*
MIT License
Copyright (c) 2017
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, distribute, su... |
package sim
import (
"encoding/json"
"math"
"testing"
"time"
"github.com/bitcoinfees/feesim/testutil"
)
func TestMultiTxSource(t *testing.T) {
const (
N = 100000 // 100000 txs
)
T := time.Duration(600) * time.Second // 10 min interblock times
f := []FeeRate{20000, 10000, 5000}
s := []TxSize{250, 500, 100... |
package p2pcommon
import (
"time"
"github.com/aergoio/aergo-actor/actor"
"github.com/aergoio/aergo/message"
"github.com/aergoio/aergo/types"
"github.com/golang/protobuf/proto"
crypto "github.com/libp2p/go-libp2p-crypto"
host "github.com/libp2p/go-libp2p-host"
inet "github.com/libp2p/go-libp2p-net"
peer "gith... |
package agollo
import (
"context"
"encoding/json"
"net/http"
"strings"
)
// Client for apollo
type Client struct {
conf *Conf
updateChan chan *ChangeEvent
caches *namespaceCache
releaseKeyRepo *cache
longPoller poller
requester requester
ctx context.Context
cancel context.CancelFunc
}
// ... |
// Copyright 2020 Authors of Hubble
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
package main
import (
"errors"
"fmt"
"io/ioutil"
"github.com/stephane-martin/vssh/commands"
"github.com/stephane-martin/vssh/widgets"
"github.com/gabriel-vasile/mimetype"
"github.com/urfave/cli"
)
// App returns the vssh application object.
func App() *cli.App {
app := cli.NewApp()
app.Name = "vssh"
app.U... |
package cluster
import (
"encoding/json"
"math"
"strings"
"time"
)
//TaskMesosState 描述Mesos中task的状态类型
type TaskMesosState int
const (
TASKMESOS_STAGING TaskMesosState = 1
TASKMESOS_STARTING TaskMesosState = 2
TASKMESOS_RUNNING TaskMesosState = 3
TASKMESOS_FINISHED TaskMesosState = 4
TASKMESOS_KILLING Tas... |
package p2pforwarder
import (
"context"
"io/ioutil"
"os"
"path/filepath"
"sync"
"time"
"github.com/libp2p/go-libp2p"
connmgr "github.com/libp2p/go-libp2p-connmgr"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
dht "github.com/libp2... |
package route
import (
"errors"
"fmt"
"github.com/blang/semver"
"github.com/cloudfoundry/cli/cf"
"github.com/cloudfoundry/cli/cf/api"
"github.com/cloudfoundry/cli/cf/commandregistry"
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
. "github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli... |
/*
Copyright 2022 CodeNotary, 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 i... |
// 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 2020-present Datadog, Inc.
package traps
import (
"net"
"strconv"
"strings"
"testing"
"time"
... |
package renter
// skyfilefanout.go implements the encoding and decoding of skyfile fanouts. A
// fanout is a description of all of the Merkle roots in a file, organized by
// chunk. Each chunk has N pieces, and each piece has a Merkle root which is a
// 32 byte hash.
//
// The fanout is encoded such that the first 32 ... |
package cain
import (
"bytes"
"crypto/sha256"
"fmt"
"log"
"path/filepath"
"strings"
"github.com/nuvo/cain/pkg/utils"
"github.com/nuvo/skbn/pkg/skbn"
)
// BackupKeyspaceSchema gets the schema of the keyspace and backs it up
func BackupKeyspaceSchema(iK8sClient, iDstClient interface{}, namespace, pod, containe... |
package main
import (
"fmt"
"encoding/json"
"os"
"time"
"sort"
"strconv"
)
type JobParser struct {
Jobs []*JobInfo
inputfile *os.File
outputfile *os.File
//num int
}
func NewJobParser(inputfilename,outputfilename string)*JobParser{
jp := new(JobParser)
jp.Jobs = make([]*JobInfo,0,0)
inputfile,err := os.... |
package config
import (
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"reflect"
"strconv"
"time"
)
var (
// ErrOutOfRange number out of range
ErrOutOfRange = errors.New("number: out of range")
// ErrWrongFormat time format is not correct
ErrWrongFormat = er... |
// Package cluster provides local access to cluster-level metadata
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
*/
package cluster
import (
"context"
"io"
"net/http"
"net/url"
"sync"
"time"
"github.com/NVIDIA/aistore/cmn"
"github.com/NVIDIA/aistore/cmn/cos"
"github.com/NVIDIA/aist... |
package logutil
import (
"bytes"
"encoding/json"
"fmt"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/rifflock/lfshook"
"github.com/sirupsen/logrus"
"github.com/wuchunfu/IpProxyPool/middleware/config"
"github.com/wuchunfu/IpProxyPool/util/fileutil"
"io"
"os"
"path"
"path/filepath"
"runtim... |
package allocation
import (
"bytes"
"fmt"
"github.com/akaspin/soil/manifest"
"github.com/mitchellh/hashstructure"
"strings"
)
const (
podUnitTemplate = `
[Unit]
Description=${pod.name}
Before=${pod.units}
[Service]
${system.pod_exec}
[Install]
WantedBy=${pod.target}
`
dirSystemDLocal = "/etc/systemd/system"
... |
/*
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... |
/*
Copyright 2021.
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... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package starter
import (
"fmt"
"io"
"io/ioutil"
"log"
"net"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"syscall"
"testing"
"time"
)
var echoServerTxt = `package main
import (
"fmt"
"io"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/lestrrat-go/server-starter/listener"
)
func m... |
package main_test
import (
"bytes"
"encoding/json"
"os"
"path/filepath"
"regexp"
"testing"
"github.com/stretchr/testify/require"
main "github.com/infracost/infracost/cmd/infracost"
"github.com/infracost/infracost/internal/config"
"github.com/infracost/infracost/internal/testutil"
)
var (
timestampRegex ... |
/*
* Minio Cloud Storage, (C) 2019-2020 Minio, 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 applicab... |
package kafka
import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/Shopify/sarama"
"github.com/xitonix/trubka/internal"
)
const (
allPartitions int32 = -1
)
// OffsetMode represents the offset mode for a checkpoint.
type OffsetMode int8
const (
// UndefinedOffsetMode the user has not requested for any ... |
//go:build !providerless
// +build !providerless
/*
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 re... |
// Copyright 2018 <NAME>. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package storage // import "miniflux.app/storage"
import (
"database/sql"
"fmt"
"strings"
"time"
"miniflux.app/model"
"miniflux.app/timer"
)
// EntryPaginati... |
// Copyright 2011-2017 <NAME>.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in t... |
// Copyright 2020 Red Hat, 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... |
package gadget
import (
"bufio"
"errors"
"fmt"
"github.com/ice1n36/inspector-gadget/utils"
"github.com/spf13/afero"
"os"
"regexp"
"strconv"
"strings"
)
var (
_libSearch = "lib/.*\\.so"
_arm64Seach = "arm64-v8a"
_fridaGadgetLibName = "libfridagadget.so"
)
// Injector is the interface for ... |
// Copyright (c) 2017-2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
/*
Program checkmetrics compares the results from a set of metrics
results, stored in JSON files, against a set of baseline metrics
'expectations', defined in a TOML file.
It returns non zero if any of the TOML metrics are not met.... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
package autorest
import (
"fmt"
"io"
"os"
"path/filepath"
"github.com/Azure/azure-sdk-for-go/tools/generator/autorest/model"
"github.com/Azure/azure-sdk-f... |
// 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.
package colltab
// An Iter incrementally converts chunks of the input text to collation
// elements, while ensuring that the collation elements are in n... |
// 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 not... |
package httpdigest
import (
"bytes"
"fmt"
"strconv"
"strings"
)
type WWWAuth struct {
Realm string
Domain string
Nonce string
Opaque string
Stale string
Algorithm string
Qop string
}
func ParseWWWAuthenticate(entry string) (wwwa *WWWAuth, err error) {
entry = strings.TrimSpace(ent... |
package model
import "time"
type ID int
const IDnil = 0
const (
AppContainer = "app"
ThingContainer = "thing"
DeviceContainer = "dev"
AttributeUpdatedByCmd = 1
AttributeUpdatedByEvt = 2
)
type ThingRegistry struct {
Things []Thing
Locations []Location
}
type AttributeValueContainer... |
package reception
import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/samuel/go-zookeeper/zk"
)
type (
zkClient struct {
conn zkConn
state zk.State
listeners []chan struct{}
mutex sync.Mutex
config *zkConfig
}
zkWatcher struct {
prefix string
name ... |
package engine
import (
"errors"
"fmt"
"mime/multipart"
"net/http"
"net/url"
"time"
"golang.org/x/net/context"
)
type (
// Ctx is the core request-response context passed between any Manage
// handlers, useful for storing & persisting data within a request & response.
Ctx struct {
engine *Engine
group... |
package store
import (
"encoding/json"
"errors"
"fmt"
"github.com/olivere/elastic"
"golang.org/x/net/context"
"google.golang.org/api/gmail/v1"
"log"
"reflect"
"time"
)
type Service struct {
Client *elastic.Client
Ctx context.Context
MailIndex string
LabelsIndex string
}
type Message struc... |
package storage
import (
"fmt"
"github.com/keybase/client/go/chat/globals"
"github.com/keybase/client/go/chat/utils"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/protocol/chat1"
"github.com/keybase/client/go/protocol/gregor1"
"golang.org/x/crypto/nacl/secretbox"
"golang.org/x/net/context... |
package main
import (
"context"
"errors"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time"
_ "time/tzdata"
_ "github.com/breml/rootcerts"
_ "github.com/lib/pq"
"github.com/qdm12/go-template/internal/config"
"github.com/qdm12/go-template/internal/data"
"github.com/qdm12/go-template/internal/health"
"git... |
package command
import (
"context"
"path/filepath"
"testing"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/db"
"github.com/evergreen-ci/evergreen/model"
"github.com/evergreen-ci/evergreen/model/patch"
"github.com/evergreen-ci/evergreen/model/task"
modelutil "github.com/evergreen-ci/e... |
package awsec2
import (
"sync"
"time"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/hashicorp/vault/helper/salt"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
func Factory(conf *logical.BackendConfig) (logical.Backend, error... |
package main
import (
"context"
"crypto/rand"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"time"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
ev "github.com/mchmarny/gcputil/env"
)
const (
googleOAuthURL = "https://www.googleapis.com/oauth2/v2/userinfo?access_token="... |
package core
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"strings"
"github.com/dosco/super-graph/core/internal/psql"
"github.com/dosco/super-graph/core/internal/qcode"
)
type stmt struct {
role *Role
qc *qcode.QCode
md psql.Metadata
sql string
}
func (sg *SuperGraph) compileQuery(cq *cquery, rol... |
// Copyright 2020 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 Adevinta
*/
package push
import (
"context"
"errors"
"fmt"
"sync"
"time"
"github.com/adevinta/vulcan-check-sdk/agent"
"github.com/adevinta/vulcan-check-sdk/config"
"github.com/adevinta/vulcan-check-sdk/helpers"
"github.com/adevinta/vulcan-check-sdk/internal/logging"
"github.com/adevinta/v... |
package diskcache
import (
"container/heap"
"context"
"io/ioutil"
"os"
"path"
"syscall"
"time"
"github.com/go-kit/kit/log/level"
"github.com/google/uuid"
"github.com/karrick/godirwalk"
)
// TODO: factor out common code with readOrCacheIndexToDisk into separate function
func (r *reader) readOrCacheBloom(ctx... |
package drill
import (
"errors"
"fmt"
"io"
"github.com/zeroshade/go-drill/internal/data"
"github.com/zeroshade/go-drill/internal/rpc/proto/exec/shared"
"github.com/zeroshade/go-drill/internal/rpc/proto/exec/user"
)
type DataVector data.DataVector
type NullableDataVector data.NullableDataVector
// A DataHandle... |
// Code generated by go-swagger; DO NOT EDIT.
package cdn
// 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/go-o... |
/*
Copyright (c) 2013 <NAME>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to al... |
package lchain
import (
"bytes"
"github.com/copernet/copernicus/logic/lmempool"
"github.com/copernet/copernicus/model/block"
"github.com/copernet/copernicus/model/blockindex"
"github.com/copernet/copernicus/model/chain"
"github.com/copernet/copernicus/model/tx"
"github.com/copernet/copernicus/persist/disk"
)
/... |
// Copyright (c) 2015 Uber Technologies, Inc.
// 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, ... |
package gohome
import (
"time"
)
const (
NUM_MEASUREMENTS = 11
NUM_TAKEAWAYS = 2
)
// This struct is used to control the time step of the game
// It smooths the time step and locks the frame rate
type FPSLimiter struct {
// The frames per second to which it should lock
MaxFPS int
// The c... |
package geo
import (
"bytes"
"fmt"
"io"
"math"
)
// Surface is the 2d version of path.
type Surface struct {
bound *Bound
Width, Height int
// represents the underlying data, as [x][y]
// where x in [0:Width] and y in [0:Height]
Grid [][]float64 // x,y
}
// NewSurface build and allocates all the me... |
package cluster
import (
"errors"
"log"
"net"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/gallir/smart-relayer/lib"
"github.com/gallir/smart-relayer/redis/radix.improved/cluster"
"github.com/gallir/smart-relayer/redis/radix.improved/pool"
"github.com/gallir/smart-relayer/redis/radix.improved/redis"
... |
package main
import (
"flag"
"fmt"
"log"
"net"
"regexp"
"time"
"github.com/hpcloud/tail"
"github.com/delamonpansie/silencer/config"
"github.com/delamonpansie/silencer/filter"
"github.com/delamonpansie/silencer/set"
)
type blockRequest struct {
ip net.IP
duration time.Duration
}
func worker(blocke... |
// 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 2018-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 ... |
package css
import (
"fmt"
"strings"
)
// StyleGridContainer groups styles for "div" container
type StyleGridContainer struct {
AutoFlow string `json:"auto_flow,omitempty"` // column | row | dense | dense column | dense row; there is no row-reverse as in CSS flex
AutoColumns string `json:"auto_columns,omitempty... |
/*
* Flow CLI
*
* Copyright 2019-2021 <NAME>, 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 applicabl... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"opencensus/core/ent/place"
"opencensus/core/ent/region"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// RegionCreate is the builder for creating a Region entity.
type RegionCreate struct {
config
mut... |
// Copyright (c) 2017 <NAME>. All rights reserved.
// Use of this source code is governed by the MIT License
// that can be found in the LICENSE file.
package rpc_test
import (
"errors"
"io"
"net/http"
"net/http/httptest"
"reflect"
"strings"
"testing"
"github.com/rvflash/eve/rpc"
)
var errNoTransport = erro... |
package server
import (
"fmt"
"net"
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"
"github.com/ahmetozer/dynamic-fou/share"
"go.uber.org/zap"
)
var (
configList []ClientConfig
CurrentClientList map[string]CurrentClient
CurrentClientIdList map[string]int
fouPortInt in... |
// *** 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 ec2
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to get the ID of an Amazon EC2 Instance for use in oth... |
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
package barneshut
import (
"github.com/thomaspeugeot/tkv/quadtree"
)
// relative to a body of interest, the storage for a neighbour with its distance
// nota : this is used to measure the stirring of the bodies along the simulation
type Neighbour struct {
n *quadtree.Body // rank in the []quadtree.Body
Dist... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sagemaker
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type CreateFlowDefinitionInput struct {
_ struct{} `type:"structure"`
// The name of your flow definition.
//
... |
// Copyright 2016 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package deepstream
import (
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
"testing"
"time"
docker "github.com/fsouza/go-dockerclient"
)
// server is a deepstr... |
package ver
import (
"testing"
"time"
)
func TestParse(t *testing.T) {
table := map[string]Version{
"0.0.0": Version{0, 0, 0, 0},
"0.01.0": Version{0, 1, 0, 0},
"2.0.0.1": Version{2, 0, 0, 1},
"3.3.3": Version{3, 3, 3, 0},
"0.0.1": Version{0, 0, 1, 0},
"0.0.0.1": Version{0, 0, 0, 1},
"1.3.3.7"... |
//
// 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 ... |
package logger
import (
"log"
"math/rand"
"net/http"
"net/url"
"strings"
"time"
myhttp "http"
"secret"
"github.com/PuerkitoBio/goquery"
)
var secretInfo *secret.Secret
var err error
var cookie string
// secretStr 输入参数
// 如果为空,则从文件中读取
func Login(loginInfo *secret.Secret) error {
// 检验网站是否正常
resp, err := ... |
// _ _
// __ _____ __ ___ ___ __ _| |_ ___
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
// \ V V / __/ (_| |\ V /| | (_| | || __/
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
//
// Copyright © 2016 - 2021 SeMI Technologies B.V. All rights reserved.
//
// CONTACT: <EMAIL>... |
package main
import (
_ "embed"
"flag"
"fmt"
"log"
"regexp"
"sort"
"strings"
"github.com/alexchao26/advent-of-code-go/util"
)
//go:embed input.txt
var input string
func init() {
// do this in init (not main) so test file has same input
input = strings.TrimRight(input, "\n")
if len(input) == 0 {
panic("... |
package pkg
import (
"fmt"
"go/ast"
"go/token"
)
type MissingLenLinter struct {
emptySliceMaps map[string]*slicePos
emptyMapMaps map[string]*mapPos
Hints []*Hint
}
type slicePos struct {
Pos token.Pos
End token.Pos
InitLenNode *ast.BasicLit
}
type mapPos struct {
Pos tok... |
// Copyright 2014 Team 254. All Rights Reserved.
// Author: <EMAIL> (<NAME>)
package main
import (
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestRefereeDisplay(t *testing.T) {
clearDb()
defer clearDb()
var err error
db, err = OpenDatabase(testDbPath)
assert.... |
package ledgerstate
import (
"math"
"github.com/cockroachdb/errors"
)
// TransactionBalancesValid is an internal utility function that checks if the sum of the balance changes equals to 0.
func TransactionBalancesValid(inputs Outputs, outputs Outputs) (valid bool) {
consumedCoins := make(map[Color]uint64)
for _,... |
package main
import (
"encoding/base64"
"fmt"
"regexp"
"strings"
sdk "gitee.com/openeuler/go-gitee/gitee"
"github.com/opensourceways/community-robot-lib/giteeclient"
"github.com/sirupsen/logrus"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/yaml"
)
const (
msgPRConflicts = "PR conflicts to the ta... |
// 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-present Datadog, Inc.
package quantile
import (
"errors"
"sort"
"github.com/DataDog/sketch... |
package auth
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v2/pkg/config/dynamic"
"github.com/traefik/traefik/v2/pkg/testhelpers"
)
func TestDigestAuthError(t *testin... |
package cpu_test
import (
"errors"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"io/ioutil"
"os"
"mysql-metrics/cpu"
)
type fakeReadSeeker struct {
ReadReturns struct {
Error error
}
SeekReturns struct {
Error error
}
}
func (f *fakeReadSeeker) R... |
package main
import (
"errors"
"fmt"
"koding/db/models"
"koding/db/mongodb/modelhelper"
"sync"
"time"
"gopkg.in/mgo.v2"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/jinzhu/no... |
// The MIT License (MIT)
//
// Copyright (c) 2016, <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, ... |
package nessie
import (
"bytes"
"context"
"errors"
"fmt"
"mime/multipart"
"net/http"
"path/filepath"
"regexp"
"strings"
"testing"
"github.com/rs/xid"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
"github.com/thanhpk/randstr"
"github.com/treeverse/lakefs/pkg/api"
"github.com/treeverse/... |
package kpexec
const (
// Reference - https://github.com/kubernetes/kubectl/blob/v0.20.2/pkg/cmd/cmd.go
bashCompletionFunc = `
# call kubectl get $1,
__kubectl_debug_out()
{
local cmd="$1"
__kpexec_debug "${FUNCNAME[1]}: get completion by ${cmd}"
eval "${cmd} 2>/dev/null"
}
__kubectl_override_flag_list=... |
// Copyright (c) 2018 IoTeX
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the cod... |
package filters
import (
"bytes"
"context"
"fmt"
"io"
"strings"
"gopkg.in/yaml.v3"
"github.com/getkin/kin-openapi/openapi3"
)
type Any = interface{}
type Entry = map[string]Any
type Nothing = struct{}
// ByPath removes all the endpoints that are not specified in the given list of.
//
// It also, removes all... |
package ch
import (
"container/heap"
"fmt"
"time"
)
const DEBUG_PREPROCESSING = false
// Preprocess Computes contraction hierarchies and returns node ordering
func (graph *Graph) Preprocess(pqImportance *importanceHeap) {
extractionOrder := int64(0)
for pqImportance.Len() != 0 {
// Lazy update heuristic:
//... |
package order
/* Representation of player/monster abilities in the game */
import (
"fmt"
"log"
"stabbey/interfaces"
)
/* Map of the base command string 'verbs' to which functions handle them */
var ACTIONS = map[byte] func(partialAction *Action) {
'.' : IdleAction,
'm' : MoveAction,
'p' : P... |
package errors
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"net/http/httptest"
"reflect"
"runtime"
"strconv"
"testing"
)
func TestOptions(t *testing.T) {
got := E(Options(WithOp("Get"), InvalidInput, WithText("stoinks")))
want := E(WithOp("Get"), InvalidInput, WithText("stoinks"))
if... |
package cli
import (
"encoding/json"
"fmt"
"io"
"strings"
"time"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/database"
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/utils"
)
func formatSpeed(speed float64) string {
if speed < 1000 {
return fmt.Sprintf("%.2f Kbit/s", s... |
package expectm
import (
"encoding/json"
"errors"
"fmt"
"reflect"
"strconv"
"time"
"github.com/tidwall/gjson"
mtime "github.com/monstercat/golib/time"
)
// This custom type is so you can't accidentally pass in the wrong
// map to a function that compares two mars
// EG: checkJSON(sentJSON, sentJSON) won't c... |
package frog
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
jeremiahBirthday = nook.Birthday{
Day: 8,
Mont... |
/*
* Copyright (c) 2021 Seagate Technology LLC and/or its Affiliates
*
* 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 req... |
package cmd
import (
"fmt"
"math"
"os"
"github.com/jaypipes/ghw"
"github.com/mvisonneau/automount/pkg/fs"
"github.com/mvisonneau/automount/pkg/lvm"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
const (
label = "automount"
)
// Mount actually formats, then mount a FS
func Mount(ctx *cli.Cont... |
package pubnub
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
"strconv"
"github.com/pubnub/go/v7/pnerr"
)
var emptyPNGetAllUUIDMetadataResponse *PNGetAllUUIDMetadataResponse
const getAllUUIDMetadataPath = "/v2/objects/%s/uuids"
const getAllUUIDMetadataLi... |
// +build !windows
// Copyright 2015 flannel 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 applica... |
// Copyright 2018 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... |
package model
import (
"database/sql"
"time"
"github.com/guregu/null"
"github.com/satori/go.uuid"
)
var (
_ = time.Second
_ = sql.LevelDefault
_ = null.Bool{}
_ = uuid.UUID{}
)
/*
DB Table Details
-------------------------------------
CREATE TABLE `qs_player_events` (
`id` int(11) unsigned NOT NULL AUTO... |
package main
import (
"bytes"
"flag"
"fmt"
"go/ast"
"go/parser"
"go/printer"
"go/token"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/Illyrix/tidb-go-fuzz/fuzz/pkg"
"github.com/Illyrix/tidb-go-fuzz/fuzz/pkg/builder"
"github.com/Illyrix/tidb-go-fuzz/fuzz/pkg/types"
)
var flagIs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.