text stringlengths 3.08k 10.4k |
|---|
package controllers
import (
"fmt"
"math"
"math/rand"
"strconv"
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func F_rasp(x float64) float64 {
if x <= 0 {
return 0
}
if x >= 1 {
return 1
}
return 2.0 / math.Pi * math.Asin(x)
}
func F_plot(x float64) float64 {
if x <= ... |
package formatters
import (
"bytes"
"log"
"strings"
"text/template"
"time"
"github.com/justinbarrick/fluxcloud/pkg/config"
"github.com/justinbarrick/fluxcloud/pkg/exporters"
"github.com/justinbarrick/fluxcloud/pkg/msg"
"github.com/weaveworks/flux"
fluxevent "github.com/weaveworks/flux/event"
"github.com/we... |
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
package azsecrets
import (
"time"
"github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets/internal/generated"
shared "g... |
package server
import (
"bufio"
"fmt"
"net"
"os"
"os/signal"
"strings"
"sync"
"syscall"
"time"
)
var socketTimeout time.Duration = 120 * time.Second
// Server is the main server that will echo input back to the client
type Server struct {
socketFilename string
saveDir string
listener net.Lis... |
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
package v2
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/... |
package api
import (
"context"
"fmt"
"net/http"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
apifs "github.com/puppetlabs/wash/api/fs"
apitypes "github.com/puppetlabs/wash/api/types"
"github.com/puppetlabs/wash/plugin"
)
func toAPIEntry(e plugin.Entry) apitypes.Entry {
return apitypes.Entry{
Name... |
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package secp256k1fx
import (
"errors"
"github.com/ava-labs/gecko/utils/crypto"
"github.com/ava-labs/gecko/utils/hashing"
"github.com/ava-labs/gecko/utils/wrappers"
"github.com/ava-labs/gecko/vms/components/verify"... |
package bot
import (
"fmt"
"log"
"time"
"github.com/bwmarrin/discordgo"
"github.com/post04/dr-docso/docs"
)
const (
// all the emojis we use
leftArrow = "⬅️"
rightArrow = "➡️"
destroyEmoji = "❌"
)
// ReactionListener is a struct for the reaction listener for pages
type ReactionListener struct {
Type ... |
package publisher
import (
"context"
"testing"
"time"
"github.com/chef/automate/api/interservice/compliance/common"
inspec "github.com/chef/automate/api/interservice/compliance/ingest/events/inspec"
"github.com/chef/automate/api/interservice/compliance/ingest/events/compliance"
"github.com/chef/automate/compo... |
/*
Copyright 2019 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
package rediscli
import (
"regexp"
"strings"
)
// https://redis.io/commands/info
type RedisInfo struct {
Server map[string]string
Clients map[string]string
Memory map[string]string
Persistence map[string]string
Stats map[string]string
Replication map[string]string
CPU map[string]s... |
// ex8.7 mirrors a website to a given depth using multiple goroutines and
// rewrites local links.
package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"golang.org/x/net/html"
)
// tokens is a counting semaphore used to
// enforce a limit of 20 ... |
package framing
import (
"encoding/binary"
"fmt"
"io"
"strconv"
"strings"
"github.com/rsocket/rsocket-go/core"
"github.com/rsocket/rsocket-go/internal/common"
"github.com/rsocket/rsocket-go/internal/u24"
)
type frozenError struct {
code core.ErrorCode
data []byte
}
// FromRawFrame creates a frame from a b... |
package models
import (
"bytes"
"io"
"mime/multipart"
"os"
"time"
"github.com/go-playground/validator/v10"
)
const MinDeliveryWindow = 60
func setupMMSValidations() {
if validate == nil {
validate = validator.New()
}
validate.RegisterStructValidation(MMSHeadValidation, MMSHead{})
}
type MMSMsg struct {
... |
/*
* Copyright 2020 The Yorkie 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... |
/*
Copyright (c) 2015, Alcatel-Lucent Inc
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, this list of condi... |
package vnc2video
import (
"encoding/binary"
"fmt"
"image"
"vnc2video/logger"
)
//var _ draw.Drawer = (*ServerConn)(nil)
//var _ draw.Image = (*ServerConn)(nil)
// Color represents a single color in a color map.
type Color struct {
pf *PixelFormat
cm *ColorMap
cmIndex uint32 // Only ... |
package main
import (
"errors"
"flag"
"fmt"
"github.com/micanzhang/gohosts"
"io/ioutil"
"os"
"os/exec"
"runtime"
"strings"
)
const VERSION = "1.0@dev"
const PLATFORM = runtime.GOOS
var pathMap map[string]string = map[string]string{
"windows": "C:\\Windows\\System32\\drivers\\etc\\hosts",
"darwin": "/etc/... |
package webrpc
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"strings"
wh "github.com/skycoin/skycoin/src/util/http"
"github.com/skycoin/skycoin/src/util/logging"
)
var (
// ErrCodeParseError parse JSON error
ErrCodeParseError = -32700 // Parse error Invalid JSON was received by the server. An error occ... |
package host
import (
"bytes"
"context"
"crypto/x509"
"encoding/json"
"fmt"
"io"
"os/exec"
"time"
"github.com/choria-io/go-choria/opa"
"github.com/choria-io/provisioning-agent/config"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
)
type ConfigResponse struct {
Defer ... |
// Copyright 2009 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 exec runs external commands. It wraps os.StartProcess to make it
// easier to remap stdin and stdout, connect I/O with pipes, and do other
// adjustm... |
/*
Original work Copyright (c) 2013 zhenjl
Modified work Copyright (c) 2015 <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
u... |
package bk
import (
"fmt"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/codebuild"
"github.com/buildkite/agent/api"
"github.com/pkg/errors"
)
const (
// DefaultAPIEndpoint default api endpoint
DefaultAPIEndpoint = "https://agent.buildkite.com/v3"
// MaxAgentConcurr... |
package wikicrawl
import (
"fmt"
"strings"
"regexp"
"encoding/json"
"golang.org/x/net/html"
"github.com/franela/goreq"
"github.com/PuerkitoBio/goquery"
)
const ApiRoot string = "https://en.wikipedia.org/w/api.php"
const WikiContentRoot string = "https://en.wikipedia.org/wiki/"
type WikiParams struct {
Forma... |
package manager
import (
"fmt"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
iamoidc "github.com/weaveworks/eksctl/pkg/iam/oidc"
"github.com/weaveworks/eksctl/pkg/kubernetes"
"github.com/weavework... |
//go:build ebpf
// +build ebpf
package ebpf
// #include "./trace_probe/function_vals.bpf.h"
import "C"
import (
_ "embed"
"encoding/binary"
"errors"
"reflect"
"runtime"
"sync"
"unsafe"
"github.com/go-delve/delve/pkg/dwarf/godwarf"
"github.com/go-delve/delve/pkg/dwarf/op"
bpf "github.com/aquasecurity/libbp... |
// Package autoupdate allows clients to request keys and get updates when the
// keys changes.
//
// To register to the autoupdate serive, a client has to receive a connection
// object by calling the Connect()-method. It is not necessary and therefore not
// possible to close a connection. The client can just stop lis... |
package main
import (
"fmt"
"log"
"strings"
"time"
)
var streamURL string = "https://www.twitch.tv"
// keeps all the info we need nice and tidy
type streamer struct {
Name string
ID string
slackChannel string
}
// data needed for a message
type slackStreamInfo struct {
Name string
... |
// Copyright 2018 The OpenPitrix Authors. All rights reserved.
// Use of this source code is governed by a Apache license
// that can be found in the LICENSE file.
// OpenPitrix IAM service config package.
package config
import (
"bytes"
"fmt"
"strings"
"github.com/BurntSushi/toml"
"github.com/koding/multiconfi... |
package http
import (
"context"
"fmt"
"hash/fnv"
"io"
"net/http"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/traefik/paerser/file"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v2/pkg/config/dynamic"
"github.com/traefik/traefik/v2/pkg/job"
"github.com/traefik/traefik/v2/pkg... |
// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package v1alpha1api20201101
import "github.com/Azure/azure-service-operator/v2/pkg/genruntime"
type PublicIPAddresses_SpecARM struct {
//APIVersion: API Version of the resource... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
package controlplane
import (
"context"
"fmt"
"time"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/upgrades"
"github.com/blang/semver"
apiconfigv1 "github.com/openshift/api/config/v1"
configv1client "github.com/openshift/client-go/config/clientset/versioned"
"g... |
package metrics
import (
"context"
"time"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
... |
// 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... |
// Copyright 2020 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 poll
import (
"internal_local/syscall/unix"
"sync/atomic"
"syscall"
)
var copyFileRangeSupported int32 = -1 // accessed atomically
const maxCopyFi... |
// Package tracking provides the use-case of tracking a cargo. Used by views
// facing the end-user.
package tracking
import (
"errors"
"fmt"
"strings"
"time"
"github.com/go-kit/kit/examples/shipping/cargo"
)
// ErrInvalidArgument is returned when one or more arguments are invalid.
var ErrInvalidArgument = erro... |
package cmd
import (
"fmt"
"github.com/Songmu/prompter"
"github.com/kballard/go-shellquote"
"github.com/spf13/cobra"
"github.com/takumakume/kubectl-credentials-broker/credentials"
"github.com/takumakume/kubectl-credentials-broker/kubeconfig"
)
var defaultExecAPIVersion = (&credentials.V1Beta1{}).APIVersionStri... |
package user
import (
"context"
"time"
"github.com/go-gorp/gorp"
"github.com/ovh/cds/engine/api/database/gorpmapping"
"github.com/ovh/cds/sdk"
"github.com/ovh/cds/sdk/log"
)
func getAll(ctx context.Context, db gorp.SqlExecutor, q gorpmapping.Query, opts ...LoadOptionFunc) ([]sdk.AuthentifiedUser, error) {
us... |
package packet
import (
"fmt"
"net"
"strings"
"time"
"github.com/tinkerbell/boots/conf"
)
// models_tinkerbell.go contains the interface methods specific to DiscoveryTinkerbell and HardwareTinkerbell structs
// DiscoveryTinkerbellV1 presents the structure for tinkerbell's new data model, version 1
type Discove... |
package dbmeta
import (
"database/sql"
"fmt"
"regexp"
"strings"
"github.com/jimsmart/schema"
)
// LoadMysqlMeta fetch db meta data for MySQL database
func LoadMysqlMeta(db *sql.DB, sqlType, sqlDatabase, tableName string) (DbTableMeta, error) {
m := &dbTableMeta{
sqlType: sqlType,
sqlDatabase: sqlDataba... |
// Copyright (c) 2018-2021 Splunk 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 appl... |
// Copyright 2014 The goyy Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package xhttp
import (
"net/http"
"gopkg.in/goyy/goyy.v0/comm/profile"
"gopkg.in/goyy/goyy.v0/comm/xtype"
"gopkg.in/goyy/goyy.v0/util/strings"
"gopkg.... |
// Licensed to the LF AI & Data foundation 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 use th... |
// Copyright (c) 2017 Cisco 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 required by applicabl... |
// Package veild is the main veil package for handling DNS to DNS-over-TLS connections.
package veild
import (
"log"
"net"
"os"
"os/signal"
"strconv"
"syscall"
"time"
)
// Config represents the command line options.
type Config struct {
ListenAddr string
Caching bool
OutboundPort uint
BlacklistFi... |
package oracle
import (
"context"
"encoding/json"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/loomnetwork/go-loom"
"githu... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package lambda
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/lambda/types"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smithy-go/m... |
package render
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
"capact.io/capact/pkg/engine/k8s/api/v1alpha1"
"capact.io/capact/pkg/sdk/apis/0.0.1/types"
"sigs.k8s.io/yaml"
)
const manifestsExtension = ".yaml"
type ManifestStore struct {
Implementations map[v1alpha1... |
package godotenv
import (
"bytes"
"fmt"
"io"
"math"
)
// An ordered map implementation.
//
// See also: https://github.com/wk8/go-ordered-map
type Pair struct {
Key, Val string
}
type EnvMap struct {
entries []Pair
keys map[string]int
}
func NewEnvMap() *EnvMap {
return &EnvMap{keys: make(map[string]int... |
// Copyright 2017 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 (c) 2019 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... |
/*
* Copyright 2019, <NAME>
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
package main
import (
"encoding/base64"
"encoding/hex"
"flag"
"fmt"
"io/ioutil"
"log"
"math/rand"
"strconv"
"strings"
"time"
... |
package main
import (
"bytes"
"encoding/binary"
"flag"
"fmt"
"log"
"net"
"os"
"os/signal"
"sync/atomic"
"time"
)
func main() {
ping()
}
/*ICMPHeader is the packet form of ICMP Packet*/
type ICMPHeader struct {
Type uint8
Code uint8
CheckSum uint16
Identifier uint16
SeqNum uint16
Da... |
// Copyright (c) 2018 Cisco 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 required by applicabl... |
package main
import (
"context"
"crypto/tls"
"flag"
"fmt"
stdlog "log"
"net/http"
"os"
"time"
"github.com/gorilla/mux"
admissioncontrol "github.com/abays/admission-control"
log "github.com/go-kit/kit/log"
)
type conf struct {
TLSCertPath string
TLSKeyPath string
HTTPOnly bool
Port string
... |
package main
import (
"context"
"database/sql"
"flag"
"fmt"
"io"
"log"
"strings"
"time"
"github.com/denisbrodbeck/migrathor"
"github.com/peterbourgon/ff"
_ "github.com/lib/pq"
)
// ParseAndRun parses the command line, and then runs the passed commands.
func ParseAndRun(stdout, stderr io.Writer, stdin io.... |
// Code generated by monitor-code-gen. DO NOT EDIT.
package ecs
import (
"github.com/signalfx/golib/v3/datapoint"
"github.com/signalfx/signalfx-agent/pkg/monitors"
)
const monitorType = "ecs-metadata"
const (
groupBlkio = "blkio"
groupCPU = "cpu"
groupMemory = "memory"
groupNetwork = "network"
)
var g... |
package configures
import (
"github.com/dynuc/gophercloud"
"github.com/dynuc/gophercloud/pagination"
"strconv"
)
type commonResult struct {
gophercloud.Result
}
type PublicIp struct {
// Specifies the configuration parameter for creating an EIP that
// will be automatically assigned to the ECS.
Eip Eip `json:... |
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-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 obtain a copy of the Li... |
// 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 Datadog, Inc.
//go:build appsec
// +build appsec
package appsec
import (
"context"
"fmt"
"... |
package pr
import (
"fmt"
"github.com/jenkins-x-plugins/jx-updatebot/pkg/apis/updatebot/v1alpha1"
"github.com/jenkins-x/go-scm/scm"
"github.com/jenkins-x/jx-helpers/v3/pkg/helmer"
"github.com/jenkins-x/jx-helpers/v3/pkg/options"
"github.com/jenkins-x/jx-helpers/v3/pkg/stringhelpers"
"github.com/jenkins-x/jx-hel... |
// 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... |
//nolint:bodyclose
package routes
import (
"bytes"
"context"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"getsturdy.com/api/pkg/auth"
service_auth "getst... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// metago is a tool to .....
//
//
//
package main
import (
"fmt"
"io"
"os"
"path/filepath"
"sort"
"github.com/nu7hatch/gouuid"
"gopkg.in/alecthomas/kingpin.v1"
)
... |
package mysql
import (
"context"
"database/sql"
"strings"
"testing"
"time"
"github.com/fleetdm/fleet/v4/server"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLocks(t *testing.T) {
ds := CreateMySQLDS(t)
defer ds.Close()
cases := []struct {
name string
fn func... |
// Copyright 2014 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... |
/*
Copyright (c) 2020 SAP SE or an SAP affiliate company. 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 applic... |
package utility
import (
"flag"
"fmt"
"testing"
)
type ParameterCommon struct {
Thread int `cui_param:"name: 'thread', init: 10, desc: 'working thread count'"`
Debug bool `cui_param:"name: 'debug', init: false, desc: 'enable debug log or not'"`
}
type Parameter struct {
ParameterCommon
InputFile string `c... |
/*
Copyright 2016 The Kubernetes 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 law or ag... |
// Build tasks for the GitHub CLI project.
//
// Usage: go run script/build.go [<task>]
//
// Known tasks are:
//
// bin/gh:
// Builds the main executable.
// Supported environment variables:
// - GH_VERSION: determined from source by default
// - GH_OAUTH_CLIENT_ID
// - GH_OAUTH_CLIENT_SECRET
//... |
package merkletree
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"testing"
)
type leafTestVector struct {
inputLength int64
input []byte
output []byte
}
// Inputs and outputs are of fixed digest size.
type nodeTestVector struct {
left []byte
right []byte
output []byte
}
type testVector str... |
/*
Copyright 2020.
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 2020 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
package websocket
import (
"encoding/json"
"errors"
"fmt"
"log"
"math"
"sync"
"time"
"github.com/shaunmza/golos-go/types"
"github.com/gorilla/websocket"
)
var (
ErrShutdown = errors.New("connection is shut down")
writeWait = 10 * time.Second
pongWait = 60 * time.Second
pingPeriod = (pongWait * 9) ... |
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package api
import (
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"sync"
"github.com/gorilla/handlers"
"github.com/rs/cors"
"github.com/ava-labs/gecko/snow"
"github.com/ava-labs/gecko/snow/engine/common"... |
/*
* MinIO Cloud Storage, (C) 2019 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 applicable la... |
package main
import (
"bufio"
"bytes"
"container/heap"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
tc := readNum(reader)
var buf bytes.Buffer
for tc > 0 {
tc--
m, n, k := readThreeNums(reader)
A := make([][]int, m)
for i := 0; i < m; i++ {
A[i] = readNNums(reader, n)
}
D := ... |
// Copyright 2015 The Cayley 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 ap... |
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
/*
* Minio Cloud Storage, (C) 2016, 2017 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 applica... |
// sips ref
// https://github.com/google/gopacket/blob/master/layers/sip.go
// https://github.com/marv2097/siprocket/blob/master/sipRequestLine.go
package sips
import (
"bytes"
"fmt"
"strconv"
"strings"
)
// SIPRequest the Request-URI is a SIP or SIPS URI as described in
// Section 19.1 or a general URI (RFC 2396... |
package server
import (
"flag"
"io"
"net/http"
"os"
"github.com/NYTimes/logrotate"
"github.com/go-kit/kit/metrics/provider"
"github.com/gorilla/handlers"
"github.com/NYTimes/gizmo/config"
"github.com/NYTimes/gizmo/config/metrics"
)
// Config holds info required to configure a gizmo server.Server.
type Conf... |
package action
import (
"fmt"
"log"
"strings"
"github.com/gobuffalo/flect"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k... |
// Copyright © 2017 Circonus, Inc. <<EMAIL>>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package check
import (
"fmt"
"regexp"
"strings"
"github.com/circonus-labs/circonus-agent/internal/config"
"github.com/circonus-labs/circonus-agent/internal/conf... |
/**
* WSSH
*
* @abstract WebSocketShell
* @version 1.0.0
* @author Wildlife <<EMAIL>>
* @link https://lanseyujie.com
*/
package wssh
import (
"crypto/x509"
"encoding/json"
"encoding/pem"
"errors"
"golang.org/x/crypto/ssh"
"golang.org/x/net/websocket"
"log"
"net"
"... |
package wechatpay
import (
"encoding/xml"
"fmt"
"strings"
)
import (
"github.com/sanxia/glib"
)
/* ================================================================================
* UnifiedOrderRequest数据域结构
* qq group: 582452342
* email : <EMAIL>
* author : 美丽的地球啊 - mliu
* ===============================... |
package googledrive
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"gitlab.com/velvetkeyboard/go-quickbackup/utils"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/api/drive/v3"
)
const (
FOLDER_MIME_TYPE = "appli... |
package redis
import (
"errors"
"strconv"
)
//* Reply
/*
ReplyType describes type of a reply.
Possbile values are:
ReplyStatus -- status reply
ReplyError -- error reply
ReplyInteger -- integer reply
ReplyNil -- nil reply
ReplyString -- string reply (bulk reply)
ReplyMulti -- multi-bulk or multicall reply
*/
typ... |
package v1
import (
www "github.com/decred/politeia/politeiawww/api/www/v1"
)
type InvoiceStatusT int
type LineItemTypeT int
const (
// Contractor Management Routes
RouteInviteNewUser = "/invite"
RouteRegisterUser = "/register"
RouteNewInvoice = "/invoices/new"
RouteEditInvoice = "/invoices/... |
package jmx
import (
"bufio"
"bytes"
"context"
"flag"
"fmt"
"os"
"runtime"
"strings"
"testing"
"time"
"github.com/newrelic/infra-integrations-sdk/v4/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
timeoutMillis = 1500
openAttempts = 10
// jmx mock cmds
cmdE... |
package errormessage
import (
"strconv"
"strings"
"sync"
)
// StatusOK = 200 // RFC 7231, 6.3.1
// StatusCreated = 201 // RFC 7231, 6.3.2
// StatusAccepted = 202 // RFC 7231, 6.3.3
// StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4
// StatusNoContent = 204 ... |
package continuous
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
"time"
git "github.com/go-git/go-git/v5"
gitConfig "github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/kballard/go-shellquote"
log "github.com/sir... |
package ably_test
import (
"context"
"fmt"
"net/url"
"reflect"
"testing"
"time"
"github.com/ably/ably-go/ably"
"github.com/ably/ably-go/ablytest"
)
func expectMsg(ch <-chan *ably.Message, name string, data interface{}, t time.Duration, received bool) error {
select {
case msg := <-ch:
if !received {
r... |
// Copyright 2019 Shift Devices AG
//
// 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 github
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"
"k8s.io/kubernetes/pkg/util/sets"
"github.com/RangelReale/osincli"
"github.com/golang/glog"
authapi "github.com/openshift/origin/pkg/auth/api"
"github.com/openshift/origin/pkg/auth/oauth/external"
"github.com/openshift/origin/pkg... |
package httpserver
/*
Onix Config Manager - Http Client
Copyright (c) 2018-2021 by www.gatblau.org
Licensed under the Apache License, Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0
Contributors to this project, hereby assign copyright in this code to the project,
to be licensed under the same term... |
// Copyright 2021 ADA Logics 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 to... |
package domain
import (
"time"
"log"
"strconv"
"net/http"
"io/ioutil"
"sort"
"strings"
"net/url"
"encoding/json"
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"crypto/md5"
"encoding/hex"
)
const host string = "http://alidns.aliyuncs.com";
type aliyunDns struct {
Appid string
Appsecrt string
}
func... |
package middleware
import (
"context"
"io"
"strings"
)
// Stack provides protocol and transport agnostic set of middleware split into
// distinct steps. Steps have specific transitions between them, that are
// managed by the individual step.
//
// Steps are composed as middleware around the underlying handler in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.