text stringlengths 3.08k 10.4k |
|---|
/*
* Copyright (c) 2019 Google LLC.
*
* 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,... |
package certdepot
import (
"time"
"github.com/pkg/errors"
"github.com/square/certstrap/depot"
"github.com/square/certstrap/pkix"
)
// CrtTag returns a tag corresponding to a certificate.
func CrtTag(prefix string) *depot.Tag {
return depot.CrtTag(prefix)
}
// PrivKeyTag returns a tag corresponding to a private... |
// Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may not
// use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" fil... |
package main
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
import (
"context"
"fmt"
"path/filepath"
mow "github.com/jawher/mow.cli"
"github.com/opctl/opctl/cli/internal/clicolorer"
core "github.com/opctl/opctl/cli/internal/core"
"github.com/opctl/opctl/cli/internal/model"
op "github... |
// _example/example.go
package main
import (
"bytes"
"context"
"flag"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
"path"
"sort"
"text/template"
"time"
"github.com/kenshaw/diskcache"
"github.com/kenshaw/httplog"
"github.com/kenshaw/webfonts"
)
func main() {
verbose := flag.Bool("v", false, "verbose")
add... |
package connect
import (
"strconv"
"strings"
cconf "github.com/pip-services3-go/pip-services3-commons-go/config"
cerr "github.com/pip-services3-go/pip-services3-commons-go/errors"
cref "github.com/pip-services3-go/pip-services3-commons-go/refer"
cauth "github.com/pip-services3-go/pip-services3-components-go/aut... |
package fsm
import (
"reflect"
"runtime"
"testing"
)
func TestDFA(t *testing.T) {
fixture := DFADescription{
Rules: []TransitionRule{
{0, 'a', 1},
{1, 'b', 0},
{1, 'a', 2},
},
AcceptState: 2,
}
dfa := NewForwardDFA(&fixture)
dfa.Feed('a')
dfa.Feed('a')
if !dfa.Accepted() || dfa.State() != 2 {
... |
package cmd
import (
"context"
"fmt"
"log"
"path/filepath"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/aws/eks-anywhere/pkg/addonmanager/addonclients"
"github.com/aws/eks-anywhere/pkg/bootstrapper"
"github.com/aws/eks-anywhere/pkg/cluster"
"github.com/aws/eks-any... |
package dynamo
import (
"bufio"
"context"
"encoding/csv"
"errors"
"fmt"
"io"
"log"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"github.com/ourrootsorg/cms-server/model"
)
const (
givenNameVariantsType ... |
package database
////////////////////////////////////////////////////////////////////////////////////////////////
/// Imports
////////////////////////////////////////////////////////////////////////////////////////////////
import (
"github.com/helyx-io/commute-importer/config"
"github.com/jinzhu/gorm"
"fm... |
package main
import (
"os"
"os/exec"
"strings"
"sync"
"syscall"
"time"
"github.com/go-fsnotify/fsnotify"
)
type TaskCoodinator struct {
mutex sync.RWMutex
runningTasks []*Task
}
func NewTaskCoodinator() *TaskCoodinator {
return &TaskCoodinator{
mutex: sync.RWMutex{},
runningTasks: []*Tas... |
package http
import (
"fmt"
"net/http"
"runtime/debug"
"strings"
"time"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/swarm/api"
"github.com/ethereum/go-ethereum/swarm/chunk"
"github.com/ethereum/go-ethereum/swarm/log"
"github.com/ethereum/go-ethereum/swarm/sctx"
"github.com/et... |
package spy
import (
"fmt"
"net/url"
"path"
"regexp"
"strings"
)
// common file extensions that are not followed if they occur in links
var IgnoredExtensions = []string{
// images
"mng", "pct", "bmp", "gif ", "jpg", "jpeg", "png", "pst", "psp", "tif",
"tiff", "ai", "drw", "dxf", "eps", "ps", "svg",
// audio... |
package drivers
import (
"encoding/json"
"fmt"
"sync"
"time"
"github.com/Arvinderpal/embd-project/common/adaptorapi"
"github.com/Arvinderpal/embd-project/common/driverapi"
"github.com/Arvinderpal/embd-project/common/message"
"github.com/Arvinderpal/embd-project/common/seguepb"
"gobot.io/x/gobot"
"gobot.io/... |
package balancer
import (
"net"
"time"
"github.com/ReToCode/openshift-cross-cluster-loadbalancer/balancer/core"
"github.com/sirupsen/logrus"
"strconv"
)
type BalancerConfig struct {
httpListen string
httpsListen string
//proxyTimeout time.Duration
routerHostTimeout time.Duration
}
type B... |
/*
* MIT License
*
* Copyright (c) 2017 <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,... |
// Copyright 2021 The CDK Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use 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 page
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
"sort"
"strconv"
"strings"
)
//PageList list all handle in the page
func (s *Service) PageList(w http.ResponseWriter, r *http.Request) {
log.Print("Running http handle model.HomeList!")
tpl, err := template.ParseFiles(s.Environment["TEMPLATE"... |
package fetching
import (
"crypto/rand"
"fmt"
"github.com/goinggo/work"
"io"
"sync"
"sync/atomic"
)
type orderCollector struct {
client OrderFetcher
pool *work.Pool
maxWorkers int
regionId int32
orderChan chan OrderPayload
start chan RegionInfo
done chan RegionInfo
endReached ... |
package docker
import (
"github.com/fsouza/go-dockerclient"
"fmt"
"log"
"os"
)
const DOCKER_STOP_TIMEOUT = 10 // seconds
type Options struct {
DockerEndpoint string `long:"docker-endpoint"`
Logger *log.Logger
}
type Manager struct {
log *log.Logger
... |
package bootstrap
import (
"encoding/json"
"fmt"
"github.com/jessevdk/go-flags"
"log"
"math/rand"
"os"
"path/filepath"
"runtime"
"time"
)
type Flags struct {
ConfFile string `long:"conf" default:"./conf.json" description:"Specify location of Factorio Server Manager config file."`
FactorioDir ... |
// Copyright 2020-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 writing... |
// Copyright (c) 2020, pole-group. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package entity
import (
"encoding/json"
"strconv"
"strings"
"github.com/pole-group/lraft/utils"
)
type ElectionPriority int16
const (
ElectionPriority... |
package exec
import (
"context"
"errors"
"fmt"
"io/ioutil"
"code.cloudfoundry.org/lager"
"code.cloudfoundry.org/lager/lagerctx"
"sigs.k8s.io/yaml"
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/configvalidate"
"github.com/concourse/concourse/atc/db"
"github.com/concourse/concours... |
package db
import (
"database/sql"
"time"
)
// 图片
type Image struct {
UUID string `db:"uuid"` // unique id
CreateAt time.Time `db:"create_at"` // create time
UpdateAt time.Time `db:"update_at"` // update time
Data []byte `db:"data"` // image 数据
Mime string `db:"mime"` // ima... |
package main
import (
"bytes"
"log"
"net"
"os"
"strconv"
"sync"
"time"
)
func TCPServer(wg *sync.WaitGroup) {
listener, err := net.ListenTCP("tcp", laddrTCP)
if err != nil {
log.Println("Error in starting server : ", err)
os.Exit(1)
}
log.Println("Starting TCP Server...")
go consume()
for {
conn... |
package types
type Operation uint8
const (
CREATE_ACCOUNT Operation = 3
CREATE_TRANSFER Operation = 4
COMMIT_TRANSFER Operation = 5
ACCOUNT_LOOKUP Operation = 6
TRANSFER_LOOKUP Operation = 7
)
type Uint128 [16]byte
type Account struct {
ID Uint128
UserData Uint128
Reserved [48]u... |
package fileio
// .esp - Effect sprite data
import (
"encoding/binary"
"io"
"log"
"os"
)
type ESPHeader struct {
Ids [8]uint8 // If value doesn't equal 0xff, there is an animation
}
type AnimBlockHeader struct {
NumFrames uint16
NumSprites uint16
Width uint8
Height uint8
Unknown uint16
}
typ... |
package kernel
import (
"bytes"
"context"
"errors"
"fmt"
"regexp"
"strconv"
"time"
"github.com/gonum/plot/palette/brewer"
"github.com/prometheus/client_golang/api"
promv1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/common/model"
"github.com/xperimental/ipromnb/scaffold"
... |
package cluster
// xlCluster_go/cluster_member_test.go
import (
"crypto/rsa"
"fmt"
xh "github.com/jddixon/hamt_go"
xr "github.com/jddixon/rnglib_go"
xi "github.com/jddixon/xlNodeID_go"
xn "github.com/jddixon/xlNode_go"
xt "github.com/jddixon/xlTransport_go"
. "gopkg.in/check.v1"
"time"
)
// Create a test cl... |
// Copyright 2019 <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... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: server.proto
package pb
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 _ = math.Inf
// This is a compi... |
// Package cluster provides common interfaces and local access to cluster-level metadata
/*
* Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
*/
package cluster
import (
"sync"
"time"
"github.com/NVIDIA/aistore/cmn/cos"
"github.com/NVIDIA/aistore/cmn/debug"
)
// nameLocker is a 2-level struct... |
package mango
import (
"fmt"
"html/template"
"io"
"io/ioutil"
"net/http"
"strings"
"github.com/gorilla/mux"
)
// Server - mango server for serving content from mango-structure data
type Server struct {
Host string
Port string
App *Application
Templates *template.Template
Router *mux.Ro... |
package buildpack
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/yourbase/yb"
"github.com/yourbase/yb/internal/biome"
"zombiezen.com/go/log"
)
func installJava(ctx context.Context, sys Sys, spec yb.BuildpackSpec) (_ biome.Environment, err error) {
installDir := sys.Biome.JoinPath(sys.Biome.Dirs().T... |
package zookeeper
import (
"github.com/golang/glog"
"github.com/kopeio/kope"
"github.com/kopeio/kope/base"
"github.com/kopeio/kope/chained"
"github.com/kopeio/kope/process"
"os"
"strconv"
"strings"
"time"
)
const DefaultMemory = 256
type Manager struct {
base.KopeBaseManager
process *process.Process
conf... |
package main
import (
"bytes"
"fmt"
"testing"
)
func Benchmark_incFilename(b *testing.B) {
b.ReportAllocs()
var f flagParams
for n := 0; n < b.N; n++ {
f.incFilename(n)
}
}
func Benchmark_lineCounter(b *testing.B) {
b.ReportAllocs()
var in *bytes.Buffer
var tmpstr string
for i := 0; i < 9; i++ {
tm... |
// SPDX-FileCopyrightText: 2020-present Open Networking Foundation <<EMAIL>>
//
// SPDX-License-Identifier: Apache-2.0
//
package trafficsim
import (
"context"
"github.com/onosproject/ran-simulator/pkg/store/event"
simapi "github.com/onosproject/onos-api/go/onos/ransim/trafficsim"
simtypes "github.com/onosproj... |
package mercadopago
// Payment is the data struct for payment MP API
type Payment struct {
ID int `json:"id,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateApproved string `json:"date_approved,omitempty"`
DateLastUpdated string `json:"date_last_updated,omitempty"`
Mon... |
// *** 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 linode
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides details about an LKE Cluster.
//
// ## E... |
/*
* Copyright (c) 2017 <NAME> (Gmail: kurt.w.jung)
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE A... |
package parser
import (
"bytes"
"fmt"
"strconv"
"strings"
"syscall"
"time"
"github.com/pantheon-systems/pauditd/pkg/metric"
)
const (
HEADER_MIN_LENGTH = 7 // Minimum length of an audit header
HEADER_START_POS = 6 // Position in the audit header that the data sta... |
// ZooBC zed25519
//
// Copyright © 2020 Quasisoft Limited - Hong Kong
//
// ZooBC is architected by <NAME> & <NAME>
// contact us at roberto.capodieci[at]blockchainzoo.com
// and barton.johnston[at]blockchainzoo.com
//
// Permission is hereby granted, free of charge, to any person obtaining a
/... |
package gvabe
import (
"fmt"
"log"
"strings"
"github.com/btnguyen2k/prom"
"main/src/goapi"
"main/src/gvabe/bo"
"main/src/gvabe/bo/group"
"main/src/gvabe/bo/user"
userv2 "main/src/gvabe/bov2/user"
"main/src/henge"
"main/src/utils"
)
func _createSqlConnect(dbtype string) *prom.SqlConnect {
switch dbtype {... |
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"... |
package goku
// all the thing about route
// may be change route to interface ?
import (
"fmt"
"regexp"
//"path"
"github.com/QLeelulu/goku/utils"
)
var (
regPathParse *regexp.Regexp = regexp.MustCompile("/?\\{[\\w\\-_]+\\}") // matched like this: /{controller}
)
// Route config
// var rt = ... |
package requests
import (
"crypto/sha256"
"encoding/base64"
"encoding/json"
"regexp"
"strings"
"time"
"github.com/ghodss/yaml"
"github.com/pelletier/go-toml"
)
type CompactRequestStatistics struct {
Stats
// required: true
StartTime time.Time
TotalRequests int `json:"total_requests"`
Complet... |
package gormigro
import (
"fmt"
"log"
"os"
"time"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
const (
InitialSchemaMigrationName = "__initialMigration"
)
// Gormigro is migration tool which allow you to simply handle migrations with gorm.io
type Gormigro struct {
// db gorm database
db *gorm.DB
// options ref... |
package compile
import (
"strconv"
"subc/ast"
"subc/scan"
)
// stmt generates code for statements.
func (c *compiler) stmt(s ast.Stmt) {
pos := s.Span().Start
switch s := s.(type) {
case *ast.EmptyStmt, *ast.BadStmt:
// skip
case *ast.BlockStmt:
for _, x := range s.Stmt {
c.stmt(x)
}
case *ast.IfStm... |
package main
import (
"time"
"cloud.google.com/go/datastore"
"github.com/jung-kurt/gofpdf"
)
var pdf *gofpdf.Fpdf
// GeneratePdf .
//
// Related: convert pdf to jpg with imagick https://stackoverflow.com/questions/47492837/golang-convert-pdf-to-image-by-bimg
func GeneratePdf(inputDate time.Time) {
pdf = gofpdf.... |
package gomog
import(
"strconv"
"net/url"
"errors"
"net/http"
"sync"
"io"
"fmt"
"math/rand"
)
type countingReader struct {
r io.Reader
bytes int
}
func (cr *countingReader) Read( buffer []byte ) (nr int, err error) {
nr, err = cr.r.Read( buffer )
cr.bytes += nr
return
}
type MogileKey... |
package godraw
import (
"fmt"
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/go-gl/glfw/v3.1/glfw"
"github.com/go-gl/mathgl/mgl32"
"log"
"strings"
)
func CreateContext(width, height int) Context {
vertexShader := `
#version 330
uniform mat4 projection;
uniform mat4 camera;
uniform mat4 model;
in vec3 vert;
voi... |
package server
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
spew "github.com/davecgh/go-spew/spew"
ws "github.com/gorilla/websocket"
common "github.com/miguelmota/go-gun/common"
netutil "github.com/miguelmota/go-gun/netutil"
storage "github.com/miguelmota/go-gun/storage"
types "github.com/m... |
/*
Copyright (c) 2021 <NAME>(<EMAIL>), <NAME>(<EMAIL>),<NAME>(<EMAIL>), <NAME>(<EMAIL>), <NAME>(<EMAIL>)
OpenGauss Operator is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/... |
package main
import (
"fmt"
"time"
)
var p = fmt.Println
var pf = fmt.Printf
// timeTrack is used for basic benchmarking in other functions
func timeTrack(start time.Time, name string) {
elapsed := time.Since(start)
fmt.Printf("%s took %s \n", name, elapsed)
}
func makeLexicoPermList(arr []int) [][]int {
// n... |
package auth
import (
"context"
"fmt"
"github.com/sourcegraph/sourcegraph/cmd/frontend/db"
"github.com/sourcegraph/sourcegraph/pkg/actor"
"github.com/sourcegraph/sourcegraph/pkg/errcode"
"github.com/sourcegraph/sourcegraph/pkg/extsvc"
)
var MockGetAndSaveUser func(ctx context.Context, op GetAndSaveUserOp) (use... |
package pf
import (
"bufio"
"fmt"
"os/exec"
"regexp"
"strconv"
"strings"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
const measurement = "pf"
const pfctlCommand = "pfctl"
type PF struct {
PfctlCommand string
PfctlArgs []string
UseSudo bool
StateTable []*E... |
// Package store provides state to the apate cluster
package store
import (
"container/list"
"sync"
"github.com/atlarge-research/apate/pkg/scenario"
"github.com/pkg/errors"
"github.com/atlarge-research/apate/api/health"
"github.com/google/uuid"
"github.com/atlarge-research/apate/api/apatelet"
)
//TODO: Mu... |
package mqueue
import (
"encoding/json"
"time"
"emperror.dev/errors"
"github.com/jonas747/discordgo"
"github.com/jonas747/yagpdb/bot"
"github.com/jonas747/yagpdb/common"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
)
type DiscordProcessor struct {
}
func (d *DiscordProcessor... |
package main
import (
"context"
"os"
"os/signal"
"syscall"
"time"
ainform "github.com/airenas/async-api/pkg/inform"
mng "github.com/airenas/async-api/pkg/mongo"
"github.com/airenas/async-api/pkg/rabbit"
"github.com/airenas/big-tts/internal/pkg/inform"
"github.com/airenas/big-tts/internal/pkg/messages"
"git... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
/*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* This source code is licensed under the Apache License Version 2.0.
*/
package tpl
import (
"bytes"
"text/template"
"github.com/pkg/errors"
)
var applicationTpl = `
configProperties:
version: v2 # config.yaml version
envFile: e... |
// Copyright 2022 The Parca 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 w... |
package requests
import (
"fmt"
"net/url"
"strings"
"github.com/google/go-querystring/query"
"github.com/atomicjolt/canvasapi"
"github.com/atomicjolt/string_utils"
)
// GetOutcomeResultRollups Gets the outcome rollups for the users and outcomes in the specified
// context.
// https://canvas.instructure.com/do... |
/*
* 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 ... |
package controller
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/a8uhnf/service-proxy/pkg/handlers"
"github.com/a8uhnf/service-proxy/pkg/utils"
api_v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
utilrunti... |
package policy
import (
"context"
"fmt"
"sync"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
"github.com/oasislabs/oasis-core/go/common"
"github.com/oasislabs/oasis-core/go/common/accessctl... |
/*
Copyright 2022 The KCP 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, softwar... |
// Copyright 2015 Raitucarp. All rights reserved.
// license that can be found in the LICENSE file.
// Package virtebi provides virtebi sorting algorithm
// to split multiple joined words into readable string.
package virtebi
// import modules
import (
"github.com/cheggaaa/pb"
"github.com/syndtr/goleveldb/lev... |
/*
Copyright 2015 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 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 rmdnodestate
import (
"context"
"encoding/json"
"fmt"
"github.com/intel/rmd-operator/pkg/apis"
intelv1alpha1 "github.com/intel/rmd-operator/pkg/apis/intel/v1alpha1"
"github.com/intel/rmd-operator/pkg/rmd"
"github.com/intel/rmd-operator/pkg/state"
rmdtypes "github.com/intel/rmd/modules/workload/types"
... |
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"sort"
"strings"
"text/template"
)
const (
inPath = "web"
outFile = "templates.go"
)
var fns = template.FuncMap{
"join": strings.Join,
}
var t = `
// generated by go generate; DO NOT EDIT
package main
import ... |
package cmd
/*
Copyright 2018 Crunchy Data Solutions, 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 logger
import (
"errors"
"fmt"
"os"
"strings"
"sync"
"github.com/loveandpeople-DAG/goHive/typeutils"
"github.com/spf13/viper"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// The Logger uses the sugared logger.
type Logger = zap.SugaredLogger
// A Level is a logging priority. Higher levels are more... |
package schemabuilder
import (
"context"
"fmt"
"log"
"reflect"
"strings"
"github.com/northvolt/thunder/graphql"
)
// IfaceStrategy determines the strategy that should be used for what fields
// to expose in GraphQL for a specific type.
type IfaceStrategy func(*schemaBuilder, reflect.Method) (string, *graphql.F... |
package internal
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"regexp"
"testing"
"github.com/infobip-community/infobip-api-go-sdk/pkg/infobip/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestPostMultipartReqOK(t *tes... |
package schema_store
import (
"database/sql"
"fmt"
"strings"
"sync"
"github.com/go-sql-driver/mysql"
"github.com/juju/errors"
log "github.com/sirupsen/logrus"
"github.com/moiot/gravity/pkg/utils"
)
func GetCreateSchemaStatement(db *sql.DB, schemaName string) (error, string) {
var createDBStatement string
... |
package generate
import (
"io/ioutil"
"log"
"os"
"path/filepath"
"github.com/go-openapi/analysis"
"github.com/go-openapi/swag"
"github.com/michalq/go-swagger/generator"
flags "github.com/jessevdk/go-flags"
"github.com/spf13/viper"
)
// FlattenCmdOptions determines options to the flatten spec preprocessing
t... |
/*
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 saelastic
import (
"context"
"log"
"time"
"github.com/olivere/elastic"
"github.com/satori/go.uuid"
)
var debuges = func(format string, data ...interface{}) {} // Default no debugging output
//IndexName ..
type IndexName string
//IndexType ....
type IndexType string
//COLLECTD
const (
CONNECTIVITYI... |
// 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... |
/* license: https://mit-license.org
*
* Ming-Ke-Ming : Decentralized User Identity Authentication
*
* Written in 2020 by Moky <<EMAIL>>
*
* ==============================================================================
* The MIT License (MIT)
*
* Copyright (c) 2020 <NAME>
*
* ... |
package kubeletconfig
import (
"bytes"
"fmt"
"reflect"
ignv2_2types "github.com/coreos/ignition/config/v2_2/types"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
ctrlcommon "github.com/openshift/machine-config-operator/pkg/controller/common"
"github.com/vinc... |
package decider_test
import (
"fmt"
"regexp"
"github.com/cloudfoundry/cloud-service-broker/brokerapi/broker/decider"
"github.com/cloudfoundry/cloud-service-broker/internal/paramparser"
"github.com/hashicorp/go-version"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pivotal-cf/brokerapi/v... |
// Copyright 2018 The Goma 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 backend
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"go.chromium.org/goma/server/auth"
"go.chromium.org/goma/server/auth/enduser"
... |
// 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... |
package sealing
type SectorState string
var ExistSectorStateList = map[SectorState]struct{}{
Empty: {},
WaitDeals: {},
Packing: {},
AddPiece: {},
AddPieceFailed: {},
GetTicket: {},
PreCommit1: {},
PreCommit2: ... |
/*
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 2016 <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 httpparms
import (
"encoding/json"
"io"
"net/http"
"net/url"
"strings"
"testing"
"github.com/go-playground/form"
"github.com/gorilla/schema"
multierr... |
package oa
import (
"context"
"testing"
"github.com/golang/mock/gomock"
"github.com/shenghui0779/gochat/wx"
"github.com/stretchr/testify/assert"
)
func TestAuthURL(t *testing.T) {
oa := New("APPID", "APPSECRET")
oa.nonce = func(size int) string {
return "STATE"
}
assert.Equal(t, "https://open.weixin.qq.c... |
package api
import (
"errors"
"fmt"
"github.com/spiffe/go-spiffe/v2/spiffeid"
"github.com/spiffe/spire-api-sdk/proto/spire/api/types"
"github.com/spiffe/spire/pkg/common/idutil"
"github.com/spiffe/spire/pkg/common/protoutil"
"github.com/spiffe/spire/pkg/common/x509util"
"github.com/spiffe/spire/proto/spire/co... |
package scan
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
consoleHelpers "github.com/Checkmarx/kics/internal/console/helpers"
"github.com/Checkmarx/kics/pkg/analyzer"
"github.com/Checkmarx/kics/pkg/engine/provider"
"github.com/Checkmarx/kics/pkg/model"
"github.com/pkg/errors"
"github.com/rs/zerol... |
package oauth
import (
"errors"
configv1 "github.com/openshift/api/config/v1"
legacyconfigv1 "github.com/openshift/api/legacyconfig/v1"
oauthv1 "github.com/openshift/api/oauth/v1"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/seria... |
package main
import (
"bufio"
"fmt"
"log"
"net"
"os"
"sync"
"time"
"github.com/pkg/errors"
"gortc.io/stun"
)
func main() {
client := NewClient()
defer client.Close()
wg := &sync.WaitGroup{}
wg.Add(1)
client.OnStunAddr(func(addr string) {
fmt.Printf("Our address: %s\n", addr)
wg.Done()
})
clien... |
/*
* Minio Client (C) 2015, 2016 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law ... |
/*
Copyright 2018 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 route
import (
"errors"
"fmt"
"log"
"net"
"net/http"
"strings"
)
const (
ipAllowTag = "allow:ip"
ipDenyTag = "deny:ip"
)
// AccessDeniedHTTP checks rules on the target for HTTP proxy routes.
func (t *Target) AccessDeniedHTTP(r *http.Request) bool {
// No rules ... skip checks
if len(t.accessRules)... |
package pubnub
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/pubnub/go/pnerr"
"github.com/pubnub/go/utils"
)
const getStatePath = "/v2/presence/sub-key/%s/channel/%s/uuid/%s"
var emptyGetStateResp *GetStateResponse
type getStateBuilder struct {
op... |
package httphelpers
import (
"log"
"net/http"
"sync"
)
// StreamControl is the interface for manipulating streams created by ChunkedStreamingHandler.
type StreamControl interface {
// Enqueue is the same as Send, except that if there are currently no open connections to this
// endpoint, the data is enqueued and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.