text stringlengths 3.08k 10.4k |
|---|
// Copyright 2018 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, ... |
/*
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 obtain a copy of... |
package main
import (
"fmt"
"net/http"
"path/filepath"
"github.com/go-chi/chi"
"github.com/BurntSushi/toml"
"log"
"net/url"
"os"
"strings"
// "flag"
// "strconv"
"github.com/vulcand/oxy/forward"
)
var global globalType
type globalType struct {
appName string
folder string
config tomlConfig
}
... |
package ungraph
import "fmt"
type EdgeInfo int // EdgeInfo, e.g. weight
type VertexType interface{} // VertexType, e.g. 1, 2, 3 or A, B, C
type Edge struct {
isVisited bool // mark that whether the current edge is visited
uIdx, vIdx int // the index of two vertices of the current ... |
/*
Copyright (C) 2018 Synopsys, Inc.
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
"... |
package term
import (
"bytes"
"fmt"
"io"
)
var logWriterDetail = false
// Writer represents the output to a terminal.
type Writer interface {
// CurrentBuffer returns the current buffer.
CurrentBuffer() *Buffer
// ResetCurrentBuffer resets the current buffer.
ResetCurrentBuffer()
// CommitBuffer updates the ... |
// headers.go implements "Q" encoding as specified by RFC 2047.
//Modified from https://github.com/joegrasse/mime to use with Go Simple Mail
package mail
import (
"bufio"
"bytes"
"fmt"
"io"
"strings"
"unicode/utf8"
)
type encoder struct {
w *bufio.Writer
charset string
usedChars int
}
// newEncod... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
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/rekognition/types"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/s... |
package tests_test
import (
"context"
"encoding/json"
"fmt"
"time"
v1 "k8s.io/api/core/v1"
kubevirtcorev1 "kubevirt.io/client-go/apis/core/v1"
k8smetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
kvtutil "kubevirt.io... |
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0
package schema
import (
"bytes"
"fmt"
"log"
"sort"
"strings"
"text/template"
"github.com/k14s/ytt/pkg/filepos"
"github.com/k14s/ytt/pkg/spell"
"github.com/k14s/ytt/pkg/yamlmeta"
)
const schemaErrorReportTemplate = `
{{- if .Summary}}
{{.... |
package adapters
import (
"cloud.google.com/go/bigquery"
"context"
"fmt"
"github.com/ksensehq/eventnative/schema"
"google.golang.org/api/googleapi"
"log"
"net/http"
"strings"
)
var (
SchemaToBigQuery = map[schema.DataType]bigquery.FieldType{
schema.STRING: bigquery.StringFieldType,
}
BigQueryToSchema = ... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package request
import (
"github.com/galaxy-future/BridgX/internal/model"
"github.com/galaxy-future/BridgX/internal/service"
)
type TagRequest struct {
ClusterName string `json:"cluster_name" binding:"required,min=1"`
Tags map[string]string `json:"tags" binding:"required"`
}
type GetTagsRequest... |
// Copyright (c) 2016 BLOCKO INC.
package blockchain
import (
"fmt"
"github.com/coinstack/coinstackd/btcec"
"github.com/coinstack/coinstackd/chaincfg"
"github.com/coinstack/coinstackd/coinstack/permission"
"github.com/coinstack/coinstackd/database"
"github.com/coinstack/coinstackd/txscript"
"github.com/coinsta... |
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package cmd
import (
"context"
"sync"
"time"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kstatus/status"
"sigs.k8s.io/kustomize/kstatus/wait"
"sigs.k8s.io/kustomize/kstatus/kustomize/internal/commands... |
package handlers
import (
"time"
"github.com/influx6/backoffice/db"
"github.com/influx6/backoffice/models/session"
"github.com/influx6/backoffice/models/user"
"github.com/influx6/faux/sink"
"github.com/influx6/faux/sink/sinks"
)
// DeferredSessionsFactory returns a function which allows easily create a new cop... |
package main
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
"strconv"
"strings"
)
var SET = struct{}{}
type TimeSlot struct {
start, end string
}
type ScheduleData map[int]map[TimeSlot]map[int]map[int]struct{}
type Schedule struct {
FileName string
Data ScheduleData
}
type ScheduleIface interface {... |
// Copyright (c) 2018 <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, distri... |
package mdnotify
import (
"errors"
"io/ioutil"
"os"
"strings"
)
type MdManager struct {
folder string
Papers map[string]*MarkDown // 使用文件名md5作为key
SortIndex []string // 排序号对应文件名md5,可能多个
TitleIndex map[string]string // 标题倒排索引
ClassIndex map[string]map[string]uint8 // 类别倒排索引
//ExtraTagIndex map[string][string... |
/*
Copyright 2019 PlanetScale 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, softwar... |
package acquire
import (
"bytes"
"context"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"log"
"time"
"github.com/earthcubearchitecture-project418/gleaner/internal/common"
"github.com/mafredri/cdp"
"github.com/mafredri/cdp/devtool"
"github.com/mafredri/cdp/protocol/page"
"github.com/mafredri/cdp/pro... |
/*
Copyright 2019 Netfoundry, 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
// Code generated by go-swagger; DO NOT EDIT.
package asynchronous_replication
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"... |
// Copyright 2017 Blues Inc. All rights reserved.
// Use of this source code is governed by licenses granted by the
// copyright holder including that found in the LICENSE file.
package notecard
import (
"bufio"
"fmt"
"os"
"strings"
"sync"
"time"
"github.com/blues/note-go/note"
)
// Interactive I/O
var iInp... |
// *** 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 v1
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new canary evaluation for an organ... |
package norta
import (
"context"
"github.com/geops/gtfsparser"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/twpayne/go-geom"
"github.com/twpayne/go-geom/encoding/ewkbhex"
)
type Repo struct {
conn *pgxpool.Pool
}
func NewRepo(conn *pgxpool.Pool) *Repo {
return &Repo{
conn: conn,... |
package base
import (
"context"
"errors"
"fmt"
"strings"
"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/hcapi2"
"github.com/hetznercloud/cli/internal/state"
"github.com/spf13/cobra"
)
// LabelCmds allows defining commands... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package macie2
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/macie2/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smit... |
package security
import (
"crypto/tls"
"encoding/json"
"errors"
"net/http"
"strings"
"github.com/graphql-editor/stucco/pkg/utils"
)
// CertAuth is a certificate auth for function
type CertAuth struct {
Cert []byte
Key []byte
Renegotation tls.RenegotiationSupport
}
const (
pemStart = "... |
// Copyright 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package discovery
import (
"fmt"
"testing"
"time"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/cache"
"github.com/wavefronthq/wavefront-collector-for-kubernetes/internal/discovery"
"github.com/stretchr/testify/asse... |
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"time"
"github.com/cwntr/go-dex-client/pkg/common"
"github.com/sirupsen/logrus"
"context"
"net/http"
"os"
"os/signal"
"sync"
"syscall"
"github.com/cwntr/go-dex-client/trading"
)
var (
cfg Config
logger *logrus.Entry
bot *trading.Bot
)
fu... |
/*
* Copyright 2018 De-labtory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in w... |
package batch
import (
"container/heap"
"sort"
"github.com/cortexproject/cortex/pkg/chunk"
promchunk "github.com/cortexproject/cortex/pkg/chunk/encoding"
)
type mergeIterator struct {
its []*nonOverlappingIterator
h iteratorHeap
// Store the current sorted batchStream
batches batchStream
// Buffers to m... |
// Package microsoftonline implements the OAuth2 protocol for authenticating users through microsoftonline.
// This package can be used as a reference implementation of an OAuth2 provider for Goth.
// To use this package, your application need to be registered in [Application Registration Portal](https://apps.dev.micro... |
// Copyright (C) 2019-2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package platformvm
import (
"bytes"
"fmt"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/vms/components/avax"
safemath "github.com/ava-labs/avalanchego/utils/math"
)
// getPagin... |
package main
import (
"fmt"
"log"
"sort"
"sync"
"time"
)
var doDelete bool
var noOp bool
func init() {
usage := "[options] [additional buckyd servers...]"
short := "Rebalance a server or the entire cluster."
long := `Locate metrics on the wrong server and move them.
Rebalance is a non-destructive operation ... |
package aliyun
import (
"VGO/pkg/curl"
"encoding/binary"
"encoding/json"
"fmt"
"strconv"
"sync"
"time"
)
var (
audioUrl = "https://nls-gateway.cn-shanghai.aliyuncs.com/stream/v1/asr"
rate = 16000 //采样率
second = 1
frameSize = rate * 2 * second //1s的数据大小:采样率*一个采样点的数据大小2byte
//intervel = 10 * ti... |
package main
import (
"cloud.google.com/go/bigquery"
"google.golang.org/api/youtube/v3"
"sync"
"sync/atomic"
)
// Comment struct represents info about youtube comment
type Comment struct {
Id string
AuthorDisplayName string
AuthorProfileImageUrl string
AuthorChannelUrl string
Auth... |
/*
Copyright 2016 The Kubernetes Authors.
Copyright 2021 The MetalLB 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 appl... |
// Copyright 2012 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 runtime_test
import (
"io"
"io/ioutil"
"os"
"os/exec"
. "runtime"
"runtime/debug"
"strconv"
"strings"
"testing"
"unsafe"
)
var errf error
... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
package transport
import (
"fmt"
"io/ioutil"
"net"
"os"
"strconv"
"time"
"github.com/google/uuid"
"github.com/insomniacslk/xjson... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package lambda
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
"github.com/aws/aws-sdk-go-v2/private/protocol/restjson"
)
type DeleteFunctio... |
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
"github.com/vmware-samples/vcenter-event-broker-appliance/vmware-event-router/internal/color"
"github.com/vmware-samples/vcenter-event-broker-appliance/vmware-event-router/internal/connection"
"github.com/vmware-samples/vc... |
// Copyright 2014 The Sporting Exchange Limited. All rights reserved.
// Use of this source code is governed by a free license that can be
// found in the LICENSE file.
// Package control implements control handlers for collect-statse(8)
package control
import (
"encoding/xml"
"fmt"
"log"
"net/http"
"net/url"
... |
package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"errors"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/converter"
"strings"
)
// 目的端服务器
type TargetServer struct {
// 源端在SMS数据库中的ID
Id *string `json:"id,omitempty"`
// 源端服务器ip,注册源端时必选,更新非必选
Ip string `json:"ip"`
// 目的端服... |
// Copyright 2017 <NAME>. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package core
import (
"errors"
"sync"
"time"
"github.com/OWASP/Amass/amass/utils"
)
const (
// ServiceRequestChanLength is the length of the chan that pulls requests ... |
package types
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
sdk "github.com/cosmos/cosmos-sdk/types"
emint "github.com/cosmos/ethermint/types"
)
// Stat... |
package clog
import (
"fmt"
"io"
"os"
"strconv"
)
func (l Level) String() string {
switch l {
case TraceLevel:
return "trace"
case DebugLevel:
return "debug"
case InfoLevel:
return "info"
case WarnLevel:
return "warn"
case ErrorLevel:
return "error"
case FatalLevel:
return "fatal"
case PanicLe... |
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"os"
"sort"
"strconv"
"time"
"github.com/gorilla/mux"
_ "github.com/heroku/x/hmetrics/onload"
"github.com/umahmood/haversine"
)
func main() {
// Ensure the port has been set
port := os.Getenv("PORT")
if port == "" {
log.Fatal("$PORT m... |
package vaulttoken
import (
"errors"
"fmt"
"os"
"strconv"
"github.com/hashicorp/vault/api"
"github.com/hootsuite/vault-ctrl-tool/v2/briefcase"
"github.com/hootsuite/vault-ctrl-tool/v2/util"
"github.com/hootsuite/vault-ctrl-tool/v2/vaultclient"
"github.com/rs/zerolog"
zlog "github.com/rs/zerolog/log"
)
var ... |
// The MIT License (MIT)
//
// Copyright (c) 2014 <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, mo... |
package parse
import (
"fmt"
"os"
"reflect"
"strings"
"sync"
"github.com/moby/buildkit/frontend/dockerfile/parser"
"github.com/safe-waters/docker-lock/pkg/generate/collect"
"github.com/safe-waters/docker-lock/pkg/kind"
)
type dockerfileImageParser struct {
kind kind.Kind
}
// NewDockerfileImageParser retur... |
// Copyright 2018 <NAME>. All rights reserved.
// This source code was released under the MIT license.
// Package tile provides image tilling composition.
package tile
import (
"image"
"image/color"
"io"
"golang.org/x/image/draw"
)
// Default scaler
var scaler draw.Scaler = draw.ApproxBiLinear
// DefaultFormat... |
package coindata
import (
"math"
"sync"
"time"
"github.com/tebben/moonfolio/cryptocompare"
"github.com/tebben/moonfolio/transactions"
)
const (
// Empty contains a number which can be used to check if something was not set
Empty = -99999.99999
)
// Histo contains historical price data
type Histo struct {
Ti... |
package cdp
import (
"context"
"encoding/json"
"os"
"sync/atomic"
"github.com/ysmood/kit"
"github.com/ysmood/rod/lib/launcher"
)
// Client is a chrome devtools protocol connection instance.
type Client struct {
ctx context.Context
ctxCancel func()
ctxCancelErr error
url string
ws Websocketab... |
/*
package psync offers some sync helper types and functions.
*/
package pksync
import (
"context"
"errors"
"fmt"
)
// ErrWaitGroupClosed is returned when Delta() or Done() are called on a closed
// CtxWaitGroup.
var ErrWaitGroupClosed = errors.New("CtxWaitGroup is closed")
// waitEvent is used internally to send... |
// +build linux
package namespaces
import (
"encoding/json"
"io"
"os"
"os/exec"
"syscall"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/cgroups"
"github.com/docker/libcontainer/cgroups/fs"
"github.com/docker/libcontainer/cgroups/systemd"
"github.com/docker/libcontainer/network"
"github.... |
package redis
import (
"github.com/plexmediamanager/micro-redis/errors"
format "fmt"
"github.com/plexmediamanager/service/helpers"
"github.com/go-redis/redis/v7"
"strings"
"time"
)
type RedisClient struct {
host string
port int
endpoints []string
pas... |
package goxbm
import (
"bytes"
"errors"
"fmt"
"math"
"strconv"
)
// #define volume_100_width 23
// #define volume_100_height 16
// static unsigned char volume_100_bits[] = {
// 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x6c,
// 0x00, 0x80, 0x6d, 0x00, 0x80, 0x6d, 0x00, 0xb0, 0x6d, 0... |
/*
* @Author: calmwu
* @Date: 2018-09-20 16:26:11
* @Last Modified by: calmwu
* @Last Modified time: 2018-09-29 11:25:26
*/
package routersvr
import (
base "doyo-server-go/doyo-base-go"
"doyo-server-go/doyo-routersvr-go/doyo-kafka-go/doyokafka"
"doyo-server-go/doyo-routersvr-go/proto"
"sync"
"time"
"githu... |
// +build windows
package smartcard
import (
"fmt"
"github.com/marknijboer/go-card/smartcard/pcsc"
"time"
)
// A smart card context is required to access readers and cards.
type Context struct {
ctxID uintptr
winscard *pcsc.WinscardWrapper
}
// Establish smart card context.
// This should be the first funct... |
// Code generated by go-swagger; DO NOT EDIT.
package intel
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go... |
package main
import (
"context"
"fmt"
"log"
"strconv"
"strings"
"time"
"github.com/ericchiang/k8s"
corev1 "github.com/ericchiang/k8s/apis/core/v1"
metav1 "github.com/ericchiang/k8s/apis/meta/v1"
"github.com/jamiealquiza/tachymeter"
)
type podrun struct {
Loadtype string
Client *k8s.Client
Namespac... |
//
// Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.
//
// Licensed under the Universal Permissive License v 1.0 as shown at
// https://oss.oracle.com/licenses/upl/
//
// Package logger provides logging functionality.
package logger
import (
"fmt"
"io"
"log"
"os"
)
// LogLevel defin... |
package keeper
import (
"time"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported"
"git... |
// Copyright © 2022 Cisco Systems, Inc. and its affiliates.
// 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
//... |
package service
import (
"errors"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
"log"
"magpie-gateway/perms"
"magpie-gateway/store"
"magpie-gateway/store/models"
"net/http"
"net/http/httputil"
"sync"
"sync/atomic"
)
type Manager struct {
... |
// Copyright 2018 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, ... |
/*
* Copyright 2018 The CovenantSQL 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 ... |
// Code generated by entc, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"entgo.io/ent/dialect/sql"
"github.com/realotz/whole/internal/apps/admin/data/ent/permission"
)
// Permission is the model entity for the Permission schema.
type Permission struct {
config `json:"-"`
// ID of the ent.
ID int... |
// Copyright 2021 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... |
/*
* @Author: <NAME>
* @Description:
* @Date: 2021-08-03 19:30:12
*/
// Go support for Protocol Buffers RPC which compatiable with https://github.com/Baidu-ecom/Jprotobuf-rpc-socket
//
// Copyright 2002-2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you... |
package main
import (
"fmt"
"strings"
"unicode"
)
/*
检索字符串
中文文档
https://studygolang.com/pkgdoc
1、func Contains(s, substr string) bool
判断字符串s是否包含substr字符串
2、func ContainsAny(s, chars string) bool
判断字符串s是否包含chars字符串中的任一字符
3、func ContainsRune(s string, r rune) bool
判断字符串s是否包含unicode码值r
4、func Count(s, sep strin... |
// Copyright 2016 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.
// This file implements printing of syntax tree structures.
package syntax
import (
"fmt"
"io"
"reflect"
"unicode"
"unicode/utf8"
)
// Fdump dumps the s... |
package main
import (
"context"
"fmt"
"html/template"
"log"
"net/http"
"os"
"strings"
"speakers/crypto"
"speakers/db"
"speakers/talks"
"speakers/types"
"speakers/users"
"github.com/BurntSushi/toml"
"github.com/gorilla/mux"
"gopkg.in/mgo.v2"
)
const (
testPassword1 = "<PASSWORD>"
testPassword2 = "🎍... |
package skiplist
import (
"math/rand"
"time"
"fmt"
)
// Key 需要支持nil
type Key interface {
Compare(other interface{}) int
}
var _NilKey Key = nil
// Value
type Value interface{}
// 节点信息
type node struct {
key Key
value Value
// 指向下一个节点
forwards []*node
}
// level: [0, maxLevel]
func newNode(level int, key... |
// Copyright 2011 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 of the
// Go Project, at golang.org/LICENSE and in LICENSE-GO.
package main
import (
"bytes"
"flag"
"fmt"
"io"
"log"
"os"
"os/exec"
"strings"
"sync"
... |
package hazana
import (
"encoding/json"
"flag"
"io/ioutil"
"log"
"os"
"time"
)
const (
fRPS = "rps"
fAttackTime = "attack"
fRampupTime = "ramp"
fMaxAttackers = "max"
fOutput = "o"
fVerbose = "verbose"
fSample = "t"
fRampupStrategy = "s"
fDoTimeout = "tim... |
// SPDX-FileCopyrightText: 2021 The go-metafeed Authors
//
// SPDX-License-Identifier: MIT
// Package metafeed implements the SSB metafeed spec to enable partial replication.
package metafeed
import (
"bytes"
"fmt"
"time"
"github.com/ssb-ngi-pointer/go-metafeed/internal/bencodeext"
"github.com/zeebo/bencode"
r... |
// *** 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 alpha
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Returns the specified TargetTcpProxy resource. Gets a list of avai... |
// Package mux is a high performance HTTP request router, also called
// multiplexer or just mux.
//
// Example:
//
// package main
//
// import (
// "log"
// "net/http"
//
// "github.com/pinub/mux/v3"
// )
//
// func index(w http.ResponseWriter, r *http.Request) {
// w.Write([]byte(`Welcome to index!`))
//... |
package initialise
import (
"context"
"fmt"
"github.com/ONSdigital/dp-dimension-extractor/config"
"github.com/ONSdigital/dp-dimension-extractor/service"
"github.com/ONSdigital/dp-healthcheck/healthcheck"
kafka "github.com/ONSdigital/dp-kafka/v2"
"github.com/ONSdigital/dp-reporter-client/reporter"
s3client "gi... |
package catalog
import (
"fmt"
"sync"
"time"
consulapi "github.com/hashicorp/consul/api"
"github.com/hashicorp/go-hclog"
)
const (
// WaitTime is the max time (in seconds) to wait before polling Consul for updates
WaitTime = 10
)
type consul struct {
client *consulapi.Client
log hclog.Logger
ns1P... |
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... |
package pagination
import (
"bytes"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
tests := []struct {
tag string
page, perPage, total int
expected... |
package auth
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
"github.com/cloudfoundry-incubator/stratos/src/jetstream/repository/interfaces"
"github.com/labstack/echo/v4"
log "github.com/sirupsen/logrus"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"githu... |
// Copyright 2018-2021 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package kratos
import (
"crypto/tls"
"errors"
"fmt"
"net/http"
"strings"
"time"
"github.com/go-kit/kit/log"
"github.com/gorilla/websocket"
"github.com/xmidt-org/webpa-common/device"
"github.com/xmidt-org/webpa-common/logging"
)
const (
// Time allowed to write a message to the peer.
writeWait = time.Dura... |
/*
Copyright 2021 ToucanSoftware.
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 2017 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by the MIT-styled
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"bytes"
"errors"
"net/textproto"
"os"
"os/exec"
"strings"
"time"
"github.com/nsf/termbox-go"
)
// ComposeBuffer is a MailBu... |
package main
import (
"fmt"
"github.com/google/go-github/v32/github"
"github.com/robfig/cron/v3"
"github.com/tidwall/gjson"
"log"
"net/http"
"net/smtp"
"os"
"os/exec"
"path"
"strconv"
"strings"
)
const (
checkoutDir = "/data"
liveOut = "/live"
betaOut = "/beta"
sourceWebh... |
package diskv
import (
"bytes"
"io/ioutil"
"math/rand"
"sync"
"testing"
"time"
)
// ReadStream from cache shouldn't panic on a nil dereference from a nonexistent
// Compression :)
func TestIssue2A(t *testing.T) {
d := New(Options{
BasePath: "test-issue-2a",
CacheSizeMax: 1024,
})
defer d.EraseAll()
... |
package main
import (
"encoding/base64"
"errors"
"log"
"strings"
"sync"
"github.com/gorilla/websocket"
)
type ScanMessageType string
const (
PackageMessage ScanMessageType = "package"
SummaryMessage ScanMessageType = "summary"
)
type PackageScanMessage struct {
Type ScanMessageType `js... |
/*
* 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 u... |
//
// date : 2016-05-16
// author: feng92f
//
package k1
import (
"bytes"
"io"
"net"
"sync"
"time"
"github.com/feng92f/kone/tcpip"
)
type UDPTunnel struct {
session *NatSession
record *DomainRecord
cliaddr *net.UDPAddr
localConn *net.UDPConn
remoteConn *net.UDPConn
}
func (tunnel *UDPTunnel) Se... |
package oauth
import (
"context"
"crypto/hmac"
"crypto/sha512"
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"github.com/blend/go-sdk/ex"
"github.com/blend/go-sdk/r2"
"github.com/blend/go-sdk/stringutil"
"github.com/blend/go-sdk/uuid"
"github.com/blend/go-sdk/webutil"
"golang.o... |
// Copyright (C) 2020 Cisco Systems 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 agr... |
package modules
import (
"fmt"
"regexp"
"strings"
"github.com/jojomi/calm-defusor/communication"
"github.com/jojomi/calm-defusor/state"
"github.com/rs/zerolog/log"
)
type MorseModule struct {
maxWordLength int
morseLetters []string
}
func (x MorseModule) Name() string {
return "Morsecode"
}
func (x Morse... |
package main
import (
"fmt"
"runtime"
"time"
"os"
"sync/atomic"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/dji/tello"
"gobot.io/x/gobot/platforms/joystick"
)
var drone = tello.NewDriver("8888")
type pair struct {
x float64
y float64
}
var leftX, leftY, rightX, rightY atomic.Value
const offset = 32... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.