text stringlengths 3.08k 10.4k |
|---|
package example
import (
"errors"
"github.com/jkomoros/boardgame"
"github.com/jkomoros/boardgame/moves"
"github.com/jkomoros/boardgame/moves/with"
)
/*
Call the code generation for readers and enums here, so "go generate" will generate code correctly.
*/
//go:generate boardgame-util codegen
type gameDelegate s... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package quicksight
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 DeleteUserInput struct {
_ struct{} `type:"structure"`
// The ID... |
package gitdiff
import (
"errors"
"fmt"
"os"
"strings"
)
// File describes changes to a single file. It can be either a text file or a
// binary file.
type File struct {
OldName string
NewName string
IsNew bool
IsDelete bool
IsCopy bool
IsRename bool
OldMode os.FileMode
NewMode os.FileMode
OldOID... |
package null
import (
"encoding/json"
"encoding/xml"
"fmt"
"math/rand"
"reflect"
"strconv"
"github.com/axiomzen/null/sql"
"gopkg.in/mgo.v2/bson"
)
// Int32 is an nullable int32.
// It does not consider zero values to be null.
// It will decode to null, not zero, if null.
type Int32 struct {
sql.NullInt32
}
... |
package main
import (
"os"
"text/template"
"github.com/rs/zerolog/log"
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/rules"
"github.com/zricethezav/gitleaks/v8/config"
)
const (
templatePath = "rules/config.tmpl"
)
func main() {
configRules := []*config.Rule{}
configRules = append(configRules, ru... |
// For example:
// $> ./bin/create-airline -name 'Flair Airlines' -parent-id 890458485 -iata-code F8 -icao-code FLE -wikidata-id Q4038797 -inception 2005 -cessation ..
package main
import (
"context"
_ "embed"
"fmt"
"log"
"github.com/sfomuseum/go-flags/flagset"
"github.com/tidwall/gjson"
"github.com/whosonfirst... |
package migrations
import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
)
// DownloadDirectory can be set as the location for FetchBinary to save the
// downloaded archive file in. If not set, then FetchBinary saves the archive
// in a temporary dire... |
package match
import (
"fmt"
"math"
"sort"
"strconv"
"sync"
"time"
)
type Match struct {
Uid int
Rating int
StartTime int64 //单位豪秒
}
type MatchPool struct {
allUser *sync.Map
timeout int64 //匹配超时时间 单位豪秒
mu sync.Mutex
num int //需要匹配人数
isWork bool
count int64 //匹配成功次数
}
func NewMa... |
// Package tradingdays - Check the day is open or not and at which period time
// 股市開休市判斷(支援非國定假日:颱風假)與當日區間判斷(盤中、盤後、盤後盤)
//
package tradingdays
import (
"bytes"
"encoding/csv"
"io"
"io/ioutil"
"net/http"
"path"
"runtime"
"time"
"github.com/toomore/gogrs/utils"
)
// IsOpen 判斷是否為開休日
func IsOpen(year int, mont... |
package main
import (
"container/list"
"crypto/rand"
"encoding/base64"
"encoding/json"
"net"
"sync"
. "github.com/elisescu/tty-share/common"
)
type sessionInfo struct {
ID string
URLWebReadWrite string
}
type ttyShareSession struct {
sessionID string
serverURL strin... |
package example_query
import (
context "context"
fmt "fmt"
log "log"
elasticSearch7 "github.com/elastic/go-elasticsearch/v7"
proto "github.com/golang/protobuf/proto"
uuid "github.com/google/uuid"
elastic_search_utils "github.com/jeroenvanmaanen/archetype-go-axon/src/pkg/elastic_search_utils"
grpc_example "gi... |
/*
* Copyright (c) 2018 - present. Boling Consulting Solutions (bcsw.net)
*
* 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 require... |
package sort_test
import (
"fmt"
"math/rand"
"sort"
"strings"
"testing"
sortproc "github.com/brimdata/zed/proc/sort"
"github.com/brimdata/zed/ztest"
)
// Data sets for tests:
const unsortedInts = `
{foo:100}
{foo:2}
{foo:9100}
`
const ascendingInts = `
{foo:2}
{foo:100}
{foo:9100}
`
const descendingInts = `... |
package main
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"path/filepath"
"strconv"
"time"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
k8serr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runt... |
//
// Copyright (C) 2019-2022 vdaas.org vald team <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a... |
// Copyright 2012 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... |
package lang
import (
"fmt"
"path/filepath"
"sort"
"strings"
)
// Language is an identifier for a supported programming language.
type Language int
// The languages identified by Language.
const (
Unknown Language = iota
Golang
JavaScript
Cpp
Java
Python
PHP
ObjectiveC
Scala
C
CSharp
Perl
Ruby
Bash... |
package k8s
import (
"bytes"
"context"
"io"
"sync"
"time"
"k8s.io/apimachinery/pkg/labels"
"github.com/windmilleng/tilt/internal/model"
"github.com/docker/distribution/reference"
"github.com/pkg/errors"
"github.com/windmilleng/tilt/internal/container"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/watch"... |
// Copyright 2017 The Cockroach 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 utils
import (
"archive/zip"
"fmt"
"io"
"math/rand"
"net/url"
"os"
"os/user"
"path/filepath"
"strings"
"time"
"github.com/briandowns/spinner"
"github.com/charmbracelet/glamour"
"github.com/kaecloud/kaectl/internal/run"
"github.com/kaecloud/kaectl/pkg/browser"
)
// OpenInBrowser opens the url in... |
// +build !wasm
package audio
import (
"time"
"github.com/kasworld/h4o/_examples/app"
"github.com/kasworld/h4o/audio"
"github.com/kasworld/h4o/eventtype"
"github.com/kasworld/h4o/math32"
"github.com/kasworld/h4o/util/helper"
)
func init() {
app.DemoMap["audio.doppler"] = &AudioDoppler{}
}
type AudioDoppler ... |
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"time"
"github.com/jordan-wright/ossmalware/pkg/library"
"gocloud.dev/pubsub"
_ "gocloud.dev/pubsub/gcppubsub"
bv1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/met... |
package builder
import (
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"github.com/pkg/errors"
"gopkg.in/src-d/go-git.v4"
"github.com/vim-volt/volt/gitutil"
"github.com/vim-volt/volt/lockjson"
"github.com/vim-volt/volt/logger"
"github.com/vim-volt/volt/pathutil"
"github.com/vim-volt/volt/plugconf... |
// Copyright 2015 <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 writi... |
package wip
import (
"fmt"
"regexp"
"strings"
"github.com/arquillian/ike-prow-plugins/pkg/command"
"github.com/arquillian/ike-prow-plugins/pkg/github"
ghclient "github.com/arquillian/ike-prow-plugins/pkg/github/client"
ghservice "github.com/arquillian/ike-prow-plugins/pkg/github/service"
"github.com/arquillia... |
package waves
import "github.com/lord/lodo/core"
import "time"
const (
n_x = 35 // Lights in x-direction
n_y = 43 // Lights in y-direction
dt = 0.1 // Duration of time step [s]
c = 1.5 // A constant (defines wave speed) [m/s]
c2 = c*c*dt*dt // Used in later calculations
dx = 0.1 ... |
package app
import (
"fmt"
"os"
"path/filepath"
"strings"
jsoniter "github.com/json-iterator/go"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/kun/log"
"github.com/yaoapp/kun/maps"
"github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/data"
"github.com/yaoapp/yao/share"
"github.com/yaoapp/yao/xfs"
... |
package libsf
import (
"encoding/json"
"time"
"github.com/pkg/errors"
)
const (
// ContentTypeUserPreferences for items that holds user's preferences.
ContentTypeUserPreferences = "SN|UserPreferences"
// ContentTypePrivileges for items that holds note's privileges.
ContentTypePrivileges = "SN|Privileges"
// ... |
package exec
import (
"bufio"
"github.com/tmyksj/rlso11n/pkg/common/errors"
"github.com/tmyksj/rlso11n/pkg/common/logger"
"github.com/tmyksj/rlso11n/pkg/common/utility"
"github.com/tmyksj/rlso11n/pkg/core"
"io"
"io/ioutil"
"os/exec"
"strconv"
"strings"
"sync"
"syscall"
)
const rlsDPidPrefix string = "rlso... |
package lndclient
import (
"context"
"encoding/hex"
"fmt"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/routing/route"
"time"
"github.com/lightningnetwork/lnd/channeldb"
"google.golang.org/grpc/codes"
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
"github.com/lightningnetwork/... |
package pool
import (
"sync"
"sync/atomic"
"time"
)
type sig struct{}
type Pool struct {
capacity int32 // Pool的容量, 即开启worker数量的上限, 每一个worker绑定一个goroutine.
running int32 // 当前正在执行任务的worker数量
expiryDuration time.Duration // 每个协程的运行时长(second)
idleWorkers []*Worker // 存放空闲worker
signal chan sig // 关闭协程池的信号
... |
package main
import (
"fmt"
"log"
"nasa-api/config"
"nasa-api/entities"
"nasa-api/util"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/gorilla/websocket"
)
func main() {
config.LoadConfig()
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGINT, syscall.SIGUSR1)... |
package ecc
import (
"encoding/json"
"errors"
"fmt"
"strings"
"github.com/tsfdsong/eos-go/btcsuite/btcd/btcec"
"github.com/tsfdsong/eos-go/btcsuite/btcutil/base58"
"golang.org/x/crypto/ripemd160"
)
var PublicKeyPrefix = "PUB_"
var PublicKeyK1Prefix = "PUB_K1_"
var PublicKeyR1Prefix = "PUB_R1_"
var PublicKeyWA... |
/*
Copyright The Accelerated Container Image 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 ap... |
package visitor
import (
"fmt"
"os"
"runtime"
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/quantumsheep/doka/parser"
)
type DokafileVisitor struct {
*parser.BaseDokafileVisitor
filepath string
variables map[string]string
output string
}
func NewDokafileVisitor(filepath string, variables map[st... |
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
"context"
"github.com/ONSdigital/dp-authorisation/v2/authorisation"
"github.com/ONSdigital/dp-authorisation/v2/permissions"
"github.com/ONSdigital/dp-healthcheck/healthcheck"
"sync"
)
// Ensure, that PermissionsCheckerMock do... |
package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/alexflint/go-arg"
"github.com/olekukonko/tablewriter"
)
type Args struct {
Expression string `arg:"--expr,positional" help:"expression to evaluate"`
ApiKey string `arg:"--api-key, env:API_KEY" help:"currency... |
// Copyright observIQ, 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 ... |
package worker
import (
"context"
"fmt"
"strings"
"github.com/ohsu-comp-bio/funnel/config"
"github.com/ohsu-comp-bio/funnel/database/datastore"
"github.com/ohsu-comp-bio/funnel/database/dynamodb"
"github.com/ohsu-comp-bio/funnel/database/elastic"
"github.com/ohsu-comp-bio/funnel/database/mongodb"
"github.com... |
package provider
import (
"context"
"fmt"
"github.com/hashicorp/terraform-provider-scaffolding-framework/internal/dvc_oauth"
"os"
dvc_mgmt "github.com/devcyclehq/go-mgmt-sdk"
dvc_server "github.com/devcyclehq/go-server-sdk"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform... |
// The following directive is necessary to make the package coherent:
// +build ignore
// This program generates unmarshall.go. It can be invoked by running
// go generate
package main
import (
"bytes"
"go/format"
"os"
"reflect"
"strings"
"text/template"
"time"
"github.com/coopgo/gtfs"
)
... |
/*
Copyright AppsCode Inc. and Contributors
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 main
import (
"bufio"
"regexp"
"strings"
"helm.sh/helm/v3/pkg/strvals"
)
//
// cluster information
//
const (
clusterUnknown = iota
clusterDockerDesktop
clusterMinikube
clusterKIND
clusterK3D
clusterGKE
clusterAKS
clusterEKS
clusterEC2
)
// clusterInfoMessages represent custom messages for som... |
package main
import (
"log"
"fmt"
gc "github.com/go-goodies/go_currency"
gu "github.com/go-goodies/go_utils"
"strings"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"errors"
"io"
"bytes"
)
func main() {
pipeline := BuildPipeline(Decrypt{}, Charge{}, Authenticate{})
go func(){
orders :=... |
// Licensed to LinDB under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. LinDB licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compli... |
package guobiao
import (
"fmt"
"github.com/pkg/errors"
"strings"
)
const (
mode_public = iota
mode_private
mode_last
)
func Parse(str string) (Hand, error) {
cardType := ZI
mode := mode_public
publicCards := Cards{}
publicType := GT_QI_XING_BU_KAO
newPublicType := GT_QI_XING_BU_KAO
newCard := NIL_CARD... |
// 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 writing, ... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: PreRestoreAction.proto
package generated
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are n... |
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// RayClusterNode defines attributes common to all ray node types.
type RayClusterNode struct {
// Labels applied to ray pods in addition to stock labels.
Labels map[string]string `json:"labels,omitempty"`
// A... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"fmt"
"strings"
"github.com/gotd/td/bin"
)
// No-op definition for keeping imports.
var _ = bin.Buffer{}
var _ = context.Background()
var _ = fmt.Stringer(nil)
var _ = strings.Builder{}
// ContactsGetLocatedRequest represents TL type `con... |
package api
import (
"bytes"
"context"
cRand "crypto/rand"
"crypto/rsa"
"crypto/subtle"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"io"
"log"
"math/rand"
"net"
"strconv"
"sync"
"testing"
"github.com/google/go-cmp/cmp"
"golang.org/x/crypto/ssh"
)
var tests = map[string]struct {
iterations int
nWo... |
package tools
import (
"os"
"io/ioutil"
"github.com/dvsekhvalnov/jose2go/keys/rsa"
"log"
"crypto/rsa"
"crypto/rand"
"encoding/pem"
"crypto/x509"
"net/http"
"github.com/dvsekhvalnov/jose2go"
"encoding/json"
"time"
"io"
"archive/zip"
"mime/multipart"
)
type (
JWTSession struct {
AccessToken string `j... |
// Package test
package test
import (
"bytes"
"context"
"errors"
"fmt"
"github.com/tkellen/memorybox/pkg/archive"
"github.com/tkellen/memorybox/pkg/file"
"io/ioutil"
"os"
"reflect"
"strings"
"testing"
"testing/iotest"
"time"
)
func StoreSuite(t *testing.T, store archive.Store) {
t.Run("put-stat-get-dele... |
// Copyright (C) 2019 Cisco Systems 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 agr... |
package cmd
import (
"fmt"
"log"
"net/http"
"os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"github.com/jenkins-x/go-scm/scm/factory"
"github.com/prometheus/client_golang/prometheus/promh... |
package logging
import (
"compress/gzip"
"fmt"
"io"
"os"
"path/filepath"
"sort"
"strings"
"sync"
"time"
)
const (
LevelBrief = 0
LevelDebug = 1
LevelTrace = 2
)
type (
LogLevel = int
batch struct {
text []string
recv time.Time
}
message struct {
name string //保存的文件名
mesg batch
rply chan ... |
package darwin
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Foundation -framework Cocoa -framework WebKit
#import <Foundation/Foundation.h>
#import "Application.h"
#import "WailsContext.h"
#include <stdlib.h>
*/
import "C"
import (
"log"
"runtime"
"strconv"
"strings"
"unsafe"
"github.com/wailsapp/wa... |
package dota2api
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"image"
"image/jpeg"
"image/png"
"sort"
"sync"
"sync/atomic"
)
var sizes = []string{"lg", "sb", "full", "vert"}
const (
heroPrefix = "npc_dota_hero_"
)
type HeroImageSize int
const (
SizeLg HeroImageSize = iota
SizeSb
SizeFull
SizeVert... |
package main
import (
//"log"
"bytes"
"crypto/rand"
xrand "math/rand"
"encoding/base64"
"encoding/hex"
"fmt"
"math"
"math/big"
"strings"
"time"
)
var prime *big.Int
/**
* Returns a random number from the range (0, prime-1) inclusive
**/
func random() (*big.Int, error) {
max := big.NewInt(0).Set(prime) /... |
// 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 main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/gpestana/htmlizer"
"github.com/zoomio/inout"
"github.com/smeshkov/lsh"
)
var (
// shingle command
shingleCmd = flag.NewFlagSet("shingle", flag.ExitOnError)
shingleSource = shingleCmd.String("s", "", "Sources of the text.")
shingleK = s... |
package gateway
import (
"bytes"
"context"
"fmt"
"io"
"net/http"
gopath "path"
"path/filepath"
"strings"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/render"
files "github.com/ipfs/go-ipfs-files"
iface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/path"
"github... |
/*
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 main
import (
"context"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"regexp"
"strings"
)
type mitmHttpHandler struct {
TargetSocket string
}
// Takes JSON in, returns JSON
func injectLabelAndCgroupParentToPostBody(input string, cgroup_parent string) string {
segments := []string{}
// So we can ... |
package controllers
import (
"encoding/json"
"fmt"
"sync"
"github.com/Arvinderpal/embd-project/common/controllerapi"
"github.com/Arvinderpal/embd-project/common/message"
"github.com/Arvinderpal/embd-project/common/seguepb"
"github.com/Arvinderpal/embd-project/pkg/controllers/lircbackend"
)
// README:
// It's ... |
package resp3
import (
"encoding"
"fmt"
"io"
"io/ioutil"
"math/big"
"reflect"
"sort"
"strconv"
"strings"
"github.com/mediocregopher/radix/v4/internal/bytesutil"
"github.com/mediocregopher/radix/v4/resp"
)
// cleanFloatStr is needed because go likes to marshal infinity values as
// "+Inf" and "-Inf", but w... |
package common
import "fmt"
import "encoding/binary"
import "bytes"
const LEN_PROTO_NAME = 16
const LEN_MSG_NAME = 8
const LEN_MAGIC_NUMBER = 8
const LEN_SERVER_ID = 32
const LEN_SSMP_HDR = LEN_PROTO_NAME + LEN_MSG_NAME + LEN_MAGIC_NUMBER + LEN_SERVER_ID
const LEN_SESSION_ID = 4
const OFF_MSG_NAME = LEN_PROTO_NAME
c... |
package wss
import (
"context"
"errors"
"fmt"
"github.com/segmentio/ksuid"
log "github.com/sirupsen/logrus"
"io"
"net"
"sync"
)
var StoppedError = errors.New("listener stopped")
// client part of wssocks
type Client struct {
tcpl *net.TCPListener
stop chan interface{}
closed bool
wgClose sync.Wait... |
package object
import (
"bytes"
"fmt"
"hash/fnv"
"strings"
"github.com/radlinskii/interpreter/ast"
)
// Type represents different object types.
type Type string
const (
// INTEGER object type
INTEGER = "INTEGER"
// BOOLEAN object type
BOOLEAN = "BOOLEAN"
// STRING object type
STRING = "STRING"
// NULL o... |
package backend
import (
"context"
"fmt"
"strings"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
"github.com/pkg/errors"
"github.com/sourcegraph/go-langserver/pkg/lsp"
"github.com/sourcegraph/go-langserver/pkg/lspext"
"github.com/sourcegraph/sourcegraph/cmd/f... |
package main
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/robfig/cron"
"github.com/sirupsen/logrus"
)
var (
dockerClient *client.Client
statsInterval = os.Getenv("stats_interval")
logFormat = os... |
package slackbot
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"google.golang.org/appengine"
"google.golang.org/appengine/urlfetch"
)
const (
location = "Asia/Tokyo"
connpassURL = "https://connpass.com/api/v1/event/"
slackURL = "https://nfug.slack... |
package jsonrouter
import (
"io"
"sync"
www "net/http"
//
json "github.com/json-iterator/go"
"github.com/valyala/fasthttp"
//"github.com/hjmodha/goDevice"
//
"github.com/jsonrouter/logging"
"github.com/jsonrouter/core/http"
"github.com/jsonrouter/core/tree"
"github.com/jsonrouter/platforms/par... |
package hashtreedb
import (
"fmt"
"github.com/hacash/chain/leveldb"
"sync"
)
// 单个文件大小至少支持 256^4×5×8 MenuWide=8 时约 80GB
/*
const (
IndexItemSize int = 1 + 4 // 固定不变
IndexMenuSize int = 16 * IndexItemSize // 固定不变
)
const (
IndexItemTypeNull = byte(0)
IndexItemTypeBranch = byte(1)
Ind... |
// Copyright (c) 2012-2020 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
//go:build !safe && !codec.safe && !appengine && go1.9 && gc
// +build !safe,!codec.safe,!appengine,go1.9,gc
package codec
import (
"reflect"
_ "runtime" // needed for go linkn... |
package results
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"
)
const (
alltoallResultsExample1 = `/global/scratch/users/geoffroy/a2av_validation_ws/install/ompi/bin/mpirun
# OSU MPI All-to-Allv Personalized Exchange Latency Test v5.6.3
# Size Avg Latency(us)
1 159.35
... |
package equinix
import (
"context"
"testing"
"time"
"github.com/equinix/ne-go"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"
)
func TestNetworkBGP_createFromResourceData(t *testing.T) {
//given
expected := ne.BGPConfiguration{
ConnectionUUID: ne.String... |
package configifytest
import (
"time"
"github.com/robsignorelli/configify"
"github.com/stretchr/testify/mock"
)
// NewMockSource creates a mock source that lets you instruct it exactly how to
// respond for specific inputs.
func NewMockSource(setup func(*MockSource)) configify.Source {
// We call setup() before ... |
/*
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, modify, merge, publish, distribute, sublicen... |
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use ... |
/*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* This source code is licensed under the Apache License Version 2.0.
*/
package cmds
import (
"encoding/json"
"errors"
"fmt"
"github.com/spf13/cobra"
"golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform"
"io/ioutil"... |
package curl
import "C"
const (
GLOBAL_SSL = C.CURL_GLOBAL_SSL
GLOBAL_WIN32 = C.CURL_GLOBAL_WIN32
GLOBAL_ALL = C.CURL_GLOBAL_ALL
GLOBAL_NOTHING = C.CURL_GLOBAL_NOTHING
GLOBAL_DEFAULT = C.CURL_GLOBAL_DEFAULT
)
const (
M_CALL_MULTI_PERFORM = C.CURLM_CALL_MULTI_PERFORM
M_BAD_HANDLE = C.CURLM_BAD_... |
package ssh
import (
"fmt"
"io"
"io/ioutil"
"net"
"net/url"
"sync"
"time"
"golang.org/x/crypto/ssh"
"github.com/yinqiwen/gsnova/common/logger"
"github.com/yinqiwen/gsnova/common/mux"
"github.com/yinqiwen/gsnova/local/proxy"
)
type sshStream struct {
net.Conn
conf *proxy.ProxyChannelConfig
addr s... |
package models
import (
"database/sql"
"encoding/json"
"fmt"
"github.com/go-contrib/uuid"
_ "github.com/lib/pq"
"log"
)
type UploadData struct {
Contacts []string `json:"contacts"`
CampaignId int `json:"campaignId"`
CamScheduleId int `json:"camScheduleId"`
TenantId int `json:... |
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"regexp"
"strconv"
"strings"
)
var (
FieldMatcher = regexp.MustCompile("(?P<name>.*): (?P<interval_1>[0-9-]*) or (?P<interval_2>[0-9-]*)")
)
type Interval struct {
Low, High int
}
type Ticket []int
type TicketsPuzzle struct {
Fields map[string][... |
package handlers
import (
"encoding/base64"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strings"
"sync"
"time"
"crypto/sha256"
"github.com/byuoitav/common/log"
"github.com/byuoitav/common/status"
_ "github.com/go-kivik/couchdb/v3"
"github.com/godbus/dbus"
"github.com/byuoitav/omxplayer-microservice/data"
... |
package clitester
import (
"fmt"
"strconv"
"strings"
"testing"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkErrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/stretchr/testify/require"
"github.com/dfinance/dnode/cmd/config/genesis/defaults"
)
type TxRequest s... |
package flag
import (
"fmt"
"strings"
"text/tabwriter"
)
const (
minInfoLen = 12
maxInfoLen = 24
)
type helpWriter struct {
buf *tabwriter.Writer
isTop bool
indent string
}
func (w *helpWriter) maxFlagInfoLen(f *FlagSet) int {
var maxLen int
for i := range f.flags {
l := len(f.flags[i].Names)
if f... |
package chain
import (
"context"
"errors"
"fmt"
"strings"
"github.com/AccumulateNetwork/accumulate/config"
"github.com/AccumulateNetwork/accumulate/internal/url"
"github.com/AccumulateNetwork/accumulate/networks"
"github.com/AccumulateNetwork/accumulate/protocol"
"github.com/tendermint/tendermint/rpc/client/... |
/*
* Copyright (c) 2015 <NAME> <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, pu... |
package main
import (
"fmt"
"log"
"os"
"bufio"
"sync"
"sync/atomic"
"time"
"errors"
"net"
dns "github.com/miekg/dns"
)
const (
logFd uintptr = 3
inputBufferSize = 100
backlogBufferSize = 100
workersNumber = 200
dialTimeout = 10 * time.Second
dialNetwork = "tcp"
requestTimeout = 10 * time.Second
con... |
// This program generates html.go/css.go. It can be invoked by running
// This package is way to have the best performance aspect, however the `go generate` should only run one time,
// so I choose to have a more readable file. The `go generate` creates the code, so is important to anyone understand
// what generated.
... |
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2017 The Decred developers
// Copyright (c) 2018-2020 The Hc developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package hcjson
// GetStakeDifficultyResult models the data returned fr... |
/// Author:koangel
/// <EMAIL>
/// 负责分析并解析字符串格式并转换成一个time
package grapeTimer
import (
"errors"
"fmt"
"log"
"regexp"
"strconv"
"strings"
"time"
)
const (
TimeFormat = "2006-01-02 15:04:05"
DateFormat = "2006-01-02"
// Day 00:00:00 每天的几点几分执行
DayRegexp = `Day\s[0-9]{2}:[0-9]{2}:[0-9]{2}`
// Week 1 00:00:00 ... |
/* Copyright 2017 The Bazel 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 ... |
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"time"
"golang.org/x/net/context"
"github.com/go-openapi/errors"
"github.com/go-openapi/runt... |
package sexpconv
import (
"exn"
"go/ast"
"go/token"
"go/types"
"magic_pkg/emacs/rt"
"sexp"
"xtypes"
)
// Go blank identifier which allows a value to be evaluated, but discarded.
const blankIdent = "_"
func isBlankIdent(node ast.Expr) bool {
if node, ok := node.(*ast.Ident); ok {
return node.Name == blankId... |
// Copyright (c) 2018-2019, AT&T Intellectual Property. All rights reserved.
//
// Copyright (c) 2014-2016 by Brocade Communications Systems, Inc.
// All rights reserved.
//
// SPDX-License-Identifier: MPL-2.0
/* Package data is the base storage for the union data structure.
* It provides the basic nary tree structur... |
package handler
import (
"fmt"
"net/http"
"reflect"
"runtime"
"strings"
"github.com/dynastymasra/cartographer/config"
"github.com/dynastymasra/cartographer/country"
"github.com/dynastymasra/cartographer/domain"
"github.com/dynastymasra/cartographer/infrastructure/provider"
"github.com/dynastymasra/cookbook"... |
// This example demonstrates how to use the STUSB4500 driver to monitor cable
// attach/detach, read the USB PD source capabilities, and negotiate different
// power profiles.
//
// An external button is used to cycle through each of the power profiles
// discovered.
//
// An LED is used to indicate USB PD negotiation ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.