text stringlengths 3.08k 10.4k |
|---|
package main
import (
"context"
"fmt"
"os"
"sort"
"strconv"
"strings"
"time"
tm "github.com/buger/goterm"
"github.com/olekukonko/tablewriter"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
)
type LeaseKeysMapping map[int64]LeaseInfo
func (m LeaseKeysMapping) keys() []int64 {
keys := make(... |
package main
import (
"bytes"
"flag"
"fmt"
"log"
"math"
"os"
"regexp"
"sort"
"time"
pto3 "github.com/mami-project/pto3-go"
)
type tbStat struct {
Count uint64 // how many instances were observed
}
type stats struct {
Conditions map[string]*tbStat
FilesProcessed uint
FilesTotal uint
TimeElapse... |
package zim
import (
"compress/bzip2"
"encoding/binary"
"errors"
"io"
"io/ioutil"
)
const (
defaultOffsetSize = 4
extendedOffsetSize = 8
maxClusterLen = 1024 * 1024 * 32 // 32MB
)
func clusterOffsetSize(clusterInformation uint8) uint8 {
/*
if (clusterInformation & 0b0001_0000) == 0b0001_0000 {
... |
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binar... |
/**
* Copyright 2020 Appvia Ltd <<EMAIL>>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
package ldap
import (
//"bufio"
//"errors"
"fmt"
//"io"
//"os"
"strings"
"testing"
)
var simpleLDIF string = `
version: 1
# comment
dn: cn=bob,ou=people,o=example.com
cn: bob
# comment in entry
description: a multi-line
attribute value
-
dn: cn=joe,ou=people,o=example.com
cn: joe
description:: VGhpcyB0ZXh... |
package banglisp
import (
"fmt"
"strings"
)
type builtinFunctionType func(env *Environment, args []*Object) (*Object, error)
type BuiltinFunction struct {
code builtinFunctionType
arity int
variadic bool
}
func newBuiltinFunction(code builtinFunctionType, arity int, variadic bool) *Object {
bf := &Buil... |
package main
import (
"bufio"
"encoding/csv"
"fmt"
"log"
"os"
"strconv"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
)
// SSHHost struct
type SSHHost struct {
Priority uint `db:"priority"`
Host string `db:"host"`
HostName string `db:"host_name"`
User string `db:"use... |
package reconciler
import (
"context"
"code.cloudfoundry.org/eirini"
"code.cloudfoundry.org/eirini/k8s"
"code.cloudfoundry.org/eirini/k8s/utils"
"code.cloudfoundry.org/eirini/opi"
eiriniv1 "code.cloudfoundry.org/eirini/pkg/apis/eirini/v1"
"code.cloudfoundry.org/lager"
"github.com/hashicorp/go-multierror"
"gi... |
package main
import (
"context"
"crypto/ecdsa"
"fmt"
"geth-cli/erc20-token"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.... |
package main
import (
"bytes"
"fmt"
"os"
"github.com/lestrrat-go/codegen"
"github.com/pkg/errors"
)
func main() {
if err := _main(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
var typs = []struct {
Name string
}{
{Name: "ArrayType"},
{Name: "AssignStmt"},
{Name: "BadDecl"},
{Name: "BadExpr"},
{Na... |
/*
This code implements the flow chart that can be found here.
http://www.html5rocks.com/static/images/cors_server_flowchart.png
A Default Config for example is below:
cors.Config{
Origins: "*",
Methods: "GET, PUT, POST, DELETE",
RequestHeaders: "Origin, Authorization, Content-Type",
ExposedHeade... |
package easypost_test
import (
"time"
"github.com/EasyPost/easypost-go/v2"
)
type Fixture struct {
}
// We keep the page_size of retrieving `all` records small so cassettes stay small
func (fixture *Fixture) pageSize() int {
return 5
}
// This is the carrier account ID for the default USPS account that comes by... |
package transmission
import (
"reflect"
"strings"
)
// Torrent contains all of the fields returned by Transmission for a torrent
type Torrent struct {
ID int `json:"id"`
ActivityDate int `json:"activityDate"`
AddedDate int ... |
package terminalbot
import (
"fmt"
"io"
"log"
"net"
"sync"
"time"
"github.com/jroimartin/gocui"
"github.com/pantheon-systems/riker/pkg/botpb"
"github.com/pantheon-systems/riker/pkg/riker"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
)
// holds info on a connected... |
// Copyright (c) 2014 <NAME>
// Licensed under the MIT license
package main
import (
"math"
"math/rand"
"sort"
"strings"
)
type MirrorSelection interface {
// Selection must return an ordered list of selected mirror,
// a list of rejected mirrors and and an error code.
Selection(*Context, *Cache, *FileInfo, G... |
package sync
import (
"bytes"
"encoding/json"
"fmt"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"io"
"io/ioutil"
"net/http"
"strings"
)
// create: POST /gists
// edit: PATCH /gists/:gist_id
// get: GET /gists/:gist_id
const (
endpoint string = "https://api.github.com"
editGist string ... |
package main
import (
"bytes"
"encoding/csv"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
"time"
"github.com/BurntSushi/toml"
"gopkg.in/yaml.v2"
)
const (
jsonFileExt = ".json"
yamlFileExt = ".yaml"
ymlFileExt = ".yml"
tomlFileExt = ".toml"
csvFileE... |
// Copyright 2018 ProximaX Limited. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package sdk
import (
"fmt"
"testing"
"github.com/proximax-storage/go-xpx-utils/mock"
"github.com/proximax-storage/go-xpx-utils/tests"
"github.com/st... |
/*
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
*/
package flags
import (
"fmt"
"os"
"sort"
"strconv"
"strings"
"github.com/facebookincubator/fbender/utils"
"... |
package main
import (
"errors"
"fmt"
"net/http"
"os"
"path/filepath"
"plugin"
"rais/src/iiif"
"reflect"
"sort"
"strings"
"github.com/uoregon-libraries/gopkg/logger"
)
var wrapHandlerPlugins []func(string, http.Handler) (http.Handler, error)
var teardownPlugins []func()
var purgeCachePlugins []func()
var e... |
package cmdlib
import (
"encoding/json"
"fmt"
"reflect"
"strings"
)
// defaultListIndent - default indent level for lists
const defaultIndent = " "
// Converts to generic interface that jsonpath can work with
func toGenericObject(v interface{}) (interface{}, error) {
var jsonData interface{}
data, err := json... |
package pig
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 (
galaBirthday = nook.Birthday{
Day: 5,
Month: ti... |
// Copyright 2016 Google 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 main
import (
"bufio"
"context"
"flag"
"io"
"log"
"math/rand"
"os"
"strconv"
"strings"
"sync"
"time"
"github.com/Akongstad/AuctionHouse/Auction"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
)
var client Auction.AuctionHouseClient
type gRPCClient struct {
conn *grpc.Clie... |
package api
import (
"bytes"
"io/ioutil"
"math/rand"
"net/http"
"time"
log "github.com/sirupsen/logrus"
"github.com/kevinburke/nacl"
"github.com/blk-io/crux/utils"
"encoding/hex"
"net/http/httputil"
"fmt"
)
// EncryptedPayload is the struct used for storing all data associated with an encrypted
// transact... |
package credit_card_utils
import (
"fmt"
"runtime"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSetupNumber(t *testing.T) {
assert.Equal(t, "1234567812345678", SetupNumber("1234-5678-1234-5678"))
assert.Equal(t, "1234567812345678", SetupNumber(" 1234 5678 1234 5678 "))
}
func ... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package redshift
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/redshift-2012-12-01/DescribeOrderableClusterOptionsMessage
type ... |
// Copyright © 2019 Circonus, Inc. <<EMAIL>>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// Package as is the api-server collector
package as
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"net/http"
"sync"
"time"
cgm "github.com/circonus-labs/cir... |
package freshservice
import (
"fmt"
"net/http"
"time"
)
const (
contractsUrl = "contracts"
contractIdUrl = "contracts/%d"
contractTypesUrl = "contract_types"
contractSubmitApprovalUrl = "contracts/%d?operation=submit-for-approval"
contractApproveUrl = "contra... |
package digitalocean
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
)
type DropletsResponse struct {
Droplets []*Droplet `json:"droplets"`
Meta *Meta `json:"neta,omitempty"`
}
type DropletResponse struct {
Droplet *Droplet `json:"droplet,omitempty"`
}
func (client *Client) Dr... |
package withings_test
import (
"context"
"net/http"
"net/http/httptest"
"reflect"
"testing"
"time"
withings "github.com/nasa9084/go-withings"
"golang.org/x/oauth2"
)
var tokenSrc = oauth2.StaticTokenSource(
&oauth2.Token{
AccessToken: "<PASSWORD>",
},
)
var httpClient = oauth2.NewClient(oauth2.NoContext... |
// Copyright 2020 Insolar Network Ltd.
// All rights reserved.
// This material is licensed under the Insolar License version 1.0,
// available at https://github.com/insolar/mainnet/blob/master/LICENSE.md.
package cmd
import (
"context"
"encoding/json"
"io/ioutil"
"net/url"
"os"
"github.com/insolar/insolar... |
/*
* Copyright (c) 2015-2018 Nexenta Systems, Inc.
*
* This file is part of EdgeFS Project
* (see https://github.com/Nexenta/edgefs).
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional informat... |
// A glob module that also provides access to which strings matched
// each wildcard.
package globingo
import (
"context"
"fmt"
// "log"
"strings"
"github.com/pkg/errors"
)
// Are we dealing with Unix-style or Windows-style paths? This affects
// the choice of directory separator character. NativeStyle c... |
// Package ta2tf provides core functionality for integrating with TensorFlow tools
/*
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
*/
package tar2tf
import (
"fmt"
"io"
"math/rand"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/NVIDIA/aistore/3rdparty/atomic"
"github.com/NVIDIA/ai... |
package common
import (
"errors"
"fmt"
"github.com/iancoleman/strcase"
"io"
"log"
"reflect"
"strconv"
"strings"
"sync"
"time"
"github.com/copybird/copybird/core"
)
func (a *App) DoBackup() error {
lFlags := a.cmdBackup.LocalFlags()
mInputArgs := lFlags.Lookup("input")
if mInputArgs == nil {
mInputArg... |
package logger
import (
"fmt"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
"os"
)
type zapLog struct {
cfg zap.Config
zap *zap.Logger
opts *Options
}
func loggerToZapLevel(level Level) zapcore.Level {
switch level {
case TraceLevel, DebugLevel:
return zap.DebugLevel
c... |
package discovery
import (
"fmt"
"sort"
"strings"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/yaml"
)
func DoSpringCloudDiscoveryService(input string) ([]runtime.Obj... |
package iww
import (
"bytes"
"encoding/json"
"io"
"log"
"os"
"os/exec"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func apikey() string {
return os.Getenv("TF_VAR_ibmcloud_api_key")
}
func resourceGroupName() string {
return os.Getenv("TF_VAR_resource_group_name")
}
func runCommand(d... |
package utils
import (
"context"
"errors"
"fmt"
"net/http"
"os"
"path"
"strconv"
"strings"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/command/agent/auth"
"github.com/hashicorp/vault/command/agent/auth/kubernetes"
)
const (
vaultAddressPrefix = "http"
... |
package git
import (
"context"
"errors"
"fmt"
"os"
"sync"
"time"
"code.gitea.io/sdk/gitea"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-billy/v5/util"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plum... |
package particle
import (
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"net/url"
log "github.com/Sirupsen/logrus"
"github.com/donovanhide/eventsource"
)
// Particle struct to access the Particle Cloud
type Particle struct {
token string
devicesURL string
access string
}
type response struct {
... |
// Copyright 2021 Google LLC. 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... |
//
// DISCLAIMER
//
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
//
// 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... |
// Code generated by protoc-gen-go.
// source: go-micro/examples/service/proto/greeter.proto
// DO NOT EDIT!
/*
Package greeter is a generated protocol buffer package.
It is generated from these files:
go-micro/examples/service/proto/greeter.proto
It has these top-level messages:
HelloRequest
HelloResponse
*/
pac... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: peer.proto
package peers
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a comp... |
package client
//go:generate mockery -name Client
import (
"encoding/json"
"fmt"
"net"
"time"
"github.com/quilt/quilt/api"
"github.com/quilt/quilt/api/pb"
"github.com/quilt/quilt/db"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
const (
// The timeout for making requests to the daemon once we've ... |
package cmd
import (
"fmt"
"io"
"os"
"sync"
"time"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/go-pg/pg/v10"
c "github.com/secretanalytics/go-scrt-events/config"
"github.com/secretanalytics/go-scrt-events/pkg/node"
"github.com/secretanalytics/go-scrt-events/... |
package v1
import (
"fmt"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Instal... |
package rest
import (
"bytes"
"github.com/go-chassis/go-chassis/core/client"
"io"
"io/ioutil"
"net/http"
"sync"
)
//Client is a struct
type Client struct {
c *http.Client
opts client.Options
mu sync.Mutex // protects following
}
//Do is a method
func (c *Client) Do(req *Request, resp *Response) (err er... |
package main
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"time"
"github.com/convox/rack/cmd/convox/stdcli"
"github.com/convox/rack/cmd/convox/templates"
"github.com/convox/rack/manifest"
"gopkg.in/urfave/cli.v1"
"gopkg.in/yaml.v2"
)
func init() {
stdcli.RegisterCommand(cli.... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.15.5
// source: proto/common.proto
package common
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sy... |
package calcium
import (
"context"
"fmt"
"sort"
"github.com/sanity-io/litter"
log "github.com/sirupsen/logrus"
"github.com/projecteru2/core/cluster"
"github.com/projecteru2/core/scheduler"
"github.com/projecteru2/core/store"
"github.com/projecteru2/core/types"
"github.com/projecteru2/core/utils"
)
// Pod... |
package view
import (
"fmt"
"sort"
"strings"
"github.com/josephburnett/time-flies/pkg/budget"
"github.com/josephburnett/time-flies/pkg/types"
)
const (
colorReset = "\033[0m"
colorRed = "\033[31m"
colorGreen = "\033[32m"
colorYellow = "\033[33m"
colorBlue = "\033[34m"
colorPurple = "\033[35m"
colo... |
package bow
import (
"fmt"
"sort"
)
// InnerJoin joins columns of two Bows on common columns and rows.
// The Metadata of the two Bows are also joined by appending keys and values.
func (b *bow) InnerJoin(other Bow) Bow {
left := b
right, ok := other.(*bow)
if !ok {
panic("bow.InnerJoin: non bow object passed ... |
package clickhouse
import (
"context"
"database/sql"
"database/sql/driver"
"errors"
"fmt"
"regexp"
"time"
)
const (
ClientHelloPacket = 0
ClientQueryPacket = 1
ClientDataPacket = 2
ClientCancelPacket = 3
ClientPingPacket = 4
)
const (
StateComplete = 2
)
const (
ServerHelloPacket = 0
Serv... |
package builder
import (
"fmt"
"github.com/broadinstitute/thelma/internal/thelma/app"
"github.com/broadinstitute/thelma/internal/thelma/app/config"
"github.com/broadinstitute/thelma/internal/thelma/app/credentials"
"github.com/broadinstitute/thelma/internal/thelma/app/logging"
"github.com/broadinstitute/thelma/i... |
package secrets
import (
"context"
"fmt"
v1 "github.com/nais/liberator/pkg/apis/nais.io/v1"
"github.com/nais/liberator/pkg/kubernetes"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runt... |
package rmap
import (
"github.com/celskeggs/hailburst/sim/fakewire/fwmodel"
"github.com/celskeggs/hailburst/sim/fakewire/rmap/packet"
"github.com/celskeggs/hailburst/sim/model"
"log"
)
const NoError uint8 = 0
type HeaderError int
const (
HeaderErrNotACommand HeaderError = 128
)
type LocalDevice interface {
/... |
package main
import (
"fmt"
"net/http"
"os"
"regexp"
"time"
log "github.com/Sirupsen/logrus"
_ "github.com/lib/pq"
"github.com/patrickmn/go-cache"
"github.com/urfave/cli"
)
var (
version string
builddate string
logger *log.Logger
)
var hexReg, _ = regexp.Compile("[^a-fA-F0-9]+")
func main2(genocr... |
package discovery
import (
"errors"
"fmt"
"log"
"net/http"
"net/url"
"path"
"sort"
"strconv"
"strings"
"time"
"github.com/coreos/etcd/client"
)
var (
ErrInvalidURL = errors.New("discovery: invalid URL")
ErrBadSizeKey = errors.New("discovery: size key is bad")
ErrSizeNotFound = errors.New("dis... |
package main
import (
"fmt"
"time"
"github.com/aerospike/aerospike-client-go/v5/types"
"github.com/prometheus/client_golang/prometheus"
aero "github.com/aerospike/aerospike-client-go/v5"
log "github.com/sirupsen/logrus"
)
var (
shouldFetchUserStatistics bool = true
)
type UserWatcher struct{}
func (uw *Use... |
// Package billmodel contains the types for schema 'equinox'.
package billmodel
// GENERATED BY XO. DO NOT EDIT.
import (
"database/sql"
"github.com/lib/pq"
)
// Acbufile represents a row from 'equinox.acbufile'.
type Acbufile struct {
Gacbutranstype sql.NullString `json:"gacbutranstype"` // gacbutranstype
... |
/*
* Copyright (C) 2019 Yunify, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this work except in compliance with the License.
* You may obtain a copy of the License in the LICENSE file, or at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... |
package repo
import (
"context"
"database/sql"
"errors"
"fmt"
"net/url"
"github.com/Masterminds/squirrel"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/postgres"
bindata "github.com/golang-migrate/migrate/v4/source/go_bindata"
"github.com/jackc/pgtype"
"github.com/ja... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: command.proto
package command
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a... |
package design
import . "github.com/goadesign/goa/design"
import . "github.com/goadesign/goa/design/apidsl"
var _ = API("pos", func() {
Title("Point Of Sale (POS)")
Version("v1")
License(func() {
Name("GPL-3.0")
URL("https://github.com/psavelis/goa-pos-poc/blob/master/LICENSE")
})
Description("go microservi... |
package server
import (
"context"
"log"
"os"
"sync"
"time"
"github.com/boltdb/bolt"
"github.com/mkorenkov/covid-19/pkg/documents"
"github.com/mkorenkov/covid-19/pkg/requestcontext"
"github.com/pkg/errors"
)
const importChanSize = 50
const batchSize = 1000
type sentinelError string
func (e sentinelError) E... |
package main
import (
"bufio"
"fmt"
"github.com/pkg/errors"
"io"
"math"
"os"
"regexp"
"sort"
"strconv"
"time"
)
const (
shiftStart = iota
fallAsleep
wakeUp
)
var (
logRegex = regexp.MustCompile(`\[(?P<Date>\d{4}-\d{2}\-\d{2} \d{2}:\d{2})\] (?P<Message>.*)`)
shiftStartRegex = regexp.MustCompile(... |
package main
/*
Adapted from this tutorial: http://www.learnopengl.com/#!Getting-started/Hello-Triangle
*/
import (
"log"
"runtime"
"unsafe"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/go-gl/glfw/v3.1/glfw"
)
const windowWidth = 800
const windowHeight = 600
func init() {
// GLFW event handling must be run... |
package crawler
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
"sync"
"time"
)
type FilterFunc func(ctx context.Context, r io.Reader, yieldTitle func(pos int, title string) error, yieldLink func(pos int, link string) error) error
type YieldURLFunc func(depth, pos... |
package typeinfo
import (
"fmt"
"log"
"reflect"
"strings"
"github.com/heetch/avro/avrotypegen"
)
// Info is the representation of Go types used
// by the analyzer. It can represent a record, a field or a type
// inside one of those.
type Info struct {
// Type holds the Go type used for this Avro type (or nil f... |
// Copyright 2016 <NAME> (LA5NTA). All rights reserved.
// Use of this source code is governed by the MIT-license that can be
// found in the LICENSE file.
package lzhuf
import (
"bytes"
"encoding/binary"
"errors"
"io"
)
// ErrChecksum indicates a checksum or file size mismatch on decode.
var ErrChecksum = error... |
package kubernetesconfig
import (
"bytes"
"fmt"
"os"
"reflect"
"strconv"
"strings"
"text/template"
)
// KubeScheduler represents "kube-scheduler" configuration.
type KubeScheduler struct {
Path string `json:"path"`
DownloadURL string `json:"download-url"`
VersionCommand string `json:"version-co... |
//go:generate license-notice
package main
import (
"bytes"
"encoding/csv"
"fmt"
"io"
"os"
"github.com/Sirupsen/logrus"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/zerok/tpl/internal/world"
)
var version, commit, date string
func main() {
log := logrus.New()
var input string
var vaultPre... |
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"
"sync"
internalcmd "github.com/sjeandeaux/toolators/internal/cmd"
"golang.org/x/oauth2"
)
//Tokens in ~/.clonator
type Tokens struct {
Bitbucket string
Github stri... |
package rego
import (
"github.com/open-policy-agent/opa/ast"
"io/ioutil"
"encoding/gob"
"encoding/json"
"bytes"
)
// ParseBytes parses data. fname is used to write error messages.
func ParseBytes(fname string, data []byte) (*ast.Module, error) {
return ast.ParseModule(fname, string(data))
}
// ParseFile parses... |
package controllers
import (
"github.com/astaxie/beegae"
"github.com/beego/i18n"
"strings"
"github.com/evepaste/evepaste/pkg/models/user"
"time"
"golang.org/x/oauth2"
"encoding/json"
"google.golang.org/appengine"
)
type AppController struct {
beegae.Controller
i18n.Locale
User user.User
}
func (c *AppCont... |
package svc
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
mclient "github.com/micro/go-micro/v2/client"
v0proto "github.com/anaswaratrajan/ocis-jupyter/pkg/proto/v0"
olog "github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/middleware"
settings "github.com/owncloud/ocis/setting... |
/* {{{ Copyright (c) <NAME> <<EMAIL>>, 2015
*
* 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, ... |
package biome
import (
"fmt"
"path"
"strings"
"github.com/hashicorp/terraform/communicator"
"github.com/hashicorp/terraform/terraform"
)
const winInstallScript = `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
iwr https://api.bintray.com/content/biome/stable/windows/x86_64/bio-... |
// Scry Info. All rights reserved.
// license that can be found in the license file.
package dot
import (
"reflect"
)
//TypeID dot type guid
type TypeID string
//LiveID dot live guid
type LiveID string
//String convert typeid to string
func (c *TypeID) String() string {
return string(*c)
}
//String convert liv... |
/*
* MIT License
* Copyright (c) 2019-2020 niels.wang
* 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, ... |
package remaps
////////////////////////////////////////////////////////////
// add by koangel
// date: 2017/11/02
// 同步remap.conf
////////////////////////////////////////////////////////////
import (
"fmt"
guard "grapeGuard"
"net/url"
"sort"
"strings"
"time"
log "grapeLoggers/clientv1"
)
const (
pluginAdd... |
package xdatabase
import (
"database/sql"
"fmt"
"github.com/go-xe2/x/core/exception"
"github.com/go-xe2/x/xf/ef/xdbUtil"
. "github.com/go-xe2/x/xf/ef/xqi"
)
type cluster struct {
master []*sql.DB
masterSize int
slave []*sql.DB
slaveSize int
}
type TDbConn struct {
config DbConfigCluster
driver s... |
package amqprpc
import "github.com/streadway/amqp"
import "gopkg.in/vmihailenco/msgpack.v2"
import "github.com/satori/go.uuid"
import "sync"
import "time"
import "fmt"
// Client for doing msgpack-encoded JSON-RPC over AMQP.
type Client struct {
conn *amqp.Connection
txChannel *amqp.Channel
r... |
// Copyright 2016 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 devapp implements a simple App Engine app for generating
// and serving Go project release dashboards using the godash
// command/library.
package d... |
package shell
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"github.com/zetamatta/go-mbcs"
"github.com/zetamatta/nyagos/dos"
)
func readEnv(scan *bufio.Scanner, verbose io.Writer) (int, error) {
errorlevel := -1
for scan.Scan() {
line, e... |
/*
* Copyright 2012-2020 <NAME> 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 ... |
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package api
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it... |
package log4g
import (
"bytes"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"time"
"bufio"
)
const bufferSize = 256 * 1024
func lineCounter(filename string) int {
file, err := os.OpenFile(filename, os.O_RDONLY|os.O_CREATE, 0660)
if err != nil && !os.IsNotExist(err) {
return 0
}
defer fil... |
// Copyright 2015 CloudAwan 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 i... |
package blsgen
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"sync"
bls_core "github.com/nordicenergy/bls/ffi/go/bls"
)
// PassSrcType is the type of passphrase provider source.
// Four options available:
// PassSrcNil - Do not use passphrase decryption
// PassSrcFile - Read the passphrase from fi... |
// Package frames will provide abstractions for processing indivudal frames within tags
package frames
import (
"encoding/binary"
"fmt"
"math"
"strconv"
"strings"
"unicode/utf16"
"unicode/utf8"
)
// IFrame is a shared interface for use with defining types of Frame formats
// for processing within the ID3 tag.
... |
package utils
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"errors"
"fmt"
"strconv"
"strings"
)
// 16 byte IV
var valIV = "0123456789012345"
// EncryptString creates the base64 encoded encrypted string using the
// cipherKey.
// It accepts th... |
package kdb
import (
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/util"
"math/big"
"bytes"
"io"
"sync/atomic"
)
type kDb struct {
IKDB
db *leveldb.DB
hmap map[string]*kHash
khashSize int64
}
// 保存khash的数量
func (k *kDb) khashSizeSave(tx *leveldb.Transaction) error {
atomic... |
package tcp
import (
"log"
"net"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
)
// Peer stores a peer of a TCP connection
type Peer struct {
// MAC is the MAC address of this peer
MAC net.HardwareAddr
// IP is the IP address of this peer
IP net.IP
// Port is the TCP port of this peer
... |
/*
Copyright 2021 The KubeSphere 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 wri... |
// Copyright © 2019 rangertaha <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, publi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.