text stringlengths 3.08k 10.4k |
|---|
/*
* Copyright (c) 2018 VMware, 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, publish, ... |
package main
import (
"encoding/json"
"fmt"
// "log"
// "os"
// "reflect"
"time"
"gopkg.in/olivere/elastic.v2"
)
type Product struct {
Id int64 `json:"id"`
Name string `json:"name"`
Description stri... |
package backup
import (
"bytes"
"context"
"crypto/sha256"
"fmt"
"io"
"os"
"github.com/alecthomas/kingpin"
"google.golang.org/grpc"
"github.com/aphistic/softcopy/internal/app/softcopy-admin/config"
"github.com/aphistic/softcopy/internal/app/softcopy-admin/runner"
"github.com/aphistic/softcopy/internal/pkg/... |
package rdshand
import (
"context"
"encoding/json"
"fmt"
"testing"
"time"
"github.com/go-redis/redis/v8"
"github.com/stretchr/testify/assert"
)
func getRds() *redis.Client {
rdsOpts, _ := redis.ParseURL("redis://:clark@127.0.0.1:6379/0")
return redis.NewClient(rdsOpts)
}
// PhoneAcc 已绑手机号账号信息,主要用于资产账号查下手机号... |
package browser
import (
"io"
"net/http"
"net/url"
)
// AssetType describes a type of page asset, such as an image or stylesheet.
type AssetType uint16
const (
// LinkAsset describes a *Link asset.
LinkAsset AssetType = iota
// ImageAsset describes an *Image asset.
ImageAsset
// StylesheetAsset describes a... |
package youtube
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"regexp"
)
var (
host = "www.youtube.com"
fullConfigRegex = regexp.MustCompile(`;ytplayer\.config\s*=\s*({.*?});`)
partialConfigRegex = regexp.MustCompile(`"player_response":"{(.*)}... |
// Copyright 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" file acco... |
package lsh
import (
"container/heap"
"errors"
"github.com/gasparian/lsh-search-go/store"
"math"
"sync"
)
var (
DistanceErr = errors.New("Distance can't be calculated")
)
// Neighbor represent neighbor vector with distance to the query vector
type Neighbor struct {
Vec []float64
ID string
Dist float64
}
... |
package libtest_simple_action
import (
"fmt"
"log"
"os"
"testing"
"time"
"github.com/asimovsecurity/rosgo/ros"
)
var feedback []int32
// ActionClient
// actionClient implements a simple action client
// using callbacks
type ActionClient struct {
node ros.Node
name string
ac ros.SimpleActionClient
}
// ... |
// 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 agreed... |
// Copyright [2021] [josexy]
//
// 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 main
import (
"testing"
)
func sliceEqual(s1 []string, s2 []string) bool {
if len(s1) != len(s2) {
return false
}
for i, _ := range s1 {
if s1[i] != s2[i] {
return false
}
}
return true
}
func TestReverse(t *testing.T) {
empty := []string{}
one := []string{"one"}
two := []string{"one", "tw... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.
package stats
import (
"sort"
"strings"
)
// Tag represents a key / v... |
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License i... |
package models
import (
"errors"
"strings"
errs "github.com/ONSdigital/dp-census-dataset-search-api/apierrors"
)
const (
maximumDimensionFilters, maximumTopicFilters = 10, 10
dimensionName = "dimensions.name"
topic1 = "topic1"
topic2 ... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package azidentity
import (
"context"
"fmt"
"math/rand"
"strings"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/pkg/browser"
)
// InteractiveBrowserCredentialOptions can be used when providing ... |
package proxyconfig
import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"net/http"
"net/url"
"strings"
"time"
"golang.org/x/net/http/httpproxy"
corev1informers "k8s.io/client-go/informers/core/v1"
corev1lister "k8s.io/client-go/listers/core/v1"
"k8s.io/klog/v2"
routeinformer "github.com/openshift/clien... |
/*
Copyright 2018 The Kubegene 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, so... |
package main
import (
"flag"
"log"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
const (
namespace = "twemproxy"
)
type metrics map[string]*prometheus.GaugeVec
var (
twemproxyLabelNames = []string{"instance"}
serverLabelNames = []strin... |
//
// Eliptic Curve Equation
//
// y^2 = x^3 + A*x + B (mod P)
//
package curve
import (
"fmt"
"math/big"
"github.com/starkbank/ecdsa-go/ellipticcurve/point"
)
type CurveFper interface {
Contains(p point.Point) bool
Length() int
}
type CurveFp struct {
A *big.Int
B *big.Int
P *big.Int
... |
//
// Author:: <NAME> (<<EMAIL>>)
// Copyright:: Copyright 2020, Lacework Inc.
// License:: Apache License, Version 2.0
//
// 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://ww... |
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
package model
import (
"database/sql"
"time"
"fmt"
"github.com/jzyds/gote/app/utils"
"github.com/russross/meddler"
)
// Comments are a slice of "Comment"s
type Comments []*Comment
// A Comment defines comment item data.
type Comment struct {
Id int64 `meddler:"id,pk"`
PostId int64 `meddle... |
package model
import (
xtime "go-common/library/time"
)
// ArchiveStat is table archive_stat
type ArchiveStat struct {
ID int64 `json:"id"`
Business int `json:"business"`
StatType int `json:"stat_type"`
TypeID int `json:"typeid"`
GroupID int `json:"group_id"`
UID ... |
/*
* Copyright (c) 2021 <NAME>. All Rights Reserved.
*
* Licensed under the MIT license (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* https://github.com/mmmorris1975/aws-runas/blob/master/LICENSE
*
* or in the "license" file accompany... |
/*
Copyright 2022 Google 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... |
/*
Copyright © 2020 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 The Kubeform 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... |
package testjson
import (
"fmt"
"io"
"strings"
"github.com/fatih/color"
)
func debugFormat(event TestEvent, _ *Execution) (string, error) {
return fmt.Sprintf("%s %s %s (%.3f) [%d] %s\n",
event.Package,
event.Test,
event.Action,
event.Elapsed,
event.Time.Unix(),
event.Output), nil
}
// go test -v
f... |
package mechanize
import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
)
const version = "0.0.1"
type historyEnt struct {
request *http.Request
response *Response
}
type Mechanize struct {
history []*historyEnt
Agent string
Client *http.Client
Co... |
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
package app
import (
"flag"
"github.com/aaronland/go-http-tangramjs"
"github.com/sfomuseum/go-flags/flagset"
spatial_flags "github.com/whosonfirst/go-whosonfirst-spatial/flags"
)
func CommonFlags() (*flag.FlagSet, error) {
fs := flagset.NewFlagSet("geotag")
fs.String("server-uri", "http://localhost:8080", "A ... |
// Copyright © 2019 Binance
//
// This file is part of Binance. The full Binance copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
package resharing
import (
"errors"
"github.com/manson1983-jda... |
package main
import (
"bufio"
"fmt"
"log"
"os"
"sort"
"strings"
"strconv"
)
func main() {
scores := readScores()
teams, err := strconv.Atoi(os.Args[1])
if err != nil {
log.Fatal(err)
}
players := os.Args[2:]
if len(players) % teams > 0 {
fmt.Printf("Jogadores sobrando: %v\n", len(players) % teams)
... |
/*
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 2014 by <EMAIL> (Peering GmbH)
// 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,
// this list of cond... |
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package gotooltest implements functionality useful for testing
// tools that use the go command.
package gotooltest
import (
"bytes"
"encoding/json"
"fmt... |
package ui
import (
"bytes"
"io"
"regexp"
"strings"
"sync"
"time"
"github.com/pkg/errors"
)
//go:generate stringer -linecomment -type Level
// Level for a log message.
type Level int
// Log levels.
const (
LevelTrace Level = iota // trace
LevelDebug // debug
LevelInfo // info
... |
package kubeclient
import (
"fmt"
"os"
"time"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
_ "k8s.io/client-go/plugin/pkg/client/auth" // Needed for azure auth side effect
log ... |
package gui
import (
"fmt"
"os"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/jesseduffield/minimal/gitignore"
"gopkg.in/ozeidan/fuzzy-patricia.v3/patricia"
)
// Thinking out loud: I'm typically... |
/*
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 render
import (
"fmt"
"log"
"strings"
"sync"
"time"
"unicode/utf8"
)
// Renderer is our simplified implemention of ncurses
type Renderer struct {
w, h int
writingMutex *sync.Mutex
pendingScreen [][]Char
currentScreen [][]Char
highlights [][]bool
drawingCursor Cursor
restingCursor Cursor
Pau... |
package forest
import (
"errors"
"sort"
"strings"
"github.com/go-logr/logr"
api "sigs.k8s.io/multi-tenancy/incubator/hnc/api/v1alpha1"
)
// HasLocalCritCondition returns if the namespace itself has any local critical conditions, ignoring
// its ancestors. Any code with the "Crit" prefix is a critical condition... |
package utils
import (
"archive/tar"
"archive/zip"
"compress/bzip2"
"compress/gzip"
"fmt"
"io"
"log"
"os"
"path"
"path/filepath"
"strings"
"github.com/ulikunitz/xz"
)
const (
// CompressorNone - uncompressed file
CompressorNone = iota
// CompressorGzip indicates that the file i compressed using gzip
... |
// Copyright 2012 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 image
import (
"image/color"
"testing"
)
func TestYCbCr(t *testing.T) {
rects := []Rectangle{
Rect(0, 0, 16, 16),
Rect(1, 0, 16, 16),
Rect(0,... |
// 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 fetch
import (
"context"
"errors"
"io"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-c... |
/*
Copyright 2021 The Everoute 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, so... |
/*
Package sqlmock provides sql driver mock connecection, which allows to test database,
create expectations and ensure the correct execution flow of any database operations.
It hooks into Go standard library's database/sql package.
The package provides convenient methods to mock database queries, transactions and
exp... |
/*
Copyright 2019 The KubeCarrier 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 diff
import (
"fmt"
"github.com/VerifyTests/Verify.Go/utils"
"os"
"strings"
)
type Tools struct {
resolved []*ResolvedTool
pathLookup map[string]*ResolvedTool
extensionLookup map[string]*ResolvedTool
}
// NewTools creates a new diff tool accessor
func NewTools() *Tools {
t := &Tools{}
t.... |
package indexer
import (
"context"
"fmt"
"net/url"
"os"
"sort"
"time"
"github.com/autarch/metagodoc/elc"
"github.com/autarch/metagodoc/indexer/crawler"
"github.com/autarch/metagodoc/indexer/repository"
"github.com/autarch/metagodoc/logger"
"github.com/hako/durafmt"
"github.com/hashicorp/errwrap"
"github... |
package net
import (
"context"
"errors"
"fmt"
"github.com/forgoer/openssl"
"github.com/goinggo/mapstructure"
"github.com/gorilla/websocket"
"go.uber.org/zap"
"slgserver/constant"
"slgserver/log"
"slgserver/util"
"sync"
"time"
)
// 客户端连接
type ClientConn struct {
wsSocket *websocket.Conn // 底层websocket... |
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
httpgzip "github.com/daaku/go.httpgzip"
"github.com/urfave/cli/v2"
"crypto/ecdsa"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"math/big"
"net"
"strings"
"time"
)
func logHandler(h http... |
package cmd
import (
"fmt"
"github.com/carsonsx/tcptester/cmd/input"
"github.com/carsonsx/tcptester/conf"
"github.com/carsonsx/tcptester/net"
"strconv"
"sync"
"time"
)
type LoadCommand struct {
connectedClientCount int
mutex sync.Mutex
stop bool
}
type LoadData struct {
Begi... |
package market
import (
"fmt"
"time"
"github.com/rs/xid"
"github.com/vanclief/ez"
"github.com/vanclief/state/interfaces"
)
// PositionType determines if its a long or short position
type PositionType string
const (
// LongPosition buy the asset
LongPosition PositionType = "long"
// ShortPosition sell the as... |
package services
import (
"context"
"log"
"time"
"github.com/emwalker/digraph/cmd/frontend/models"
"github.com/pkg/errors"
"github.com/volatiletech/null"
"github.com/volatiletech/sqlboiler/boil"
"github.com/volatiletech/sqlboiler/queries/qm"
)
// CompleteRegistrationResult holds the result of a CreateUser ca... |
/*
Copyright 2021 The Dapr 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, software
d... |
/**
* Copyright © 2014-2021 The SiteWhere 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... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iot
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type DescribeThingGroupInput struct {
_ struct{} `type:"structure"`
// The n... |
package words_test
import (
"encoding/hex"
"strings"
"testing"
"github.com/amarin/binutils"
"github.com/amarin/gomorphy/internal/grammeme"
"github.com/amarin/gomorphy/pkg/words"
)
type marshalUnmarshalTestStruct struct {
name string
index *words.Index
words []*words.Word
wantData string
wantErr... |
/*
Copyright IBM Corporation 2020
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
package login_handler
import (
"crypto/md5"
"encoding/json"
"fgame/fgame/account/login/login"
"fgame/fgame/account/login/types"
uipb "fgame/fgame/common/codec/pb/ui"
"fgame/fgame/sdk"
sdksdk "fgame/fgame/sdk/sdk"
"fmt"
"io/ioutil"
"net/http"
"net/url"
log "github.com/Sirupsen/logrus"
)
func init() {
log... |
/*
Copyright 2016 The Rook 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 agreed to ... |
// Copyright (c) 2021 Aiven, Helsinki, Finland. https://aiven.io/
package controllers
import (
"context"
"fmt"
"strconv"
"github.com/aiven/aiven-go-client"
"github.com/aiven/aiven-operator/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v... |
package html
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/leaanthony/slicer"
"github.com/wailsapp/wails/v2/internal/assetdb"
"golang.org/x/net/html"
)
// AssetBundle is a collection of Assets
type AssetBundle struct {
assets []*Asset
basedirectory string
}
// NewAssetBund... |
/*
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, ... |
package controllers
import (
"context"
"github.com/kuadrant/authorino/api/v1beta1"
configv1beta1 "github.com/kuadrant/authorino/api/v1beta1"
controller_builder "github.com/kuadrant/authorino/controllers/builder"
"github.com/kuadrant/authorino/pkg/common"
"github.com/go-logr/logr"
v1 "k8s.io/api/core/v1"
"k8s... |
package wsupload
import (
"context"
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/monstercat/websocket"
)
var (
ErrClosedByClient = errors.New("closed by client")
)
// This package implements a websocket handler with a protocol to handle (sequential) resumable data uplo... |
package maven
// This file contains the Service definition, and a basic service
// implementation. It also includes service middlewares.
import (
"context"
// "errors"
//"time"
//
mavenCli "github.com/guherbozdogan/causalera-api-search/client/maven"
"github.com/guherbozdogan/kit/log"
//"log"
"time"
// "fmt"... |
// *** 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 organizations
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Allows management of a Google Cloud Platfor... |
// +build kube
/*
Copyright 2020 Docker Compose CLI 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 app... |
package agent
import (
"fmt"
"time"
"github.com/hashicorp/consul/agent/structs"
)
func (a *Agent) sidecarServiceID(serviceID string) string {
return serviceID + "-sidecar-proxy"
}
// sidecarServiceFromNodeService returns a *structs.NodeService representing a
// sidecar service with all defaults populated based ... |
/*
Copyright 2016, RadiantBlue Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
package supply
import (
"context"
"encoding/json"
"fmt"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-multistore"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
"github.com/ipld/go-ipld-prime"
basicnode "github.c... |
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"strings"
"github.com/gotsunami/gitlab-copy/config"
"github.com/gotsunami/gitlab-copy/migration"
"github.com/gotsunami/gitlab-copy/stats"
)
func map2Human(m map[string]int) string {
keys := make([]string, len(m))
i := 0
for k := range m {
keys[i] ... |
// Copyright 2018 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 kbtime
import (
"fmt"
"testing"
"time"
"github.com/stretchr/testify/require"
)
const testTTzFmt = `2006-01-02 15:04:05 -0700`
type longDurTestCase struct {
expected string
duration string
}
func TestAddLongDurationLong(t *testing.T) {
then, err := time.Parse(testTTzFmt, "2020-04-01 12:23:08 +0000")
... |
package http_
import (
"bufio"
"errors"
"fmt"
"github.com/searKing/golib/io_"
"io"
"mime"
"net/http"
"os"
"path/filepath"
"time"
)
// The algorithm uses at most sniffLen bytes to make its decision.
const sniffLen = 512
func ContentType(content io.Reader, name string) (ctype string, bufferedContent io.Reade... |
package main
import (
"encoding/csv"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"math/rand"
"os"
"time"
"github.com/konimarti/fixedincome/pkg/term"
)
var (
fileFlag = flag.String("f", "term.json", "json file containing the parameters for the Nelson-Siegel-Svensson term structure")
nInput... |
package agent
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"encoding/json"
"errors"
"fmt"
"hash"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strings"
"github.com/buildkite/agent/api"
"github.com/buildkite/agent/logger"
)
type ArtifactoryUploaderConfig struct {
// The d... |
package sagas
import (
"context"
"time"
"github.com/DoNewsCode/core-dtx"
"github.com/DoNewsCode/core/contract"
"github.com/DoNewsCode/core/events"
"github.com/go-kit/kit/log"
"github.com/pkg/errors"
"github.com/rs/xid"
)
// Step is a step in the Saga. Steps should be registered during the bootstrap
// phase ... |
package game
import (
"fmt"
"math"
"time"
"sdl"
)
var playerTemplate = &spriteTemplate{
sheetFile: "assets/spacepsn.png",
framesX: 4,
framesY: 2,
frameWidth: 32,
frameHeight: 32,
}
const (
playerUpdateInterval = 10 * time.Millisecond
playerWalkSpeed = 384 // pixels per second?
playerJumpSpee... |
package config
import (
"os"
"path/filepath"
"sync"
"github.com/spf13/viper"
)
var once sync.Once
var realPath string
// Conf ...
var Conf *Config
const (
SuccessReplyCode = 0
FailReplyCode = 1
SuccessReplyMsg = "success"
QueueName = "gochat_sub"
RedisBaseValidTime = 8640... |
package scheduler
import (
"fmt"
"strconv"
"strings"
"time"
"github.com/kennydo/automatic-light-controller/lib"
)
// LocationConfig describes the coordinates of a geographical location and the timezone in that location
type LocationConfig struct {
Timezone Timezone `toml:"timezone"`
Latitude float64 `toml:... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: envoy/config/filter/dubbo/router/v2alpha1/router.proto
package envoy_config_filter_dubbo_router_v2alpha1
import (
fmt "fmt"
_ "github.com/cncf/udpa/go/udpa/annotations"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppr... |
package pulltabs
import (
"bytes"
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"net/url"
"strings"
"appengine"
"appengine/urlfetch"
)
type notifier struct {
Label string
Message string
Secret string
SlackURL string
StatusTmpl ... |
package tasks
import (
"fmt"
consulapi "github.com/hashicorp/consul/api"
"github.com/starkandwayne/rdpgd/globals"
"github.com/starkandwayne/rdpgd/instances"
"github.com/starkandwayne/rdpgd/log"
"github.com/starkandwayne/rdpgd/pg"
)
// CleanupUnusedDatabases - Identify Databases that should be decommissioned an... |
package main
import (
"fmt"
"os"
"os/exec"
"strings"
"github.com/josa42/git-release/errors"
"github.com/josa42/git-release/utils"
"github.com/josa42/git-release/versionfiles"
git "github.com/josa42/go-gitutils"
"github.com/spf13/cobra"
)
var cmd = &cobra.Command{
Use: "git-release [<version>]",
Versi... |
package nfsserver
import (
"context"
"reflect"
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/storageos/cluster-operator/internal/pkg/image"
storageosapis "github.com/stora... |
package sso
import (
"fmt"
"net/http"
"net/url"
"github.com/skygeario/skygear-server/pkg/auth/dependency/identity/loginid"
"github.com/skygeario/skygear-server/pkg/core/config"
coreTime "github.com/skygeario/skygear-server/pkg/core/time"
)
type Azureadv2Impl struct {
URLPrefix *url.URL
Redirec... |
package day12
import (
"fmt"
"strings"
"time"
)
type plant struct {
Index int
Value bool
Left *plant
Right *plant
}
//type rule func(bool, bool, bool, bool, bool) (matches bool, value bool)
type rule func(v1 bool, v2 bool, v3 bool, v4 bool, v5 bool) (matches bool, value bool)
func Solve(lines []string, part... |
package eks
import (
"fmt"
"io/ioutil"
"os"
"os/signal"
"syscall"
"time"
"github.com/aws/aws-k8s-tester/eks/stresser"
"github.com/aws/aws-k8s-tester/eksconfig"
"github.com/aws/aws-k8s-tester/pkg/fileutil"
k8s_client "github.com/aws/aws-k8s-tester/pkg/k8s-client"
"github.com/aws/aws-k8s-tester/pkg/logutil"
... |
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"syscall"
"time"
"github.com/bookingcom/nanotube/pkg/conf"
"github.com/bookingcom/nanotube/pkg/metrics"
"github.com/bookingcom/nanotube/pkg/rewrites"
"github.com/bookingcom/nanotube/pkg/rules"
"... |
package command
import (
"flag"
"fmt"
"github.com/mefellows/pkigo/pki"
"github.com/mitchellh/cli"
"os"
"strings"
"time"
)
type PkiCommand struct {
meta Meta
caHost string
outputCA bool
importClientCert string
importClientKey string
outputClientCert bool
outputClientKey bo... |
package service
import (
"fmt"
"io/ioutil"
net2 "net"
"os"
"strconv"
"github.com/IceWhaleTech/CasaOS/pkg/config"
command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command"
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
"github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
"github.com/shirou/gopsutil/v3/cpu"
"... |
package transactor
import (
"errors"
"github.com/dusk-network/dusk-blockchain/pkg/core/consensus"
"github.com/dusk-network/dusk-blockchain/pkg/core/consensus/maintainer"
"github.com/dusk-network/dusk-blockchain/pkg/core/database"
"github.com/dusk-network/dusk-blockchain/pkg/core/database/heavy"
"github.com/dusk... |
package pwsafe
import (
"bytes"
"crypto/cipher"
"crypto/hmac"
"crypto/sha256"
"encoding/binary"
"errors"
"hash"
"io"
"golang.org/x/crypto/twofish"
)
// Enumeration of field types
type FieldType uint8
const (
FldTypeEndOfEntry FieldType = 0xFF
HdrTypeVersion FieldType = 0x00
HdrTypeUUID ... |
package locale
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/fs"
"path"
"path/filepath"
"strings"
"golang.org/x/text/language"
"gopkg.in/yaml.v3"
)
const serverApplication = "corteza-server"
var (
defaultLanguage = language.English
)
func loadConfigs(fsys fs.FS) (ll []*Language, err error) {
var (
... |
package filesys
import (
"encoding/json"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"private-conda-repo/api/dto"
"private-conda-repo/domain/condatypes"
"private-conda-repo/domain/enum"
"private-conda-repo/libs"
)
type Channel struct {
n... |
package main
import (
"encoding/json"
"errors"
"fmt"
"log"
"net/http"
"strconv"
"sync"
"sync/atomic"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
)
type lunchOrder struct {
ID uint64 `json:"id,omitempty"`
Day byte `json:"day"`
Person string `json:"person"`
MealID uint16 `json:"mealId... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.