text stringlengths 3.08k 10.4k |
|---|
// Copyright (c) 2013-2019 by <NAME> and contributors. All Rights Reserved.
// Use of this source code is governed by a MIT-style license that can
// be found in the LICENSE file.
package mop
import (
`github.com/nsf/termbox-go`
`strings`
`time`
`strconv`
`fmt`
)
// Screen is thin wrapper aroung T... |
package main
import (
"context"
"errors"
"fmt"
"log"
"math/rand"
"os"
"strconv"
"strings"
"time"
MQTT "github.com/eclipse/paho.mqtt.golang"
"github.com/gocolly/colly"
influxdb2 "github.com/influxdata/influxdb-client-go"
"github.com/influxdata/influxdb-client-go/api"
)
//define a function for the default... |
//
//
//
package application
import (
"fmt"
"log"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/lib/pq"
"github.com/gorilla/mux"
"github.com/gorilla/handlers"
)
type App struct {
Router *mux.Router
DB *gorm.DB
}
// Qu... |
// Package locator implements the handling of maidenhead locators (https://en.wikipedia.org/wiki/Maidenhead_Locator_System)
package locator
import (
"fmt"
"math"
"regexp"
"strings"
"github.com/ftl/hamradio/latlon"
)
// Locator represents a maidenhead locator with up to four pairs of characters.
// This is equiv... |
// Copyright 2018 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
/*
Copyright 2019 Hammerspace
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
dis... |
// Copyright © 2017 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
// Copyright 2019 The Chromium OS 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 arc
import (
"context"
"io/ioutil"
"path/filepath"
"regexp"
"strconv"
"time"
"chromiumos/tast/errors"
"chromiumos/tast/local/arc"
"c... |
package scheduler
import (
"sync"
"github.com/pivotal-golang/lager"
"github.com/concourse/atc"
"github.com/concourse/atc/db"
"github.com/concourse/atc/engine"
)
//go:generate counterfeiter . PipelineDB
type PipelineDB interface {
CreateJobBuild(job string) (db.Build, error)
CreateJobBuildForCandidateInputs(... |
package flow
import (
"fmt"
"log"
"strconv"
"strings"
"github.com/kubeshop/kusk/generators/nginx_ingress"
"github.com/kubeshop/kusk/options"
)
type nginxIngressFlow struct {
baseFlow
}
func (n nginxIngressFlow) getBasePath() string {
var basePathSuggestions []string
for _, server := range n.apiSpec.Servers... |
// Package jsonschema uses reflection to generate JSON Schemas from Go types [1].
//
// If json tags are present on struct fields, they will be used to infer
// property names and if a property is required (omitempty is present).
//
// [1] http://json-schema.org/latest/json-schema-validation.html
package jsonschema
im... |
// Copyright 2014 The zephyr-go 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... |
package main
/*
#cgo CFLAGS: -I/usr/local/cuda/include
#cgo LDFLAGS: -lnvidia-ml
#include "bridge.h"
*/
import "C"
import (
"errors"
"fmt"
"unsafe"
)
var (
errNoErrorString = errors.New("nvml: expected an error from driver but got nothing")
errNoError = errors.New("nvml: getGoError called on a successful ... |
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"strings"
"unicode/utf8"
)
// Takes a GID Ensembl identifier and returns the gene plus a defined
// upstream region of this gene in fasta format.
func GetUpstreamRegion(gid string, upstream int) string {
client := &http.... |
// Copyright ©2013 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Based on the CholeskyDecomposition class from Jama 1.0.3.
package mat64
import (
"math"
"github.com/gonum/blas"
"github.com/gonum/blas/blas64"
"git... |
package service
import (
"context"
"encoding/json"
"fmt"
"net"
"go-common/app/interface/main/account/service/realname/crypto"
"go-common/app/job/main/member/conf"
"go-common/app/job/main/member/dao"
"go-common/app/job/main/member/model"
"go-common/app/job/main/member/model/queue"
"go-common/app/job/main/mem... |
// Copyright 2012, <NAME> <<EMAIL>>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package popcount
// bithacks-based implementation in go for 32-bit values.
func PopCount32(v uint32) int {
/*
This is taken from bithacks.
0xf = 11... |
/*
*
* Copyright 2014, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of condi... |
package factoids
import (
"context"
"fmt"
"regexp"
"strings"
"time"
log "github.com/sirupsen/logrus"
)
var lastfact fullfactoid
// NewReplyString adds a custom reply string to the list of reply strings
// TODO: generalize config file read/write/parse
// TODO: switch to toml for config
func NewReplyString(ctx ... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
package provider
import (
"context"
"reflect"
"sync"
"github.com/ChainSafe/fil-secondary-retrieval-markets/shared"
"github.com/filecoin-project/specs-actors/actors/abi"
logging "github.com/ipfs/go-log/v2"
)
var log = logging.Logge... |
/**
* Copyright 2021 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
package globals
import (
pb "github.com/leboncoin/subot/pkg/engine_grpc_client/engine"
"time"
)
// User represents the slack user that wrote a message
type User struct {
ID string `json:"id"`
SlackID int `json:"slack_id"`
Avatar string `json:"avatar"`
TeamMember bool `jso... |
package rpc
import (
"io"
"net"
log "github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
"github.com/pierrec/lz4"
cdocker "github.com/yosisa/craft/docker"
)
type Docker struct {
c *docker.Client
}
func NewDocker(endpoint string) (*Docker, error) {
c, err := docker.NewClient(endpoint)
if err != ... |
// Copyright 2014 <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 cedict
import (
"fmt"
"io"
"reflect"
"strings"
"testing"
)
// The following example demonstrates basic usage of the package. It uses a
// string.Reader a... |
package log
import (
"context"
"io"
"gitoa.ru/go-4devs/log/field"
"gitoa.ru/go-4devs/log/level"
)
//nolint:gochecknoglobals
var global = With(New(),
WithCaller("caller", 1, false),
WithLevel("level", level.Debug),
WithExit(level.Alert),
WithPanic(level.Emergency),
)
// SetLogger sets global used logger. Thi... |
package trace
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"image"
"image/color"
"image/png"
"io/ioutil"
"log"
"math"
"math/rand"
"net/http"
"os"
"strconv"
"tracer/pkg/geom"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package connection
import (
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"github.com/cucumber/godog"
"github.com/hyperledger/aries-framework-go/pkg/controller/command/connection"
didexcmd "github.com/h... |
package cmd
import (
"context"
"fmt"
"io"
"log"
"regexp"
"strconv"
"strings"
"time"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
var detectBrokenRFC3339PrefixRe *regexp.Regexp
func init() {
detectBrokenRFC3339PrefixRe = regexp.MustCompile(`^\d{4}-\d{2}-\d{2} `)
}
// cliAttrsTo... |
package functions
import (
"fmt"
"time"
"github.com/cygy/ginamite/common/authentication"
"github.com/cygy/ginamite/common/errors"
"github.com/cygy/ginamite/common/mongo/session"
"github.com/cygy/ginamite/plugins/mongodb/model"
"github.com/gin-gonic/gin"
"github.com/globalsign/mgo/bson"
)
// BuildTokenFromID... |
package main
import (
"crypto/rsa"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"math/big"
"net/http"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/iver-wharf/wharf-core/pkg/ginutil"
"github.com/iver-wharf/wharf-core/pkg/problem"
"github.com/golang-jwt/jwt/v4"
)
// This is a modified vers... |
package gossiper
import (
"bytes"
"encoding/json"
"fmt"
"github.com/Never-M/MyGossip/pkg/types"
"io/ioutil"
"net/http"
"time"
)
// Time formatter
var timeFormat = "2006-01-02 15:04:05"
const HEARTBEAT_PORT = ":8001"
const HEARTBEAT_PATH = "heartbeat"
const HEARTBEAT_TIMEOUT = 1000
type gossiper struct {
nam... |
package tools_suggester
import (
"io/ioutil"
"net/http"
"os"
"strconv"
"strings"
"github.com/graniet/go-pretty/table"
"github.com/graniet/operative-framework/session"
)
type ToolsSuggesterModule struct {
session.SessionModule
sess *session.Session `json:"-"`
Stream *session.Stream `json:"-"`
Lists []W... |
package registry
import (
"encoding/json"
"errors"
"net"
"sync"
"time"
"github.com/ICKelin/glog"
"github.com/ICKelin/gtun/common"
)
type GtundConfig struct {
Listener string `json:"gtund_listener"`
Token string `json:"token"` // 内部系统鉴权token
}
type gtund struct {
listener string
token string
}
func... |
package main
import (
"errors"
"io"
"os"
"strconv"
"sync"
"time"
"github.com/unixpickle/essentials"
"github.com/unixpickle/muniverse"
"github.com/unixpickle/muniverse/chrome"
)
func main() {
essentials.Die((&Server{
Input: os.Stdin,
Output: os.Stdout,
}).Run())
}
type Server struct {
Input io.Read... |
package inspector
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/mitchellh/mapstructure"
)
const (
// Report types
ReportTypeFACING_COUNT = "FACING_COUNT"
ReportTypeSHARE_OF_SPAC = "SHARE_OF_SPAC"
ReportTypeREALOGRAM = "REALOGRAM"
ReportTypePRICE_TAGS = "PRI... |
//
// Description: Stores the latitute and longitude translations of the defined places.
//
package server
import dt "concurrency-9/dataTypes"
// Locations returns a map[string] of type dt.Vertex.
// Other packages can access these places using Locations()
//
// Input: None
// Output: A map[string] dt.Vertex
var L... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
doryBackend "github.com/abhishekkr/dory/doryBackend"
doryClient "github.com/abhishekkr/dory/doryClient"
doryCluster "github.com/abhishekkr/dory/doryCluster"
golenv "github.com/abhishekkr/gol/golenv"
gollog "github.com/abhishekkr/gol/gollog"
gin "github.c... |
// btcgw is an API Server that handles anchor CRUD for BBc-1 Ledger Subsystem.
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/ebiiim/btcgw/api"
"github.com/ebiiim/btcgw/auth"
"github.com/ebiiim/btcgw/btc"
"github.com/ebiiim/btcgw/gw"
"github.com/ebiii... |
package bees
import (
"context"
"log"
"math/rand"
"sync"
"sync/atomic"
"time"
)
// WorkerPool - keep information about active/free workers and task processing
type WorkerPool struct {
activeWorkers *int64
freeWorkers *int64
taskCount *int64
workersCapacity *int64
process TaskProcessor
taskCh ... |
// Copyright (c) 2017 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... |
// The campwiz package contains all of the brains for querying campsites.
package cache
import (
"bytes"
"encoding/gob"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
"net/url"
"os"
"time"
"log"
"github.com/steveyen/gkvlite"
)
var (
// cachePath is the location of the cache
cachePath = os.Exp... |
// Copyright 2020 cloudeng llc. All rights reserved.
// Use of this source code is governed by the Apache-2.0
// license that can be found in the LICENSE file.
package annotators
import (
"context"
"fmt"
"go/ast"
"go/token"
"go/types"
"strings"
"cloudeng.io/errors"
"cloudeng.io/go/cmd/goannotate/annotators/f... |
/*
Copyright 2020 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... |
package types
import (
"encoding/json"
"fmt"
"github.com/go-bluestore/common"
"github.com/go-bluestore/utils"
"hash/crc32"
"os"
"sync"
"sync/atomic"
)
var (
BufferTrackCrc bool = GetEnvBool("CEPH_BUFFER_TRACK")
BufferCachedCrc uint64 = 0
BufferCachedCrcAdjusted uint64 = 0
BufferMissedCr... |
package geo
import(
"fmt"
pmgeo "github.com/paulmach/go.geo" // https://godoc.org/github.com/paulmach/go.geo
)
type Polygon struct {
*pmgeo.Path
closedPath *pmgeo.Path // transient
}
func NewPolygon() *Polygon { return &Polygon{ Path: pmgeo.NewPath() } }
func (poly *Polygon)String() string {
return fmt.Sprintf... |
package utils
import (
"fmt"
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
)
// BasicInfo has all the the values in the upper box
type BasicInfo struct {
CorePercentages []float64
MemoryUsed uint64
TotalMemory uint64
MemoryUsedPercent float64
Hostname string
Up... |
package controller
import (
"fmt"
"github.com/vishvananda/netlink"
"io/ioutil"
"k8s.io/klog/v2"
"net"
"os"
"path/filepath"
"strings"
"github.com/containernetworking/plugins/pkg/ns"
"syscall"
)
//EnsureLinkUp set link up, return changed and err
func EnsureLinkUp(link netlink.Link) (bool, error) {
if link.A... |
package main
import (
"fmt"
azdrv "github.com/cloud-barista/poc-cb-spider/cloud-driver/drivers/azure"
idrv "github.com/cloud-barista/poc-cb-spider/cloud-driver/interfaces"
irs "github.com/cloud-barista/poc-cb-spider/cloud-driver/interfaces/resources"
"github.com/davecgh/go-spew/spew"
"gopkg.in/yaml.v3"
"io/iout... |
package mapper
import (
"fmt"
"net/http"
"net/url"
"sort"
"strconv"
"strings"
"github.com/ONSdigital/dp-api-clients-go/v2/dataset"
"github.com/ONSdigital/dp-api-clients-go/v2/filter"
"github.com/ONSdigital/dp-api-clients-go/v2/population"
"github.com/ONSdigital/dp-cookies/cookies"
"github.com/ONSdigital/dp... |
package cmd
import (
"apim-rest-client/comm"
"apim-rest-client/constants"
"apim-rest-client/dcr"
"apim-rest-client/persist"
"apim-rest-client/token"
"bytes"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
)
type APIOptions struct {
API string
Method string
Resource string
Headers *FlagMap
... |
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License... |
// Code generated by "stringer -type=MessageType,Ret,AppMessageType -linecomment=true -output=stringer.go"; DO NOT EDIT.
package openwechat
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
... |
package api
import (
"fmt"
"log"
"net"
"net/http"
"sync"
"github.com/dollarshaveclub/acyl/pkg/config"
"github.com/dollarshaveclub/acyl/pkg/ghevent"
"github.com/dollarshaveclub/acyl/pkg/persistence"
"github.com/dollarshaveclub/acyl/pkg/spawner"
muxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux"
... |
package controller
import (
"context"
"fmt"
"time"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
corev1listers "k8s.io/client-go/listers/core/v1"
"k8s.io/... |
package game
import (
"testing"
"git.ares-ensiie.eu/hackathon/hackathon-server/config"
"git.ares-ensiie.eu/hackathon/hackathon-server/field"
"git.ares-ensiie.eu/hackathon/hackathon-server/player"
. "github.com/smartystreets/goconvey/convey"
)
// func Attack(f *field.Field, attacker *player.Player, fromX int, f... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"image"
"math/rand"
"net/http"
"os"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/disintegration/imaging"
)
// base file name
const basefilename = "%s%s.%s"
... |
package main
import (
"errors"
"fmt"
"github.com/IljaN/w2d/deepl"
"github.com/IljaN/w2d/wikipedia"
"github.com/alexflint/go-arg"
"io"
"net/http"
"net/url"
"os"
"sort"
"strings"
)
type rootArgs struct {
Translate *translateArgs `arg:"subcommand:translate" help:"translates a wikipedia article"`
Mar... |
/*
Copyright © 2020 maxcleme <<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, distribute... |
package sysdig
import (
"context"
"fmt"
"net/http"
)
// TeamsService is the Service for communicating with the Sysdig Monitor Team related API.
type TeamsService service
// ProductType defines the Sysdig product types. Valid options are `SDC` for Sysdig Monitor and
// "SDS" for Sysdig Secure.
type ProductType str... |
package idcard
import (
"fmt"
"math/rand"
"strconv"
"strings"
"time"
)
var provines = map[int]string{
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北",
43: "湖南",
44: "广东",
... |
// Package dotpgx creates a connection pool, parses and executes queries.
package dotpgx
import (
"errors"
"fmt"
"strings"
"github.com/jackc/pgx"
"github.com/jackc/pgx/log/log15adapter"
log "gopkg.in/inconshreveable/log15.v2"
)
// DB represents the database connection pool and parsed queries.
type DB struct {
... |
/*
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 generators
import (
"bytes"
"encoding/base64"
"strings"
bioproto "github.com/ag-computational-bio/BioProtobufSchemas/go"
)
//GenerateGBfromproto Genbank protobuf to genbank file
//Generates a genbank file from a given protobuf genbank
func GenerateGBfromproto(record *bioproto.Genbank) string {
var strin... |
package opsgy
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"golang.org/x/oauth2/clientcredentials"
)
// OpsgyClient to interface with the Opsgy api.
type OpsgyClient struct {
baseURL string
projectID string
client *http.Client
}
// KubernetesNodePoolPage page of pools
type KubernetesNodeP... |
// Copyright (c) 2013-2018 <NAME>. All rights reserved.
// Licensed under a simplified BSD license (see LICENSE file).
package noise
import (
"github.com/cozely/cozely/coord"
"github.com/cozely/cozely/x/math32"
)
////////////////////////////////////////////////////////////////////////////////
var Gradient3D = []c... |
package shack
import (
"fmt"
"net/http"
"strings"
)
const (
_GET = http.MethodGet
_POST = http.MethodPost
_DELETE = http.MethodDelete
_PUT = http.MethodPut
_PATCH = http.MethodPatch
_OPTIONS = http.MethodOptions
_HEAD = http.MethodHead
_ALL = "ALL"
)
type HandlerFunc func(*Context)
... |
package kafka
import (
"github.com/Shopify/sarama"
"github.com/boxgo/box/pkg/logger"
)
type (
Kafka struct {
cfg *Config
client sarama.Client
}
)
func newKafka(c *Config) *Kafka {
client, err := sarama.NewClient(c.Addrs, c.kfkCfg)
if err != nil {
logger.Panicw("kafka build error", "err", err)
} else ... |
package main
import (
"bytes"
"errors"
"net/http"
"strconv"
"sync"
// ------------------------------------------
// IMPORT YOUR PROTOBUF BINDINGS HERE
// ------------------------------------------
mts "github.com/arkrozycki/go-pigeon/protorepo-go/message-transfer"
"github.com/rs/zerolog/log"
"google.gola... |
package wsclient
import (
"fmt"
"github.com/bitly/go-simplejson"
"github.com/feeeei/huobiapi-go/config"
"github.com/feeeei/huobiapi-go/debug"
"github.com/feeeei/huobiapi-go/sign"
"github.com/feeeei/huobiapi-go/utils"
)
type TradeWSClient struct {
ws *huobiWebSocket
subscribeWait map[string]chan er... |
/*
Copyright 2019 Atos
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 ... |
// Copyright © 2020 Intel Corporation. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
package utilities
import (
"fmt"
"reflect"
"strconv"
"strings"
"time"
)
// GetGenericError helps keep the ProcessApplicationSettings slim by enabling
// re-use of a common error format that should be returned to... |
package main
import (
"encoding/csv"
"encoding/gob"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
"strings"
"time"
)
// A gene has a Name an identifier and a fasta formated sequence
type Gene struct {
Name, ID, Fasta, Seq string
}
// A cephalopod is defined by its species Name and a number of Genes t... |
package main
import (
"bytes"
_ "embed"
"errors"
"fmt"
"html/template"
"io/fs"
"io/ioutil"
"log"
"os"
"path/filepath"
"github.com/99designs/gqlgen/api"
"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/internal/code"
"github.com/99designs/gq... |
/*
* Copyright (c) 2018, <NAME> <<EMAIL>>
* Copyright (c) 2018, University of California, Berkeley
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code mus... |
package entries
import (
"fmt"
)
// Collection represents a searchable collection of entries.
// It can be used to resolve links.
type Collection struct {
titleMap map[string][]*Entry // entries can share titles
pathMap map[string]*Entry // paths are unique
}
// NewCollection returns a new, initialised Collect... |
package net2
import (
"fmt"
"net"
"strings"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/filter"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/inputs/system"
netutil "github.com/shirou/gopsutil/net"
)
type NetIOStats struct {
filter filte... |
package api_v1
import (
"context"
"errors"
"fmt"
"net"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/gin-gonic/gin"
pingttl "github.com/strideynet/go-ping-ttl"
"golang.org/x/sync/errgroup"
)
type tracerouteParams struct {
// IPv6 defines if the traceroute should be ran as IPv6.
IPv6 bool ... |
package index
import (
"context"
"errors"
"fmt"
"io"
"strings"
// "time"
core "github.com/dms3-fs/go-dms3-fs/core"
cmdenv "github.com/dms3-fs/go-dms3-fs/core/commands/cmdenv"
e "github.com/dms3-fs/go-dms3-fs/core/commands/e"
cmds "github.com/dms3-fs/go-fs-cmds"
cmdkit "github.com/dms3-fs/go-fs-cmdkit"
pat... |
/*
Copyright © 2021 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 or agreed to in writi... |
//
// Copyright 2021 The Sigstore 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 ... |
// tools
package tools
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"reflect"
"strings"
"sync"
)
// 浮点数四舍五入
func Round(num float64, precision int64) float64 {
strPrecision := String(precision)
return Float64(fmt.Sprintf("%."+strPrecision+"f", num))
}
// json to map... |
package redis
import (
"fmt"
"errors"
"strings"
"github.com/garyburd/redigo/redis"
"github.com/vsco/dcdr/cli/api/stores"
"github.com/vsco/dcdr/cli/printer"
"github.com/vsco/dcdr/config"
)
const DefaultAddr = ":6379"
var (
ErrRedisConfig = errors.New("missing redis config address")
ErrIndexRange = errors... |
// Copyright 2021 The Okteto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// Copyright (c) 2012 - Cloud Instruments Co., Ltd.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, th... |
// Package chunker provides a way to chunk an input into uploadable-size byte slices.
package chunker
import (
"fmt"
"io"
"io/ioutil"
"github.com/klauspost/compress/zstd"
"github.com/pkg/errors"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/reader"
"github.com/bazelbuild/remote-apis-sdks/go/pkg/uploadinfo"
)... |
// Copyright 2020 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... |
package main
import (
"bytes"
"compress/gzip"
"fmt"
"hash/fnv"
"io"
"io/ioutil"
"net/http"
"sort"
"strconv"
"strings"
"github.com/Vertamedia/chproxy/chdecompressor"
"github.com/Vertamedia/chproxy/log"
)
func respondWith(rw http.ResponseWriter, err error, status int) {
log.ErrorWithCallDepth(err, 1)
rw.... |
package recovery
import (
"context"
"encoding/json"
"testing"
"github.com/bxcodec/faker/v3"
"github.com/gofrs/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/ory/kratos/driver/config"
"github.com/ory/kratos/identity"
"github.com/ory/kratos/selfservice/form"
"gi... |
// Copyright 2021 The Chromium OS 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 verifier
import (
"context"
"time"
"chromiumos/tast/errors"
"chromiumos/tast/testing"
)
// ResultType defines abstract type of results t... |
package main
import (
"flag"
"fmt"
"log"
"net"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/miekg/dns"
cache "github.com/patrickmn/go-cache"
"golang.org/x/net/publicsuffix"
)
var (
version string
build string
date string
)
var path string
var logflag bool
var mapv4 map[string]string
v... |
package handler
import (
"encoding/json"
"html/template"
"net/http"
"github.com/toowoxx/go-graphql"
)
// graphiqlData is the page data structure of the rendered GraphiQL page
type graphiqlData struct {
GraphiqlVersion string
QueryString string
VariablesString string
OperationName string
ResultString ... |
package configurator
import (
"encoding/json"
"fmt"
"strings"
"time"
corev1 "k8s.io/api/core/v1"
"github.com/openservicemesh/osm/pkg/auth"
"github.com/openservicemesh/osm/pkg/constants"
)
const (
// defaultServiceCertValidityDuration is the default validity duration for service certificates
defaultServiceC... |
// *** 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 eks
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages an EKS Cluster.
type Cluster struct {
s *pul... |
package design
import (
. "github.com/goadesign/goa/design"
. "github.com/goadesign/goa/design/apidsl"
)
var User = Type("User", func() {
Attribute("id", String, "ID of logged user")
Attribute("subscriber", Boolean, "Flag whether user is subscriber (has paid for access)")
Attribute("browser_id", String, "Anonymi... |
package alicloud
import (
"fmt"
"log"
"regexp"
"github.com/alibaba/terraform-provider/alicloud/connectivity"
"github.com/denverdino/aliyungo/ram"
"github.com/hashicorp/terraform/helper/schema"
)
func dataSourceAlicloudRamRoles() *schema.Resource {
return &schema.Resource{
Read: dataSourceAlicloudRamRolesRea... |
package fileutils
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/pebblescape/pebblescape/Godeps/_workspace/src/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus"
)
// exclusion return true if the specified pattern is an exclusion
func exclusion(pattern... |
package executor
import (
"context"
"fmt"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
docker "github.com/docker/docker/client"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/... |
/*
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 model
import (
"encoding/json"
xtime "go-common/library/time"
)
// official role const.
const (
OfficialRoleUnauth = iota
OfficialRoleUp
OfficialRoleIdentify
OfficialRoleBusiness
OfficialRoleGov
OfficialRoleMedia
OfficialRoleOther
)
// OfficialRoleName official role name.
func OfficialRoleName(role... |
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
"sync"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudtrail"
"github.com/billhathaway/cloudtail/notifier"
)
type (
// Stash is used to filter events
Stash struct {
EventName string ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.