text stringlengths 3.08k 10.4k |
|---|
package main
import (
"context"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"time"
"github.com/honteng/gomon/notify"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
"github.com/c9s/gomon/logger"
"github.com/howeyc/fsnotify"
)
var (
versionStr = "1.0.0"
wasFailed ... |
package goblaze
import (
"io/ioutil"
"log"
"os"
"path"
"strings"
"sync"
"time"
"github.com/jack-ohara/goblaze/goblaze/accountauthorization"
"github.com/jack-ohara/goblaze/goblaze/filedownloader"
"github.com/jack-ohara/goblaze/goblaze/fileuploader"
"github.com/jack-ohara/goblaze/goblaze/uploadedfiles"
)
ty... |
package gofakeit
import (
"encoding/hex"
"math/rand"
"reflect"
"github.com/brianvoe/gofakeit/v6/data"
)
// const is32bit = (32 << uintptr(^uintptr(0)>>63)) == 32
const minUint = 0
const maxUint = ^uint(0)
const minInt = -maxInt - 1
const maxInt = int(^uint(0) >> 1)
// Bool will generate a random boolean value
f... |
/*
* MIT License
*
* Copyright (c) 2021 <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, m... |
package gxutil
import (
"bytes"
"io"
"os/exec"
"strings"
"github.com/spf13/cast"
"github.com/xo/dburl"
)
// MySQLConn is a Postgres connection
type MySQLConn struct {
BaseConn
URL string
}
// Init initiates the object
func (conn *MySQLConn) Init() error {
u, err := dburl.Parse(conn.URL)
if err != nil {
... |
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package rpc
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 types
import (
sdk "github.com/hbtc-chain/bhchain/types"
authexported "github.com/hbtc-chain/bhchain/x/custodianunit/exported"
stakingexported "github.com/hbtc-chain/bhchain/x/staking/exported"
supplyexported "github.com/hbtc-chain/bhchain/x/supply/exported"
)
// DistributionKeeper expected distribution k... |
package git
import (
"net"
"net/url"
"regexp"
"strings"
"github.com/buildbuddy-io/buildbuddy/server/util/log"
"github.com/buildbuddy-io/buildbuddy/server/util/status"
)
const (
// DefaultUser is the default user set in a repo URL when the username is not
// known.
DefaultUser = "buildbuddy"
)
var (
Scheme... |
/*
Copyright 2020 Elotl Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... |
package gosort_test
import (
"fmt"
"math/rand"
"sort"
"testing"
"github.com/sevagh/go-sort"
)
// copied from https://github.com/golang/go/blob/master/src/sort/sort_test.go
const (
_Sawtooth = iota
_Rand
_Stagger
_Plateau
_Shuffle
_NDist
)
const (
_Copy = iota
_Reverse
_ReverseFirstHalf
_ReverseSecon... |
package service
import (
"cloud.google.com/go/logging"
"context"
"fmt"
"github.com/golang/protobuf/proto"
"github.com/google/uuid"
loggingProto "google.golang.org/genproto/googleapis/appengine/logging/v1"
ltype "google.golang.org/genproto/googleapis/logging/type"
logpb "google.golang.org/genproto/googleapis/lo... |
/*
Copyright AppsCode Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... |
package verify
import (
"crypto/ecdsa"
"encoding/base64"
"encoding/json"
"fmt"
"strings"
"github.com/Truelayer/truelayer-signing/go/crypto"
"github.com/Truelayer/truelayer-signing/go/errors"
"github.com/Truelayer/truelayer-signing/go/jws"
"github.com/Truelayer/truelayer-signing/go/sign"
)
// Build to verify... |
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"os"
"regexp"
"strings"
"github.com/nlopes/slack"
)
type userInfo struct {
RealName string
ID string
Email string
Admin bool
}
type saltUsers struct {
Users []saltUserDetails `json:"users"`
}
type saltUserDetails struct {
... |
package iso20022
// Net position of a segregated holding, in a single security, within the overall position held in a securities account at a specified place of safekeeping.
type AggregateBalancePerSafekeepingPlace28 struct {
// Place where the securities are safe-kept, physically or notionally. This place can be, ... |
package main
import (
"context"
"flag"
"fmt"
"log"
"math/rand"
"os/exec"
"strings"
"sync/atomic"
"time"
"code.cloudfoundry.org/loggregator/plumbing"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"github.com/cloudfoundry/sonde-go/events"
"github.com/gogo/protobuf/proto"
)
func main() {... |
package semt
import (
"encoding/xml"
"github.com/fairxio/finance-messaging/iso20022"
)
type Document00200102 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:semt.002.001.02 Document"`
Message *CustodyStatementOfHoldingsV02 `xml:"CtdyStmtOfHldgsV02"`
}
func (d *Document002001... |
/*
MIT License
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distrib... |
package pixelart
import (
"fmt"
"image"
"image/color"
"bytes"
)
// todo/check: rename pixel_raw to pixel_uncast/generic/... or similar - why? why not?
func renderPixel( x, y int,
pixel color.NRGBA,
colors map[string]*ColorInfo ) string {
// convert color to rgba() hexstring
hex :... |
package hipchat
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"testing"
)
type HipChatClientTestSuite struct {
suite.Suite
// client is the GitHub client being tested.
client... |
package lobby
import (
"errors"
"runtime/debug"
"github.com/spf13/viper"
"github.com/JohnnyS318/RoyalAfgInGo/pkg/log"
"github.com/JohnnyS318/RoyalAfgInGo/services/poker/events"
"github.com/JohnnyS318/RoyalAfgInGo/services/poker/models"
"github.com/JohnnyS318/RoyalAfgInGo/services/poker/serviceconfig"
"github... |
package functions
import (
"fmt"
"github.com/EMCECS/influx/query"
"github.com/EMCECS/influx/query/execute"
"github.com/EMCECS/influx/query/plan"
"github.com/EMCECS/influx/query/semantic"
)
const DedupKind = "dedup"
const DedupSortCol = "_time"
type DedupOpSpec struct {
}
var dedupSignature = query.DefaultFunc... |
// Copyright (c) 2021 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package legacy
import (
"context"
"fmt"
"net/http"
"runtime/debug"
"strings"
"time"
pd "github.com/decred/politeia/politeiad/api/v1"
cms "github.com/decred/politeia/p... |
package supplier
import (
"fmt"
"os/exec"
"strings"
"time"
"github.com/getsumio/getsum/internal/status"
)
type CommandType int
const (
UNIX CommandType = iota
MAC
WINDOWS
OPENSSL
)
var unixAlgos []Algorithm = []Algorithm{MD5, SHA1, SHA224, SHA256, SHA384, SHA512}
var winAlgos []Algorithm = []Algorithm{MD2... |
package common
import (
"fmt"
"image/color"
"log"
"strings"
"sync"
"github.com/EngoEngine/ecs"
"github.com/EngoEngine/engo"
"github.com/EngoEngine/engo/math"
"github.com/EngoEngine/gl"
)
var (
// UnicodeCap is the amount of unicode characters the fonts will be able to use, starting from index 0.
UnicodeCa... |
package mysqlconnector
import (
"database/sql"
"strings"
"github.com/go-courier/sqlx/v2"
"github.com/go-courier/sqlx/v2/builder"
)
func toInterfaces(list ...string) []interface{} {
s := make([]interface{}, len(list))
for i, v := range list {
s[i] = v
}
return s
}
func dbFromInformationSchema(db sqlx.DBExe... |
// Proof of Concepts of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// This is a Cloud Driver Example for PoC Test.
//
// program by... |
package migemo
import (
"errors"
)
// Level は、Loudsツリーの深さ毎のloudsやlabelを格納した構造体
type Level struct {
louds []bool
outs []bool
labels []uint16
}
// LoudsTrieBuilder は、LoudsTrieを生成するための構造体
type LoudsTrieBuilder struct {
levels []Level
lastKey []uint16
}
// NewLoudsTrieBuilder は、LoudsTrieBuilderを初期化する
func New... |
package main
import (
"context"
"flag"
"log"
"net"
"plugin"
"google.golang.org/grpc"
pb "github.com/regen-network/keystone2/keystone"
krplugin "github.com/regen-network/keystone2/plugin"
)
func discoverKeyring(plugins []*krplugin.Plugin) (*krplugin.Plugin, error) {
// return the first plugin as the keyring... |
package web_proxy
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/signal"
"strings"
"sync"
"syscall"
"github.com/elazarl/goproxy"
log "github.com/sirupsen/logrus"
)
type proxiedRequest struct {
Host string
Method string
URL url.URL
Body string
// PostForm url.Values
// Multip... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the MIT License.
// This product includes software developed at Guance Cloud (https://www.guance.com/).
// Copyright 2021-present Guance, Inc.
// Package jenkins collects Jenkins metrics.
package jenkins
import (
"encoding/json"... |
// Copyright (c) <NAME> and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
package sorted
import (
"reflect"
"github.com/kelindar/binary"
)
// ------------------------------------------------------------------------------
// Uint16s represe... |
package logwatcher
import (
"encoding/json"
"math"
"time"
"golang.org/x/net/context"
"golang.org/x/sync/errgroup"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)
// LogWatcher is an interface to stream a Cloudwatch Logs group to std... |
package features
import (
"fmt"
"math/rand"
"net/http"
"github.com/jinzhu/gorm"
"github.com/labstack/echo"
"github.com/tormaroe/foosman3/server/core"
"github.com/tormaroe/foosman3/server/database"
)
type dashboardFlash struct {
Raw string
}
func GetDashboardFlash(c echo.Context) error {
ac := c.(*core.Foos... |
package wsexec
import (
"errors"
"fmt"
"io"
"net"
"sync"
"time"
"github.com/gorilla/websocket"
"k8s.io/client-go/tools/remotecommand"
)
type Server struct {
conn *websocket.Conn
resizeChan chan remotecommand.TerminalSize
doneChan chan error
ticker *time.Ticker
pingInterval time.Durat... |
package wats
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/cloudfoundry-incubator/cf-test-helpers/cf"
"github.com/cloudfoundry-incubator/cf-test-helpers/helpers"
"github.com/onsi/gomega/gbytes"
. "github.com/cloudfoundry-incubator/cf-test-helpers/workflowhelp... |
// Copyright 2017 Typeform SL. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package http is a library designed to make working with the HTTP transport
// easier for jenny servers.
package http
import (
"context"
"crypto/rand"
"error... |
package lcd
import (
"fmt"
"math"
"os"
"os/exec"
"time"
"github.com/sirupsen/logrus"
"github.com/tarm/serial"
)
type LCD struct {
logger *logrus.Logger
device string
virtual bool
contrast int
buffer [4]string
serialConfig *serial.Config
conn *serial.Port
lastrender ... |
package cuelang
import (
"fmt"
"log"
"path"
"path/filepath"
"sort"
"strings"
"cuelang.org/go/cue/ast"
"cuelang.org/go/cue/parser"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/language"
"github.com/bazelbuild/bazel-gazelle/rule"
"github.com/iancoleman/strcase"
)
// Gen... |
package main
import (
"errors"
"fmt"
"github.com/chzyer/readline"
"github.com/codegangsta/cli"
"github.com/madcitygg/rcon"
"github.com/mitchellh/colorstring"
"io"
"os"
"strconv"
"strings"
)
const (
version = "0.0.2"
)
// Server addresses
const (
defaultPort = 27015
)
type Address struct {
Host string
... |
package clearbit
import "fmt"
const (
enrichmentURL = "https://person.clearbit.com/v2/combined/find"
personURL = "https://person.clearbit.com/v2/people/find"
)
type EnrichmentService struct {
client *Client
}
type Enrichment struct {
Person *Person `json:"person"`
Company *Company `json:"company"`
}
typ... |
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"os/signal"
"strings"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"github.com/weaveworks/tcptracer-bpf/pkg/tracer"
"github.com/kinvolk/inspektor-gadget/pkg/gadgets/networkpolicy/typ... |
package keyproof
import (
"github.com/privacybydesign/gabi/big"
"github.com/privacybydesign/gabi/internal/common"
)
type (
AlmostSafePrimeProductProof struct {
Nonce *big.Int
Commitments []*big.Int
Responses []*big.Int
}
almostSafePrimeProductCommit struct {
nonce *big.Int
commitments []... |
package gtm
import (
"bytes"
"encoding/base64"
"encoding/gob"
"fmt"
"strconv"
"time"
"github.com/jinzhu/gorm"
)
// DBStorage is a GTM Storage implementation using DB.
// It depends on a gorm.DB.
type DBStorage struct {
db *gorm.DB
}
// NewDBStorage returns a *DBStorage and needs to be injected into the gorm... |
package forge
import (
"bufio"
"io"
"strings"
"github.com/go-aah/forge/token"
)
var eof = rune(0)
func isLetter(ch rune) bool {
return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')
}
func isDigit(ch rune) bool {
return ('0' <= ch && ch <= '9')
}
func isNonNewlineWhitespace(ch rune) bool {
return (ch... |
package cmd
import (
"fmt"
"strconv"
"strings"
"github.com/jaredbancroft/aoc2020/pkg/helpers"
"github.com/jaredbancroft/aoc2020/pkg/translator"
"github.com/spf13/cobra"
)
// day16Cmd represents the day16 command
var day16Cmd = &cobra.Command{
Use: "day16",
Short: "Advent of Code 2020 - Day16: Ticket Transl... |
package rtc
import (
"github.com/pion/webrtc/v2"
"github.com/rriverak/gogo/internal/config"
"github.com/rriverak/gogo/internal/gst"
"github.com/rriverak/gogo/internal/utils"
)
//NewSession create a new Session
func newSession(name string, cfg *config.Config) *Session {
return &Session{ID: utils.RandSeq(5), Name:... |
package stash
import (
"bytes"
"context"
"fmt"
"net/http"
"net/url"
"time"
"github.com/Azure/azure-storage-blob-go/azblob"
"github.com/gomods/athens/pkg/config"
"github.com/gomods/athens/pkg/errors"
"github.com/gomods/athens/pkg/observ"
"github.com/gomods/athens/pkg/storage"
"github.com/google/uuid"
)
//... |
// Copyright 2019 spaGO Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ag
import (
"reflect"
"strings"
"sync"
"sync/atomic"
"github.com/nlpodyssey/spago/ag/fn"
"github.com/nlpodyssey/spago/mat"
)
var (
_ fn.Operand... |
package gremcos
import (
"encoding/json"
"fmt"
"github.com/supplyon/gremcos/interfaces"
)
func (c *client) handleResponse(msg []byte) error {
resp, err := marshalResponse(msg)
// ignore the error here in case the response status code tells that an authentication is needed
if resp.Status.Code == interfaces.Sta... |
// Package flagstruct supports automatic registration of struct fields as
// flags. Flags are associated with exported struct fields that have a tag
// declaring them as a flag with the specified name and help text:
//
// flag:"flagname,help description"
//
// A flag may optionally be given a default value, using th... |
/* license: https://mit-license.org
* ==============================================================================
* The MIT License (MIT)
*
* Copyright (c) 2021 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "S... |
package rbo
// Go implementation of https://github.com/dlukes/rbo/blob/master/rbo.py
import (
"fmt"
"math"
"github.com/thedahv/keyword-cluster-finder/pkg/rankings"
)
// RBO calculates the rank-biased overlap of 2 SERPs
// p is the probability of looking for overlap at rank k + 1 after having
// examined rank k
f... |
package mongoload
import (
"context"
"fmt"
"sync"
//"io"
//"strings"
"github.com/bmeg/grip/log"
"github.com/bmeg/grip/mongo"
"github.com/bmeg/grip/util"
"github.com/spf13/cobra"
"go.mongodb.org/mongo-driver/bson"
mgo "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
var m... |
package httpwrapper
import (
"bytes"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
"strings"
"time"
"github.com/hpgood/boomer"
jsoniter "github.com/json-iterator/go"
)
var client *http.Client
var verbose = true
func init() {
http.DefaultTransport.(*http.Transport).MaxIdleCon... |
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"sync"
"time"
"github.com/korylprince/go-graphql-ws"
"github.com/korylprince/snmp-tracker/snmp"
)
const gqlReadSystems = `
query read_systems {
system(where: {connection_id: {_is_null: false}, hostname: {hostname: {_neq: ""}}, port: ... |
package serialization
import (
"bufio"
"bytes"
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"reflect"
"sync"
"github.com/linkedin/goavro"
"github.com/sirupsen/logrus"
"github.com/dangkaka/go-kafka-avro"
"github.com/rhinof/grabbit/gbus"
)
var _ gbus.MessageEncoding = &AvroSerializer{}
type avroDeserializer ... |
package swan
import (
"bytes"
"fmt"
"net/url"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/andybalholm/cascadia"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
)
// Article is a fully extracted and cleaned document.
type Article struct {
// Final URL after all redirects
URL string
// Newl... |
package task
import (
"time"
"github.com/hydroscan/hydroscan-api/internal/json"
"github.com/hydroscan/hydroscan-api/models"
"github.com/hydroscan/hydroscan-api/redis"
"github.com/shopspring/decimal"
log "github.com/sirupsen/logrus"
)
type RelayerTrades24hData struct {
Trades24h uint64
Trades24hChange... |
package wallet
import (
"errors"
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/wire"
"github.com/ethereum/go-ethereum/params"
"github.com/tyler-smith/go-bip39"
"math"
"strconv"
)
type SegWitType int
const (
SymbolEth = "ETH"
SymbolBtc = "BTC"
SymbolTrx = "TRX"
BtcChainMainNet = in... |
package throughputlb
import (
"errors"
"sync"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
)
var (
errUnavailable = grpc.Errorf(codes.Unavailable, "there is no address available")
errMaxRequestsExceeded = errors.New("max requests exceeded")
)
type addrSta... |
package index
import (
"bytes"
"context"
"encoding/binary"
"fmt"
"sync"
"github.com/goydb/goydb/pkg/model"
"github.com/goydb/goydb/pkg/port"
)
// RegularIndexFunc gets a document and returns multiple keys
// and values or nil, nil.
type RegularIndexFunc func(ctx context.Context, doc *model.Document) ([][]byte... |
package logger
import (
"fmt"
"go.uber.org/config"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
"log"
"strconv"
"strings"
"time"
)
var sugar *zap.SugaredLogger
var Logger *zap.Logger
// getLumberjackLogger 获取lumberjack.Logger
func getLumberjackLogger(root *config.YAML, leve... |
package gontentful
import (
"bytes"
"encoding/json"
"text/template"
)
const jsonbSyncTemplate = `BEGIN;
CREATE SCHEMA IF NOT EXISTS {{ .SchemaName }};
COMMIT;
--
{{ range $tblidx, $tbl := .Tables }}
BEGIN;
CREATE TABLE IF NOT EXISTS {{ $.SchemaName }}.{{ .TableName }} (
id text primary key not null,
fields jsonb... |
package impl
import (
"context"
"fmt"
"strings"
"github.com/infraboard/cmdb/apps/resource"
"github.com/infraboard/mcube/exception"
"github.com/infraboard/mcube/sqlbuilder"
)
func (s *service) Search(ctx context.Context, req *resource.SearchRequest) (
*resource.ResourceSet, error) {
// 为了提升效率, 当有Tag查询时, 采用右关联... |
package client
import (
"fmt"
"github.com/acme-dns/acme-dns-client/pkg/dnsclient"
"github.com/acme-dns/acme-dns-client/pkg/integration"
)
var (
CAA_SETTINGS = `Please copy the CAA record information for the ACME account you are using and add it to your
domain's DNS zone. CAA record with "issue" tag is used for ex... |
package netsuite
import (
"encoding/xml"
"net/http"
"net/url"
"github.com/cydev/zero"
"github.com/omniboost/go-netsuite-soap/omitempty"
"github.com/omniboost/go-netsuite-soap/utils"
"github.com/pkg/errors"
)
func (c *Client) NewAccountSearchRequest() AccountSearchRequest {
r := AccountSearchRequest{
client... |
package v1
import (
"strings"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// ScheduleSpec defines the schedules for the various job types.
type ScheduleSpec struct {
Restore *RestoreSchedule `json:"restore,omitempty"`
Backup *BackupSchedule `j... |
package uuid64
import (
"crypto/rand"
"strings"
"sync"
"time"
"github.com/pkg/errors"
)
// Generator generate UUID by specified sections.
type Generator struct {
Sections []Section
}
// New UUID
func (gen *Generator) New() (string, error) {
var sections []string
for _, section := range gen.Sections {
sect... |
package mocktwilio
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/pkg/errors"
"github.com/target/goalert/notification/twilio"
"github.com/target/goalert/validation/validate"
)
// Config is used to configure the mock server.
type Config st... |
// MIT License
//
// Copyright (c) 2021 Lack
//
// 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 views
import (
"errors"
"fmt"
"strings"
"github.com/go-humble/detect"
"github.com/gopherjs/gopherjs/js"
"github.com/influx6/haiku/jsutils"
"github.com/influx6/haiku/pub"
)
// PathSpec represent the current path and hash values
type PathSpec struct {
Hash string
Path string
Sequence string
}... |
/*
Copyright 2018, Cossack Labs Limited
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, softwa... |
package config
import (
"context"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
)
// Config combines all available configuration parts.
type Config struct {
Commons *shared.Commons `yaml:"-"` // don't use this directly as configuration for a service
Service Service `yaml:"-"`
Tracing *Tracing `yaml:"tracing"`... |
// Code generated by go-swagger; DO NOT EDIT.
package users
// 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/runtime"
... |
package main
import (
"context"
"crypto/tls"
"encoding/json"
"flag"
"fmt"
"net/http"
"time"
"github.com/airbusgeo/geocube-ingester/common"
"github.com/airbusgeo/geocube-ingester/processor"
"github.com/airbusgeo/geocube-ingester/service"
"github.com/airbusgeo/geocube-ingester/service/log"
"github.com/airbu... |
// Copyright © 2021 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... |
package civ
import (
"fmt"
runewidth "github.com/mattn/go-runewidth"
termbox "github.com/nsf/termbox-go"
)
type Terminal struct {
prompt string
}
func NewTerminal() *Terminal {
t := &Terminal{
prompt: ":",
}
return t
}
func (t *Terminal) Draw(ql *QueryLine, tb *Table) error {
termbox.Clear(termbox.ColorD... |
/*
Copyright (c) 2018, <NAME>. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
Package arraylist implements the array list.
Structure is not thread safe,and remember that array in golang is call by value.
It costs a lot while you try to pass as an... |
/*
Copyright 2020 Red Hat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distribute... |
package main
import (
"log"
"regexp"
"strconv"
"strings"
)
// Patterns for parsing log messages.
var (
logLine = regexp.MustCompile(` ?(postfix(?:-\w+)?)(?:/(\w+))?\[\d+\]: (.*)`)
lmtpPipeSMTPLine = regexp.MustCompile(`, relay=(\S+), .*, delays=([0-9\.]+)/([0-9\.]+... |
package weather
import (
"net/http"
"log"
"time"
"io/ioutil"
"math"
)
// A generic check for error handling
func check(e error) {
if e != nil {
log.Fatal(e)
}
}
// Meant to be used in goroutines to periodically poll for json responses
func WeatherLoop(url string, filename string, ... |
package gitstatus
import (
"context"
"fmt"
"net/url"
"regexp"
"strings"
"sync"
"github.com/google/go-github/github"
"github.com/gosimple/slug"
"github.com/kubebuild/agent/pkg/graphql"
"github.com/kubebuild/agent/pkg/types"
"github.com/sirupsen/logrus"
"github.com/xanzy/go-gitlab"
"golang.org/x/oauth2"
... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"os"
"time"
)
var (
// tpl stores the parsed frontend html template
tpl *template.Template
)
// guestbookEntry represents the message object returned from the backend API.
type guestbookEntry struct {
Author ... |
package main
import (
"context"
"encoding"
"encoding/csv"
"encoding/json"
"fmt"
"io"
"os"
"time"
"cloud.google.com/go/datastore"
)
// ExportKindCmd dump kind to a json file
type ExportKindCmd struct {
ProjectID string `short:"p" long:"project" description:"Project to be used." required:"true"`
Namespace s... |
// Copyright District Capital Inc 2019
// All rights reserved.
package paginate
import (
"bytes"
"fmt"
"sort"
"strings"
"github.com/jinzhu/gorm"
)
func build(db *gorm.DB, c *Config, q *Query) (*gorm.DB, error) {
s, err := selectCols(c, q)
if err != nil {
return nil, err
}
if s != "" {
db = db.Select(s)... |
// Copyright © 2021 <NAME>. All rights reserved.
// Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
// Package cmd [...]
package cmd
import (
"fmt"
"github.com/markdumay/restic-unattended/lib"
homedir "github.com/mitchellh/go-homedir"
"github.com/rs/zerolog"
"... |
package s3
import (
"bytes"
"io"
"net/url"
"path"
"strings"
"time"
)
// Option defines a callback for configuring the service and subsequent requests.
// It's important that this remain an exported name so that users can create slices
// of custom/conditional options.
type Option func(in *inputModel)
func meth... |
package controllers
import (
"bytes"
"encoding/json"
"log"
"reflect"
"time"
"xnok/slack-go-demo/views"
"github.com/slack-go/slack"
"github.com/slack-go/slack/slackevents"
"github.com/slack-go/slack/socketmode"
)
// We create a sctucture to let us use dependency injection
type AppHomeController struct {
Eve... |
// Copyright (c) 2016 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
// 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 writin... |
package main
import (
"bytes"
"encoding/gob"
"errors"
"fmt"
bolt "github.com/coreos/bbolt"
"os"
"strings"
"sync"
"time"
)
// Key value store(s) for data
// interface for golang awesomeness
type Storage interface {
Load(name string) (data []byte, err error)
Save(name string, data []byte) (err error)
List(... |
package game
import (
"log"
"github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
"github.com/torlenor/asciiventure/assets"
"github.com/torlenor/asciiventure/components"
"github.com/torlenor/asciiventure/console"
"github.com/torlenor/asciiventure/entity"
"github.com/torlenor/asciiventure/fov"
"g... |
package dhcpv6
import (
"net"
"testing"
"github.com/stretchr/testify/require"
)
func TestOpt4RDNonMapRuleParse(t *testing.T) {
data := []byte{0x81, 0xaa, 0x05, 0xd4}
opt, err := ParseOpt4RDNonMapRule(data)
require.NoError(t, err)
require.True(t, opt.HubAndSpoke)
require.NotNil(t, opt.TrafficClass)
require.E... |
package dog
import (
"context"
"crypto/sha256"
"embed"
"encoding/hex"
"encoding/json"
"fmt"
"html/template"
"net/http"
"os"
"path/filepath"
"time"
"unicode/utf8"
)
//go:embed embed/static embed/*
var embedfs embed.FS
type Dog struct {
homeTemplate *template.Template
minLevel Level
wsRouter *Ws... |
package cli
import (
"context"
"encoding/json"
"flag"
"fmt"
"github.com/aaronland/go-flickr-api/application"
"github.com/aaronland/go-flickr-api/auth"
"github.com/aaronland/go-flickr-api/client"
"github.com/aaronland/go-flickr-api/http/oauth1"
"github.com/aaronland/go-http-server"
"github.com/mitchellh/go-wo... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.17.1
// source: pair.proto
package btree
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
co... |
/*
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed un... |
// Copyright 2014 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.
// Gofixerr fixes errors in Go programs.
//
// Usage:
//
// gofixerr [-v] [-w] [file.go ... | package ...]
//
// Gofixerr attempts to build the package or pack... |
package onedb
import (
"bytes"
"encoding/base64"
"fmt"
"time"
"unicode/utf8"
)
func getJSON(rows RowsScanner) (string, error) {
columns, vals, err := getColumnNamesAndValues(rows, true)
if err != nil {
return "", err
}
var b bytes.Buffer
writeComma := false
b.WriteByte('[')
for rows.Next() {
err := s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.