text stringlengths 3.08k 10.4k |
|---|
// Copyright 2019 Antrea 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 ... |
package cws
import (
"encoding/json"
"log"
"sync"
"time"
"github.com/gofrs/uuid"
"github.com/gorilla/websocket"
)
type (
Client struct {
id string
conn *websocket.Conn
sendLock sync.Mutex
// sendCallback is callback based on packetID
sendCallback map[string]func(req WSPacket)
sendCallbackLoc... |
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package e2e_test
import (
"context"
"fmt"
"sort"
"testing"
"time"
"github.com/efficientgo/e2e"
"github.com/thanos-io/thanos/pkg/metadata/metadatapb"
"github.com/thanos-io/thanos/pkg/promclient"
"github.com/thanos-io/thanos/pkg/ru... |
/*
* Minio-Operator - Manage Minio clusters in Kubernetes
*
* Minio (C) 2018 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/LICENS... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
package frame
import (
"github.com/BurntSushi/xgb/xproto"
"github.com/BurntSushi/xgbutil"
"github.com/BurntSushi/wingo/render"
)
type Borders struct {
*frame
theme *BordersTheme
topSide, bottomSide, leftSide, rightSide *piece
topLeft, topRight, bottomLeft, bottomRight *piece
}
func NewBorders(X *xgbutil.... |
// Copyright 2019 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
// 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-2020 Datadog, Inc.
package sampler
import (
"math"
"time"
"github.com/DataDog/datadog-agen... |
package main
import (
"net/http"
"strconv"
"time"
"github.com/go-kit/kit/metrics"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/xmidt-org/webpa-common/xhttp"
"github.com/xmidt-org/webpa-common/xmetrics"
)
// Metric names
const (
Outbou... |
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the Li... |
package mustache
import (
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"strings"
"sync"
"github.com/cbroglie/mustache"
"github.com/gofiber/template/utils"
"github.com/valyala/bytebufferpool"
)
// Engine struct
type Engine struct {
// views folder
directory string
// http.FileSystem supports embedded files... |
package main
import (
"fmt"
"time"
tb "gopkg.in/tucnak/telebot.v2"
)
func (st *State) handlePredict(m *tb.Message) {
fut, err := time.Parse(monthFormat, m.Payload)
if err != nil {
fut = time.Now().AddDate(1, 0, 0)
}
predictions := st.Predict(fut, m.Sender.ID)
st.Bot.Send(m.Sender, predictions, tb.ModeMark... |
// Copyright 2018 <NAME>. All rights reserved.
// Use of this source code is governed under the MIT License
// that can be found in the LICENSE file.
package discovery
import (
"sync"
"time"
"github.com/danjacques/gopushpixels/device"
"github.com/danjacques/gopushpixels/protocol"
)
type discoveredDeviceState st... |
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
package gomail
import (
"crypto/tls"
"fmt"
"io"
"net"
"strings"
"time"
"github.com/emersion/go-sasl"
"github.com/emersion/go-smtp"
)
var defaultDialer = &net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 30 * time.Second,
}
// A Dialer is a dialer to an SMTP server.
type Dialer struct {
// Host represe... |
package pdfhandler
import (
"archive/zip"
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"sync"
"time"
"github.com/satori/go.uuid"
)
var (
acceptedContentTypes = []string{
"application/zip",
"application/pdf",
}
logger StdL... |
package jirachat
import (
"encoding/json"
"github.com/buger/jsonparser"
"io/ioutil"
"net/http"
"strings"
)
// This is a json response for a JIRA webhook (more or less) according to
// https://developer.atlassian.com/jiradev/jira-architecture/webhooks
type JIRAWebevent struct {
// Internal ID of the event
Id in... |
package tracing
import (
"context"
"fmt"
"log"
"os"
"strconv"
"sync"
"github.com/pkg/errors"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propa... |
package db
import (
"fmt"
"regexp"
"strings"
)
type Select struct {
where []string
joins []string
order_by []string
limit int
offset int
columns []string
params []interface{}
group_by string
having string
param_count int
table string
block_start bool
}
... |
// Package tests contains supporting code for running tests.
package tests
import (
"context"
"crypto/rand"
"crypto/rsa"
"errors"
"log"
"os"
"testing"
"time"
"github.com/ardanlabs/service/business/auth"
"github.com/ardanlabs/service/business/data/schema"
"github.com/ardanlabs/service/business/data/user"
"... |
package lnd
import (
"fmt"
"net"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/chanbackup"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channelnotifier"
)
// addrSource is an interface that allow us to get the addresses for... |
// +build !windows
package writer
import (
"errors"
"fmt"
"strings"
"testing"
"time"
"github.com/DataDog/datadog-agent/pkg/trace/info"
"github.com/DataDog/datadog-agent/pkg/trace/test/testutil"
"github.com/stretchr/testify/assert"
)
func TestPeriodicFlush(t *testing.T) {
assert := assert.New(t)
testFlush... |
// Code generated by zanzibar
// @generated
// Copyright (c) 2018 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 limitat... |
package sns
import (
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sns"
)
type attributeDataType string
const (
attributeDataTypeString attributeDataType = "String"
attributeDataTypeStringArray attributeDataType = "StringArray"
attributeDataTypeNumber attr... |
/* SPDX-License-Identifier: MIT
*
* Copyright (C) 2017-2020 WireGuard LLC. All Rights Reserved.
*
* This implements userspace semantics of "sticky sockets", modeled after
* WireGuard's kernelspace implementation. This is more or less a straight port
* of the sticky-sockets.c example code:
* https://git.zx2c4.com... |
package dispatcher
import (
"bytes"
"fmt"
"sync"
"time"
uuid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"io"
"io/ioutil"
"vegeta-server/models"
)
// AttackFunc provides type used by the attacker class
type AttackFunc func(string, models.AttackParams, chan struct{}) (io.Reader, error)
//... |
// Copyright 2016 Square, 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 wri... |
package engine
import (
"fmt"
"github.com/Jecced/go-tools/src/ak"
"github.com/Jecced/go-tools/src/fileutil"
"github.com/Jecced/go-tools/src/strutil"
"path"
"path/filepath"
"strings"
)
var (
out = ""
content *string
)
func Mix(dir string, html *string) {
out = dir
content = html
register, noJsList := ... |
//go:build windows
package hcn
import (
"sync"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/Microsoft/hcsshim/internal/log"
)
var (
// featuresOnce handles assigning the supported features and printing the supported info to stdout only once to avoid unnecessary work
// multiple times.
fe... |
package main
import (
"log"
"fmt"
// "io"
"os"
"path"
"strconv"
"strings"
"text/tabwriter"
"time"
"github.com/nlevitt/hdfs"
)
type LSifier struct {
client *hdfs.Client
long bool
all bool
humanReadable bool
descend bool
tw *tabwriter.Writer
}
type File struct {
relPath string // more like path for di... |
package middleware
import (
"context"
"errors"
"fmt"
"net/http"
"time"
"github.com/justinas/alice"
middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
sessionsapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
)
// Sto... |
/*
* 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 ... |
/*
MIT License
Copyright (c) 2015-2017 University Corporation for Atmospheric Research
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... |
package structs
import (
"time"
)
// IndexedCARoots is the list of currently trusted CA Roots.
type IndexedCARoots struct {
// ActiveRootID is the ID of a root in Roots that is the active CA root.
// Other roots are still valid if they're in the Roots list but are in
// the process of being rotated out.
ActiveRo... |
package oracle
import (
"errors"
"fmt"
"time"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/utils"
sdk "github.com/cosmos/cosmos-sdk/types"
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
"github.com/tendermint/te... |
// Copyright 2020 <NAME>. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
package converter
import (
"context"
"fmt"
"os"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/dragonflyoss/image-service/contrib/nydusify/pkg/backend"
"github.com... |
// Copyright 2018 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.
// +build ignore
// +build aix
/*
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
*/
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs m... |
package graphite
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"path"
"regexp"
"strings"
"golang.org/x/net/context/ctxhttp"
"github.com/miprotek/grafana-de/pkg/log"
"github.com/miprotek/grafana-de/pkg/models"
"github.com/miprotek/grafana-de/pkg/setting"
"github.com/miprotek/... |
package commands
import (
"context"
"fmt"
"os"
"strings"
"text/tabwriter"
"time"
"github.com/docker/buildx/build"
"github.com/docker/buildx/driver"
"github.com/docker/buildx/store"
"github.com/docker/buildx/util/platformutil"
"github.com/docker/buildx/util/progress"
"github.com/docker/cli/cli"
"github.co... |
package main
import (
"fmt"
"sort"
"github.com/prometheus/client_golang/prometheus"
)
// Used to programmatically create prometheus.Gauge metrics
type gaugeDefinition struct {
id int
name string
desc string
key string
}
// Used to programmatically create prometheus.CounterVec metrics
type counterVecDefini... |
// Copyright 2018-2021 CERN
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wr... |
package scalers
import (
"context"
"fmt"
"strconv"
"strings"
"time"
"github.com/robfig/cron/v3"
"k8s.io/api/autoscaling/v2beta2"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/metrics/pkg/apis/external_metrics"
logf "sigs.k8s.i... |
package cos
import (
"fmt"
"net/http"
"net/url"
"sort"
"strings"
"time"
"github.com/imroc/req"
)
type request struct {
Method string
Url string
Params req.QueryParam
Headers req.Header
prepared bool
Payload interface{}
timeout time.Duration
expire time.Time //time point
SignKey s... |
package user
import (
"fmt"
"log"
"strings"
"time"
"github.com/bashmohandes/go-askme/answer"
"github.com/bashmohandes/go-askme/models"
"github.com/bashmohandes/go-askme/question"
"github.com/bashmohandes/go-askme/user"
)
type userUsecase struct {
questionRepo question.Repository
answerRepo answer.Reposit... |
/*
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, merge, publish, distribute, sublicen... |
package proxy
import (
"bytes"
"compress/gzip"
"context"
"io/ioutil"
"net/http"
"net/http/httputil"
"net/url"
"strings"
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/log"
"github.com/goadesign/goa"
"github.com/pkg/errors"
)
// RouteHTTPToPath uses a reverse p... |
package engine
import (
"fmt"
"io"
"os"
"path"
"time"
"github.com/google/go-containerregistry/pkg/crane"
log "github.com/sirupsen/logrus"
"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/errors"
containerutils... |
package engine
import (
"context"
"fmt"
"sync"
"time"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/longhorn/longhorn-engine/pkg/instance-manager/rpc"
"github.com/longhorn/longhorn-engine/pkg/instance-manager/types"
... |
// Copyright 2020 The conprof 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... |
package utils
import (
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"regexp"
"strconv"
"strings"
"sync"
"time"
"agent/g"
"github.com/astaxie/beego/httplib"
)
const (
NO_ERROR = 0
REQ_TIMEOUT = 1
INVALID_RESP_CODE = 2
KEYWORD_UNMATCH = 3
DNS_ERROR = 4
ERROR_TIME_OUT = "Request ti... |
package model
import (
"database-autoupdater/globals"
"encoding/json"
"fmt"
"net/http"
"strconv"
"time"
"github.com/sirupsen/logrus"
)
// ArticleWarehouse represents an Article in the Warehouse API
type ArticleWarehouse struct {
ID int32 `json:"id"`
Identification int32 `json:"identification"`... |
// Copyright 2021 TiKV 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... |
/*
* umoci: Umoci Modifies Open Containers' Images
* Copyright (C) 2016-2019 SUSE 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.... |
// Copyright 2022 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... |
/*
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 main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
log "github.com/sirupsen/logrus"
"github.com/neuvector/scanner/common"
"github.com/neuvector/scanner/cvetools"
"github.com/neuvector/neuvector/share"
"github.com/neuvect... |
package mixins
import (
ipld "github.com/ipfs/fs-repo-migrations/ipfs-10-to-11/_vendor/github.com/ipld/go-ipld-prime"
)
// Int can be embedded in a struct to provide all the methods that
// have fixed output for any int-kinded nodes.
// (Mostly this includes all the methods which simply return ErrWrongKind.)
// Othe... |
package main
import (
"flag"
"net/http"
_ "net/http/pprof"
"os"
"strings"
"time"
"github.com/Azure/aad-pod-identity/pkg/mic"
"github.com/Azure/aad-pod-identity/pkg/probes"
"github.com/Azure/aad-pod-identity/version"
"github.com/golang/glog"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
)
var... |
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
package controlapi
import (
"regexp"
"github.com/docker/distribution/digest"
"github.com/docker/swarmkit/api"
"github.com/docker/swarmkit/identity"
"github.com/docker/swarmkit/manager/state/store"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
)
// Currently this is contai... |
package ddl
import (
"bytes"
"fmt"
"regexp"
"strings"
"text/template"
"go.uber.org/zap"
)
type (
Generator struct {
log *zap.Logger
tpl *template.Template
}
)
// @todo all DDL operations (altering, droping, adding...) from all *sql* implementations should be moved here
// logic is more or less the... |
package main
import (
"errors"
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/spf13/pflag"
)
const version = "0.4.3"
const usage = `flog is a fake log generator for common log formats
Usage: flog [options]
Version: %s
Options:
-f, --format string log format. available formats:
... |
package gitlaboauth
import (
"context"
"fmt"
"net/http"
"strconv"
"time"
"github.com/cockroachdb/errors"
"golang.org/x/oauth2"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/auth/providers"
"github.com/sourcegraph/sourcegraph/cmd/frontend/hubspot"
"... |
package reindexer
import (
"fmt"
"log"
"testing"
"github.com/sapariduo/reindexer"
)
const testNs string = "test_items_force_sort_order"
type TestForceSortOrderItem struct {
ID int `reindex:"id,,pk"`
Year int `reindex:"year,tree"`
Name string `reindex:"name"`
Phone string `reindex:... |
/*
Copyright 2021 Cortex Labs, 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, softwa... |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v3beta1
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Retrieves the specified page.
func LookupPage(ctx *pulumi.Contex... |
package token
import "strconv"
type Token int
const (
_ Token = iota
ILLEGAL
EOF
COMMENT
KEYWORD
STRING
BOOLEAN
NULL
NUMBER
IDENTIFIER
PLUS
MINUS
MULTIPLY
SLASH
REMAINDER
AND
OR
EXCLUSIVE_OR
SHIFT_LEFT
SHIFT_RIGHT
UNSIGNED_SHIFT_RIGHT
ADD_ASSIGN
SUBTRACT_ASSIGN
MULTIPLY_ASSIGN
QUOTIENT_... |
package scribe
import (
"fmt"
"testing"
"github.com/obsidiandynamics/libstdgo/check"
"github.com/stretchr/testify/assert"
)
type logCapture struct {
scene *Scene
msg *string
}
func (c *logCapture) capturing() LoggerFactory {
return func(level Level, scene Scene) Logger {
c.scene = &scene
return func(fo... |
package gotils
//go:generate enumer -type LogLevel loglevel.go
import (
"fmt"
"io"
"log"
"os"
"strings"
)
// LogLevel sets the criticality of a logging output. It is used to filter logging messages
// depending on their priority. Compare to log4j.
type LogLevel int
// The predefined LogLevels that are used by ... |
// Copyright 2016 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL.txt and at www.mariadb.com/bsl11.
//
// Change Date: 2022-10-01
//
// On the date above, in accordance with the Business Source License, use
// of this software will be gov... |
/*
Copyright 2021 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, software... |
/*
Copyright 2021 The Triton 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 2018 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 ... |
package main
import (
"context"
"errors"
"flag"
"fmt"
"net/url"
"os"
"os/exec"
"path"
"runtime"
"strings"
"time"
)
const (
minRestartInterval = 2 * time.Second
minRestartDelay = 1 * time.Second
)
type config struct {
dataDir string
uri string
chromeCmd string
extraArgs ... |
package api
import (
"encoding/json"
"errors"
"sync"
"github.com/gorilla/websocket"
"github.com/grafana/metrictank/stats"
"github.com/raintank/raintank-apps/pkg/message"
"github.com/raintank/raintank-apps/task-server/agent_session"
"github.com/raintank/raintank-apps/task-server/model"
"github.com/raintank/ra... |
package writer
import (
"bytes"
"context"
"fmt"
"hash/crc32"
"net"
"net/http"
"time"
"github.com/golang/protobuf/proto"
"github.com/golang/snappy"
"github.com/prometheus/client_golang/api"
"github.com/prometheus/prometheus/prompb"
"github.com/toolkits/pkg/logger"
)
type Options struct {
Url st... |
package edgolang
import (
"io/ioutil"
"log"
"path/filepath"
"regexp"
"sort"
"strings"
"errors"
"./journal"
"./watch"
)
var (
journalRE = regexp.MustCompile(`^journal[.][0-9]+[.][0-9]+.log$`)
ErrEWShutdown = errors.New("elitewatcher: shutdown")
)
// EliteWatcher watches the Elite Dangerous journal direct... |
/*
* Tencent is pleased to support the open source community by making Blueking Container Service available.,
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obt... |
package shellquote
import (
"bytes"
"errors"
"strings"
"unicode/utf8"
)
// From https://github.com/kballard/go-shellquote
// Join quotes each argument and joins them with a space.
// If passed to /bin/sh, the resulting string will be split back into the
// original arguments.
func Join(args ...string) string {
... |
package host
import (
"crypto/ed25519"
"encoding/binary"
"errors"
"math/bits"
"strings"
"gitlab.com/NebulousLabs/Sia/modules"
"gitlab.com/NebulousLabs/Sia/types"
"golang.org/x/crypto/blake2b"
"lukechampine.com/us/merkle"
)
var (
// ErrMissingSiacoinOutput is returned when a transaction spends an output tha... |
// SPDX-FileCopyrightText: 2020 SAP SE
//
// SPDX-License-Identifier: Apache-2.0
// Package dsn handles data source names.
package dsn
import (
"fmt"
"net/url"
"os"
"reflect"
"sort"
"strconv"
"strings"
)
// Info represents all required information to open a connection to
// an ASE server.
//
// The json tag i... |
package types
import (
"testing"
"github.com/fastock/fastock-chain/x/common"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"
)
func TestValidatorTestEquiv... |
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
)
var dryRun = flag.Bool("dry-run", false, "Print the commands that would be run.")
var removeSrcDir = flag.Bool("remove-src", false, "Remove the source dir after building.")
// We expect 5 arguments on the command line
const NumArgs = 5
func DoBuildCommand()... |
//go:build integration
// +build integration
package db
import (
"encoding/json"
"fmt"
"go/ast"
"go/parser"
"go/token"
"reflect"
"strings"
"testing"
"time"
"github.com/shopspring/decimal"
"github.com/stretchr/testify/require"
"github.com/determined-ai/determined/master/pkg/etc"
"github.com/determined-... |
package server
import (
"fmt"
"net/http"
"strconv"
"strings"
"time"
"go.uber.org/zap"
"encoding/json"
"github.com/mssola/user_agent"
"github.com/openfresh/plasma/config"
"github.com/openfresh/plasma/event"
"github.com/openfresh/plasma/log"
"github.com/openfresh/plasma/manager"
"github.com/openfresh/pla... |
// Copyright 2019 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.
// Command prologuer reports what fraction of samples from a profile
// are from IPs marked as function prologue in DWARF line tables.
//
// In Go binaries (as ... |
package flow
import (
"time"
"github.com/jinzhu/gorm"
)
// SfWorkFlows This table holds the definition for each workflow process, such as 'Order Fulfillment'.
type SfWorkFlows struct {
gorm.Model
Name string `gorm:"type:varchar(100)"`
Description string `gorm:"type:text"`
IsValid b... |
package layer2
import (
"net"
"sync"
"time"
"github.com/go-kit/kit/log"
)
// Announce is used to "announce" new IPs mapped to the node's MAC address.
type Announce struct {
logger log.Logger
sync.RWMutex
arps map[int]*arpResponder
ndps map[int]*ndpResponder
ips map[string]net.IP // map containing IPs we s... |
package metrics
import (
"strings"
"time"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/klog"
)
var (
ovnNorthdVersion string
ovnNorthdOvsLibVersion string
)
func ge... |
// Copyright (c) 2018 <NAME> <<EMAIL>>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIM... |
// gogh project gogh.go
package gogh
import (
//"fmt"
"image"
"log"
)
const (
GRAY = 0
GRAY16 = 1
NRGBA = 3
NRGBA64 = 4
RGBA = 5
RGBA64 = 6
)
func Color(colors ...uint8) []uint8 {
return colors
}
func NewImg(rect image.Rectangle, T int) *Img {
var (
im []uint8
stride int = 1
)
switch ... |
package main
import (
"time"
"github.com/clarketm/json"
log "github.com/sirupsen/logrus"
"github.com/streadway/amqp"
)
var conn *amqp.Connection
var ch *amqp.Channel
var password string
var init_err error
var _year int
var _month time.Month
var _day int
var _messages_sent int
//Status
var _statusDBM StatusDBM
v... |
package stripe
import "encoding/json"
// TransactionStatus is the list of allowed values for the transaction's status.
// Allowed values are "available", "pending".
type TransactionStatus string
// TransactionType is the list of allowed values for the transaction's type.
// Allowed values are "charge", "refund", "ad... |
package log
import (
"errors"
"fmt"
"mango/pkg/util"
"mango/pkg/util/colorprint"
"os"
"path"
"runtime"
"time"
)
type LogInfo struct {
File string
Line int
Classname string
Level int
LogStr string
TimeNs int64
}
var (
logger *Logger = ni... |
//
// Copyright © 2021 Uncharted Software 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 ap... |
package hic
import (
"bytes"
"compress/zlib"
"errors"
"fmt"
"log"
"math"
"github.com/gonum/matrix/mat64"
. "github.com/nimezhu/netio"
)
type MatrixViewer interface {
mat64.Matrix
mat64.Viewer
}
type Block struct {
NPositions int32
XOffset int32
YOffset int32
Mat *mat64.Dense //using dense ... |
// Copyright 2013-2020 <NAME> (<EMAIL>). All rights reserved.
// Use of this source code is governed by a MIT-license
// that can be found in the LICENSE file.
// Summarize size of directories and files in directories.
package main
import (
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
"string... |
package dbmeta
import (
"errors"
"fmt"
"reflect"
"strconv"
"strings"
"unicode"
)
// commonInitialisms is a set of common initialisms.
// Only add entries that are highly unlikely to be non-initialisms.
// For instance, "ID" is fine (Freudian code is rare), but "AND" is not.
var commonInitialisms = map[string]bo... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"time"
"github.com/sensu/sensu-go/types"
"github.com/spf13/cobra"
)
var (
webhook string
annotations string
debug bool
stdin *os.File
)
// Properties struct includes the two fields (subject and me... |
package proxy
import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/kyma-project/kyma/components/apiserver-proxy/internal/authn"
"github.com/kyma-project/kyma/components/apiserver-proxy/internal/authz"
"github.com/kyma-project/kyma/components/apiserver-proxy/internal/monitoring"
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.