text stringlengths 3.08k 10.4k |
|---|
package physical
import (
"math"
"reflect"
"time"
"github.com/rancher/octopus/adaptors/mqtt/api/v1alpha1"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
const (
minInt53 = -2251799813685248
maxInt53 = 2251799813685247
... |
// +build !race
// Disable race detector since these tests are inherently racy
package progress
import (
"bytes"
. "github.com/smartystreets/goconvey/convey"
"strings"
"testing"
"time"
)
func TestBasicProgressBar(t *testing.T) {
writeBuffer := &bytes.Buffer{}
Convey("With a simple ProgressBar", t, func() {
... |
package plane
import (
"V-switch/crypt"
"V-switch/tools"
"log"
"net"
"strings"
)
func init() {
go TLVInterpreter()
}
func TLVInterpreter() {
log.Println("[PLANE][TLV][INTERPRETER] Thread starts")
for my_tlv_enc := range UdpToPlane {
go interpreter(my_tlv_enc)
}
}
func interpreter(mytlvenc NetMessa... |
// Copyright © 2018-2021 <NAME> <<EMAIL>>
//
// 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, pu... |
/*
* Copyright 2016 ClusterHQ
*
* 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 sampler
import (
"github.com/mattkimber/gorender/internal/geometry"
"image"
"image/color"
"image/draw"
"math"
"math/rand"
)
type Sample struct {
Location geometry.Vector2
Influence float64
}
type SampleList []Sample
type Samples [][]SampleList
func (s Samples) Width() int {
return len(s)
}
func ... |
package mfr
import (
"container/list"
"fmt"
"sync"
"time"
)
const (
StatusNone = iota
StatusQueued // waiting to get to the top
StatusActive // being processed
StatusDone // done processing
)
// Item is a queue storage unit.
type Item struct {
key string
Value interface{}
queue *Queue
p... |
package output
import (
"bufio"
"fmt"
"os"
"time"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/database"
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/utils"
)
// MeasurementJSON prints the JSON of a measurement
func MeasurementJSON(j map[string]interface{}) {
log.WithFie... |
// Copyright 2021 Praetorian Security, 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 o... |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mixins
import (
"testing"
"github.com/glycerine/gxui"
"github.com/glycerine/gxui/math"
)
type testTreeNode struct {
item gxui.AdapterItem
ch... |
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package e2e_test
import (
"context"
"fmt"
"os"
"path/filepath"
"reflect"
"sort"
"testing"
"time"
"github.com/cortexproject/cortex/integration/e2e"
"github.com/pkg/errors"
"github.com/thanos-io/thanos/pkg/promclient"
"github.c... |
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
// Copyright 2019 The Gitea 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 integrations
import (
"bytes"
"image"
"image/png"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
"path"
"testing"
"github.com/jolheis... |
package computeservice
import (
"context"
"log"
"strings"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
"github.com/openshift/machine-api-provider-gcp/pkg/version"
"google.golang.org/api/compute/v1"
)
// GCPComputeService is a pass through wrapper for google.golang.org/api/compute/v1/compute
//... |
/*
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 law or agreed to in ... |
// Copyright 2020 Antrea Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
package controller
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
)
func getWfOperationCtx() *wfOperationCtx {
return &wfOperationCtx{
wf: &v1alpha1.Wo... |
package cmsketch
import (
"fmt"
"math/rand"
"sync"
"testing"
"time"
)
func createTestCMSketch() CMSketch {
cm, _ := New(0.999, 0.001)
return cm
}
func TestCMSketchCreate(t *testing.T) {
fmt.Println("TestCMSketchCreate")
cases := []struct {
delta float64
epsilon float64
depth, width uint
... |
// +build linux
/*
Copyright 2020 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 agree... |
package views
import (
"fmt"
"sort"
"strings"
"time"
v1 "github.com/jenkins-x/jx-api/v4/pkg/apis/jenkins.io/v1"
"github.com/jenkins-x/octant-jx/pkg/common/viewhelpers"
"github.com/jenkins-x/octant-jx/pkg/plugin"
"github.com/vmware-tanzu/octant/pkg/view/component"
)
func ToStatus(pa *v1.PipelineActivity) *com... |
package service
import (
"fmt"
"net"
"strings"
"github.com/lianxiangcloud/linkchain/config"
"github.com/lianxiangcloud/linkchain/libs/log"
"github.com/lianxiangcloud/linkchain/libs/rpc"
"github.com/lianxiangcloud/linkchain/rpc/ethapi"
"golang.org/x/time/rate"
)
type Service struct {
logger log.Logger
conf... |
// Copyright 2020 The Okteto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package gobeeq
import (
"context"
"encoding/json"
"time"
"github.com/go-redis/redis/v8"
)
type Status string
const (
StatusCreated Status = "created"
StatusSucceeded Status = "succeeded"
StatusRetrying Status = "retrying"
StatusFailed Status = "failed"
StatusWaiting Status = "waiting"
StatusActive... |
package phase0
import (
"context"
"errors"
"fmt"
"github.com/protolambda/zrnt/eth2/beacon/common"
"github.com/protolambda/ztyp/codec"
"github.com/protolambda/ztyp/tree"
. "github.com/protolambda/ztyp/view"
)
func ProcessAttesterSlashings(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, state... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iotsitewise
import (
"context"
"fmt"
"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"
)
type BatchPutAssetPropertyValueInput struct {
_ struct{} `type:... |
package trapauth
import (
"errors"
"fmt"
"net/http"
"strings"
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
"github.com/golang-jwt/jwt/v4"
"go.uber.org/... |
package browser
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// WindowID [no description].
type WindowID int64
// Int64 returns the WindowID as int64 value.
func (t WindowID) Int64() int6... |
// Copyright 2017 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package bitroute
import (
"sort"
"github.com/singleton11/k8s-lab/pkg/router"
)
const (
maxLevel = 255
asterisk = "*"
)
type handle func(router.Control)
type pa... |
//--------------------------------------------------------------------------
// Copyright 2018-2022 infinimesh
// www.infinimesh.io
//
// 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
/... |
package main
import (
"fmt"
"github.com/gogf/gf-cli/commands/env"
"github.com/gogf/gf-cli/commands/mod"
"github.com/gogf/gf/errors/gerror"
"github.com/gogf/gf/text/gregex"
"strings"
_ "github.com/gogf/gf-cli/boot"
"github.com/gogf/gf-cli/commands/build"
"github.com/gogf/gf-cli/commands/docker"
"github.com/g... |
package start
import (
"bufio"
"bytes"
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/DarthSim/overmind/v2/utils"
"golang.org/x/crypto/ssh/terminal"
)
var tmuxVersionRe = regexp.MustCompile(`(\d+)\.(\d+)`)
var tmuxUnescapeRe = regexp.MustCompile(`\\(\d{3})`)
var tmuxOu... |
package main
import (
"context"
"database/sql"
"io/ioutil"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
"time"
"github.com/ClickHouse/clickhouse-go"
"github.com/golang/protobuf/proto"
"github.com/golang/snappy"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_go... |
package signer
import (
"fmt"
"io/ioutil"
"os/exec"
"os/user"
"path/filepath"
"strings"
"github.com/hashicorp/vault/api"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
)
type Client struct {
API *api.Client
RoleConfig map[string]interface{}
Options Options
Pu... |
package fxtx
import (
"bytes"
"encoding/xml"
"fmt"
"io/ioutil"
"net"
"sync"
"text/template"
"time"
"github.com/Masterminds/sprig"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)
// Gpx
type Gpx struct {
XMLName xml.Name `xml:"gpx"`
Wpts []Wpt `xml:"wpt"`
}
// Wpt
type Wpt struct {
XMLName xml.Name `xml:"... |
/*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANT... |
package services
import (
"fmt"
"sync"
"sync/atomic"
"time"
libovsdbclient "github.com/ovn-org/libovsdb/client"
globalconfig "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn/acl"
ovnlb "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn... |
package v1
import "time"
const (
AppTypeContainer = "container"
AppTypeFunction = "function"
ServiceTypeDeployment = "deployment"
ServiceTypeStatefulSet = "statefulset"
ServiceTypeDaemonSet = "daemonset"
)
// Application application info
type Application struct {
Name string ... |
/*
* SMF Configuration Factory
*/
package factory
import (
"time"
"github.com/free5gc/logger_util"
"github.com/free5gc/openapi/models"
)
const (
SMF_EXPECTED_CONFIG_VERSION = "1.0.2"
UE_ROUTING_EXPECTED_CONFIG_VERSION = "1.0.1"
)
type Config struct {
Info *Info `yaml:"info"`
... |
// Copyright [2017] LinkedIn Corp. 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... |
// RPC-like calls mapper: by name, and interface{} input and output parameters which should
// match signatures of registered functions and services.
//
// It supports both services and functions, and allows several possible function signatures for convenience.
//
// Note that registrations (Func, ServiceDef) are not g... |
package gotwilio
import (
"encoding/json"
"net/url"
"time"
"github.com/gorilla/schema"
)
var formDecoder *schema.Decoder
func init() {
formDecoder = schema.NewDecoder()
formDecoder.SetAliasTag("form")
formDecoder.IgnoreUnknownKeys(true)
}
func DecodeWebhook(data url.Values, out interface{}) error {
return ... |
package lreindex
import (
"container/list"
"github.com/copernet/copernicus/conf"
"github.com/copernet/copernicus/errcode"
"github.com/copernet/copernicus/log"
"github.com/copernet/copernicus/logic/lblock"
"github.com/copernet/copernicus/logic/lchain"
"github.com/copernet/copernicus/model/block"
"github.com/cop... |
package expression
import (
"testing"
"github.com/stretchr/testify/assert"
)
var exp = New()
func assertTokenList(t *testing.T, code string, types ...string) {
tokens, err := exp.tokenize(code)
assert.Nil(t, err, "tokenize failed")
assert.Equal(t, len(tokens), len(types), "the tokens's count is not equal")
fo... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package servicecatalog
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type ListResourcesForTagOptionInput struct {
_ struct{} `type:"structure"`
// The maximum number of items to retur... |
package ebpf
//go:generate stringer -output types_string.go -type=MapType,ProgramType
// MapType indicates the type map structure
// that will be initialized in the kernel.
type MapType uint32
// All the various map types that can be created
const (
UnspecifiedMap MapType = iota
// Hash is a hash map
Hash
// Arr... |
package main
import "github.com/iancoleman/orderedmap"
const (
OpenAPIVersion = "3.0.0"
ContentTypeText = "text/plain"
ContentTypeJson = "application/json"
ContentTypeForm = "multipart/form-data"
)
type OpenAPIObject struct {
OpenAPI string `json:"openapi"` // Required
Info InfoObject `json:"in... |
package interp
import (
"context"
"go/ast"
"io/ioutil"
"reflect"
"runtime"
"runtime/debug"
)
// A Program is Go code that has been parsed and compiled.
type Program struct {
pkgName string
root *node
init []*node
}
// Compile parses and compiles a Go code represented as a string.
func (interp *Interpr... |
// 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.
// +build linux,386 linux,amd64
package guess
import (
"fmt"
"unsafe"
"github.... |
// This example shows how to use PCF8574T + HD44780 combo.
//
// Connections:
// P0 --> RS
// P1 --> R/W
// P2 --> E
// P3 --> Backlight
// P4 <-> DB4
// P5 <-> DB5
// P6 <-> DB6
// P7 <-> DB7
//
// It seems that PCF8574T works up to 480 kHz (VCC = 5V, short cables, 16:9).
package main
import (
"bytes"
"delay"
"fmt... |
package ruby
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strings"
"time"
"github.com/choria-io/go-choria/choria"
"github.com/choria-io/go-choria/server"
"github.com/choria-io/go-config"
"github.com/choria-io/mcorpc-agent-provider/mcorpc"
"github.com/choria-io/mcorpc-... |
/*
Copyright 2017 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 bulk
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"github.com/fioprotocol/fio-go"
"github.com/fioprotocol/fio-go/eos"
"log"
"os"
"strconv"
"strings"
)
func Respond() (success int, fails int, err error) {
stat, err := F.Stat()
if err != nil {
return 0, 0, err
}
if stat.Size() <= 1 {
return... |
package codegen
import (
"math"
)
var basicOpFuncs = map[string]func(
dest, r1, r2 uint32,
) uint32{
"+": asm.add,
"-": asm.sub,
"*": asm.mul,
"u*": asm.mulu,
"/": asm.div,
"u/": asm.divu,
"%": asm.mod,
"u%": asm.modu,
"&": asm.and,
"|": asm.or,
"^": asm.xor,
"nor": asm.nor,
}
func g... |
// Copyright 2017 The WPT Dashboard Project. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package webapp
import (
"strings"
"testing"
"github.com/deckarep/golang-set"
"github.com/stretchr/testify/assert"
)
const mockTestPath = "/moc... |
/*
Copyright 2019 The Jetstack cert-manager 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 agreed... |
package heartbeat
import (
"strconv"
"sync"
"time"
"github.com/henrylee2cn/goutil/coarsetime"
tp "github.com/jslyzt/teleport"
)
const (
// HeartbeatURI heartbeat service URI
HeartbeatURI = "/heartbeat"
heartbeatQueryKey = "hb_"
)
// NewPing returns a heartbeat(CALL or PUSH) sender plugin.
func NewPing(... |
/*
* Copyright 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 writi... |
// Copyright 2018 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
package vodka
import (
"context"
"encoding/json"
"encoding/xml"
"mime/multipart"
"net/http"
"net/url"
)
// MIME types
const (
MIMEJSON = "application/json"
MIM... |
// Copyright 2019 VMware, Inc.
// SPDX-License-Identifier: Apache-2.0
package upgrade
import (
"context"
"fmt"
"time"
"github.com/blang/semver"
"github.com/go-logr/logr"
"github.com/pkg/errors"
kubernetes2 "github.com/vmware/cluster-api-upgrade-tool/pkg/internal/kubernetes"
v1 "k8s.io/api/core/v1"
metav1 "k... |
/*
Copyright 2017 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, ... |
// Copyright 2017 Istio 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 i... |
/*
Copyright 2021 The KodeRover 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, s... |
package crypto
import (
"crypto/elliptic"
"crypto/sha256"
"encoding/base64"
"errors"
"fmt"
"io"
"math/big"
"strings"
)
// ECDH manages creating and providing keys.
type ECDH interface {
// GenerateKey will create a new Private/Public key pair based on random numbers from io.Reader.
// Returns error if it wa... |
package lotusdb
import (
"context"
"errors"
"sync"
"time"
)
var (
ErrLockWaitTimeout = errors.New("lock wait timeout")
ErrInvalidStripeIdx = errors.New("stripe index is invalid")
)
const (
maxStripeNum = 1 << 16
defaultStripeNum = 16
)
type (
// LockMgr lock manager for read and write keys.lockMaps
L... |
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
import (
"encoding/json"
"reflect"
"github.com/33cn/chain33/types"
)
// PrivacyX privacy executor name
var PrivacyX = "privacy"
... |
package mock
import (
"context"
"fmt"
"github.com/magiconair/properties"
"github.com/pingcap/go-ycsb/pkg/ycsb"
"time"
"net/http"
"io/ioutil"
"bytes"
"github.com/dustin/go-humanize"
)
const (
cephPath = "ceph.path"
poolName = "ceph.pool"
mockPort = "mock.port"
mockType = "mock.type"
mockLength = ... |
package gohttp
import (
"bytes"
"crypto/tls"
"encoding/json"
"encoding/xml"
"errors"
"io/ioutil"
"log"
"net"
"net/http"
"net/url"
"strings"
"time"
"github.com/7045kHz/http-client/core"
"github.com/7045kHz/http-client/gohttp_mock"
"github.com/7045kHz/http-client/gomime"
"github.com/Azure/go-ntlmssp"
)
... |
package gocbcore
import (
"crypto/rand"
"encoding/hex"
"fmt"
)
func randomCbUid() []byte {
out := make([]byte, 8)
_, err := rand.Read(out)
if err != nil {
logWarnf("Crypto read failed: %s", err)
}
return out
}
func formatCbUid(data []byte) string {
return fmt.Sprintf("%02x%02x%02x%02x%02x%02x%02x%02x",
... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Package store provides store commands.
package store
import (
"encoding/json"
"io"
"github.com/hyperledger/aries-framework-go/spi/storage"
"github.com/trustbloc/edge-core/pkg/log"
"github.com/trustbloc/agen... |
// Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Lice... |
// Copyright 2019 The LUCI 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... |
/*
Copyright © 2019 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 appli... |
package screen
import (
"image"
"github.com/klauspost/gfx"
)
type Fx struct {
// main and mipmaps
screen [][]byte
font [128][16]byte
fontLU [256][8]byte
draw *image.Gray
lines [][]byte
cpl int
fgColor, bgColor uint8
}
func NewFx(file stri... |
//
// Copyright (c) 2019 <NAME> <<EMAIL>>.
// All rights reserved. This program is free software. It comes without
// any warranty, to the extent permitted by applicable law. You can
// redistribute it and/or modify it under the terms of the Do What
// The Fuck You Want To Public License, Version 2, as published by
// ... |
// Copyright 2019 Liquidata, 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... |
package rest
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
)
type Interface interface {
Get() *Request
Post() *Request
Put() *Request
Patch() *Request
Delete() *Request
Verb(verb string) *Request
Reset() *Request
}
// HTTPClient is an interfa... |
package git
import (
"context"
"log"
"sync"
"github.com/lzecca78/one/internal/config"
"github.com/google/go-github/v26/github"
"github.com/spf13/viper"
"golang.org/x/oauth2"
)
// CommitSpec is a type def as map of string and Commit
type CommitSpec map[string]Commit
//Commit is a struct needed to define an ob... |
package ctags
import (
"bufio"
"fmt"
"io"
"sort"
"strconv"
"strings"
)
const (
tagNamePosition = iota
tagFilePosition
tagAddressPosition
)
var escapeMap = []struct {
escaped, raw string
}{
{`\\`, "\\"},
{`\n`, "\n"},
{`\r`, "\r"},
{`\t`, "\t"},
}
// TagFields is a map of name/value pairs.
type TagFiel... |
package env
import (
"errors"
"fmt"
"net/url"
"reflect"
"strings"
)
// Marshaler is the interface implemented by types that can marshal
// themselves into valid object.
type Marshaler interface {
MarshalEnv() ([]string, error)
}
// The marshalEnv saves object's fields to environment.
// Changes the environment... |
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"github.com/schollz/progressbar"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
type Plurk struct {
PlurkId int
Content string
Posted string
ResponseCount int
Responses []PlurkResponse
}
typ... |
package handlers
import (
"encoding/json"
"sync"
"github.com/ds-test-framework/scheduler/log"
"github.com/ds-test-framework/scheduler/testlib"
"github.com/ds-test-framework/scheduler/types"
)
const (
// StartStateLabel is the start state label of a state machine
StartStateLabel = "startState"
// FailStateLab... |
package registry
import (
"fmt"
"github.com/pkg/errors"
"github.com/wangkechun/vv/pkg/header"
pb "github.com/wangkechun/vv/pkg/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"io"
"net"
"qiniupkg.com/x/log.v7"
"sync"
"time"
)
type rpcConn struct {
net.Conn
closed bool
header *pb.Prot... |
/*
Copyright 2018 Planet Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
//
// (C) Copyright 2020-2021 Intel Corporation.
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
package system
import (
"fmt"
"net"
"strings"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/daos-stack/daos/src/control/build"
)
var (
ErrEmptyGroupMap = errors.New("empty group map (all ran... |
/*
Copyright 2021-2022 The Volcano 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 ogame
import "github.com/go-errors/errors"
// MoonID represent a moon id
type MoonID CelestialID
// Celestial convert a MoonID to a CelestialID
func (m MoonID) Celestial() CelestialID {
return CelestialID(m)
}
// Moon ogame moon object
type Moon struct {
ogame *OGame `gorm:"-"`
ID MoonID `go... |
package mtproto
import (
"context"
"errors"
"net"
"time"
"go.uber.org/zap"
"golang.org/x/xerrors"
"github.com/gotd/td/bin"
"github.com/gotd/td/internal/crypto"
"github.com/gotd/td/internal/proto"
"github.com/gotd/td/internal/proto/codec"
)
// errRejected is returned on invalid message that should not be p... |
package scanning
// GetGfXSS is get cool parameter name from Gf-Patterns
func GetGfXSS() []string {
// https://github.com/1ndianl33t/Gf-Patterns/blob/master/xss.json
params := []string{
"q",
"s",
"search",
"lang",
"keyword",
"query",
"page",
"keywords",
"year",
"view",
"email",
"type",
"cat... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: protobuf/saver_participle_group.proto
package protobuf
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _... |
//
// Copyright 2019 Insolar Technologies GmbH
//
// 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... |
package grammar
import (
"errors"
"fmt"
)
type ruleTreeBuilder struct {
ruleNodeBuilder RuleNodeBuilder
tok Token
nodes [][]RepetitiveRuleNode
grammar Grammar
children map[string]RuleTree
}
func createRuleTreeBuilder(ruleNodeBuilder RuleNodeBuilder) RuleTreeBuilder {
out ... |
package telegram
const (
// Private is a constant of private chat type.
Private = "private"
// Group is a constant of group chat type.
Group = "group"
// Supergroup is a constant of supergroup type.
Supergroup = "supergroup"
// Channel is a constant of channel type.
Channel = "channel"
)
// Chat represents a ... |
package appconfig
import (
"archive/tar"
"compress/gzip"
"context"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"strings"
"golang.org/x/mod/semver"
"github.com/google/go-github/v33/github"
"github.com/manifoldco/promptui"
archutil "github.com/jessesomerville/ephemeral-iam/internal/appconfig/arch_util"
u... |
// +build integration
package webhook_test
import (
"context"
"fmt"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
arv1 "k8s.io/api/admissionregistration/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/ap... |
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mocks
import (
"context"
"github.com/libsv/go-bc"
"github.com/libsv/go-bc/spv"
"github.com/libsv/go-bt/v2"
"sync"
)
// Ensure, that PaymentVerifierMock does implement spv.PaymentVerifier.
// If this is not the case, regenerate this file wi... |
// Copyright (c) 2019 Uber Technologies, 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 o... |
package pack
import (
"bytes"
"encoding/binary"
"fmt"
"log"
"math"
"strconv"
"strings"
)
type Protocol struct {
Format []string
}
//编码
func (p *Protocol) Pack(args ...int64) (ret []byte) {
la := len(args)
ls := len(p.Format)
if ls > 0 && la > 0 && ls == la {
for i := 0; i < la; i++ {
if p.Format[i] ... |
package cmd
import (
"bytes"
"fmt"
"io"
"os"
"github.com/alecthomas/chroma"
"github.com/alecthomas/chroma/formatters"
"github.com/alecthomas/chroma/lexers"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"
"github.com/toshimaru/nyan/styles"
)
var (
isTerminalFunc = isa... |
package main
import (
"io"
"io/ioutil"
"math"
"net"
"os"
"sync"
"time"
"../tpl"
)
var done = false
var dataChunks [][]byte
var retries chan uint32
var unsent chan uint32
var conn net.Conn
var initRtt = 100 * time.Millisecond
var rtt = initRtt
// Used to manage a final timeout and signal total failure
var r... |
package asset
import (
"context"
"fmt"
"github.com/algorand/go-algorand-sdk/crypto"
"github.com/algorand/go-algorand-sdk/future"
"github.com/algorand/go-algorand-sdk/types"
"github.com/vecno-io/algo-collection/shared/account"
"github.com/vecno-io/algo-collection/shared/contract"
exec "github.com/vecno-io/al... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.