text stringlengths 3.08k 10.4k |
|---|
package main
import (
"context"
"flag"
"fmt"
"net/http"
"net/url"
"os"
"strings"
"sync"
"time"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo"
"github.com/Victo... |
package main
import "fmt"
import "math"
type node struct {
value int
next *node
}
type head struct {
h *node
}
func addNode(head *node, value int) {
var n = head
for n.next != nil {
n = n.next
}
var newNode = node{value: value, next: nil}
n.next = &newNode
}
func addNodes(head *node, value []int) {
for... |
package hybrik
import (
"bytes"
"encoding/json"
"fmt"
)
const (
failed = "false"
EncoderVersion4_10bit = "hybrik_4.0_10bit"
FFMPEGVersion3_4_10bit = "hybrik_3.4_10bit"
)
type presetResponse struct {
Success string `json:"success"`
Msg string `json:"message"`
}
// ErrCreatePreset occurs ... |
package cmd
import (
"fmt"
"io/ioutil"
"log"
"strconv"
"strings"
"time"
"github.com/FleexSecurity/fleex/pkg/sshutils"
"github.com/FleexSecurity/fleex/pkg/utils"
"github.com/FleexSecurity/fleex/provider/controller"
"github.com/hnakamur/go-scp"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"gi... |
/*
* Copyright 2021, Offchain Labs, 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 ag... |
// Copyright 2020 spaGO Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Part of this code is a modified version of Gonum matrix
// pool handling:
// https://github.com/gonum/gonum/blob/master/mat/pool.go
//
// Copyright ©2014 Th... |
package editor
import (
"fmt"
"io"
)
func Help(w io.Writer) error {
for _, x := range quickref {
_, err := w.Write([]byte(fmt.Sprintf("%-12s%s\n", x.k, x.v)))
if err != nil {
return err
}
}
return nil
}
// Reference: Vim's quickref.txt.
var quickref = []struct{ k, v string }{
{"h", "left"},
{"l", "ri... |
/*
Copyright 2014 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 squirrel
import (
"time"
"github.com/lindsaygelle/nook"
"github.com/lindsaygelle/nook/animal"
"github.com/lindsaygelle/nook/character"
"github.com/lindsaygelle/nook/gender"
"github.com/lindsaygelle/nook/personality"
"golang.org/x/text/language"
)
var (
rickyBirthday = nook.Birthday{
Day: 14,
Mo... |
package mongobackend
import (
"context"
"fmt"
"strings"
"time"
"github.com/mongodb/mongo-go-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options"
"git.abyle.org/hps/alolstats/riotclient"
"git.abyle.org/hps/alolstats/storage"
)
// GetLeagueByQueue is not implemented, yet
func (b *Backend) GetLeagueByQueue... |
// Copyright 2019 Yunion
//
// 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... |
// Description: conf 项目配置项,也用于读取当前目录下的app.conf中的项目
// Author: <NAME>
// Since: 2016-02-26 19:19
package conf
import (
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"strings"
"reflect"
)
type Config struct {
SERVER struct {
RUNMODE string `yaml:runmode`
PORT string `yaml:"port"`
}
DATABASE struct {
HOST... |
package index
import (
"fmt"
// "github.com/gzg1984/golucene/core/analysis/tokenattributes"
. "github.com/gzg1984/golucene/core/index/model"
"github.com/gzg1984/golucene/core/util"
// "sort"
)
// index/Term.java
/*
A Term represents a word from text. This is the unit of search. It is
composed of two elements, t... |
package device
import (
"bufio"
"fmt"
"github.com/ScriptRock/crypto/ssh"
"io"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"time"
)
type CiscoDevice struct {
Username string
Password string
Enable string
name string
Hostname string
stdin io.WriteCloser
stdout io.Reader
session *... |
// sync synchronizes a CSV file to the Pobox bulk forwarding API.
package main
import (
"bufio"
"context"
"flag"
"os"
"strings"
"time"
whitelabel "github.com/fastmail/pobox-bulk-go"
"github.com/fastmail/pobox-bulk-go/auth"
"github.com/golang/glog"
)
var (
mapFile = flag.String("map", "", "map file, defaul... |
package metrics
import (
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/assert"
io_prometheus_client "github.com/prometheus/client_model/go"
"github.com/hyperledger/burrow/bcm"
"github.com/hyperledger/burrow/consensus/tendermint"
"github.com/hyperledger/burrow/logging"
"github.com/hyperledger/b... |
//go:build pkcs11
// +build pkcs11
/*
Copyright 2021 IBM All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package identity
import (
"crypto/elliptic"
"encoding/hex"
"fmt"
"math/big"
"sync"
"github.com/miekg/pkcs11"
)
// HSMSignerOptions are the options required for HSM Login.
type HSMSignerOption... |
package xmlenc
import (
"crypto/aes"
"crypto/cipher"
"crypto/des" // nolint: gas
"encoding/base64"
"errors"
"fmt"
"github.com/beevik/etree"
)
// CBC implements Decrypter and Encrypter for block ciphers in CBC mode
type CBC struct {
keySize int
algorithm string
cipher func([]byte) (cipher.Block, error)... |
// Copyright 2018 <NAME>
//
// This file is part of vcard. Vcard is free software: you are free to use it
// for any purpose, make modified versions and share it with others, subject
// to the terms of the Apache license (version 2.0), a copy of which is
// provided alongside this project.
package vcard
import (
"io... |
// Code generated by protoc-gen-go.
// source: google.golang.org/cloud/bigtable/internal/duration_proto/duration.proto
// DO NOT EDIT!
/*
Package google_protobuf is a generated protocol buffer package.
It is generated from these files:
google.golang.org/cloud/bigtable/internal/duration_proto/duration.proto
It has t... |
/*
Copyright 2020 BlackRock, 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 writing, software
di... |
// The MIT License (MIT)
//
// Copyright (c) 2019 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, mo... |
package main
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"code.cloudfoundry.org/filelock"
"code.cloudfoundry.org/winc/hcs"
"code.cloudfoundry.org/winc/network"
"code.cloudfoundry.org/winc/network/mtu"
"code.cloudfoundry.org/winc/network/netinterface"
"code.cloudfoundry.org/winc/ne... |
// Copyright 2020 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 util
import (
"encoding/binary"
"fmt"
"net"
"strings"
"go.chromium.org/luci/common/errors"
ufspb "infra/unifiedfleet/api/v1/models"
)
... |
// Copyright © 2018 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribu... |
package rmdnodestate
import (
"context"
"fmt"
"strings"
"time"
intelv1alpha1 "github.com/intel/rmd-operator/pkg/apis/intel/v1alpha1"
"github.com/intel/rmd-operator/pkg/rmd"
"github.com/intel/rmd-operator/pkg/state"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/run... |
// Copyright © 2019 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
package admin
import (
"bytes"
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"github.com/hexa-org/policy-orchestrator/pkg/websupport"
"io/ioutil"
"log"
"net/http"
"strings"
)
type Integration struct {
ID string
Name string
Provider string
Key []byte
}
type IntegrationHandler interface {
... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
/*
* Copyright (c) 2020 wellwell.work, LLC by Zoe
*
* Licensed under the Apache License 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 proof
import (
"crypto"
"crypto/rand"
"errors"
"reflect"
"golang.org/x/crypto/ed25519"
)
var (
EmptyProof = Proof{}
)
type (
// Type is the type of cryptographic key that is listed in a DID Document.
KeyType string
// SignatureType is the signature suite that was used to generate a digital signatu... |
package main
import (
"time"
"log"
"github.com/boltdb/bolt"
"os"
"strconv"
)
type Discussion struct {
Data string
owner string
}
func createDiscussion(owner string, data string) (dis Discussion) {
dis.owner = owner
dis.Data = data
return
}
var (
DiscussionQueWasNotFull bool
DiscussionInSession bool
D... |
// Copyright The 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 ag... |
package s3gopher
import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"sort"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/aws/session"
)
//Config for bucket
type Config str... |
/*
Provides collections enabled go client
*/
package couchbase
import (
"encoding/binary"
"encoding/json"
"fmt"
"github.com/couchbase/indexing/secondary/common/collections"
"time"
"github.com/couchbase/indexing/secondary/dcp/transport"
"github.com/couchbase/indexing/secondary/dcp/transport/client"
)
// Genera... |
package stadiacontroller
import (
"encoding/base64"
"errors"
"fmt"
"log"
"time"
)
const (
stadiaControllerVid = 0x18D1
stadiaControllerPid = 0x9400
)
type StadiaController struct {
device *Device
ticker *time.Ticker
err error
}
func NewStadiaController() *StadiaController {
ticker := time.NewTicker(1 ... |
//
// Copyright 2020 IBM 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 agreed to ... |
package semver
import (
"fmt"
"log"
"regexp"
"strconv"
"strings"
)
func MustParseRequest(request string) *Request {
result, err := ParseRequest(request)
if err != nil {
log.Fatalf("failed to parse request %s: %v", request, err)
}
return result
}
func ParseRequest(request string) (*Request, error) {
var ... |
package circuit
import (
"bytes"
"fmt"
"sync"
"sync/atomic"
"time"
"github.com/olekukonko/tablewriter"
log "github.com/yunfeiyang1916/toolkit/logging"
metrics "github.com/yunfeiyang1916/toolkit/metrics"
)
var globalPanel = NewPanel()
func AddBreaker(name string, cb *Breaker) {
globalPanel.Add(name, cb)
}
... |
package socketclient
import (
"bufio"
"encoding/json"
"errors"
"bytes"
"fmt"
"sync/atomic"
"net"
"log"
"runtime"
"sync"
"strconv"
"time"
)
type SocketRequest struct {
request []byte
result interface{}
id int64
... |
package limiter
import (
"context"
"fmt"
"sync"
"time"
"github.com/systay/go-concurrency-limits/limit"
"github.com/systay/go-concurrency-limits/core"
)
const longBlockingTimeout = time.Hour * 24 * 30 * 12 * 100 // 100 years
// BlockingListener wraps the wrapped Limiter's Listener to correctly handle releasin... |
// Copyright (c) 2017-2021 Ingram Micro Inc.
// +build windows
package discovery
import (
"bufio"
"bytes"
"fmt"
"os/exec"
"regexp"
"strconv"
"strings"
)
const (
windowsFirewallRuleNameHeader = "\r\nRule Name:"
)
var whiteSpaces = regexp.MustCompile("\\A\\s*\\z")
var ruleField = regexp.MustCompile("(?P<fiel... |
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
package gemini
import (
"database/sql"
"fmt"
"labix.org/v2/mgo"
"reflect"
"strings"
)
// The sole purpose of TableInfo is to tag extra information you would like.
// For now the main use is to specify a table name different than the struct name -
// this can be done by setting, `name:"tableName"`
type TableInfo ... |
// Command fakehub serves multiple instances of a local git repository over HTTP,
// along with a pastable config for easier manual testing of sourcegraph.
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"text/template"
"github.com/pkg/errors"
)
func main() {
... |
/*
Copyright 2019 by ofunc
This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of
this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alte... |
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package api
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
pjson "github.com/pinpt/go-common/v10/json"
"time"
hclog "github.com/hashicorp/go-hclog"
"github.com/pinpt/agent/pkg/ids2"
"github.com/pinpt/go-common/v10/httpdefaults"
pstrings "github.com/p... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/golang/glog"
"k8s.io/api/admission/v1beta1"
admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runti... |
package cmd
import (
"os"
"strings"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var cfgFile string
var rootCmd = &cobra.Command{
Use: "simulator",
Short: "Simulator command line",
Long: `
A distributed systems and infrastructure simulator for at... |
package main
/**
Copyright 2018 TheRedSpy15
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, s... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package authcrypt
import (
"crypto/ed25519"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"github.com/hyperledger/aries-framework-go/pkg/didcomm/crypto"
"github.com/btcsuite/btcutil/base58"
chacha "golan... |
// Copyright 2016 Apcera Inc. All right reserved.
package main
import (
"encoding/json"
"strconv"
"sync"
"time"
"github.com/apcera/sample-apps/apcera-job-scaler/metrics"
"github.com/apcera/sample-apps/apcera-job-scaler/monitor"
"github.com/apcera/sample-apps/apcera-job-scaler/sink"
"github.com/apcera/sample-... |
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... |
/*
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, ... |
/*
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, ... |
// Copyright © 2020 <NAME>
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writin... |
// Package tfvar contains the essential tools to extract input variables from Terraform configurations, retrieve variable definitions from sources, and parse those values back into the input variables.
package tfvar
import (
"bytes"
"encoding/json"
"fmt"
"io"
"github.com/cockroachdb/errors"
"github.com/hashicor... |
// Copyright 2009 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 time
import (
"syscall"
"sync"
"os"
)
// BUG(brainman): The Windows implementation assumes that
// this year's rules for daylight savings time appl... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdp"
)
// No-op definition for keeping imports.
var _ = bin.Buffer{}
var _ = context.Background()
var _ = fmt.Stringer(nil)
var _ = strings.Builder{}
var _ = e... |
// Main application package
package main
import (
"fmt"
"time"
"github.com/lanphiergm/adventofcodego/internal/puzzles/year2021"
"github.com/lanphiergm/adventofcodego/internal/utils"
)
// Runs all puzzles
func main() {
runPuzzle(2021, 1, 1, year2021.SonarSweepPart1)
runPuzzle(2021, 1, 2, year2021.SonarSweepPart... |
package acceptance_test
import (
"fmt"
"net/http"
"net/http/httptest"
"os"
"regexp"
"testing"
"time"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-pages/internal/fixture"
)
var defaultProcessConfig = processConfig{
wait: true,
pagesBinary: *pagesBinary,
listeners: ... |
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build go1.16
// +build go1.16
package godoc
import (
"bytes"
"go/ast"
"go/format"
"go/printer"
"log"
"regexp"
"strings"
"unicode/utf8"
"golang.... |
package linkedlist
type MyLinkedList struct {
size int
head *Node
}
type Node struct {
val int
next *Node
pre *Node
}
/** Initialize your data structure here. */
func Constructor() MyLinkedList {
head := &Node{}
head.next = head
head.pre = head
return MyLinkedList{
size: 0,
head: head,
}
}
/** Get t... |
package main
import (
"context"
"fmt"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
"github.com/jessevdk/go-flags"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
"github.com/mxpv/podsync/pkg/config"
"github.com/mxpv/podsync/pkg/model"
"github.com/mxpv/podsync/pkg/ytdl"
"g... |
/*
Copyright 2020n 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 p2p
import (
"io"
"net"
"time"
log "github.com/cihub/seelog"
"github.com/wbaiyy/gopub/src/library/p2p/flowctrl"
)
const (
// 最多从其它Peer发送请求
maxOurRequests = 30
)
const (
// HAVE 每当客户端下载了一个piece,即将该piece的下标作为have消息的负载构造have消息,并把该消息发送给所有建立连接的peer
HAVE = iota
// BITFIELD 交换位图
BITFIELD
// REQUEST 向... |
package builder
import (
"bytes"
"github.com/codingXiang/gecko/parser"
"github.com/codingXiang/gecko/template/model"
"io/ioutil"
"log"
"os"
"strings"
)
type ModelBuilderInterface interface {
General()
Save()
}
type ModelBuilder struct {
_source string
_destination string
_filename string
_parser... |
// Package gist7480523 contains types and funcs for dealing with instances of a Go package found in a directory,
// including caching of its directory entry, vcs repository, and vcs state.
package gist7480523
import (
"fmt"
"go/build"
"os"
"path/filepath"
"sort"
"strings"
"github.com/shurcooL-legacy/Conception... |
// Copyright 2020 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
package auth
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"github.com/tolexo/aero/cache"
"github.com/tolexo/aero/db/orm"
"net/http"
"strconv"
"time"
)
const TIMESTAMP_VALIDITY int = 60000
const APP_SECRET string = "TOLEXOANDROIDAPP"
//authentication error codes
const INVALID_REQUEST int = 601
const I... |
package natpmp_test
import (
"context"
"errors"
"fmt"
"io"
"net"
"sync"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"inet.af/nat/natpmp"
)
func TestClientExternalAddress(t *testing.T) {
t.Parallel()
// Fixed data structures reused throughout tests.
const op = 128
var (
resNetworkFailure = []byt... |
package main
import (
"bufio"
"bytes"
"container/heap"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
tc := readNum(reader)
var buf bytes.Buffer
for tc > 0 {
tc--
n := readNum(reader)
P := readNNums(reader, n)
res := solve(P)
if res {
buf.WriteString("YES\n")
} else {
buf.... |
package buffer
import (
"errors"
"math"
"github.com/tidwall/geojson"
"github.com/tidwall/geojson/geo"
"github.com/tidwall/geojson/geometry"
"github.com/tidwall/gjson"
)
// TODO: detect of pole and antimeridian crossing and generate
// valid multigeometries
const bufferSteps = 15
// Simple performs a very sim... |
package mpq
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"github.com/aarondl/bitstream"
)
var (
headerBETTable = []byte("BET\x1A")
errorBETTableBounds = errors.New("BET Table ended unexpectedly")
)
// BETTable from the MPQ Header.
type BETTable struct {
Version int
DataSize int
TableSize ... |
package core
import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"testing"
"github.com/nathj07/go-resourcesync/fetcher"
)
func TestProcess(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Req... |
/*
* MIT License
*
* Copyright (c) 2017 SmartestEE Co., Ltd..
*
* 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, ... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = ... |
package seq
import (
"testing"
"github.com/google/go-cmp/cmp"
)
type simple struct {
b bool
i int
u uint
f float64
s string
a []byte
p *bool
l []int
m map[string]int
}
func TestCompareSimple(t *testing.T) {
var vtrue, vfalse bool
vtrue = true
var tests = []struct {
msg string
s1, s2 simple
wa... |
// Code generated by protoc-gen-go.
// source: internal/testdata/v2/v2.proto
// DO NOT EDIT!
/*
Package v2 is a generated protocol buffer package.
It is generated from these files:
internal/testdata/v2/v2.proto
It has these top-level messages:
*/
package v2
import proto "github.com/golang/protobuf/proto"
import fm... |
package cmn
import "strings"
type ACC_TYPE int
const (
ACC_TYPE_CLASS ACC_TYPE = iota
ACC_TYPE_FIELD
ACC_TYPE_METHOD
)
// All ACCESS FLAG
const (
ACC_PUBLIC uint16 = 0x0001
ACC_FINAL = 0x0010
ACC_SUPER = 0x0020
ACC_INTERFACE = 0x0200
ACC_ABSTRACT = 0x04... |
package province_city
import (
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"goskeleton/app/global/variable"
"goskeleton/app/model"
"goskeleton/app/utils/data_bind"
)
func CreateProvinceCityFactory(sqlType string) *ProvinceCityModel {
return &ProvinceCityModel{BaseModel: model.BaseModel{DB: model.UseDbConn(sqlT... |
package abc
import (
"fmt"
"io"
"sync"
)
const (
// TimeLayoutNamedLogger is the time layout that the named logger
// uses for its messages.
TimeLayoutNamedLogger = "2006-01-02 15:04:05.000"
)
// NamedLogger is a logger that has and prints a name
// in its log messages.
// NamedLoggers are completely safe for ... |
package main
import (
"bytes"
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget"
nativeDialog "github.com/sqweek/dialog"
"io"
"log"
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"time"
)
func tidyUp() {
fmt.Println("Exited"... |
// Copyright 2019 The go-shopify 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 shopify
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"reflect"
)
// Shopify errors usually have the form:
// {
// ... |
package rerouting
import (
"encoding/json"
"errors"
"fmt"
"koding/tools/amqputil"
"koding/tools/logger"
"sync"
"github.com/streadway/amqp"
"gopkg.in/fatih/set.v0"
)
var log = logger.New("router")
type Consumer struct {
Conn *amqp.Connection
Channel *amqp.Channel
}
type Producer struct {
Conn *amqp... |
package core
import (
"fmt"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/json"
"math"
"os"
"reflect"
"runtime"
"strings"
"time"
)
// 顶层公共Config
type Config struct {
MemTrace MemTraceConfig
PerfStat PerfStatConfig
Algorithm AlgorithmConfig
Kubernetes KubernetesConfig
Manager ManagerConfi... |
package http
import (
"bytes"
"context"
"fmt"
"reflect"
"strings"
"go.unistack.org/micro/v3/broker"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/register"
"go.unistack.org/micro/v3/server"
)
var typeOfError = reflect.TypeOf((*error)(nil)).Elem()
type handl... |
package randomuser // import "github.com/grokify/go-randomuser/v1.3"
import (
"fmt"
"regexp"
"strings"
"time"
"github.com/grokify/oauth2more/scim"
"github.com/grokify/simplego/type/stringsutil"
)
type User struct {
Gender string `json:"gender,omitempty"`
Name Name `json:"name,omitempt... |
package cmdexport
import (
"context"
"fmt"
"time"
"github.com/hashicorp/go-hclog"
"github.com/pinpt/agent/pkg/expin"
"github.com/pinpt/agent/pkg/expsessions"
"github.com/pinpt/agent/pkg/gitclone"
"github.com/pinpt/agent/slimrippy/exportrepo"
)
func (s *export) gitSession(logger hclog.Logger, exp expin.Export... |
package usecase
import (
"context"
"errors"
"fmt"
"log"
"github.com/camphor-/relaym-server/domain/entity"
"github.com/camphor-/relaym-server/domain/repository"
"github.com/camphor-/relaym-server/domain/service"
"github.com/camphor-/relaym-server/domain/spotify"
"github.com/google/uuid"
"golang.org/x/oauth2... |
package controller
import (
"bytes"
"errors"
"net/http"
"net/http/httptest"
"os"
"sync"
"syscall"
"testing"
"time"
"github.com/imyousuf/appcommons/config"
"github.com/julienschmidt/httprouter"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
type ServerLifecycleListenerMockImpl ... |
/*
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 ... |
/* Copyright (c) 2018-2019 Rubicon Communications, LLC (Netgate)
* 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
... |
package grant
import "html/template"
var defaultGrantTemplate = template.Must(template.New("defaultGrantForm").Parse(defaultGrantTemplateString))
const defaultGrantTemplateString = `<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>
Authorize
{{ if and ... |
package main
import (
"bytes"
"strconv"
"testing"
"github.com/stretchr/testify/assert"
)
var (
poem1 = `There was movement at the station, for the word had passed around
That the colt from old Regret had got away,
And had joined the wild bush horses — he was worth a thousand pound,
So all the cracks ... |
// Generated. DO NOT EDIT.
package myunion
import (
"github.com/dotchain/dot/changes"
"github.com/dotchain/dot/changes/types"
"github.com/dotchain/dot/streams"
"github.com/dotchain/dot/x/heap"
)
func (my myUnion) get(key interface{}) changes.Value {
switch key {
case "_heap_":
return my.activeKeyHeap
case ... |
package modules
import (
"errors"
"time"
"github.com/WindGreen/pi"
)
var TM1637_MAP = map[rune]byte{
0: 0x3f,
1: 0x06,
2: 0x5b,
3: 0x4f,
4: 0x66,
5: 0x6d,
6: 0x7d,
7: 0x07,
8: 0x7f,
9: 0x6f,
'0': 0x3f,
'1': 0x06,
'2': 0x5b,
'3': 0x4f,
'4': 0x66,
'5': 0x6d,
'6': 0x7d,
'7': 0x0... |
package client
import (
"errors"
"fmt"
"net/url"
"strings"
"time"
"github.com/bbengfort/todos"
"github.com/dgrijalva/jwt-go"
"github.com/shibukawa/configdir"
"gopkg.in/yaml.v3"
)
const (
vendorName = "bbengfort"
applicationName = "todos"
credentialsFile = "credentials.yaml"
)
// Configuration retur... |
package sshclient
import (
"bufio"
"bytes"
"errors"
"fmt"
"github.com/fatih/color"
"golang.org/x/crypto/ssh"
"io"
"io/ioutil"
"net"
"os"
"path/filepath"
"strings"
"time"
)
type Client struct {
SshClient *ssh.Client
Hostname string
Addr string
}
func NewClient(ip, user, pass string, port int, sk... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.