text stringlengths 3.08k 10.4k |
|---|
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"text/template"
)
const mimeDBVersion = "1.52.0"
var mimeTypesExtensionsTpl = `package mime
var mimeTypesExtensions = map[string][]string{
{{range $k, $v := .MimeTypesExtensions}}"{{$k}}": { {{range $i := $v}}"{... |
package dingtalk
import (
"fmt"
"strings"
"time"
)
const (
// ProcessInstanceStatusNew 审批状态 新创建
ProcessInstanceStatusNew = "New"
// ProcessInstanceStatusRunning 审批状态 审批中
ProcessInstanceStatusRunning= "RUNNING"
// ProcessInstanceStatusTerminated 审批状态 被终止
ProcessInstanceStatusTerminated = "TERMINATED"
// Proc... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = ... |
package environments
import (
"context"
"errors"
"fmt"
"github.com/AlecAivazis/survey/v2"
prompt "github.com/c-bata/go-prompt"
"github.com/fenixsoft/fenix-cli/lib/go-ansi"
"github.com/fenixsoft/fenix-cli/src/internal/template"
"github.com/fenixsoft/fenix-cli/src/suggestions"
"github.com/schollz/progressbar/v3... |
package registry
import (
"context"
iv "github.com/docker/compose-on-kubernetes/internal/internalversion"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/registry/gen... |
// Copyright 2018-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 ... |
// Copyright (c) 2019 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
// Copyright 2015 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... |
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"
"time"
"github.com/alecthomas/kingpin"
"go.mongodb.org/mongo-driver/mongo"
"github.com/percona/percona-backup-mongodb/pbm"
"github.com/percona/percona-backup-mongodb/version"
)
var (
pbmCmd = kingpin.New("pbm", "Percona Backup for MongoDB")
mU... |
package main
import (
"fmt"
"html/template"
"io"
"io/ioutil"
"goexpenses/database"
"goexpenses/midware"
"goexpenses/routes"
"goexpenses/util"
"github.com/jasonlvhit/gocron"
"github.com/labstack/echo"
_ "github.com/lib/pq"
)
type Template struct {
templates *template.Template
}
func (t *Template) Render... |
package display
import (
"fmt"
"strconv"
"strings"
"github.com/auth0/auth0-cli/internal/ansi"
"github.com/auth0/auth0-cli/internal/auth0"
"github.com/auth0/auth0-cli/internal/iostream"
"golang.org/x/term"
"gopkg.in/auth0.v5/management"
)
type apiView struct {
ID string
Name string
Iden... |
package profile
import (
"bytes"
"encoding/base64"
"encoding/json"
"time"
)
var emptyHist = make([]PastName, 0, 0)
// fillProfile fills out p with basic profile information from m.
// m MUST contain string values for the keys "id" and "name".
// If available, "demo" and "legacy" MUST map to boolean values.
// fi... |
package core
import (
"github.com/PerformLine/go-stockutil/pathutil"
"github.com/PerformLine/go-stockutil/stringutil"
"github.com/PerformLine/go-webfriend/browser"
"github.com/PerformLine/go-webfriend/dom"
"github.com/jdxcode/netrc"
defaults "github.com/mcuadros/go-defaults"
)
// [SKIP]
// Directly call an RPC ... |
package buildlogfile
import (
"fmt"
"os"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/errs"
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/pkg/platform/model"
"github.com/ActiveState/cli/pkg/platform... |
// 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... |
package waiter
import (
"context"
"fmt"
"strings"
"time"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/aws/aws-sdk-go-v2/service/eks"
ekstypes "github.com/aws/aws-sdk-go-v2/service/eks/types"
"github.com/aws/smithy-go/middleware"
smithytime "github.com/aws/smithy-go/time"
smithywaite... |
package ipinfo
import (
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
const (
defaultBaseURL = "https://ipinfo.io/"
defaultUserAgent = "IPinfoClient/Go/2.4.0"
)
// A Client is the main handler to communicate with the IPinfo API.
type Client struct {
// HTTP client use... |
/*
Copyright © 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense... |
package main
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
"github.com/ca-risken/common/pkg/logging"
mimosasqs "github.com/ca-risken/common/pkg/sqs"
"github.com/ca-risken/core/proto/alert"
"github.com/ca-risken/core/proto/... |
/*
Copyright 2018 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... |
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... |
package core
import (
"math/rand"
"strings"
"time"
"github.com/techxmind/go-utils/object"
)
// register core varaiables
// succ : bool, true
// rand : int, random value in range 1 ~ 100
// datetime : string, current date time with format 2006-01-02 15:04: 05
// date : string, current date wit... |
package deployment
import (
"log"
"github.com/kubernetes/dashboard/resource/common"
"github.com/kubernetes/dashboard/resource/replicaset"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
client "k8s.io/kubernetes/pkg/client/unversioned"
deploymentutil... |
package updateref
import (
"bufio"
"bytes"
"context"
"fmt"
"gitlab.com/gitlab-org/gitaly/v14/internal/command"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
)
// Updater wraps a `git u... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudtrail
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/cloudtrail-2013-11-01/PutEventSelectorsRequest
type PutEventSe... |
package ripemgr
import (
"fmt"
"math"
"net"
"strings"
"time"
atlas "github.com/keltia/ripe-atlas"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/ConsenSys/fc-latency-map/manager/addresses"
"github.com/ConsenSys/fc-latency-map/manager/models"
)
type RipeMgrImpl struct {
conf viper.V... |
// Copyright 2021 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... |
package mine
import (
"fim/ints"
"sort"
)
// Apriori determines the frequent itemsets for the given transactions.
func Apriori(txs []Itemset, minSupport int) []Itemset {
// Count items and item pairs.
var itemCount = make(map[int]int)
var itemPairCount = make(map[int]map[int]int)
for _, tx := range txs {
for ... |
package cmd
import (
"context"
"crypto/x509"
"encoding/pem"
"os"
"time"
"github.com/dimboknv/tg-stand-with-ukraine/app/bot"
"github.com/dimboknv/tg-stand-with-ukraine/app/hub"
"github.com/dimboknv/tg-stand-with-ukraine/app/reporter"
"github.com/dimboknv/tg-stand-with-ukraine/app/store"
"github.com/jessevdk/... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"time"
"net/http"
"errors"
"github.com/Sirupsen/logrus"
"github.com/jinzhu/now"
"github.com/urfave/cli"
"strconv"
)
type Invoice struct {
From string `json:"from"`
To string `json:"to"`
Number int `j... |
package bopsend
import (
"fmt"
"math"
"github.com/bitcoinsv/bsvd/bsvec"
log "github.com/ejfhp/trail"
"github.com/ejfhp/trail/trace"
"github.com/libsv/go-bk/wif"
"github.com/libsv/go-bt"
)
func UTXOsToAddress(utxos []*UTXO, toAddress string, key string, fee uint64) (*bt.Tx, error) {
t := trace.New().Source("t... |
/*
* Copyright 2019 National Library of Norway.
*
* 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... |
// Code generated by go-swagger; DO NOT EDIT.
package user
// 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-... |
// Copyright (c) 2018-2021 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package provider
import (
"github.com/go-test/deep"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
zschemas "github.com/zededa/terraform-provider-zedcloud/schemas"
"github.com/zededa/zedcloud-api/swagger_models"
"testing... |
package gonighttime
import (
"math"
"time"
"github.com/kelvins/sunrisesunset"
)
type Place struct {
Lat float64
Lon float64
Time time.Time
}
type Route struct {
Departure Place
Arrival Place
}
func deg2rad(degrees float64) float64 {
return degrees * math.Pi / 180
}
func hsin(theta float64) float64 {
... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"github.com/FactomWyomingEntity/prosper-pool/config"
"github.com/Factom-Asset-Tokens/factom"
"github.com/FactomWyomingEntity/prosper-pool/accounting"
"github.com/pegnet/pegnetd/fat/fat2"
"github.com/spf13/cobra"
)
func init() {
// Defaults
ro... |
package controllers
import (
"fmt"
"sort"
"golang.org/x/xerrors"
corev1 "k8s.io/api/core/v1"
listers "k8s.io/client-go/listers/core/v1"
"sigs.k8s.io/yaml"
"go.f110.dev/heimdallr/pkg/config/configv2"
proxyv1alpha2 "go.f110.dev/heimdallr/pkg/k8s/api/proxy/v1alpha2"
)
type ConfigConverter struct {
}
func (Con... |
// Gerencia a base de credenciais que valida o fingerprint do mTLS e define os claims validos
package authzman
import (
"reflect"
"sync"
"time"
log "github.com/sirupsen/logrus"
)
// Store - Estrutura que armazena as permissoes,
type Store struct {
permMapStorage map[int]PermissionMap
// contagem crescente corr... |
package scanner
import (
"fmt"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcutil"
"github.com/muun/libwallet"
"github.com/muun/recovery/electrum"
)
// scanTask encapsulates a parallelizable Scanner unit of work.
type scanTask struct {
servers *Serve... |
package deployer
import (
"bufio"
"fmt"
"math/rand"
"net"
"os"
"strconv"
"strings"
"time"
)
func cidrHosts(cidr string) ([]string, error) {
ip, ipnet, err := net.ParseCIDR(cidr)
if err != nil {
return nil, err
}
var ips []string
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
ips = appe... |
package game
import (
"errors"
"math"
)
type UnitID uint64
type UnitName string
type UnitGroup uint8
const (
_ UnitGroup = iota
UnitGroupPlayer
UnitGroupAI
)
type Unit struct {
id UnitID
group UnitGroup
name UnitName
resource UnitResource
correction UnitCorrection
class *Class
... |
package cache
import (
"context"
"time"
"github.com/bool64/ctxd"
"github.com/bool64/stats"
)
type trait struct {
closed chan struct{}
config Config
log ctxd.Logger
stat stats.Tracker
}
type backend interface {
Len() int
deleteExpiredBefore(t time.Time)
}
func newTrait(b backend, config Config) *tra... |
package model3d
import (
"math"
"math/cmplx"
"math/rand"
"testing"
)
func TestMatrix3Inverse(t *testing.T) {
for i := 0; i < 10; i++ {
m := Matrix3{}
for j := range m {
m[j] = rand.NormFloat64()
}
m1 := m.Inverse()
product := m.Mul(m1)
product[0] -= 1
product[4] -= 1
product[8] -= 1
for j, x... |
/*
* MSX SDK
*
* MSX SDK client.
*
* API version: 1.0.8
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package msxsdk
import (
"encoding/json"
)
// TenantCreateAllOf struct for TenantCreateAllOf
type TenantCreateAllOf struct {
ParentId NullableString `json:"parentId... |
// Copyright 2021 RetailNext, Inc. All rights reserved.
// Copyright 2013 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 overflow
import (
"net"
"runtime"
"testing"
"time"
)
const defaultMaxOpenFiles = 256
type... |
// 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 2015 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 applicabl... |
package raiden
import (
"github.com/genshinsim/gcsim/pkg/core"
)
func (c *char) ActionFrames(a core.ActionType, p map[string]int) (int, int) {
switch a {
case core.ActionAttack:
f := 0
a := 0
if c.Core.Status.Duration("raidenburst") == 0 {
switch c.NormalCounter {
//TODO: need to add atkspd mod
case... |
package querytoolsclient
import (
"crypto/tls"
"errors"
"fmt"
"net/http"
"net/url"
"time"
medcomodels "github.com/ldsec/medco/connector/models"
"github.com/ldsec/medco/connector/wrappers/unlynx"
httptransport "github.com/go-openapi/runtime/client"
medcoclient "github.com/ldsec/medco/connector/client"
"git... |
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
package tasks
import (
"time"
"strings"
"github.com/hyper-ml/hyperml/server/pkg/utils"
ws "github.com/hyper-ml/hyperml/server/pkg/workspace"
)
const (
MOUNT_TYPE_DEFAULT int = iota
MOUNT_TYPE_PIPE
MOUNT_TYPE_FUSE
)
// details of mount file system
// this is usually tied to a repo or commit key
typ... |
package rolemanager
import (
"fmt"
"log"
"github.com/Optum/dce/pkg/awsiface"
errors2 "github.com/Optum/dce/pkg/errors"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/aws"
)
type RoleManager interface {
CreateRoleWithPolicy(input *CreateRoleWithPolicyIn... |
// Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors
// This file is consisted of the MATRIX library and part of the go-ethereum library.
//
// The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
//
// Permissi... |
// Copyright 2019 The gVisor 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... |
// Copyright Contributors to the Open Cluster Management project.
package clusterpools
import (
"context"
"fmt"
"github.com/go-logr/logr"
hivev1 "github.com/openshift/hive/apis/hive/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/api... |
package meals
import (
"strings"
"github.com/DATA-DOG/go-sqlmock"
uuid "github.com/satori/go.uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func (s *Suite) TestPlanMeal_InvalidRecipeID() {
userID := uuid.NewV4()
storeID := uuid.NewV4()
args := map[string]interface{}{
"re... |
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2019 Intel Corporation
package log
import (
"fmt"
"log/syslog"
)
// Printer formats and writes logs conditionally based on the current priority
// level.
type Printer struct {
Format func(frmt string, a ...interface{}) string
Write func(lvl syslo... |
// Copyright (c) 2004-present Facebook All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by entc, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"github.com/facebook/ent/dialect/sql"
"github.com/facebookincub... |
package dfs_copier_batch
import (
"github.com/watermint/toolbox/domain/dropbox/api/dbx_context"
"github.com/watermint/toolbox/domain/dropbox/api/dbx_util"
"github.com/watermint/toolbox/domain/dropbox/filesystem"
"github.com/watermint/toolbox/essentials/file/es_filesystem"
"github.com/watermint/toolbox/essentials/... |
package dvid
import (
"fmt"
"time"
)
type ModeFlag uint
const (
DebugMode ModeFlag = iota
InfoMode
WarningMode
ErrorMode
CriticalMode
SilentMode
)
var (
// mode is a global variable set to the run modes of this DVID process.
mode ModeFlag = InfoMode
// we use a single goroutine for writing a stream of m... |
package sheep
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
cashmereBirthday = nook.Birthday{
Day: 2,
Mon... |
// Copyright 2022 The CubeFS 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 pubsubapi
import (
"context"
"encoding/base64"
"encoding/json"
"strings"
"time"
"github.com/jpeden/smartthings-nest/internal/pkg/logging"
"github.com/jpeden/smartthings-nest/internal/pkg/sdmapi"
"github.com/pkg/errors"
apioption "google.golang.org/api/option"
pubsubv1 "google.golang.org/api/pubsub/v... |
package ui
import (
"fmt"
"log"
"github.com/jroimartin/gocui"
"github.com/k8smon/models"
)
var containerLogs []models.ContainerLog
var nos []models.Node
var noSelecionado models.Node
var pods []models.Pod
var podSelecionado models.Pod
var containerSelecionado string
const (
//Nós
nodesTitulo = "Nodes"
nodesR... |
package schema
import (
"fmt"
"reflect"
"regexp"
"strconv"
"strings"
datetime "github.com/di-wu/xsd-datetime"
"github.com/elimity-com/scim/errors"
"github.com/elimity-com/scim/optional"
)
// SimpleCoreAttribute creates a non-complex attribute based on given parameters.
func SimpleCoreAttribute(params SimpleP... |
// Copyright 2018 Anapaya Systems
//
// 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 k8s
import (
"context"
"fmt"
"io"
"io/ioutil"
"testing"
"github.com/pkg/errors"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/scheme"
apiv1 "k8s.io/client-go... |
package load
import (
"encoding/json"
"fmt"
"io"
"io/fs"
"os"
"path/filepath"
"strings"
"testing"
"testing/fstest"
"cuelang.org/go/cue/errors"
"github.com/grafana/grafana/pkg/schema"
"github.com/laher/mergefs"
"github.com/stretchr/testify/require"
)
var p = GetDefaultLoadPaths()
// Basic well-formednes... |
package internal
import (
"encoding/json"
"errors"
"fmt"
"log"
"strings"
)
const (
defaultEnvironment = Production
minNumber = 1
)
type Release struct {
branch string
number string
previousNumber string
environment ReleaseEnvironment
// File paths, which are not guaranteed t... |
package operation
import (
"bytes"
"io"
"mime"
"os"
"path"
"strconv"
"strings"
"github.com/chrislusf/seaweedfs/go/glog"
"github.com/chrislusf/seaweedfs/go/security"
)
type FilePart struct {
Reader io.Reader
FileName string
FileSize int64
IsGzipped bool
MimeType string
ModTime int64... |
package exporter_test
import (
"strconv"
"time"
"github.com/golang/mock/gomock"
"github.com/kenfdev/remo-exporter/config"
"github.com/kenfdev/remo-exporter/types"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"... |
// This file is safe to edit. Once it exists it will not be overwritten
package restapi
import (
"crypto/tls"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/pgillich/meals-demo/internal/models"
"github.com/pgillich/meals-demo/i... |
package main
import (
"bufio"
"bytes"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
n, k := readTwoNums(reader)
nums := make([]int, n)
for i := 0; i < n; i++ {
nums[i] = readNum(reader)
}
res := solve(k, nums)
var buf bytes.Buffer
for _, ans := range res {
buf.WriteString(fmt.Sprintf(... |
package service
import (
"context"
"fmt"
"io"
"log"
"net"
"sync"
"time"
ads "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v2"
"github.com/gogo/protobuf/proto"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc... |
// Copyright (c) 2018 CommerceBlock Team
// Use of this source code is governed by an MIT
// license that can be found in the LICENSE file.
package crypto
import (
"crypto/ecdsa"
"encoding/binary"
"math/big"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
"gi... |
package elementScraper
import (
"fmt"
"strings"
)
type tokpos struct {
lpos, rpos int
}
type tokval struct {
lpos, rpos int
value string
}
type toggle struct {
a int
}
type termPos struct {
term string
lpos int
}
func (elmScrpr *elementScraper) find(lpos int) string {
return elmScrpr.mapper[lpos]
}
... |
/*
* Go OAuth2 Client
*
* MIT License
*
* Copyright (c) 2015 Globo.com
*/
package galf
import (
"bytes"
"encoding/json"
"errors"
"io"
"net/http"
"time"
"github.com/afex/hystrix-go/hystrix"
"github.com/facebookgo/stackerr"
"github.com/globocom/goreq"
)
type (
Client struct {
TokenManager TokenManager
... |
package minecraft
import (
"vimagination.zapto.org/minecraft/nbt"
)
func yzx(x, y, z int32) uint32 {
return (uint32(y&15) << 8) | (uint32(z&15) << 4) | uint32(x&15)
}
func getNibble(arr nbt.ByteArray, x, y, z int32) byte {
coord := yzx(x, y, z)
data := byte(arr[coord>>1])
if coord&1 == 0 {
return data & 15
}... |
package search
import (
"context"
"encoding/json"
"net/url"
"strconv"
"time"
elastic "gopkg.in/olivere/elastic.v5"
"github.com/pkg/errors"
"github.com/urandom/readeef/content"
"github.com/urandom/readeef/content/repo"
"github.com/urandom/readeef/log"
)
const (
elasticIndexName = "readeef"
elasticArtic... |
// -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2018 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope tha... |
package validator
import (
"errors"
"fmt"
"strings"
"github.com/luqmanMohammed/eventsrunner-k8s-sensor/sensor/rules"
"github.com/luqmanMohammed/eventsrunner-k8s-sensor/utils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes"
"k8s.io/klog/v2"
... |
package main
import (
"fmt"
"time"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/pkg/errors"
)
// validateMoveOrCopy performs validation on a provided post list to determine
// if all permissions are in place to allow the for the posts to be moved or
// copied.
func (p *Plugin) validateMoveOrCop... |
/*
* Public Domain Software
*
* I (<NAME>) am the author of the source code in this file.
* I have placed the source code in this file in the public domain.
*
* For further information see: http://creativecommons.org/publicdomain/zero/1.0/
*/
/*
Package lockutil contains a file based lock which can be used to l... |
// Golang API for cex.io trading
// Author: <EMAIL>
// Contributor : <NAME> (https://github.com/AleksandrShepelev)
// Date: 09/03/2014
// Update: 12/04/2018
// Version: 0.4
package cexio
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"errors"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"time... |
package blockstore
import (
"bytes"
"io"
)
type inMemBlock struct {
data []byte
}
func newInMemBlock(size int) inMemBlock {
return inMemBlock{
data: make([]byte, size, size),
}
}
// Im Memory block storage is uesd for testing only
type InMemBlockStorage struct {
blocks []inMemBlock
blockLen int
blockSi... |
package main
import (
"bufio"
"crypto/rand"
"encoding/csv"
"flag"
"fmt"
"io"
"log"
"math/big"
"os"
"strings"
"text/tabwriter"
)
const version = "1.0.0"
var length = 6
var extra bool
var beale bool
var dw8k bool
var tsvfile string
var wordfile string
func init() {
flag.IntVar(&length, "w", 6, "number of ... |
package admin
import (
"encoding/json"
"net/http"
"sync"
"gateway/config"
aphttp "gateway/http"
"gateway/logreport"
"gateway/model"
apsql "gateway/sql"
"github.com/gorilla/context"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
)
func RouteSingularResource(controller SingularResourceController, p... |
package views
import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"github.com/go-kit/kit/log"
"github.com/skoona/homie-service/pkg/UIAdapters/gui/components"
dc "github.com/skoona/homie-service/pkg/deviceCore"
)
const (
HomeTab = "Home"
NetworksTab = "Networks"
Firmware... |
package agent
import (
"bufio"
"errors"
"fmt"
"io"
"net"
"net/http"
"strconv"
"time"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"
"github.com/google/gopacket/tcpassembly"
"github.com/google/gopacket/tcpassembly/tcpreader"
"github.com/jacexh/polaris/l... |
package main
import (
"bytes"
"io/ioutil"
"os"
"testing"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func executeCommand(root *cobra.Command, args ...string) (output string, err error) {
_, output, err = executeCommandC(root, args...)
return output, ... |
package processor
import (
"bufio"
"bytes"
"github.com/francoispqt/gojay"
"github.com/viant/cloudless/ioutil"
"io"
"sort"
"strconv"
"strings"
)
type (
Spec struct {
Format string
Delimiter string
}
//Sort represents configuration sort definition
Sort struct {
Spec
By []Field
Batch bool //... |
package monitoring
import (
"encoding/json"
"fmt"
"github.com/linkedin/goavro"
"github.com/smartcontractkit/chainlink-relay/pkg/monitoring/avro"
)
// See https://avro.apache.org/docs/current/spec.html#schemas
var transmissionAvroSchema = avro.Record("transmission", avro.Opts{Namespace: "link.chain.ocr2"}, avro.... |
// Copyright © 2018 NAME HERE <EMAIL ADDRESS>
//
// 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 main
import (
"flag"
"os"
"text/tabwriter"
"fmt"
ipamv1 "github.com/Nexinto/k8s-ipam/pkg/apis/ipam.nexinto.com/v1"
ipamclientset "github.com/Nexinto/k8s-ipam/pkg/client/clientset/versioned"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
... |
package cmd
import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/BurntSushi/toml"
"github.com/urfave/cli/v2"
"github.com/testground/testground/pkg/api"
"github.com/testground/testground/pkg/client"
"github.com/testground/testground/pkg/config"
"github.com/testground/testground/pkg/conv"
)
f... |
// Copyright 2019-present Open Networking Foundation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
// Package http provides an http client for use with checking remote signed
// statements.
package http
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"strings"
"time"
"unicode/utf8"
)
// ErrTimeout is a timeout error.
type ErrTimeout struct {
error
}
// Err is an HTTP Err... |
package main
import (
"crypto/x509"
"flag"
"fmt"
"io"
"log"
"math/rand"
"os"
"path"
"regexp"
"strings"
"time"
)
const (
usageCredentials = "use to set the info/credentials on Imgur"
usageConfig = "use to set the config file parameter with info/credentials on Imgur"
usageHttpPort = "use to set HT... |
package dns
import (
"fmt"
"time"
log "github.com/cihub/seelog"
types "github.com/chrusty/dns-from-gce/types"
context "golang.org/x/net/context"
google "golang.org/x/oauth2/google"
googledns "google.golang.org/api/dns/v1"
metadata "google.golang.org/cloud/compute/metadata"
)
// Periodically populate DNS us... |
package scheduler
import (
"context"
"fmt"
"github.com/kubernetes-csi/csi-driver-lvm/pkg/scheduler/filter"
"github.com/kubernetes-csi/csi-driver-lvm/pkg/scheduler/postfilter"
"github.com/kubernetes-csi/csi-driver-lvm/pkg/scheduler/score"
//"github.com/BCRDB/LVM-Scheduler/pkg/lvm/sort"
v1 "k8s.io/api/core/v1"
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.