text stringlengths 3.08k 10.4k |
|---|
// Copyright (c) 2015 <NAME>
// This file is licensed under the MIT license.
// See the LICENSE file for more information.
package main
import (
"log"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
"code.google.com/p/go-uuid/uuid"
r "github.com/dancannon/gorethink"
)
const (
numWorkers = 50
)
fun... |
package util
import (
"context"
"crypto/tls"
"encoding/json"
"math/rand"
"net"
"net/http"
"net/http/cookiejar"
"net/url"
"os"
"path/filepath"
"sync"
"time"
"unsafe"
)
var agents = []string{
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36",
"Mozi... |
package client
import (
"github.com/cnlh/nps/lib/common"
"github.com/cnlh/nps/lib/conn"
"github.com/cnlh/nps/lib/lg"
"github.com/cnlh/nps/lib/pool"
"net"
"sync"
"time"
)
type TRPClient struct {
svrAddr string
linkMap map[int]*conn.Link
tunnel *conn.Conn
msgTunnel *conn.Conn
brid... |
// Code generated by go-swagger; DO NOT EDIT.
package gamification
// 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... |
package s3queue
import (
"database/sql"
"encoding/json"
"fmt"
"sync"
// sqlite driver
_ "github.com/mattn/go-sqlite3"
)
// Queue 是一个使用 SQLite 实现的队列
type Queue struct {
db *sql.DB
dbLock sync.Mutex
taskTypeNameToIDMap map[string]int
taskTypeIDToNameMap map[int]string
taskTypeMapLock sync.Mutex
i... |
package daemon
import (
"fmt"
"io/ioutil"
"log"
"math"
"net/http"
"net/url"
"os"
"strconv"
"time"
"github.com/larsth/go-gpsfix"
"github.com/larsth/go-rmsggpsbinmsg"
"github.com/larsth/rmsggpsd-gpspipe/errors"
)
var ErrNoSuchUrlKey = errors.New("No such url.Values key")
func parseFloat32FromUrlValue(v ur... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package cloudwatch
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/cloudwatch/types"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smi... |
package ssh
import (
"context"
"fmt"
"net"
"os"
"sync"
"github.com/anmitsu/go-shlex"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh"
)
type Session interface {
ssh.Channel
Logger() Logger
User() string
RemoteAddr() net.Addr
LocalAddr() net.Addr
Environ() []string
Exit(code int) error
ExitSignal(si... |
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"runtime"
"strings"
"sync"
"time"
"github.com/arkste/sherlock/data"
strip "github.com/grokify/html-strip-tags-go"
)
const (
userAgent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/... |
package arukas
import (
"bytes"
"encoding/json"
"reflect"
"strings"
"testing"
"github.com/dopin/jsonapi"
)
const singleAppResponseJson = `
{
"data": {
"id": "126cd38b-371d-451a-8965-b84f1215ddfb",
"type": "apps",
"attributes": {
"name": "redis",
"created-at": "2018-03-29T09:20:01.704Z",
"upda... |
package ast
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
"path/filepath"
"runtime"
"strings"
"unicode"
"unicode/utf8"
)
// type WalkFunc func(path string, info os.FileInfo, err error) error
type FileSystemWalker interface {
Walk(string, filepath.WalkFunc) error
}
type filePathWalker struct{}
func ... |
package interpreter
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"strconv"
"github.com/maknahar/go-utils"
"github.com/nlopes/slack"
)
type Order struct {
SessionID string `json:"sessionId"`
BlockCode string `json:"blockCode"`
Bill struct {
Total float64 `json:"total... |
// Copyright 2018 Twitch Interactive, 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. A copy of the License is
// located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license"... |
package main
import (
"flag"
"github.com/elazarl/goproxy"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"fmt"
"regexp"
"bufio"
"strings"
"io"
)
type readCloser struct {
io.Reader
io.Closer
}
type shokolatHttpProxy struct {
proxy *goproxy.ProxyHttpServer
cachePatterns []*regexp.Regexp
docRoot *st... |
package main
import (
"crypto/rand"
"database/sql"
"fmt"
"html/template"
"io/ioutil"
"mime"
"net/http"
"os"
"regexp"
"strconv"
"strings"
"time"
_ "github.com/mattn/go-sqlite3"
)
var db *sql.DB
var parsedTemplates *template.Template
var host = os.Getenv("HOST")
var onion = os.Getenv("ONION")
type Sucess... |
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
package shortuuid
import (
"fmt"
"math"
"math/big"
"sort"
"strings"
crand "crypto/rand"
"github.com/satori/go.uuid"
)
type ShortUUID struct {
alphabet []string
alphaLength int
}
func (su *ShortUUID) GetAlphabet() string {
return strings.Join(su.alphabet, "")
}
func (su *ShortUUID) SetAlphabet(alphabet... |
/*
nginx-sso - Simple cookie-based single-sign-on
Copyright (C) 2015 by <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your... |
package main
import (
"flag"
"fmt"
"io"
"os"
"runtime/debug"
"strings"
"text/tabwriter"
)
// Version can be used to set the version at link time
var Version string
type options struct {
allowed string
download bool
dump bool
listLicenses bool
listLicenseNames bool
output... |
// Vkpipe by DomesticMoth
//
// To the extent possible under law, the person who associated CC0 with
// Vkpipe has waived all copyright and related or neighboring rights
// to Vkpipe.
//
// You should have received a copy of the CC0 legalcode along with this
// work. If not, see <http://creativecommons.org/publicdomai... |
// Package cmd contains the core application logic and goroutine launch points.
package cmd
import (
"context"
"fmt"
"os"
"time"
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
"github.com/ropes/banken/pkg/sniff"
"github.com/ropes/banken/pkg/traffic"
log "github.com/sirupsen/logrus"
"gi... |
package options
import (
"flag"
"fmt"
"github.com/DeNA/unity-meta-check/options"
"github.com/DeNA/unity-meta-check/tool/unity-meta-check-github-pr-comment/github"
"github.com/DeNA/unity-meta-check/tool/unity-meta-check-github-pr-comment/l10n"
"github.com/DeNA/unity-meta-check/tool/unity-meta-check-github-pr-comm... |
package mconn
import (
"bufio"
"bytes"
"crypto/tls"
"fmt"
"io"
"net"
"sync"
"time"
"github.com/juju/errors"
)
const (
_ = iota
connStatusConnected
connStatusClosed
)
const (
badConnErrDesc = "bad connection: "
maxPayloadLength = 1<<24 - 1
)
var (
// ErrMalformPacket represents a response with the ... |
// SPDX-FileCopyrightText: 2021 k8sviz authors
// SPDX-License-Identifier: Apache-2.0
package resources
import (
"fmt"
"os"
"strings"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
v1beta1 "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/api... |
package scanner
import (
"fmt"
"regexp"
"strconv"
"github.com/gustavopergola/golox/src/token"
)
type ScannerError struct {
line int
message string
}
type Scanner struct {
SourceCode string
Errors []ScannerError
runes []rune
tokens []token.Token
line int
start int
current int
}
func (s *... |
package gopace
import (
"bytes"
"crypto/rand"
"encoding/asn1"
"fmt"
)
var (
cardAccessEF = []byte{0x01, 0x1c}
apduSetAT = []byte{0x00, 0x22, 0xc1, 0xa4}
getNonce = []byte{0x10, 0x86, 0x00, 0x00}
mapNonce = []byte{0x10, 0x86, 0x00, 0x00}
performKeyAgreement = []byte... |
package auth
import (
"crypto"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"errors"
"io/ioutil"
"log"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"time"
"github.com/ligenhw/goshare/user"
)
type AlipayClient struct {
Url string
AppID ... |
// SPDX-FileCopyrightText: 2020-present Open Networking Foundation <<EMAIL>>
//
// SPDX-License-Identifier: Apache-2.0
//
package routes
import (
"context"
"github.com/onosproject/ran-simulator/pkg/store/routes"
"github.com/onosproject/ran-simulator/pkg/store/event"
modelapi "github.com/onosproject/onos-api/go... |
// Copyright The 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 writ... |
package internal
import (
"fmt"
"strings"
"time"
"github.com/slack-go/slack"
"github.com/sirupsen/logrus"
"github.com/perkbox/cloud-access-bot/internal/utils"
)
type Cloud interface {
ResourceFinder(service string, accountName string) ([]string, bool)
ValidateResourcesFormat(resources []string) []string
}
... |
// Copyright 2017, 2020 The Agostle Authors. All rights reserved.
// Use of this source code is governed by an Apache 2.0
// license that can be found in the LICENSE file.
// Package converter implements function for converting files to PDF
package converter
import (
"os"
"os/exec"
"path/filepath"
"time"
"conte... |
// Copyright (c) 2019, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this software.
package sys
import (
"log"
"os"
"path/filepath"
"runtim... |
// Copyright 2021 Authors of KubeArmor
// SPDX-License-Identifier: Apache-2.0
package genscript
import (
//"flag"
//"fmt"
kg "github.com/kubearmor/KVMService/operator/log"
"os"
"strconv"
)
var (
ewFile *os.File
p GenScriptParams
ScriptData string
)
type GenScriptParams struct {
port uint1... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package main
import (
"encoding/xml"
"flag"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/microsoft/go-infra/buildmodel"
"github.com/microsoft/go-infra/buildmodel/buildassets"
"github.com/microsoft/go-infra/execu... |
package broker
import (
"bytes"
"encoding/json"
"io/ioutil"
"path"
"reflect"
"testing"
"github.com/stretchr/testify/require"
"github.com/kyma-project/control-plane/components/kyma-environment-broker/internal"
)
func TestSchemaGenerator(t *testing.T) {
tests := []struct {
name string
generator... |
// Copyright (c) 2021 Terminus, 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 agree... |
package pterm_test
import (
"io"
"testing"
"time"
"github.com/MarvinJWendt/testza"
"github.com/pterm/pterm"
)
func TestSpinnerPrinter_NilPrint(t *testing.T) {
p := pterm.SpinnerPrinter{}
p.Success()
p.Warning()
p.Fail()
}
func TestSpinnerPrinter_Fail(t *testing.T) {
p := pterm.DefaultSpinner
testPrintCon... |
package dbUtils
import (
"database/sql"
"errors"
"fmt"
"log"
"reflect"
"strings"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
)
var db *sql.DB
func checkErr(err error) {
if err != nil {
fmt.Println("Error")
log.Fatal(err)
}
}
func Connect(driver string, db... |
package cmd
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/google/renameio"
"github.com/spf13/cobra"
"github.com/twpayne/chezmoi/internal/chezmoi"
vfs "github.com/twpayne/go-vfs"
)
var editCmd = &cobra.Command{
Use: "edit targets...",
Short: "Edit the source state of a target",
Long: ... |
// MinIO Cloud Storage, (C) 2016, 2017, 2018 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 appl... |
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
"os/signal"
"path/filepath"
"strings"
"time"
"unicode"
"github.com/sixt/gomodproxy/pkg/api"
"expvar"
_ "net/http/pprof"
)
func prometheusExpose(w io.Writer, name string, v interface{}) {
// replace all in... |
/*
* Copyright 2019 The Knative Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
package db2
import (
"fmt"
"math"
"reflect"
"strconv"
"strings"
sq "github.com/Masterminds/squirrel"
"github.com/stellar/go/support/errors"
)
const (
// DefaultPageSize is the default page size for db queries
DefaultPageSize = 10
// MaxPageSize is the max page size for db queries
MaxPageSize = 200
// Or... |
// Copyright 2019 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package telemetry
import (
"bytes"
"time"
"github.com/newrelic/newrelic-telemetry-sdk-go/internal"
)
const spanTypeName string = "spans"
// Span is a distributed tracing span.
type Span struct {
// Required Fie... |
/*
Copyright 2016 The Kubernetes Authors 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 ag... |
// Copyright 2021 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package main
import (
"math/rand"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/syzkaller/pkg/rpctype"
"github.com/google/syzka... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudhsmv2
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/cloudhsmv2-2017-04-28/DescribeClustersRequest
type DescribeClu... |
package upcloud
import (
"encoding/xml"
"github.com/stretchr/testify/assert"
"testing"
)
// TestUnmarshalStorage tests that Storages and Storage struct are unmarshaled correctly
func TestUnmarshalStorage(t *testing.T) {
originalXML := `<?xml version="1.0" encoding="utf-8"?>
<storages>
<storage>
<acces... |
package gossie
import (
"crypto/rand"
"errors"
"fmt"
"io"
"strconv"
"strings"
"sync"
"time"
)
/*
to do:
comp func
*/
type UUID [16]byte
var ZeroUUID UUID = [16]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
var LowestTimeUUID UUID = [16]byte{0x00, 0x0... |
package api
import (
"crypto/tls"
"crypto/x509"
"net"
"net/http"
"net/http/httputil"
"net/url"
"sync"
"time"
"github.com/grafana/grafana/pkg/api/cloudwatch"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
m "github.com/grafana/graf... |
/*
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 sql provides SQL implementations of the storage interface.
package sql
import (
"database/sql"
"regexp"
"time"
// import third party drivers
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/dexidp/dex/pkg/log"
)
// flavor represents a specific SQL implementation, and is used to tr... |
// Package dialog defines standard dialog windows for application GUIs
package dialog // import "fyne.io/fyne/dialog"
import (
"image/color"
"fyne.io/fyne"
"fyne.io/fyne/canvas"
"fyne.io/fyne/layout"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
)
const (
padWidth = 32
padHeight = 16
)
// Dialog is the common... |
package swarm_test
import (
"testing"
"time"
"context"
ma "<KEY>"
peer "<KEY>"
inet "<KEY>"
. "gx/ipfs/QmVHhT8NxtApPTndiZPe4JNGNUxGWtJe3ebyxtRz4HnbEp/go-libp2p-swarm"
)
func TestNotifications(t *testing.T) {
const swarmSize = 5
ctx := context.Background()
swarms := makeSwarms(ctx, t, swarmSize)
defer fu... |
// Copyright 2013 tsuru 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 docker
import (
"encoding/json"
"github.com/globocom/tsuru/cmd"
"github.com/globocom/tsuru/exec/testing"
"launchpad.net/gocheck"
"net/http"
"net/h... |
/*
Copyright 2015 The Kubernetes Authors 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 ag... |
package bigip
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"io/ioutil"
)
var goodDeviceResponse = `{
"items": [
{
"activeModules": [
"APM, Base, VE GBB (500 CCU, 2500 Access Sessions)|XFLGBEL-B... |
// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
//
// Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://... |
// Copyright (c) 2012-present The upper.io/db authors. All rights reserved.
//
// 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 righ... |
// Code generated by protoc-gen-go.
// source: TestMessage.proto
// DO NOT EDIT!
/*
Package protobuf is a generated protocol buffer package.
It is generated from these files:
TestMessage.proto
It has these top-level messages:
TestMessage
*/
package protobuf
import proto "github.com/golang/protobuf/proto"
import f... |
package builder
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path"
"sort"
"strings"
"syscall"
"time"
"github.com/Symantec/Dominator/lib/filter"
"github.com/Symantec/Dominator/lib/format"
"github.com/Symantec/Dominator/lib/srpc"
)
const (
cmdPerms = syscall.S_IRWXU | sysca... |
/*
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 agreed to in writing, ... |
// Code generated by go-swagger; DO NOT EDIT.
package wallet
// 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/g... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: crypto.proto
package internal
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
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 compil... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package configtx
import (
"testing"
cb "github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric/protoutil"
"github.com/stretchr/testify/require"
)
func TestBadKey(t *testing.T) {
require.Error(t, addToMap... |
package settings
import (
"net/http"
"net/url"
"time"
"github.com/pkg/errors"
"github.com/ory/herodot"
"github.com/ory/x/urlx"
"github.com/ory/kratos/driver/config"
"github.com/ory/kratos/identity"
"github.com/ory/kratos/selfservice/errorx"
"github.com/ory/kratos/selfservice/flow"
"github.com/ory/kratos/... |
/*
* Copyright 2019, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package iotproject
import (
"context"
"fmt"
corev1 "k8s.io/api/core/v1"
"time"
"github.com/enmasseproject/enmasse/pkg/util"
batchv1 "k8s.io/api/batch/v1"
"k8s.io/ap... |
package ante
import (
"errors"
"fmt"
commerciominttypes "github.com/commercionetwork/commercionetwork/x/commerciomint/types"
"github.com/commercionetwork/commercionetwork/x/government"
sdkErr "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/commercionetwork/commercionetwork/x/pricefeed"
sdk "github.c... |
// Copyright 2019 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 appl... |
package adapter
import (
"reflect"
"testing"
kapi "k8s.io/kubernetes/pkg/api"
kauthorizer "k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/util/sets"
oauthorizer "github.com/openshift/origin/pkg/authorization/authorizer"
)
// ensure we satisfy both interfaces
var _ = oauthorizer.AuthorizationAtt... |
package cmd
import (
"crypto/rand"
"crypto/tls"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
"os"
"runtime"
"strconv"
"strings"
"time"
"github.com/mdp/gloss/certs"
"github.com/spf13/cobra"
)
// StdLog is our default logger
var StdLog = log.New(os.Stdout, "", 0)
var mappings string
... |
/*
Copyright 2019 The Skaffold 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, sof... |
// The RS232 package lets you access old serial junk from go
package rs232
//go:generate ./genc.sh
/*
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
void initBaudRates();
*/
import "C"
import (
"fmt"
"os"
"syscall"
"time"
)
var baudConversionMap = map[int]_Ctype_speed_t{}
// This is your serial p... |
package main
import (
"fmt"
"io/ioutil"
"reflect"
"strconv"
"strings"
)
// 序列化和反序列化
// 序列化数据到指定的文件
func MarshalFile(filename string, data interface{}) (err error) {
// 1.数据的序列化
result, err := Marshal(data)
if err != nil {
return
}
// 2.将序列化好的数据,写出到filename
return ioutil.WriteFile(filename, result, 0666)
... |
// Copyright 2018 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
/*
Copyright 2018 The Kubernetes Authors.
Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... |
// Copyright © 2018 <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, publish... |
package main
import (
"fmt"
"regexp"
"strconv"
"strings"
"time"
"gopkg.in/redis.v5"
)
// CopyKeysOptions are provided by the caller of RunCopyKeys.
type CopyKeysOptions struct {
RedisMasterFile string // Path to the redis master file.
Databases string // List of databases to scan.
System... |
// +build !appengine
package fasthttp
import (
"sync"
glog "github.com/labstack/gommon/log"
"github.com/trafficstars/echo"
"github.com/trafficstars/echo/engine"
"github.com/trafficstars/echo/log"
"github.com/valyala/fasthttp"
)
type (
// Server implements `engine.Server`.
Server struct {
*fasthttp.Server
... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/signal"
"syscall"
"time"
mqtt "git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git"
helper "github.com/cascades-fbp/cascades-mqtt/lib"
"github.com/cascades-fbp/cascades/components/utils"
"github.com/cascades-fbp/cascades/runtime"
zmq... |
// Copyright 2019 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 cmd_test
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
"golang.org/x/tools/go/packages/packagestest"
"golang.org/x/tools/intern... |
// Copyright 2018 The Redix Authors. All rights reserved.
// Use of this source code is governed by a Apache 2.0
// license that can be found in the LICENSE file.
//
// leveldb is a db engine based on leveldb
package leveldb
import (
"bytes"
"errors"
"fmt"
"strconv"
"strings"
"sync"
"time"
"github.com/alash3a... |
// Copyright 2018 Google LLC 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 l... |
package raftkv
import (
"encoding/gob"
"labrpc"
"log"
"net/rpc"
"raft"
"strconv"
"sync"
"time"
)
const Debug = 0
func DPrintf(format string, a ...interface{}) (n int, err error) {
if Debug > 0 {
log.Printf(format, a...)
}
return
}
type Op struct {
// Your definitions here.
// Field names must start w... |
package qdeepneuro
import (
"errors"
"fmt"
"math"
"math/rand"
"sync"
"github.com/Antonite/oware"
"gonum.org/v1/gonum/mat"
)
const (
inputCount int = 15
weightCount int = 11
outputCount int = 1
)
type network struct {
mu sync.Mutex
layer1Weights *mat.Dense
layer2Weights *mat.Dense
}
func ne... |
package main
import (
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
)
func main() {
checkSig()
http.HandleFunc("/planeTracker", response)
http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets"))))
http.Handle("... |
// Command webster1913-convert converts Project Gutenberg's Webster's 1913
// Unabridged Dictionary to a dictgen dictfile.
package main
import (
"bytes"
"encoding/json"
"fmt"
"html/template"
"io"
"os"
"github.com/spf13/pflag"
"github.com/pgaskin/dictutil/dictgen"
"github.com/pgaskin/dictutil/examples/webste... |
package deployer
import (
"fmt"
"strconv"
"github.com/golang/glog"
"github.com/spf13/cobra"
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/openshift/origin/pkg/api/late... |
// Copyright (c) 2021 Terminus, 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 agree... |
/*
Copyright (C) 2017 Verizon. 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... |
package ui
import (
"strings"
"github.com/Bios-Marcel/tview"
"github.com/gdamore/tcell"
)
const noHistoryIndexSelected = -1
// CommandView contains a simple textview for output and an input field for
// input. All commands are added to the history when confirmed via enter.
type CommandView struct {
commandOutpu... |
package storage
import (
"io"
"path"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest"
"github.com/docker/distribution/storagedriver"
"github.com/docker/docker/pkg/tarsum"
)
// layerUploadController is used to control the various aspects of resumable
// layer upload. It implements th... |
// Copyright (c) 2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agr... |
package server
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"sync"
"sync/atomic"
"time"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
"github.com/kohkimakimoto/hq/internal/structs"
"github.com/kohkimakimoto/hq/internal/version"
)
var (
WorkerDefaultUserAgent = fmt.Sprintf("HQ/%... |
// *** 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 compute
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Get the IP address from a static address. For mo... |
// Copyright OpenTelemetry 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 2014 <NAME>
// Package push2ws contains a web server which will act as a PubsubHubBub to
// WebSocket bridge. WebSocket clients can connect to /bridge?feed=FEED_URL in
// order to be notified of updates published to the feed's hub.
//
// var conn = new WebSocket('ws://my.bridge.com/bridge?feed=' + feedU... |
package aws
import (
"crypto/tls"
"net"
"net/http"
"reflect"
"sync"
"time"
)
// Defaults for the HTTPTransportBuilder.
var (
// Default connection pool options
DefaultHTTPTransportMaxIdleConns = 100
DefaultHTTPTransportMaxIdleConnsPerHost = 10
// Default connection timeouts
DefaultHTTPTransportIdle... |
// Copyright 2015 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
// +build windows
package lib
import (
"os"
"path/filepath"
"github.com/urfave/cli"
)
const (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.