text stringlengths 3.08k 10.4k |
|---|
// This is a hardly refactred and more general version of the naive
// implementation. It is designed for reuse and can be applied as toolchain.
package main
// This example only uses features from Go's stdlib.
import (
"bytes"
"fmt"
"regexp"
"strings"
)
// Declaring an interface helps us to apply the Normalize ... |
// Package data_aggregation pulls data from a Riot API client and stores it in
// a centralized table.
package data_aggregation
import (
"context"
"log"
"sync"
"time"
"github.com/yuhanfang/riot/apiclient"
"github.com/yuhanfang/riot/constants/queue"
"github.com/yuhanfang/riot/constants/region"
)
// Match is th... |
package cliutils
import (
"fmt"
"io"
"strings"
"time"
ifxcli "github.com/influxdata/influxdb1-client/v2"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
)
/// prometheus 数据转行协议 metrics
///
/// 转换规则
/// prometheus 数据是Key/Value 格式,以 `cpu_usage_user{cpu="cpu0"} 1.411290322581615... |
// Copyright 2021 EMQ Technologies Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law o... |
// port of "chia farm summary"
// https://github.com/Chia-Network/chia-blockchain/blob/1.0.3/src/cmds/farm.py
package main
import (
"bytes"
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"math"
"math/bits"
"net/http"
"os"
"path/filepath"
// "github.com/davecgh/go-spew/spew"
"github.com/tidwall/gjson"
)
const (
... |
package exec
import (
"amp/back-go/common"
"amp/back-go/util"
psProc "github.com/shirou/gopsutil/process"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"sync"
"syscall"
"time"
)
type Daemon struct {
// 这个选项是进程启动多少秒之后,此时状态如果是running,则我们认为启动成功了
// 默认值为1 。。非必须设置
StartSecs int
// 当进程启动失败后,最大尝试启动的次数。。当超过预定次数后,将把此... |
/*
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 gohome
import (
"github.com/PucklaMotzer09/mathgl/mgl32"
"image/color"
)
// This interface handles every low level rendering operation
type Renderer interface {
// Initialises the renderer
Init() error
// Gets called after the initialisation of the engine
AfterInit()
// Cleans everything up
Terminate(... |
package main
import (
"bytes"
"compress/zlib"
"crypto/md5"
"encoding/base64"
"encoding/hex"
"errors"
"io/ioutil"
"regexp"
"strings"
"github.com/sloonz/go-iconv"
"github.com/sloonz/go-qprintable"
)
// Scan the data part for a Subject line. Can be a multi-line
func scanSubject(client *Client, reply string) ... |
// Copyright the Hyperledger Fabric contributors. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package serializer
import (
"encoding/json"
"fmt"
"reflect"
"time"
"github.com/hyperledger/fabric-contract-api-go/internal/types"
"github.com/hyperledger/fabric-contract-api-go/internal/utils"
"github... |
// SPDX-FileCopyrightText: 2020-present Open Networking Foundation <<EMAIL>>
//
// SPDX-License-Identifier: Apache-2.0
package config
import (
gnmiutils "github.com/onosproject/onos-config/test/utils/gnmi"
"github.com/onosproject/onos-config/test/utils/proto"
"github.com/openconfig/gnmi/proto/gnmi"
"github.com/st... |
package main
import (
"encoding/json"
"fmt"
"github.com/gus-maurizio/sre-agent/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/shirou/gopsutil/mem"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shiro... |
package postgres9
import (
"database/sql/driver"
"github.com/sanggonlee/pogo/internal/convert"
"github.com/sanggonlee/pogo/internal/query"
"gopkg.in/guregu/null.v3"
)
// StatTable represents a row in pg_stat_{all,sys,user}_tables
type StatTable struct {
RelID null.Int `json:"relid"`
Sc... |
// +build integrationtests
package integrationtests
import (
"fmt"
"reflect"
"testing"
"github.com/launchdarkly/ld-relay/v6/integrationtests/docker"
"github.com/launchdarkly/ld-relay/v6/internal/core"
"github.com/stretchr/testify/require"
)
const (
dynamoDBTableName = "test-table"
awsRegion = "us-e... |
package om
import (
"context"
"encoding/json"
"fmt"
"reflect"
"strconv"
"strings"
"time"
"github.com/rueian/rueidis"
)
// NewJSONRepository creates an JSONRepository.
// The prefix parameter is used as redis key prefix. The entity stored by the repository will be named in the form of `{prefix}:{id}`
// The s... |
package logger
import (
"bytes"
"fmt"
"io"
"os"
"strings"
"github.com/docker/docker/pkg/term"
"github.com/fatih/color"
)
// Logger implements a per-plan logger.
type Logger struct {
output io.Writer
// if recording, will fill this buffer with logger output instead of printing to stdio.
// if not yet record... |
package parser
import (
"crypto/md5" //#nosec
"encoding/json"
"fmt"
"io"
"os"
"strings"
"github.com/aquasecurity/defsec/pkg/terraform"
"github.com/liamg/memoryfs"
)
type Parser struct {
debugWriter io.Writer
stopOnHCLError bool
}
func New(options ...Option) *Parser {
parser := &Parser{}
for _, o := ... |
package framework
import (
"fmt"
"strconv"
"time"
"github.com/golang/protobuf/proto"
"github.com/taskgraph/taskgraph/pkg/etcdutil"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
var (
ErrEpochMismatch = fmt.Errorf("server epoch mismatch")
)
func (f *framework) Check... |
package eastmoney
import (
"encoding/json"
"fmt"
"github.com/gocolly/colly/v2"
"io/ioutil"
"net/http"
"strconv"
"time"
)
type yanBaoRes struct {
Hits int `json:"hits"`
Size int `json:"size"`
Data YanBaoDatas `json:"data"`
Year int `json:"currentYear"`
}
func (r *yanBaoRes) setYear(... |
// +build linux
package main
import (
"fmt"
"os/exec"
"strings"
"time"
"github.com/pkg/errors"
"github.com/crowdsecurity/crowdsec/pkg/models"
log "github.com/sirupsen/logrus"
)
type ipTablesContext struct {
Name string
version string
ipsetBin string
iptablesBin string
... |
package root
import (
"fmt"
"os"
"path/filepath"
"github.com/BurntSushi/toml"
"github.com/bensallen/hkmgr/internal/config"
"github.com/bensallen/hkmgr/internal/console"
"github.com/bensallen/hkmgr/internal/destroy"
"github.com/bensallen/hkmgr/internal/down"
"github.com/bensallen/hkmgr/internal/ssh"
"github.... |
package config
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"log"
"math/big"
"os"
"time"
"github.com/elastos/Elastos.ELA.Utility/common"
)
const (
DefaultConfigFilename = "./config.json"
MINGENBLOCKTIME = 2
DefaultGenBlockTime = 6
)
var (
Parameters configParams
Version string
mai... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: requestSQL.proto
package io_radicalbit_nsdb_rpc
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
/... |
/*
Copyright (c) 2021 Nordix Foundation
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... |
// Copyright 2022 The CubeFS 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... |
// Command ipam-tree, read blocks from Stdin, print sorted Tree
package main
import (
"encoding/csv"
"flag"
"fmt"
"io"
"log"
"os"
"strings"
"github.com/gaissmai/go-inet/v2/inet"
"github.com/gaissmai/go-inet/v2/inettree"
"github.com/gaissmai/go-inet/v2/tree"
)
var flagFree = flag.Bool("f", false, "show also... |
package main
import (
"bufio"
. "fmt"
"io"
"sort"
)
// github.com/EndlessCheng/codeforces-go
type node10 struct {
ch [2]*node10
priority uint
key, sz int
}
func (o *node10) cmp(b int) int {
switch {
case b < o.key:
return 0
case b > o.key:
return 1
default:
return -1
}
}
func (o *node10) si... |
package jobs
import (
"context"
"os"
"testing"
"time"
_ "github.com/mattn/go-sqlite3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/cloudradar-monitoring/rport/db/migration/jobs"
"github.com/cloudradar-monitoring/rport/db/sqlite"
"github.com/cloudradar-monitoring/rp... |
package v1alpha1
import (
"fmt"
"github.com/appscode/go/types"
"github.com/kubedb/apimachinery/apis"
"github.com/kubedb/apimachinery/apis/kubedb"
apps "k8s.io/api/apps/v1"
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
crdutils "kmodules.xyz/client-go/apiextensions/v1beta1"
meta... |
package effect
import (
"korok.io/korok/math"
"korok.io/korok/math/f32"
"korok.io/korok/gfx"
)
type Config struct {
Max int
Duration float32
Rate float32 // Number of particles per-second
Life Var
X, Y Var
Size Range
Rot Range
R, G, B, A Range
Additive bool
}
// GravityConfig used to configure t... |
// Copyright (c) 2017 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package gnmi
import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"math"
"net"
"time"
"io/ioutil"
"strings"
"github.com/aristanetworks/goarista/netns"
pb "... |
package list
import (
"context"
"encoding/json"
"errors"
"fmt"
flagutil "github.com/redhat-developer/app-services-cli/pkg/cmdutil/flags"
"github.com/redhat-developer/app-services-cli/pkg/connection"
"github.com/redhat-developer/app-services-cli/pkg/iostreams"
"github.com/redhat-developer/app-services-cli/pkg/... |
/*
Package ydbtypes provides tools for integration ydb types with go/types package.
It is intended primarily for writing generation tools and linters.
*/
package ydbtypes
import (
"fmt"
"go/types"
"strings"
"github.com/yandex-cloud/ydb-go-sdk/v2/internal"
)
func PrimitiveTypeFromString(s string) (t internal.Prim... |
package onedrive
import (
"errors"
"net/url"
"strings"
"sync"
"gonelist/conf"
"gonelist/pkg/file"
log "github.com/sirupsen/logrus"
)
const (
REFRESH_NONE = 0 // 未在刷新状态
REFRESH_RUNNING = 1 // 正在刷新
)
var (
gRefreshStatus = REFRESH_NONE
gRefreshLock sync.Mutex
)
// 初始化登陆状态, 如果初始化时获取失败直接退出程序
// 如果在自动刷... |
// Here is a dirty implementation of WebSocket streamer.
//
// It should be considered as a Proof of Concept.
//
// It may fail in some conditions (not fully tested), and probably has some lacks of implementations required by
// gorilla.WebSocket package, but it demonstrates the idea of using Streamer with WebSocket co... |
/*
Copyright (C) NoRouter 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 i... |
package main
import (
"encoding/json"
"fmt"
"github.com/camsiabor/qcom/agenda"
"github.com/camsiabor/qcom/global"
"github.com/camsiabor/qcom/qdao"
"github.com/camsiabor/qcom/qlog"
"github.com/camsiabor/qcom/qnet"
"github.com/camsiabor/qcom/qref"
"github.com/camsiabor/qcom/util"
"github.com/camsiabor/qdaobund... |
package agent
import (
"encoding/json"
"path"
"sync"
log "github.com/coreos/fleet/Godeps/_workspace/src/github.com/golang/glog"
"github.com/coreos/fleet/job"
"github.com/coreos/fleet/resource"
)
type AgentState struct {
// used to lock the datastructure for multi-goroutine safety
mutex sync.Mutex
// unres... |
package assets
import (
"context"
"encoding/hex"
"encoding/json"
"fmt"
"strconv"
"strings"
chain "blockwatch.cc/tzgo/tezos"
"github.com/everstake/teztracker/models"
"github.com/everstake/teztracker/repos/assets"
"github.com/everstake/teztracker/repos/operation"
"github.com/everstake/teztracker/services/mic... |
package main
import (
"bufio"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"syscall"
"time"
)
const (
exitOK = iota
exitErr
)
type mtimes struct {
store map[string]time.Time
}
func newMtimes() *mtimes {
return &mtimes{
store: make(map[string]time.Time),
}
}
func ... |
/*
Q1) Can you change the implementation to return all possible paths to the goal (rather than the shortest)?
*/
package main
import (
"fmt"
"github.com/golang-collections/collections/queue" // queue implementation has O(1) complexity for poping the first element,
// Go standard library has no queue data structure... |
package external
import (
"context"
"crypto/tls"
"log"
"net"
"time"
"github.com/city-mobil/gobuns/config"
"github.com/city-mobil/gobuns/promlib"
"github.com/city-mobil/gobuns/retry"
)
type VersionTLS string
const (
VersionTLS10 VersionTLS = "1.0"
VersionTLS11 VersionTLS = "1.1"
VersionTLS12 VersionTLS = ... |
// vim: sw=8
// Package `shorter` is a name shorting service backed by MongoDB.
package shorter
import (
"crypto/sha256"
"encoding/base64"
"fmt"
"strings"
"sync"
mgo "gopkg.in/mgo.v2"
bson "gopkg.in/mgo.v2/bson"
)
const (
KeyId = "_id"
KeyUri = "uri"
MinAbbrvLen = 11
)
// `Names` maintains a mapping be... |
// Package rectangle represents Rectangle Object
package rectangle
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strconv"
"text/tabwriter"
)
//Point holds X and Y coordinates which represent a corner of a rectangle
type Point struct {
X int `json:"X"`
Y int `json:"Y"`
}
//Rectangle has for corners defined... |
/*
MIT License
Copyright (c) Nhost
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, s... |
package event
import (
"sort"
"sync"
)
// This is a reimplementation of eventmgr found at github.com/goshuirc/eventmgr with an ID system added.
// The original idea is theirs.
// Priority levels
const (
PriHighest = 16
PriHigh = 32
PriNorm = 48
PriLow = 64
PriLowest = 80
)
// HandlerList is a slic... |
// Package htmltest : Main package, provides the HTMLTest struct and
// associated checks.
package htmltest
import (
"github.com/wjdp/htmltest/htmldoc"
"github.com/wjdp/htmltest/issues"
"github.com/wjdp/htmltest/output"
"github.com/wjdp/htmltest/refcache"
"net/http"
"path"
"sync"
"time"
)
// HTMLTest struct, ... |
package impl
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/open-kingfisher/king-k8s/resource"
"github.com/open-kingfisher/king-utils/common"
"github.com/open-kingfisher/king-utils/common/access"
"github.com/open-kingfisher/king-utils/common/handle"
"github.com/open-kingfisher/king-utils/common/log"
... |
// Copyright 2018 The Chubao 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 c4
import (
"bytes"
"crypto/sha512"
"io"
"math/bits"
"strings"
)
// `Tree` implements an ID tree as used for calculating IDs of non-contiguous
// sets of data. A C4 ID Tree is a type of merkle tree except that the list
// of IDs is sorted. According to the standard this is done to insure that
// two iden... |
package parser
import (
"regexp"
"strings"
attack_vector "github.com/s9rA16Bf4/go-evil/domains/attack_vector"
"github.com/s9rA16Bf4/go-evil/domains/backdoor"
"github.com/s9rA16Bf4/go-evil/domains/infect"
"github.com/s9rA16Bf4/go-evil/domains/keyboard"
"github.com/s9rA16Bf4/go-evil/domains/malware"
mal "github... |
package client
import (
"context"
"fmt"
"sync"
"sync/atomic"
"time"
"github.com/jackc/pgx"
"github.com/yanmengfei/logical/logger"
"github.com/yanmengfei/logical/model"
"go.uber.org/zap"
)
// client for logical
type client struct {
cfg pgx.ConnConfig
table string
slot stri... |
// Package example is a CoreDNS plugin that prints "example" to stdout on every packet received.
//
// It serves as an example CoreDNS plugin with numerous code comments.
package block
import (
"context"
"encoding/json"
"net"
"net/http"
"time"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plu... |
package darts
import (
"fmt"
"math"
"panda/utils"
"regexp"
"strconv"
"strings"
)
type fReq struct {
next map[string]int
sum int
}
type wTable struct {
untokenMap map[string]int
tokeMap map[string]*fReq
maxCodeLen int
minFreq int
sumFreq int
}
func (t *wTable) loadUntoken(path string) {
space... |
package gfx
import (
"image"
"image/color"
"image/draw"
"math"
)
// Triangle is an array of three vertexes
type Triangle [3]Vertex
// NewTriangle creates a new triangle.
func NewTriangle(i int, td *TrianglesData) Triangle {
var t Triangle
t[0].Position = td.Position(i)
t[1].Position = td.Position(i + 1)
t[2... |
package main
import (
"fmt"
"io/ioutil"
"regexp"
"strconv"
"strings"
)
func main() {
inputPath := "./day_16/input.txt"
fmt.Println("--- Part One ---")
fmt.Println(part1(inputPath))
fmt.Println("--- Part Two ---")
fmt.Println(part2(inputPath))
}
type rule struct {
name string
min1,... |
// Copyright 2017 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package main
import (
"context"
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
gerrit "github.com/andygrunwald/go-gerrit"
buildbucke... |
package pqconn
import (
"fmt"
"sync"
"time"
"github.com/lib/pq"
"github.com/domonda/go-sqldb"
)
var (
globalListeners = make(map[string]*listener)
globalListenersMtx sync.RWMutex
ListenerMinReconnectInterval = time.Second * 10
ListenerMaxReconnectInterval = time.Second * 60
ListenerPingInterval ... |
// Copyright 2020 The Matrix.org Foundation C.I.C.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
package sim
import (
"fmt"
"github.com/spacemeshos/go-spacemesh/common/types"
"github.com/spacemeshos/go-spacemesh/log"
)
// Frac is a shortcut for creating Fraction object.
func Frac(nominator, denominator int) Fraction {
return Fraction{Nominator: nominator, Denominator: denominator}
}
// Fraction of somethin... |
/*
* gomacro - A Go interpreter with Lisp-like macros
*
* Copyright (C) 2017-2019 <NAME>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
* st... |
package context
import (
"github.com/ishidawataru/sctp"
)
// AMF main states in the GNB Context.
const Inactive = 0x00
const Active = 0x01
const Overload = 0x02
type GNBAmf struct {
amfIp string // AMF ip
amfPort int // AMF port
amfId int64 // A... |
package upload
import (
"fmt"
"io/ioutil"
"path"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/AdRoll/baker"
"github.com/AdRoll/baker/input/inputtest"
"github.com/AdRoll/baker/testutil"
)
var customOutputDesc = baker.OutputD... |
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/... |
package collection
import (
"sync"
"github.com/beaconsoftwarellc/gadget/errors"
)
// ListNonEmptyError is returned when a empty list is required for the operation.
type ListNonEmptyError struct{ trace []string }
func (err *ListNonEmptyError) Error() string {
return "list is not empty"
}
// Trace returns the sta... |
package inject
import (
"context"
"fmt"
"github.com/enescakir/emoji"
"github.com/logrusorgru/aurora"
"gopkg.in/yaml.v3"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/kuritka/golic/utils/log"
"github.com/denormal/go-gitignore"
)
type Inject struct {
opts Options
ctx context.Con... |
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"regexp"
"runtime"
"strings"
"time"
)
type context struct {
done bool
start time.Time
}
func traceln(v ...interface{}) {
pc, _, _, _ := runtime.Caller(1)
fn := runtime.FuncForPC(pc)... |
package cmd
import (
"fmt"
"reflect"
"strings"
"sync"
"time"
"github.com/spf13/pflag"
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-cli/base"
"github.com/ucloud/ucloud-cli/ux"
)
func bindRegion(req request.Common, flags *pflag.FlagSet) {
var region string
flags.StringVar(&re... |
package testdb
import (
"crypto/sha1"
"database/sql"
"database/sql/driver"
"encoding/csv"
"io"
"regexp"
"strings"
"time"
)
var d *testDriver
func init() {
d = newDriver()
sql.Register("testdb", d)
}
type testDriver struct {
openFunc func(dsn string) (driver.Conn, error)
conn *conn
... |
package main
import (
"crypto/rand"
"fmt"
"math/big"
)
// Unlike AES ElGamal is a private/public key system
type ElGamalPrivateKey struct {
// a
a *big.Int
// a pointer to the public key
public *ElGamalPublicKey
}
type ElGamalPublicKey struct {
// The prime p
p *big.Int
// The generator of the group
g *b... |
package webNet
import (
"fmt"
"sync/atomic"
"time"
"github.com/gorilla/websocket"
//"encoding/binary"
//"io"
//"strings"
"go-snake/common"
"go-snake/common/messageBase"
"go-snake/common/mixNet"
"github.com/Peakchen/xgameCommon/akLog"
"github.com/Peakchen/xgameCommon/utils"
"sync"
)
type wsMessage stru... |
package main
import (
"bufio"
"bytes"
"fmt"
"os"
"sort"
)
func main() {
reader := bufio.NewReader(os.Stdin)
tc := readNum(reader)
var buf bytes.Buffer
for tc > 0 {
tc--
n := readNum(reader)
A := readNNums(reader, n)
res := solve(A)
if res {
buf.WriteString("YES")
} else {
buf.WriteStrin... |
/*
* Copyright 2018-2019, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package v1alpha1
import (
"encoding/json"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runti... |
/*
* Copyright 2019-2020, 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 ... |
package gores
import (
"errors"
"fmt"
"log"
"os"
"os/exec"
"strconv"
"strings"
"time"
"github.com/deckarep/golang-set"
)
// Worker represents a object involved in Gores
type Worker struct {
id string
goroutineID int
queues mapset.Set
shutdown bool
child string
pid int
h... |
package chef
import (
"log"
"os"
"fmt"
"net/url"
"strings"
"bufio"
"path/filepath"
"io/ioutil"
"github.com/mattn/go-shellwords"
"gopkg.in/chef.v0"
)
type Chef struct {
endpoint string
user string
key string
}
func (ch *Chef) Find_instance(ip string) string {
node_name := ""
if !ch.read_... |
/*
* // Copyright Aeraki 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... |
/*
* Copyright 2019 Regents of the University of Minnesota.
*
* 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 ... |
// Code generated by go-swagger; DO NOT EDIT.
package security
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com... |
package version
import (
"strings"
"testing"
)
// Some tests/benchmarks in this file are too small to test. They are
// included to provide samples of how to
// - write table driven tests
// - write benchmarks
// Test_GetVersionSimple_NoSet test for performance testing to
// determine potential improvements for t... |
// Copyright 2019 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 ... |
// Copyright 2018 <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 ... |
package main
import (
"fmt"
"math"
)
var parallelize = true
var hard = true
var recursionDepth = 13
var verbose = false
type Entity struct {
Hitpoints, Damage, Defense, Mana int
Effects []Effect
}
var boss = Entity{
Hitpoints: 71,
Damage: 10,
Defense: 0,
Mana: 0,
}
var pl... |
// Copyright 2016 The Gem Authors. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
package sessions
import (
"encoding/gob"
"fmt"
"sync"
"time"
"github.com/valyala/fasthttp"
)
// Default flashes key.
const flashesKey = "_flash"
// Options
... |
package main
import (
"fmt"
"log"
"github.com/kiteco/kiteco/kite-golib/status"
"github.com/kiteco/kiteco/kite-golib/workerpool"
)
// deployment nodes such as user nodes, user muxes
type deployment struct {
Region string // Region is the region name of the node
Type string // Type is the node type
IP str... |
package logger
import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/mail"
"net/smtp"
"strings"
"time"
"github.com/ohko/logger/email"
)
// MonitorOption ...
type MonitorOption struct {
ID int // 标识符
LogPath string // 日志目录
MaxSize int64 ... |
package functional
import (
"bytes"
"io"
"net/http"
"net/http/httptest"
"net/url"
"os"
"testing"
"togo/globals/database"
"togo/migration"
"togo/models"
"togo/routes"
"github.com/joho/godotenv"
"github.com/stretchr/testify/assert"
)
func TestIndexRoute(t *testing.T) {
routers := routes.InitRoutes()
w :... |
// +build ignore
package main
var a, b, c int
var unknown bool // defeat dead-code elimination
func func1() {
var h int // @line f1h
f := func(x *int) *int {
if unknown {
return &b
}
return x
}
// FV(g) = {f, h}
g := func(x *int) *int {
if unknown {
return &h
}
return f(x)
}
print(g(&a)) ... |
package timers
import (
"context"
"math/rand"
"sync"
"sync/atomic"
"time"
)
// Timeline is a data structure that maintains a cache of deadlines represented
// by background contexts. A Timeline has a resolution attribute representing
// the accuracy of the deadlines it maintains. All deadlines that fall within
/... |
/*
* Copyright 2017-2018 <NAME>, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
*/
package bulk
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"os"
"path/filepath"
"runtime"
"strconv"
"github.com/dgraph-io/dgrap... |
// test specification examples, see:
// http://www.red-bean.com/sgf/sgf4.html
// http://www.red-bean.com/sgf/var.htm
package sgf_test
import (
"fmt"
"testing"
"github.com/dgf/gotv/sgf"
)
// SGF basics and property value clean up
func TestParse_cleanup(t *testing.T) {
for _, check := range []struct{ name, sgf, ex... |
package textanalytics
import (
"strings"
"math"
textAnalyticsClient "github.com/docker/compliance/nlptooling/nlputil/textanalytics/client"
"github.com/docker/compliance/nlptooling/nlputil/textanalytics/client/operations"
"github.com/docker/compliance/nlptooling/nlputil/textanalytics/models"
"github.com/docker/... |
package configcat
import (
"bufio"
"context"
"encoding/csv"
"fmt"
"io"
"log"
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"testing"
)
const (
valueKind = 0
variationKind = 1
)
type integrationTest struct {
sdkKey string
fileName string
kind int
}
var integrationTests = []integrationTes... |
package agents
import (
"context"
"fmt"
"io/ioutil"
"math"
"net/url"
"os"
"time"
"github.com/chromedp/cdproto/emulation"
"github.com/chromedp/cdproto/page"
"github.com/chromedp/chromedp"
"github.com/michenriksen/aquatone/core"
)
type URLScreenshotter struct {
session *core.Session
}
func NewURLScreensho... |
package main
import (
"context"
"log"
"net/http"
"time"
_ "embed"
"github.com/bmizerany/pat"
"github.com/gorilla/websocket"
)
//go:embed index.html
var index []byte
//go:embed neat.css
var neatCSS []byte
//go:embed custom.css
var customCSS []byte
//go:embed index.js
var indexJS []byte
func Index(w http.R... |
// 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 wri... |
// Copyright (c) 2020, The Emergent 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 deep
import (
"github.com/emer/axon/axon"
"github.com/emer/emergent/emer"
"github.com/goki/ki/ints"
"github.com/goki/ki/kit"
)
// TRNLa... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package migrationhub
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type PutResourceAttributesInput struct {
_ struct{} `type:"structure"`
// Optional boolean flag to indicate w... |
package main
/*
usage examples:
$ ffmpeg -y -v quiet -i "$B".??[!ast] -map 0:v -filter:v "crop=608:86:154:395" -f rawvideo -pix_fmt yuv444p - | go run extract_timings_from_hardsubs.go -fgYuvRanges d0 -frameSize 156864 -fps 30 "$B".timings.srt
$ ffmpeg -y -v quiet -ss 00:00:00 -i "$B".??[!ast] -map 0:v -filter:v "... |
package jobsd
import (
"bytes"
"database/sql"
"database/sql/driver"
"encoding/gob"
"fmt"
"reflect"
"time"
"github.com/pkg/errors"
"gorm.io/gorm/schema"
)
// JobFunc .
type JobFunc struct {
runInfoArg bool
jobFunc reflect.Value
}
var (
//ErrJobFuncNotFunc Job Func not a func
ErrJobFuncNotFunc = error... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.