text stringlengths 3.08k 10.4k |
|---|
// Copyright 2019 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... |
package graphs
// Copyright © 2018 <NAME> Trading
// 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... |
// Licensed to LinDB under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. LinDB licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compli... |
package channels
import (
"bytes"
"context"
"fmt"
"mime/multipart"
"strconv"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models"
"github.com/prometheus/alertmanager/template"
"github.com/prometheus/alertmanager/types"
"github.com/prometheu... |
package dagtraversalmanager
import (
"container/heap"
"github.com/kaspanet/kaspad/domain/consensus/model"
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
)
type blockHeapNode struct {
hash *externalapi.DomainHash
ghostdagData *model.BlockGHOSTDAGData
}
func (left *blockHeapNode) less(ri... |
/*
* Copyright 2018-2021, CS Systemes d'Information, http://csgroup.eu
*
* 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 r... |
package serialize
// messages.go отвечает за имплементацию сериализации сообщений. зашифрованных и незашифрованных.
import (
"bytes"
"encoding/binary"
"fmt"
"github.com/pkg/errors"
"github.com/xelaj/go-dry"
ige "github.com/lonesta/mtproto/internal/aes_ige"
"github.com/lonesta/mtproto/utils"
)
// CommonMessa... |
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"path/filepath"
"strconv"
"strings"
"time"
"k8s.io/api/admission/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
const (
tlsDir = `/run/s... |
package content
import (
"bytes"
"context"
"path/filepath"
"sync"
"sync/atomic"
"github.com/pkg/errors"
"github.com/kopia/kopia/internal/clock"
"github.com/kopia/kopia/repo/blob"
)
// smallIndexEntryCountThreshold is the threshold to determine whether an
// index is small. Any index with fewer entries than ... |
/*
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... |
/*
Command gherkinfmt is a command-line gherkin formater and pretty printer.
Usage
gherkinfmt OPTIONS
Formating Options
-centersteps[=false] control step alignment
-fixands[=false] successive step keywords replaced by 'And'
-nosteps[=false] hide steps
-nocomments[=false] ... |
package util
import (
"fmt"
"os/user"
"testing"
"github.com/sirupsen/logrus"
)
func TestCustomFormatterFormat(t *testing.T) {
type formatterTest struct {
title string
isTerminal bool
entry *logrus.Entry
expected string
}
formatterTests := []formatterTest{
formatterTest{"terminal debug",... |
package api
import (
"context"
"fmt"
"time"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/venus-wallet/core"
"github.com/filecoin-project/ve... |
/*
Copyright 2018 The kube-fledged 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... |
// Copyright 2015 The rkt 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 engine
import (
"fmt"
"github.com/go-gl/gl"
)
var lastProgram Program
type Program struct {
gl.Program
}
func (p Program) Use() {
if lastProgram != p {
p.Program.Use()
lastProgram = p
}
}
type Material interface {
Load() error
Begin(gobj *GameObject)
End(gobj *GameObject)
}
type BasicMaterial ... |
package colors
import (
"fmt"
"math"
"regexp"
"strconv"
"strings"
)
const (
rgbaString = "rgba(%d,%d,%d,%g)"
rgbaCaptureRegexString = "^rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])... |
package exec
import (
"errors"
"strings"
"time"
)
// Pipeline commands pipeline
type Pipeline struct {
// pipeline started
Started bool
// pipeline done
Done bool
// pipeline failed
Failed bool
// pipeline canceld
Canceled bool
// pipline Timedout
Timedout bool
// Cmd pointer slice
PipeCmds []*PipeCmd
... |
package ssh
import (
"errors"
"fmt"
"os"
"os/user"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"github.com/seveas/herd"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
)
var clientVersion = "SSH-2.0-Herd-" + herd.Version()
type strictHostKeyChecking int
const (
no = iota
yes
ask
acc... |
// Copyright 2016 The Netstack 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 arp_test
import (
"testing"
"time"
"github.com/google/netstack/tcpip"
"github.com/google/netstack/tcpip/buffer"
"github.com/google/netstack... |
// Copyright 2018 the u-root 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 dhcp4
import (
"fmt"
"net"
"strings"
"github.com/u-root/u-root/pkg/uio"
)
const (
minPacketLen = 236
// Maximum length of the CHAddr (clie... |
/*
Copyright 2020 <NAME> <<EMAIL>>
and other contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... |
//go:build go1.18
// +build go1.18
package parse
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"math"
"strconv"
"strings"
"testing"
"time"
"github.com/logrusorgru/aurora/v3"
)
func FuzzReadLog(f *testing.F) {
f.Add([]byte(`{}`))
f.Add([]byte(`{"ts": 1234, "level": "info", "msg": "hello"}` + "\n"))
... |
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package admission
import (
"path/filepath"
"testing"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestShouldUpdatePolicyServerDeployment(t *testing.T) {
deployment := createDeployment(1, "sa", "", "image", nil, []corev1.EnvVar{{Name: "env1"}}, map... |
package main
import "fmt"
const (
num1 = iota
num2
num3
num4, num5, num6 = iota, iota, iota
num7 = iota
num8 = iota
)
func computeValue() int {
return 3
}
func SumAndProduct(a, b int) (int, int){
return a+b, a*b
}
func updateMap(key string, value int, pMap map[string]int) {
pMap[key] = value
}
type tes... |
package human
import (
"reflect"
"strings"
"testing"
"time"
"github.com/alecthomas/assert"
"github.com/dustin/go-humanize"
"github.com/scaleway/scaleway-sdk-go/scw"
)
type Struct struct {
String string
Int int
Bool bool
Strings []string
Time time.Time
Struct *Struct
... |
package gate
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
pbRelay "Open_IM/pkg/proto/relay"
"Open_IM/pkg/utils"
"bytes"
"context"
"encoding/gob"
"fmt"
"github.com/golang/protobuf/proto"
"net"... |
package memfs
import (
"errors"
"io"
"os"
)
// Buffer is a usable block of data similar to a file
type Buffer interface {
io.Reader
io.ReaderAt
io.Writer
io.Seeker
io.Closer
// Truncate shrinks or extends the size of the Buffer to the specified size.
Truncate(int64) error
}
// MinBufferSize is the minimal ... |
package influxdb
import (
"context"
"fmt"
"log"
"math"
"github.com/influxdata/flux"
"github.com/influxdata/flux/execute"
"github.com/influxdata/flux/semantic"
platform "github.com/influxdata/influxdb"
"github.com/influxdata/influxdb/tsdb/cursors"
"github.com/pkg/errors"
)
type HostLookup interface {
Hosts... |
package main
/*
Provide a metrics endpoint.
• Provide a metrics endpoint.
• Provide a health endpoint.
• Periodically fetch all pods in k8s cluster and check latency to the pod via ping. Exclude pods that run with hostNetwork: true
*/
import (
"flag"
"fmt"
"math/rand"
"net"
"net/http"
"time"
metav1 "... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ec2
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyVolumeRequest
type ModifyVolumeInput... |
// 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 amass
import (
"context"
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"net"
"strconv"
"time"
"github.com/OWASP/Amass/amass/core"
"github.com/OWASP/Amass/amas... |
/*
* Copyright (C) 2015 Red Hat, 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 Licens... |
// Copyright © 2016 <NAME> & <NAME>.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 278.
// Package memo provides a concurrency-safe non-blocking memoization
// of a function. Requests for different keys proceed in parallel.
// Concurrent requests for the same key block until the first co... |
package maintenance
import (
"context"
"runtime"
"strings"
"sync"
"time"
"github.com/pkg/errors"
"github.com/kopia/kopia/internal/units"
"github.com/kopia/kopia/repo/blob"
"github.com/kopia/kopia/repo/content"
)
const defaultRewriteContentsMinAge = 2 * time.Hour
const parallelContentRewritesCPUMultiplier ... |
package push
import (
"sync"
)
// PushBatchQueue holds the processing and state information
// of a PushBatchQueue.
type PushBatchQueue struct {
worker func([]interface{})
concurrency int
batchSize int
availableWorkers int
depth int
items []in... |
/*
* This module allows upload via mod_http_upload_external
* Also see: https://modules.prosody.im/mod_http_upload_external.html
*/
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"mime"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strconv"... |
package kversion
import (
"math"
"testing"
)
func TestSetMaxKeyVersion(t *testing.T) {
var vs Versions
for i := int16(0); i < math.MaxInt16; i++ {
vs.SetMaxKeyVersion(i, i)
}
for i, v := range vs.k2v {
if int16(i) != v {
t.Errorf("set incorrect: at %d got %d != exp %d", i, v, i)
}
}
}
func TestVersio... |
package db
import (
"context"
"strings"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
appv1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/util/settings"
)
// SecretMaperValidation determine whether the secret should be transformed(i.e. trailing CRLF cha... |
package oracle
import (
"errors"
"github.com/open-policy-agent/opa/ast"
)
// Error defines the structure of errors returned by the oracle.
type Error struct {
Code string `json:"code"`
}
func (e Error) Error() string {
return e.Code
}
// Oracle implements different queries over ASTs, e.g., find definition.
typ... |
package source
import (
"bufio"
"fmt"
"log"
"math/rand"
"sort"
"strconv"
"strings"
"github.com/kiteco/kiteco/kite-go/localfiles"
"github.com/kiteco/kiteco/kite-golib/fileutil"
"github.com/kiteco/kiteco/kite-golib/pipeline"
"github.com/kiteco/kiteco/kite-golib/pipeline/sample"
// postgres driver
_ "githu... |
// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 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 Soft... |
package secret
import (
"bufio"
"bytes"
"fmt"
"io"
"net/textproto"
"sort"
"strings"
)
const (
// Ident is the Gopass MIME secret header
Ident = "GOPASS-SECRET-1.0"
)
var (
// WriteMIME can be disabled to disable writing the new secrets format.
// Use this to ensure secrets written by gopass can be correct... |
package main
import (
"fmt"
"log"
"strings"
"github.com/jmoiron/sqlx"
)
/*
NOTE TO ME.
https://www.postgresql.org/docs/9.6/static/catalog-pg-proc.html
* divide inputs and outputs
* make use of proretset
* if output only 1, it uses prorettype
* otherwise, everything is on proallargtypes
* inputs are always proar... |
package pgproto3
import (
"encoding/binary"
"errors"
"fmt"
"io"
)
// Frontend acts as a client for the PostgreSQL wire protocol version 3.
type Frontend struct {
cr ChunkReader
w io.Writer
// Backend message flyweights
authenticationOk AuthenticationOk
authenticationCleartextPassword Authent... |
// Code generated by go-swagger; DO NOT EDIT.
package support
// 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/... |
package tlsutils
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"errors"
"io/ioutil"
"math/big"
"net"
"os"
"path/filepath"
"time"
log "github.com/Sirupsen/logrus"
)
var (
ErrNotRSAPrivateKey = errors.New("private key is not an RSA key")
)
con... |
package hostedcluster
import (
"context"
"fmt"
"os"
"strings"
v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/rancher/rancher/pkg/catalogv2/system"
"github.com/rancher/rancher/pkg/controllers/dashboard/chart"
controllerv3 "github.com/rancher/rancher/pkg/generated/controllers/manag... |
// Copyright (c) 2016 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... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
package dockerit
import (
"bytes"
"errors"
"fmt"
"os"
"strconv"
"strings"
"text/template"
)
const (
qualifierHost = "Host" // host
qualifierContainerPort = "ContainerPort" // exposed port within container
qualifierTargetPort = "TargetPort" // exposed port within container
qualifierH... |
package archiveorg
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"time"
"github.com/cenkalti/backoff"
log "github.com/sirupsen/logrus"
)
const timestampLayout = "20060102150405"
var (
BaseURL = "https://web.archive.org" ... |
// Package extract provides provides functions for working with compressed files
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
*/
package extract
import (
"archive/tar"
"compress/gzip"
"io"
"github.com/NVIDIA/aistore/3rdparty/glog"
"github.com/NVIDIA/aistore/cluster"
"github.com/NVIDI... |
//----------------------------------------
// 代码由GenlibVcl工具自动生成。
// Copyright © ying32. All Rights Reserved.
//
//----------------------------------------
package vcl
import (
. "github.com/ying32/govcl/vcl/api"
. "github.com/ying32/govcl/vcl/types"
"unsafe"
)
type TListGroups struct {
IObject
i... |
package routetables
import (
"github.com/chnsz/golangsdk"
"github.com/chnsz/golangsdk/pagination"
)
// ListOptsBuilder is an interface by which can build the request body of listing route tables
type ListOptsBuilder interface {
ToRouteTableListQuery() (string, error)
}
// ListOpts allows to query all route tables... |
package cmd
import (
"bytes"
"errors"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"testing"
"github.com/damianoneill/nc-hammer/result"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
)
var myCmd = &cobra.Command{}
type fn func(*cobra.Command, []string)
// helper ... |
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package router
import (
"errors"
"net/http"
"strings"
"sync"
)
// Options passed to the router
type Options struct {
NoAutoCleanURL bool // don't automatically clean URLs, not recommended
NoDefaultPanicHandler bool // don't use the default panic handler
NoPanicOnInvalidAddRoute bool // don't panic... |
package crf
import (
"fmt"
"math"
"math/rand"
"strings"
)
// Label is a label applied to a word in a sentence
type Label string
// FeatureFunction is a feature function for linear-chain CRF
type FeatureFunction func(s []string, i int, labelCurr Label, labelPrev Label) bool
// Feature includes the weight and fea... |
// 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 writing, ... |
package server
import (
"fmt"
"net"
"net/http"
"os"
"path"
"github.com/libopenstorage/openstorage/pkg/auth/secrets"
osecrets "github.com/libopenstorage/secrets"
"github.com/sirupsen/logrus"
"github.com/gorilla/mux"
)
// Route is a specification and handler for a REST endpoint.
type Route struct {
verb st... |
/*
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 under the License... |
package aws
import (
"encoding/json"
"finala/config"
"finala/expression"
"finala/storage"
"finala/structs"
"time"
awsClient "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/docdb"
"github.com/aws/aws-sdk-go/service/pricing"
log "github.com/si... |
package main
import (
"encoding/json"
"fmt"
"log"
"os"
agentapi "github.com/lumjjb/tornjak/tornjak-backend/api/agent"
"github.com/pkg/errors"
"github.com/spiffe/spire/cmd/spire-server/cli/run"
"github.com/spiffe/spire/pkg/common/catalog"
"github.com/urfave/cli/v2"
)
type cliOptions struct {
genericOptions ... |
// Copyright 2019 The Chromium 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 cmd
import (
"context"
"fmt"
"log"
"os"
"path/filepath"
"strings"
"time"
"github.com/maruel/subcommands"
"github.com/pkg/errors"
"go.c... |
package sqlstore
import (
"fmt"
"time"
"github.com/grafana/grafana/pkg/bus"
m "github.com/grafana/grafana/pkg/models"
)
func init() {
bus.AddHandler("sql", SetDashboardAcl)
bus.AddHandler("sql", UpdateDashboardAcl)
bus.AddHandler("sql", RemoveDashboardAcl)
bus.AddHandler("sql", GetDashboardAclInfoList)
}
fu... |
package hashfs
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"io/fs"
"mime"
"net/http"
"os"
"path"
"regexp"
"strconv"
"strings"
"sync"
)
// Ensure file system implements interface.
var _ fs.FS = (*FS)(nil)
// FS represents an fs.FS file system that can optionally use content addressable
// hashes i... |
package wshandler
import (
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
)
// Websocket functionality list and state consts
const (
NoWebsocketSupport uint32 = 0
WebsocketTickerSupported uint32 = 1 << (iota - 1)
WebsocketOr... |
package tunnel
import (
"errors"
"go.uber.org/zap"
"sync"
"github.com/aliyun/aliyun-tablestore-go-sdk/tunnel/protocol"
)
type BatchGetStatusReq struct {
callbackCh chan map[string]*protocol.Channel
}
func NewBatchGetStatusReq() *BatchGetStatusReq {
return &BatchGetStatusReq{callbackCh: make(chan map[string]*pr... |
/*
Copyright 2018 The Multicluster-Scheduler 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 response
import (
"io"
"strings"
"net/http"
"github.com/deatil/lakego-doak/lakego/router"
viewFetch "github.com/deatil/lakego-doak/lakego/view"
)
// 使用
func New() *Response {
response := &Response{}
response.WithHttpCode(http.StatusOK)
return response
}
/**
* 响应
*
* @cre... |
package main
import (
"code.google.com/p/go.net/websocket"
"fmt"
"log"
"time"
"os"
"crypto/sha256"
"crypto/hmac"
"strconv"
)
func generate_token(secret_key, project_key, user_id string, timestamp string) string {
token := hmac.New(sha256.New, []byte(secret_key))
token.Write([]b... |
package dataio
import (
"encoding/csv"
"fmt"
"github.com/sjwhitworth/golearn/base"
"io"
"os"
"regexp"
"runtime"
"strings"
)
// ParseDirtyCSVToInstances reads the CSV file given by filepath and returns
// the read Instances. CSV may have missing or malformed values.
func ParseDirtyCSVToInstances(filepath strin... |
// Copyright (c) 2019 <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 vendor
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"reflect"
"testing"
)
func TestParseImports(t *testing.T) {
root := filepath.Join(getwd(t), "_testdata", "src")
got, err := ParseImports(root)
if err != nil {
t.Fatalf("ParseImports(%q): %v", root, err)
}
want := set("github.com/quux/flob... |
package gofaker
import (
"bytes"
"fmt"
"regexp"
"strings"
"unicode"
)
var userSeparators = []string{"_", "."}
var reUserSplit = regexp.MustCompile(`\W+`)
var safeEmailSuffixes = []string{"org", "com", "net"}
var privateNetRegEx = []*regexp.Regexp{
regexp.MustCompile(`^10\.`),
regexp.MustCompile(`^127\.`),
reg... |
package user
import (
"net"
"strings"
. "github.com/KouKouChan/CSO2-Server/blademaster/core/inventory"
. "github.com/KouKouChan/CSO2-Server/blademaster/core/message"
. "github.com/KouKouChan/CSO2-Server/blademaster/typestruct"
. "github.com/KouKouChan/CSO2-Server/configure"
. "github.com/KouKouChan/CSO2-Server... |
package csv
import (
"encoding/csv"
"encoding/json"
"fmt"
"os"
"reflect"
"strconv"
"time"
"github.com/qiniu/pandora-go-sdk/base/ratelimit"
"github.com/qiniu/logkit/conf"
"github.com/qiniu/logkit/sender"
. "github.com/qiniu/logkit/sender/config"
"github.com/qiniu/logkit/utils/models"
)
const (
defaultRo... |
// Copyright (c) 2017, The Dcrdata developers
// See LICENSE for details.
package explorer
import (
"github.com/HcashOrg/hcd/hcjson"
"github.com/HcashOrg/hcd/hcutil"
"github.com/HcashOrg/hcexplorer/db/dbtypes"
"github.com/HcashOrg/hcexplorer/txhelpers"
)
// BlockBasic models data for the explorer's explorer page... |
package v1alpha1
import (
core_v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cmd_api "k8s.io/client-go/tools/clientcmd/api"
)
// Tenant contains information about tenant
type Tenant struct {
// Metadata for the particular object, including name, namespace, labels, etc
meta_v1.ObjectMeta ... |
// run
// 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.
// Test conversion from non-interface types to the empty interface.
package main
type J interface {
Method()
}
type (
U16 uint16
U32 uint32
U64... |
/*
Package thc is a thin wrapper around Go's http.Client package which provides:
Metrics
THC exports metrics of your requests using expvar. You can observe average times for DNS lookups,
TLS handshakes, TCP sessions and more.
Circuit breaker
After a defined number of consecutive failures, THC will switch to an *o... |
package gm
import (
"github.com/ctrip-nephele/gmagick"
)
// Wrapper of gmagick's MagickWand
type MagickWand struct {
*gmagick.MagickWand
}
// New a MagickWand from the image blob
func NewMagickWand(blob []byte) (*MagickWand, error) {
mw := &MagickWand{gmagick.NewMagickWand()}
err := mw.ReadImageBlob(blob)
// In... |
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
package main
// run: alfred_workflow_data=workflow alfred_workflow_cache=/tmp/alfred alfred_workflow_bundleid=mk_testing go run alfred-deezer.go track mötley
import (
"encoding/json"
"os"
"strconv"
"strings"
aw "github.com/deanishe/awgo"
resty "gopkg.in/resty.v1"
)
// TrackResult represents a result of a Deez... |
package xmlydownloader
import (
"github.com/stretchr/testify/assert"
"log"
"testing"
)
func TestGetAlbumInfo(t *testing.T) {
albumID := 2780581 //https://www.ximalaya.com/youshengshu/2780581/
ai, err := GetAlbumInfo(albumID)
if err != nil {
t.Fatal(err)
}
t.Logf("%+v", ai)
assert.NotNil(t, ai)
assert.Equa... |
package discover
import (
"context"
"math/rand"
"time"
"github.com/libp2p/go-libp2p-core/discovery"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/host"
"github.com/lthibault/jitterbug"
ww "github.com/wetware/ww/pkg"
"github.com/wetware/ww/pkg/runtime"
"github.com/wetware/ww/pkg/... |
package commands
import (
"fmt"
"github.com/ambientsound/visp/api"
"github.com/ambientsound/visp/input/lexer"
"github.com/ambientsound/visp/list"
"github.com/ambientsound/visp/log"
"github.com/ambientsound/visp/spotify/aggregator"
"github.com/zmb3/spotify"
)
// Select manipulates song selection within a songl... |
// Copyright © Copyright 2020 Orion 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... |
// 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... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ovh
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func GetOvh_Vps(ctx *pulumi.Context, args *GetOvh_VpsAr... |
package geos
/*
#cgo LDFLAGS: -lgeos_c
#cgo CFLAGS: -Wall
#include "geos_c.h"
#include <stdlib.h>
#include <string.h>
void sf_error_handler(const char *message, void *userdata) {
strncpy(userdata, message, 1024);
}
GEOSContextHandle_t sf_init(void *userdata) {
GEOSContextHandle_t ctx = GEOS_init_r();
GEOSContext_... |
/*******************************************************************************
* Copyright 2021 EdgeSec 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/lic... |
// Copyright 2020 Tetrate
//
// 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... |
// 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 modload
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"sort"
"cmd/go/internal/modfetch"
"cmd/go/internal/mvs"
"golang.org/x/mod/mod... |
package image
import (
"image"
"image/color"
"sync"
"github.com/hajimehoshi/ebiten/v2"
)
// A NineSlice is an image that can be drawn with any width and height. It is basically a 3x3 grid of image tiles:
// The corner tiles are drawn as-is, while the center columns and rows of tiles will be stretched to fit the ... |
package amazoneks
import (
"bytes"
"context"
"fmt"
"path"
"text/template"
"github.com/go-kit/kit/log"
multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/replicatedhq/libyaml"
"github.com/replicatedhq/ship/pkg/api"
"github.com/replicatedhq/ship/pkg/lifecycle/render/inline"
... |
package candle
import (
"encoding/json"
"errors"
"time"
"github.com/t73liu/tradingbot/lib/utils"
)
type JSONCandle struct {
OpenedAt time.Time `json:"openedAt"`
Volume int64 `json:"volume"`
Open float64 `json:"open"`
High float64 `json:"high"`
Low float64 `json:"low"`
Close floa... |
package signalr
import (
"fmt"
"github.com/go-kit/kit/log"
"reflect"
"runtime/debug"
"sync"
)
type serverLoop struct {
server *Server
info StructuredLogger
dbg StructuredLogger
protocol HubProtocol
hubConn hubConnection
pings *sync.WaitGroup
streamer *streamer
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.