text stringlengths 3.08k 10.4k |
|---|
package clippan
import (
"context"
"fmt"
"net/url"
"strings"
_ "github.com/go-kivik/couchdb/v4"
"github.com/go-kivik/kivik/v4"
"github.com/mattn/go-shellwords"
"github.com/tidwall/pretty"
)
type Printer interface {
Error(string, ...interface{})
Debug(string, ...interface{})
Print(string, ...interface{})
... |
package shp
import (
"encoding/binary"
"log"
"math"
"os"
"strings"
)
// Reader provides a interface for reading Shapefiles. Calls
// to the Next method will iterate through the objects in the
// Shapefile. After a call to Next the object will be available
// through the Shape method.
type Reader struct {
Geomet... |
package miner
import (
"fmt"
"strings"
h "github.com/sam-the-programmer/bitcoinminer/hash"
)
// CPUMiner is a struct of a CPU coin miner.
type CPUMiner struct {
Difficulty uint // The difficulty for the miner. Defaults to 1.
HashTimes uint // The number of times to hash the value. Defaults to 1.
Workers... |
package vcluster
import (
"bytes"
"fmt"
"text/template"
"get.porter.sh/porter/pkg/exec/builder"
"github.com/Masterminds/semver"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
)
const (
vClusterDockerfileLines string = `RUN curl -L --output vcluster https://github.com/loft-sh/vcluster/releases/download/{{ .C... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"text/template"
"time"
cfauth "github.com/hashicorp/vault-plugin-auth-cf"
"github.com/hashicorp/vault/api"
)
type weatherCurrent struct {
Observations []struct {
StationID string `json:"stationID"`
Ob... |
package model
import (
"fmt"
"net/http"
"os"
"path"
"runtime"
"strconv"
"strings"
"sync"
"time"
"github.com/codegangsta/martini-contrib/render"
"github.com/heartbeatsjp/happo-agent/db"
"github.com/heartbeatsjp/happo-agent/halib"
"github.com/heartbeatsjp/happo-agent/util"
leveldbUtil "github.com/syndtr/g... |
package pulsar
import (
"fmt"
"github.com/araddon/dateparse"
"github.com/bytedance/sonic"
"github.com/elastic/beats/v7/libbeat/beat"
"github.com/elastic/beats/v7/libbeat/common"
"github.com/elastic/beats/v7/libbeat/logp"
"github.com/elastic/beats/v7/libbeat/processors"
"reflect"
"strconv"
"time"
)
func init... |
package model
import (
"fmt"
"strings"
"time"
"git.containerum.net/ch/kube-api/pkg/kubeerrors"
kube_types "github.com/containerum/kube-client/pkg/model"
api_core "k8s.io/api/core/v1"
api_meta "k8s.io/apimachinery/pkg/apis/meta/v1"
api_validation "k8s.io/apimachinery/pkg/util/validation"
)
// EndpointsList -... |
// Copyright 2019 Aporeto 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,... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package codebuild
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type ListSharedReportGroupsInput struct {
_ struct{} `type:"structure"`
// The maximum number of paginated shared repor... |
/*
Copyright 2013 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
/*
Copyright 2019 Pressinfra SRL
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
... |
//////////////////////////////////////////////////////////////////////////
//
// Copyright 2019 Dell, 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/... |
package tor
import (
"bytes"
"errors"
"io/ioutil"
"path/filepath"
"testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
// TestOnionFile tests that the OnionFile implementation of the OnionStore
// interface behaves as expected.
func TestOnionFile(t *testing.T) {
t.Parallel()
... |
package gobar
import (
"encoding/json"
"fmt"
"log"
"reflect"
)
// BarHeader i3 bar header
type barHeader struct {
Version int `json:"version"`
ClickEvents bool `json:"click_events"`
// StopSignal int `json:"stop_signal"`
// ContinueSignal int `json:"cont_signal"`
}
type BarSlotAlign string
const ... |
package main
import (
"fmt"
"image"
"image/color"
"log"
"golang.org/x/mobile/event/lifecycle"
"golang.org/x/mobile/event/paint"
"golang.org/x/mobile/event/mouse"
"golang.org/x/mobile/event/key"
"golang.org/x/mobile/event/size"
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
)
var (
// ... |
package socks5
import (
"bytes"
"errors"
"net"
"github.com/hahahrfool/v2ray_simple/netLayer"
"github.com/hahahrfool/v2ray_simple/utils"
)
//为了安全, 我们不支持socks5作为 proxy.Client;
// 不过为了测试 udp associate 需要我们需要模拟一下socks5请求
//传入 conn必须非nil,否则panic
func Client_EstablishUDPAssociate(conn net.Conn) (port int, err error)... |
package server
import (
centerclient "fgame/fgame/center/client"
coredb "fgame/fgame/core/db"
coreredis "fgame/fgame/core/redis"
_ "fgame/fgame/game/remote/cmd/handler"
"fgame/fgame/pkg/idutil"
"fgame/fgame/pkg/osutils"
"fgame/fgame/trade_server/api"
"fgame/fgame/trade_server/remote"
"fgame/fgame/trade_server... |
package vehicle
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"github.com/mitchellh/hashstructure"
)
// List contains vehicles that were found during parsing.
type List map[uint64]Vehicle
// RegCountry represents a country of registration for a vehicle.
type RegCountry int
// List of allowed regi... |
package engine_test
// Copyright (c) 2018 Bhojpur Consulting Private Limited, India. All rights reserved.
// 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 w... |
package bridgekeeper
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"strconv"
"time"
)
type keeper struct {
ctx context.Context
cancel context.CancelFunc
client Client
retries int
ticker *time.Ticker
delay time.Duration
concurrency ... |
package xml
import (
"encoding/base64"
"encoding/xml"
"fmt"
"io"
"strings"
"time"
)
type xmlTag int
const (
valueTag xmlTag = iota
structTag xmlTag = iota
arrayTag xmlTag = iota
dataTag xmlTag = iota
base64Tag xmlTag = iota
booleanTag xmlTag = iota
date... |
package gobot
import (
"encoding/json"
"errors"
"math/rand"
"time"
)
// MoveRule dictates how moves should be made
type MoveRule uint8
const (
// RequireVote requires players to vote
RequireVote MoveRule = iota
// RequireMove requires players to move
RequireMove
)
// Captures is how many _opponent's_ stones... |
// *** 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 dashboard
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to access information abo... |
package main
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
"image/png"
"log"
"net/http"
"os"
"os/signal"
"regexp"
"strconv"
"sync/atomic"
"time"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/code128"
)
type key int
const (
requestIDKey key = 0
)
var (
listenAddr string
healthy ... |
package dovetail
import (
"testing"
"github.com/stretchr/testify/assert"
"encoding/json"
)
var c = &ConditionalChoice{}
func TestConditionalChoiceString(t *testing.T) {
// return second value if condition is true
v, err := c.Eval(true, "foo", "bar", "opt")
assert.NoError(t, err, "conditionalChoice(true, \"foo\... |
package deploy
import (
"bytes"
"context"
"flag"
"html/template"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"time"
"golang.org/x/xerrors"
"github.com/go-generalize/pubsub_gen/misc"
"github.com/otiai10/copy"
)
func Main() {
var (
dryRun = flag.Bool("dry-run", false, "Don't create actual resour... |
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/ajays20078/go-http-logger"
"github.com/miekg/dns"
"log"
"net"
"net/http"
"os"
"strconv"
)
type QuestionRec struct {
Name string `json:"name"`
Type int `json:"type"`
}
type ResponseRecord struct {
AD bool `json:"AD"`... |
/*
Copyright 2021 The cert-manager 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 main
import (
"9fans.net/go/draw"
"bytes"
"fmt"
"image"
"io/ioutil"
"os"
"os/user"
"sync"
"unicode/utf8"
)
const (
Qdir int = iota
Qacme
Qcons
Qconsctl
Qdraw
Qeditout
Qindex
Qlabel
Qnew
QWaddr
QWbody
QWctl
QWdata
QWeditout
QWerrors
QWevent
QWrdsel
QWwrsel
QWtag
QWxdata
QMAX
Blo... |
package config
import (
"errors"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"github.com/thoas/go-funk"
)
func validateBusinessConfig(out *Config) error {
// Validate resources if they exists in all targets, validate target mount path and validate actions
for i := 0; i < len(out.Targets); i++ {
target := ... |
// Command to dump a font to PNG
package main
import (
"flag"
"image"
"image/color"
"image/draw"
"image/png"
"log"
"os"
"strconv"
"strings"
"textmod.es/font"
"textmod.es/font/rom/amiga"
"textmod.es/font/rom/ibm"
"textmod.es/font/rom/mullard"
)
var fonts = map[string]font.Font{
"cp437": ibm.Codepage437... |
package amqp
import (
"encoding/binary"
"errors"
"fmt"
. "github.com/zubairhamed/go-amqp/frames"
. "github.com/zubairhamed/go-amqp/frames/performatives"
. "github.com/zubairhamed/go-amqp/types"
"log"
"net"
"sync"
"github.com/zubairhamed/go-amqp/util"
)
func NewConnectInfo(url, nodeAddress string) *ConnectIn... |
package ppt
import (
"bytes"
"fmt"
"html/template"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
// A Config represents the configuration for a Presentation
type Config struct {
// Name is the name of the presentation
Name string
// Path represents the path to the primary html template file of... |
package main
import (
"fmt"
"log"
"net/http"
"os"
"path"
"strings"
"sync"
"github.com/setlog/trivrost/pkg/misc"
"github.com/setlog/trivrost/pkg/launcher/config"
"github.com/setlog/trivrost/pkg/system"
)
func main() {
flags := parseFlags()
if flags.ActAsService {
registerMetrics()
actAsService(flags)... |
package logging
import (
"fmt"
"log/syslog"
"strconv"
"strings"
colorable "github.com/mattn/go-colorable"
log "gopkg.in/inconshreveable/log15.v2"
"gopkg.in/inconshreveable/log15.v2_ild/stack"
"helputils"
config "logging/config"
"types"
)
const (
syslogTag = "Tesla"
entryFormatMono = iota
entryFormatCo... |
package readfiles
import (
"bufio"
"bytes"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadSU2(t *testing.T) {
{ // Test reading the file structure
reader := bufio.NewReader(bytes.NewReader(inputFile))
dim := readNumber(reader)
assert.Equal(t, 2, dim)
nelem := readNumber(reader)
assert.... |
package main
import (
"regexp"
"testing"
"github.com/honwen/golibs/cip"
"github.com/honwen/golibs/domain"
"github.com/stretchr/testify/assert"
)
func TestIp2locCN(t *testing.T) {
assert.Equal(t, ip2locCN("172.16.17.32"), "[中国 广东 广州 电信]")
assert.Equal(t, ip2locCN("192.168.127.12"), "[中国 上海 上海 电信]")
assert.Equ... |
package docker
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
)
type (
// Login defines Docker login parameters.
Login struct {
Registry string // Docker registry address
Username string // Docker registry username
Password string // Docker registry password
Email string // Docker regis... |
// Copyright 2016 The Neugram 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 eval
import (
"fmt"
"io/ioutil"
"math/big"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"testing"
"neugram.io/ng/eval/environ"
"n... |
package chremotelib
import (
"fmt"
"io"
"log"
"math/rand"
"sync/atomic"
"github.com/amattn/deeperror"
"golang.org/x/net/websocket"
)
// the WebDriver spec calls the app (chrome.app, firefox.app, etc.) User Agents.
// a User Agent will have zero or more active browsers (window or tab)
type SupportedUserAgents ... |
package connstate
import (
"context"
"net"
"net/http"
"sync"
"time"
stat "github.com/asecurityteam/component-stat"
"github.com/asecurityteam/settings"
)
const (
statCounterClientNew = "http.server.connstate.new"
statGaugeClientNew = "http.server.connstate.new.gauge"
statCounterClientActive = ... |
package memory
import (
"github.com/mr-tim/goboye/internal/pkg/display/register"
"io"
"os"
)
type Controller struct {
romImage memoryMap
ram memoryMap
stack memoryMap
ControllerData controllerRegister
Divider divRegister
TimerCounter simpleByteRegister
TimerMod... |
// 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... |
package main
import (
"context"
"fmt"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
proto "github.com/gtfierro/mortar/proto"
"github.com/pkg/errors"
logrus "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"net"
"net/http"
"os"
"strings"
"sync"
"time"
)
func init() {
logrus.SetFormatter(&logrus.T... |
// Copyright © 2018 DigitalGlobe
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, di... |
// Copyright 2020 IBM Corp.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"flag"
"os"
"github.com/hashicorp/vault/api"
networkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
kruntime "k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/cl... |
package apicommon
import (
"bytes"
"encoding/json"
"io/ioutil"
"net/http"
"runtime"
"strconv"
"strings"
"sync"
"github.com/golang/glog"
"github.com/open-horizon/anax/config"
"github.com/open-horizon/anax/events"
"github.com/open-horizon/anax/exchange"
"github.com/open-horizon/anax/version"
)
type Config... |
package graph
import (
"bytes"
"fmt"
"regexp"
)
const (
NORMAL_EDGE_COLOR = "green"
TRUE_EDGE_COLOR = "limegreen"
FALSE_EDGE_COLOR = "yellow"
FAIL_EDGE_COLOR = "goldenrod"
RETURN_EDGE_COLOR = "navy"
)
func nodeDotID(node NodeID) string {
return fmt.Sprintf("n%d", node)
}
type DotStyler interface {
Bl... |
package headers
import (
"fmt"
"strconv"
"strings"
"github.com/aler9/gortsplib/base"
)
// StreamProtocol is the protocol of a stream.
type StreamProtocol int
const (
// StreamProtocolUDP means that the stream uses the UDP protocol
StreamProtocolUDP StreamProtocol = iota
// StreamProtocolTCP means that the s... |
package gou
import (
"context"
"fmt"
"io"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/yaoapp/kun/log"
"github.com/yaoapp/kun/maps"
"github.com/gin-gonic/gin"
"github.com/yaoapp/gou/helper"
"github.com/yaoapp/gou/websocket"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/xu... |
package api
import (
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/midnightfreddie/nbt2json"
"github.com/midnightfreddie/McpeTool/world"
)
var apiVersion = "1.1"
// Response is the default JSON response object
type Response struct {
key []byte
key... |
package main
import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"sort"
"strings"
"time"
"github.com/urfave/cli"
"github.com/yulefox/gitbook-gen/internal"
)
var (
depth int
rootPath string
extensions []string
exclusions []string
showAll bool
)
const (
Ignore = iota
Directory
... |
package pqt
import (
"crypto/md5"
"encoding/base64"
"fmt"
"strings"
)
const (
// ConstraintTypeUnknown ...
ConstraintTypeUnknown ConstraintType = "unknown"
// ConstraintTypePrimaryKey ...
ConstraintTypePrimaryKey ConstraintType = "pkey"
// ConstraintTypeCheck ...
ConstraintTypeCheck ConstraintType = "check"... |
// DiskCache is an LRU cache that reads and writes to the filesystem.
package diskcache
import (
"encoding/hex"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"sort"
spooky "github.com/dgryski/go-spooky"
"github.com/kiteco/kiteco/kite-golib/bufutil"
)
var (
// ErrNoSuchKey is returned by Cac... |
package operations
import (
"fmt"
"io"
"io/ioutil"
"path"
"path/filepath"
"time"
log "github.com/sirupsen/logrus"
api "github.com/weaveworks/ignite/pkg/apis/ignite"
"github.com/weaveworks/ignite/pkg/constants"
"github.com/weaveworks/ignite/pkg/dmlegacy"
"github.com/weaveworks/ignite/pkg/logs"
"github.com/... |
package main
import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"path"
"strings"
)
import _ "github.com/mattn/go-sqlite3"
// type Base struct {
// Name string
// File os.File
// Query string
// Results [][][]string // []map[string]interface{}
// DB *sql.DB
// }
func ImportJSON(... |
package broadcast
import (
"context"
"fmt"
"time"
"github.com/renproject/aw/dht"
"github.com/renproject/aw/protocol"
"github.com/renproject/id"
"github.com/renproject/kv"
"github.com/sirupsen/logrus"
)
// A Broadcaster is used to send messages to all peers in the network. This is
// done using a decentralise... |
package cli
import (
"fmt"
"github.com/cloudfoundry-community/gautocloud"
"github.com/cloudfoundry-community/gautocloud/cloudenv"
"github.com/cloudfoundry-community/gautocloud/connectors/generic"
"github.com/cloudfoundry-community/gautocloud/interceptor/cli/urfave"
"github.com/cloudfoundry-community/gautocloud/i... |
package filter
import (
"fmt"
"net"
"net/http"
"os"
"regexp"
"strconv"
"strings"
"github.com/sirupsen/logrus"
)
func parseReplaceConfig(log logrus.FieldLogger, rep []Creplacement, prefix []replaceParameters) []replaceParameters {
result := make([]replaceParameters, 0)
for _, r := range rep {
p := replac... |
package main
import (
"clive/cmd"
"clive/u"
"errors"
"fmt"
"sort"
"strconv"
"strings"
"sync"
)
var (
fnslk sync.Mutex
builtins = map[string]func(x *xEnv, args ...string) error{}
fns = map[string]*Nd{}
xpath []string
errBreak = errors.New("break")
)
func newFunc(nd *Nd) {
fnslk.Lock()
fns[n... |
// Copyright 2018 <NAME>. All rights reserved.
package web
import (
"encoding/json"
"fmt"
"math"
"net/http"
"strconv"
"time"
"github.com/mongodb/mongo-go-driver/bson"
"github.com/simagix/keyhole/sim"
)
func (g *Grafana) handler(w http.ResponseWriter, r *http.Request) {
if r.URL.Path[1:] == "grafana/" {
f... |
package main
import (
"context"
"fmt"
"log"
"os"
"regexp"
"github.com/antihax/optional"
"github.com/pkg/errors"
stackoverflow "github.com/grokify/go-stackoverflow/client"
"github.com/grokify/simplego/cmd/cmdutil"
"github.com/grokify/simplego/config"
"github.com/grokify/simplego/fmt/fmtutil"
"github.com/g... |
// SPDX-License-Identifier: MIT
package preview
import (
"errors"
"io/fs"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"time"
"github.com/fsnotify/fsnotify"
"github.com/issue9/localeutil"
"golang.org/x/text/message"
"github.com/caixw/blogit/v2"
"github.com/caixw/blogit/v2/internal/cmd/console"
)... |
package remotewriteexporter
import (
"context"
"fmt"
"testing"
"time"
"github.com/grafana/agent/pkg/metrics/instance"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/stretchr/testify/require"
"go.opentel... |
package xwd
import (
"encoding/binary"
"image"
"image/color"
"io"
)
const (
xwdVersion = 7
xwdHeaderSize = 100 // size of the header without the window name
xwdHeaderPropSize = 4 // uint32
pixmapFormat = 2 // ZPixmap
xOffset = 0 // "number of pixels offset in X direction", idk
)
// FileHe... |
package signalutils
import (
"fmt"
"math"
"sync"
"time"
)
//StateTracker state transition tracker
type StateTracker struct {
onChange func(*State, *State)
onUnchanged func(*State)
CurrentState *State
CandidateState string
CandidateCount int
lastUnchang... |
/*
core.go
Copyright 1999-present Alibaba Group Holding Ltd.
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... |
// Different objects that are subject to physics and flood fill
// for destuction into pieces. Much like mob, but special adds
// like FF and different physics and actions.
package main
import (
"math"
"github.com/faiface/pixel"
)
type object struct {
phys
graphics
light *light
lightOffsetX float64
l... |
// Backs up all repos from GitHub and GitLab.
package main
import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
)
const (
backupDirPrefix = "hashi_"
shallow = true
)
var ghOrgs = []string{
// "barklan",
// "barklan-junk-yard",
"hashicorp",
}
// Don't ... |
package cmpb
import (
"fmt"
"io"
"strings"
"sync"
"time"
"github.com/fatih/color"
"github.com/nu11ptr/cmpb/strutil"
)
const (
defaultInterval = 200 * time.Millisecond
defaultPrePad = 0
defaultKeyWidth = 10
defaultMsgWidth = 20
defaultPreBarWidth = 11 // Duration (max size = 00h 00m 00s)
... |
package db_test
import (
"context"
"crypto/md5"
"database/sql"
"fmt"
"log"
"os"
"testing"
"github.com/github-vet/bots/internal/db"
_ "github.com/mattn/go-sqlite3"
"github.com/stretchr/testify/assert"
)
var DB *sql.DB
func TestMain(m *testing.M) {
dbPath := fmt.Sprintf("%s/test.db", os.TempDir())
// del... |
package messageformat
import (
"testing"
"github.com/stretchr/testify/require"
"libs.altipla.consulting/langs"
)
type testItem struct {
input string
lang string
params []interface{}
want string
}
func TestFormat(t *testing.T) {
items := []testItem{
// No replacements.
{"string without formatting",... |
// *** 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 storage
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a V1 volume resource within Enterprise Cl... |
package models
import (
"github.com/Juniper/contrail/pkg/format"
"github.com/Juniper/contrail/pkg/models/basemodels"
)
// Virtual network forwarding modes.
const (
L3Mode = "l3"
L2L3Mode = "l2_l3"
)
// TODO: Enums strings should be generated from schema
const (
UserDefinedSubnetOnly = "user-defined-subne... |
package tree
import (
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
var _ tview.Primitive = &FileTree{}
type FileTree struct {
theme *Theme
view *tview.TreeView
root *tview.TreeNode
onSelect func(node *FSNode)
onChanged func(node *FSNode)
onOpen func(node *FSNode)
AfterDraw []fun... |
package mpcuenotesrsserverstatus
import (
"bufio"
"bytes"
"flag"
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strconv"
mp "github.com/mackerelio/go-mackerel-plugin"
)
// CuenoteSrsServerStatusPlugin mackerel plugin for Cuenote SR-S server status
type CuenoteSrsServerStatusPlugin struct {
URI string
Tempfil... |
package main
import (
"context"
"fmt"
"log"
"os"
"strconv"
"sync"
"time"
gpubsub "cloud.google.com/go/pubsub"
pubsubv1 "cloud.google.com/go/pubsub/apiv1"
"github.com/pkg/errors"
pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
)
func startLengthy(projectId, sub string) error {
ctx := context.TO... |
package aws
import (
"fmt"
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsIamUser() *schema.Resource {
return &schema.Resource{
Create: resourceAwsIamUserCreate,
Read: ... |
// Copyright © 2020 <NAME>.
// +build !go1.13
package ref
import (
"reflect"
)
// IsZero reports whether v is the zero value for its type.
// It panics if the argument is invalid.
func IsZero(v reflect.Value) bool {
//switch v.Kind() {
//case reflect.Bool:
// return !v.Bool()
//case reflect.Int, reflect.Int8, ... |
package unit_general_cgi_key_value
import (
"encoding/json"
"errors"
"github.com/gazercloud/gazernode/common_interfaces"
"github.com/gazercloud/gazernode/resources"
"github.com/gazercloud/gazernode/system/units/units_common"
"github.com/gazercloud/gazernode/utilities/logger"
"os/exec"
"strconv"
"strings"
"ti... |
package gcppubsub
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"cloud.google.com/go/pubsub"
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
"github.com/jhump/protoreflect/desc"
"github.com/jhump/protoreflect/dynamic"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"githu... |
package server
import (
"encoding/json"
"fmt"
"io/fs"
"io/ioutil"
"log"
"math/rand"
"net/http"
"runtime"
"time"
"github.com/gorilla/mux"
)
func returnError(title string, err string, trace string, code int, writer http.ResponseWriter) {
if Config.Mail.ErrorTo != "" && title != "Not found" {
log.Println("... |
package create
import (
"encoding/json"
"flag"
"fmt"
"io"
"os"
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/command/flags"
"github.com/hashicorp/consul/command/intention/finder"
"github.com/mitchellh/cli"
)
func New(ui cli.Ui) *cmd {
c := &cmd{UI: ui}
c.init()
return c
}
type cmd struc... |
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... |
package cmd
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"strings"
"time"
"github.com/spf13/cobra"
)
// genrated using https://mholt.github.io/json-to-go/
type Delhivery struct {
Meta struct {
RequestID string `json:"requestId"`
} `json:"meta"`
Data []struct {
Status struct {
Status ... |
// Copyright © 2022 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// 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
//
// Unle... |
package endpointedge
import (
"encoding/base64"
"errors"
"fmt"
"net/http"
"strconv"
"time"
httperror "github.com/portainer/libhttp/error"
"github.com/portainer/libhttp/response"
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/http/middlewares"
)
type stackStatusResponse s... |
package pgm
import (
"fmt"
"math/rand"
"sort"
"testing"
"time"
)
func TestPGMIndex(t *testing.T) {
testCases := []struct {
data []float64
segments int // segments in the last level
epsilon int
searchMem []struct {
k float64
present bool
}
searchPred []float64
}{
{
data: ... |
package main
import (
"os"
"github.com/lordofthejars/diferencia/core"
"github.com/lordofthejars/diferencia/log"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "diferencia",
Short: "Interact with Diferencia",
}
func areHttpsClientAttributesCorrect(caCert, clientCe... |
// 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 ssa
import (
"cmd/internal/src"
)
// fuse simplifies control flow by joining basic blocks.
func fuse(f *Func) {
for changed := true; changed; {
ch... |
package engine
import (
"context"
"fmt"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"github.com/pkg/errors"
"github.com/windmilleng/tilt/internal/store"
"github.com/windmilleng/tilt/internal/k8s"
)
type PodWatcher struct {
kCli k8s.Client
watches []PodWatch
}
func NewPodWatcher(kCli k8s.C... |
package main
import (
"bufio"
"bytes"
"crypto/hmac"
"crypto/rand"
"crypto/sha1"
"encoding/base32"
"encoding/binary"
"flag"
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
)
const FILENAME = ".twofactor"
var Debug = false
var debug = flag.Bool("d", false, "Debug")
var generate = flag.Bool("gen", false, "Gen... |
// Copyright 2019 spaGO 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 adam
import (
"github.com/nlpodyssey/spago/pkg/mat"
"gonum.org/v1/gonum/floats"
"testing"
)
func Test_IncExample(t *testing.T) {
updater := New(New... |
package pt
import (
"fmt"
"log"
"math"
"strconv"
"strings"
)
var digitalFormatMap = map[DigitalFormat][]string{
Blueray: []string{"bluray", "blu-ray", "blueray", "bdrip", "bd"},
HDTV: []string{"hdtv"},
WebDL: []string{"webdl", "web-dl", "webrip", "web"},
UHDTV: []string{"uhdtv"},
Blueray3D: [... |
// Copyright (c) 2017 OysterPack, 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 t... |
package controllers
import (
//"bytes"
"encoding/json"
"fmt"
"github.com/astaxie/beego"
"log"
//"os"
"os/exec"
//"strings"
//"time"
"bufio"
"io/ioutil"
"os"
//"path/filepath"
"strconv"
)
type PFbridgeController struct {
beego.Controller
}
type NetConfig struct {
NetIN string `json:"netIN"`
NetOUT s... |
// Copyright (c) 2011-2017, HL7, Inc & The MITRE Corporation
// All rights reserved.
//
// 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 above copyright notice, ... |
// Package types provides the PDFContext, representing an ecosystem for PDF processing.
//
// It implements the specification PDF 32000-1:2008
//
// Please refer to the spec for any documentation of PDFContext's internals.
package types
import (
"encoding/hex"
"fmt"
"strconv"
"time"
)
// Supported line delimiters... |
package main
import (
"fmt"
"github.com/spf13/viper"
"io"
"os"
"path/filepath"
"time"
cpm "github.com/otiai10/copy"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/proxy"
tmsm "github.com/tend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.