text stringlengths 3.08k 10.4k |
|---|
package binance
// Copyright (c) 2015-2019 Bitontop Technologies Inc.
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
type AccountBalances struct {
MakerCommission int `json:"makerCommission"`
TakerCommission int `json:"t... |
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you ... |
package impl
import (
"fmt"
"github.com/gdamore/tcell"
)
//GradientRaySampler sample a ray given it depth and some other properties
//TODO: remove outOfRangeStyle property
type GradientRaySampler struct {
//styles to be used to render a wall (i.e: the color used in a range of distance).
wallStyles []tcell.Style
... |
package checks
import (
"sync"
"time"
"github.com/DataDog/datadog-agent/pkg/process/config"
"github.com/DataDog/datadog-agent/pkg/process/net"
"github.com/DataDog/datadog-agent/pkg/process/procutil"
"github.com/DataDog/datadog-agent/pkg/process/util"
"github.com/DataDog/gopsutil/cpu"
model "github.com/n9e/age... |
/*
Copyright [2018] [jc3wish]
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
distrib... |
package bitbucketserver
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"github.com/myback/webhooks/v6/webhook"
)
const (
RepositoryReferenceChangedEvent webhook.Event = "repo:refs_changed"
RepositoryModifiedEvent webhook.Event = "repo:modified"
R... |
package view
import (
"fmt"
"io"
"os"
"strings"
"text/tabwriter"
"time"
"github.com/ankitpokhrel/jira-cli/api"
"github.com/ankitpokhrel/jira-cli/internal/cmdutil"
"github.com/ankitpokhrel/jira-cli/pkg/jira"
"github.com/ankitpokhrel/jira-cli/pkg/tui"
)
// SprintIssueFunc provides issues in the sprint.
type ... |
// RegionInfo <-> CB-Store Handler for Cloud Region Info. Manager.
// Cloud Region Info. Manager 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... |
package ende
import (
"crypto"
"crypto/ed25519"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"syscall"
"go.uber.org/zap"
"github.com/scryinfo/dot/dot"
"github.com/scryinfo/dot/lib/scrypto"
_ "github.com/scryinfo/dot/lib/scrypto/ende25519"
_ "github.com/scryinfo/dot/lib/scrypto/sx25519"
"github.com/s... |
package handler
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"github.com/cloudevents/sdk-go/pkg/cloudevents"
keptnevents "github.com/keptn/go-utils/pkg/lib"
)
type ApprovalTriggeredEventHandler struct {
keptn *keptnevents.Keptn
}
// NewApprovalTriggeredEventHandler returns a new a... |
// Plane permutations are those which avoid the pattern 213'54
// Avoiding 213'54 is equivalent to avoiding 2-14-3
// This generating tree based enumeration is based on the following paper:
// https://arxiv.org/pdf/1702.04529.pdf
package main
import (
"fmt"
"strings"
"sync"
"flag"
"time"
"os"
"runtime/trace"
... |
package gui
import (
"fmt"
"log"
"time"
"github.com/gotk3/gotk3/gtk"
"github.com/tkuhlman/gopwsafe/pwsafe"
)
func (app *GoPWSafeGTK) errorDialog(msg string) {
parent := app.GetWindowByID(app.mainWindowID)
messagedialog := gtk.MessageDialogNew(
parent,
gtk.DIALOG_MODAL,
gtk.MESSAGE_INFO,
gtk.BUTTONS_C... |
package main
import (
"embed"
"encoding/json"
"errors"
"fmt"
"io/fs"
"log"
"net/http"
"regexp"
"strings"
"github.com/fasthttp/router"
"github.com/valyala/fasthttp"
"github.com/valyala/fasthttp/fasthttpadaptor"
"github.com/xtrafrancyz/golish/backend"
)
//go:embed admin/*
var adminFiles embed.FS
type web... |
package csrf
import (
"net/url"
"github.com/boyfinal/opm"
"github.com/gorilla/securecookie"
"github.com/pkg/errors"
)
// CSRF token length in bytes.
const tokenLength = 32
// Context/session keys & prefixes
const (
tokenKey string = "csrf.Token"
formKey string = "csrf.Form"
skipCheckKey string = "<K... |
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// netstack doesn't build on 32-bit machines (https://github.com/google/gvisor/issues/5241)
// +build amd64 arm64 ppc64le riscv64 s390x
// Package ... |
package auth
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/oauth2"
"github.com/umputun/remark/app/store"
)
func TestLogin(t *testing.T) {
_, ts, ots :... |
package freshservice
import (
"fmt"
"net/http"
"time"
)
const (
releasesUrl = "releases"
releaseIdUrl = "releases/%d"
releaseRestoreUrl = "releases/%d/restore"
releaseNotesUrl = "releases/%d/notes"
releaseNoteIdUrl = "releases/%d/notes/%d"
releaseT... |
// Heartbeat is a generic timing heartbeat plugin.
//
// Copyright 2018 HenryLee. 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/lic... |
package main
import (
"os"
"fmt"
"bufio"
"strings"
"os/exec"
"regexp"
"io/ioutil"
"text/template"
"encoding/json"
"github.com/russross/blackfriday"
)
// We will parse *.md file here
type Mrkdwn map[string]string
var (
HeaderRE = regexp.MustCompile("(?s)^(------\n(.+)\n------\n)")
AttrsRE = regexp.MustCom... |
// Copyright 2019 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use 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 (
"strings"
"net"
"time"
"log"
"fmt"
"regexp"
"database/sql"
"github.com/miekg/dns"
"github.com/spf13/viper"
)
func serveDNSRequest(db *sql.DB, w dns.ResponseWriter, r *dns.Msg) {
m := new(dns.Msg)
m.SetReply(r)
m.Compress=false
viper.SetDefault("dns.records.A.default","127.0.0.1")
va... |
package main
import (
"bufio"
"fmt"
"log"
"os"
"sort"
"strconv"
"strings"
)
func newDisplay(i []string, o []string) *Display {
d := Display{
input: i,
output: o,
}
d.numbers = make(map[string]string)
return &d
}
type Display struct {
input []string
output []string
numbers map[string]string
}
f... |
/*
<NAME>
Go page for Eliza chatBot
Ref:
https://golang.org/doc/articles/wiki/
https://github.com/abigailCul/Go-Problem3/blob/master/Prob3.go
https://github.com/data-representation/go-ajax
https://gist.github.com/ianmcloughlin/c4c2b8dc586d06943f54b75d9e2250fe
*/
package main
//The imports i have used in my go
impor... |
// Copyright 2020 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
package github
import (
"context"
"fmt"
"strings"
"github.com/PuerkitoBio/goquery"
"github.com/chromedp/chromedp"
"github.com/muraenateam/necrobrowser/action"
"github.com/muraenateam/necrobrowser/action/cookie"
"github.com/muraenateam/necrobrowser/action/dom"
"github.com/muraenateam/necrobrowser/action/navi... |
package check
import (
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/bakito/dns-checker/version"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
log "github.com/sirupsen/logrus"
)
const (
// envMetricSummaryObjectives a ',' separated list of '... |
// Copyright 2019 GoAdmin. All rights reserved.
// Use of this source code is governed by a Apache-2.0 style
// license that can be found in the LICENSE file.
package template
import (
"bytes"
"errors"
"fmt"
c "github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/modules/language"
... |
//: Copyright Verizon Media
//: Licensed under the terms of the Apache 2.0 License. See LICENSE file in the project root for terms.
package telemetry
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.... |
package clix
import (
"bytes"
"errors"
"flag"
"io"
"os"
"sort"
"strings"
)
// @author valor.
// Command is a command for your application.
type Command struct {
// Name: the command's name
Name string
Summary string
Description string
commands map[string]*Command
parent *Command
// Usage4Flags... |
package client
import (
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/emqx/wormhole/common"
quic "github.com/lucas-clemente/quic-go"
"io/ioutil"
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
type QCClient struct {
Server string
Identifier string
Stream quic.Stream
cancel ... |
package upcloud
import (
"context"
"fmt"
"github.com/UpCloudLtd/upcloud-go-api/upcloud"
"github.com/UpCloudLtd/upcloud-go-api/upcloud/request"
"github.com/UpCloudLtd/upcloud-go-api/upcloud/service"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
"time"
)
// StepCreateServer... |
// Package amcp implements the Advanced Media Control Protocol as defined
// here: https://github.com/CasparCG/help/wiki/AMCP-Protocol.
package amcp
import (
"errors"
"net"
"net/textproto"
"strconv"
"strings"
"time"
"unicode"
)
// Return codes
const (
ReturnInfo = 100
ReturnInfoLine = 101
ReturnOkMulti... |
/*
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 writing, software
distribu... |
package character
import (
"fmt"
"image"
"github.com/hajimehoshi/ebiten/v2"
vpad "github.com/kemokemo/ebiten-virtualpad"
"github.com/kemokemo/kuronan-dash/assets/se"
"github.com/kemokemo/kuronan-dash/internal/anime"
"github.com/kemokemo/kuronan-dash/internal/field"
"github.com/kemokemo/kuronan-dash/internal/m... |
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
package armerror
import (
"context"
"encoding/json"
"regexp"
"strings"
"github.com/Azure/azure-sdk-for-go/services/resources... |
package indexing
import (
"context"
"strconv"
"time"
"github.com/cockroachdb/errors"
"github.com/hashicorp/go-multierror"
"github.com/inconshreveable/log15"
"github.com/sourcegraph/sourcegraph/enterprise/internal/codeintel/stores/dbstore"
"github.com/sourcegraph/sourcegraph/internal/actor"
"github.com/sourc... |
package main
import (
"bufio"
"fmt"
"log"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
// Cell represents a cell in the game of life
// aliveNext is used as a buffer to store the next cell's status
type Cell struct {
alive bool
aliveNext bool
aliveNeighbors int
}
func main() {
// number of m... |
package socket2em
import (
"bufio"
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net"
"net/textproto"
"strings"
"sync"
)
type Server struct {
Host string
Port int
ConnType string
NumClients int
LoggingHandler func(string)
OnDisconnect func(string)
MethodHandlers map[strin... |
package rpc
import (
"compress/gzip"
"github.com/golang-jwt/jwt/v4"
"github.com/rs/cors"
"io"
"io/ioutil"
"net"
"net/http"
"strings"
"sync"
"time"
)
// https://github.com/ethereum/go-ethereum/blob/4860e50e057b0fb0fa7ff9672fcdd737ac137d1c/node/rpcstack.go#L402
// NewHTTPHandlerStack returns wrapped http-rel... |
package cstoresqlite0
import (
"bytes"
"fmt"
"log"
"math"
"sort"
"strings"
"text/template"
"github.com/gimpldo/ba-prototype-go/geconf"
"github.com/gimpldo/ba-prototype-go/sqlschema"
)
func generateDefsForAllElements(
generated []sqlschema.ElementDef,
templates []sqlschema.ElementTemplate,
prefix string,
... |
package godis
import (
"sync"
"log"
"time"
"gopkg.in/redis.v3"
"strconv"
"math/rand"
)
// Task handler representation
type ClientTask struct {
done chan bool
HandlerFunc HandleClientFunc
}
type ServiceCache struct {
id string
expireAt int64
}
type Client struct {
id string
re... |
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the Li... |
package account
import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
"strconv"
"strings"
"time"
"github.com/gidyon/micro/v2/pkg/middleware/grpc/auth"
"github.com/gidyon/micro/v2/utils/errs"
"github.com/gidyon/services/pkg/api/account"
"github.com/google/uuid"
"google.golang.org/grpc/codes"
"gorm.io/go... |
package epgdata
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/benjaminbear/xmltv-proxy/config"
)
const (
folderPersistence = "persistence"
filePersistence = "epgdata.bin"
fileEPGIncludeChannels = "channels.json"
)
var (
pathPersistence = filepath.Jo... |
/*
Copyright 2015 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 to in writing, softwa... |
package main
import (
"alertmanager_notifier/config"
"alertmanager_notifier/log"
"alertmanager_notifier/metrics"
"alertmanager_notifier/middleware"
"alertmanager_notifier/modules/db"
"alertmanager_notifier/notifiers"
alertApi "alertmanager_notifier/notifiers/api"
"alertmanager_notifier/notifiers/kafka"
"alert... |
/*
* Copyright 2020 The Dragonfly 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 la... |
// Copyright 2018-2019 The logrange 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... |
package db
import (
"com.fha.gocan/business/data/schema"
"com.fha.gocan/foundation"
"com.fha.gocan/foundation/db"
"encoding/json"
"fmt"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"io/ioutil"
"os"
"os/user"
"strconv"
)
func Commands(ctx foundation.Context) []*cobra.Command {
return []*cobra.Command {... |
// Copyright 2020 SpotHero
//
// 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 [2016] [SnapRoute 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 t... |
package main
import (
"context"
"flag"
"fmt"
"math/rand"
"os"
"syscall"
qrterminal "github.com/mdp/qrterminal/v3"
"github.com/oklog/run"
"go.uber.org/zap"
"moul.io/srand"
"moul.io/u"
"moul.io/zapconfig"
"berty.tech/berty/v2/go/pkg/bertybot"
"berty.tech/berty/v2/go/pkg/bertyversion"
)
var (
username ... |
package goja
import (
"reflect"
"strconv"
)
type objectGoMapSimple struct {
baseObject
data map[string]interface{}
}
func (o *objectGoMapSimple) init() {
o.baseObject.init()
o.prototype = o.val.runtime.global.ObjectPrototype
o.class = classObject
o.extensible = true
}
func (o *objectGoMap... |
/*
* Copyright (C) 2020 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
package tasks
import (
"bytes"
"encoding/json"
"fmt"
"github.com/pkg/errors"
"intel/isecl/lib/clients/v3"
"intel/isecl/lib/common/v3/setup"
"intel/isecl/sgx_agent/v3/config"
"intel/isecl/sgx_agent/v3/constants"
"intel/isecl/... |
package cli
import (
"fmt"
stdos "os"
"strings"
"time"
"path/filepath"
"github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.blockdaemon.com/bpm/cli/pkg/command"
"go.blockdaemon.com/bpm/cli/pkg/config"
"go.blockdaemon.com/bpm/cli/pkg/pbr"
pkgversion "go.blockdaemon.com/b... |
package analyzer
import (
"bytes"
"fmt"
"go/ast"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
"github.com/quasilyte/go-ruleguard/ruleguard"
"golang.org/x/tools/go/analysis"
)
// Version contains extra version info.
// It's is initialized via ldflags -X when ruleguard is built with Make.
//... |
package netstorage
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"sync"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/fs"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
"github.com/Victor... |
package converters
import (
"bufio"
"io"
"io/ioutil"
"os/exec"
"regexp"
"strings"
log "github.com/sirupsen/logrus"
"github.com/erik/gruppo/model"
)
// <span id="_cswwk72is3z0" class="anchor"></span>Title => Title
func stripAnchorSpans(in string) string {
re := regexp.MustCompile("<span [^>]+?></span>(.*)")... |
package keeper
import (
"fmt"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/umee-network/umee/x/leverage/types"
)
type (
Keeper struct {
cdc codec.Codec
storeKey sdk.StoreKey
memKey sdk.StoreKey
bankKe... |
// 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 restmachinery
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/brigadecore/brigade/v2/apiserver/internal/meta"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/xeipuuv/gojsonschema"
)
type Endpoints interface {
Register(router *mux.Router)
}
type BaseEndpoints st... |
// Copyright 2016 CoreOS, 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... |
// Copyright 2016-2021, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
package debugstream
import (
"fmt"
"strconv"
"strings"
"github.com/oakmound/oak/v3/collision"
"github.com/oakmound/oak/v3/debugtools"
"github.com/oakmound/oak/v3/dlog"
"github.com/oakmound/oak/v3/event"
"github.com/oakmound/oak/v3/mouse"
"github.com/oakmound/oak/v3/oakerr"
"github.com/oakmound/oak/v3/render... |
package coroutine
import (
"time"
"github.com/benbjohnson/clock"
)
type Event interface {
Key() interface{}
}
type Group struct {
clock clock.Clock
active []*C
queue []Event
}
type C struct {
group *Group
children []*C
yield chan request
resume chan response
requesting request
}
type ... |
// Copyright (c) 2020-2021 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// 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/license... |
package v2
import (
"fmt"
"log"
"sort"
"gopkg.in/yaml.v2"
"github.com/cyberark/secretless-broker/pkg/secretless/plugin"
"github.com/cyberark/secretless-broker/pkg/secretless/plugin/sharedobj"
)
// Config represents a full configuration of Secretless, which is just a list of
// individual Service configuration... |
// Copyright 2014 The ql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSES/QL-LICENSE file.
// Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in complia... |
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"os"
"os/signal"
"sort"
"syscall"
"time"
"github.com/capella-pw/queue/compress"
"github.com/myfantasy/mft"
log "github.com/sirupsen/logrus"
"github.com/valyala/fasthttp"
_ "github.com/lib/pq"
)
var fDebug = flag.String("log_level", "info",
`Leve... |
package models
import (
bt "ApiManager/app/bootstrap"
"errors"
"strconv"
"strings"
)
type Api struct {
Id int `json:"id"`
Aid int `json:"aid"`
Num string `json:"num"`
Url string `json:"url"`
Name string `json:"name"`
Des string `json:"des"`
Parameter string `json:"... |
/*
* Copyright IBM Corporation 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 o... |
package gowaves
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"strconv"
)
type WavesNodeClient struct {
Host string
Port uint
ApiKey string
Debug bool
}
func initWNC() *WavesNodeClient {
wnc := &WavesNodeClient{}
wnc.Host = DefaultURL
wnc.Port = DefaultP... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: ligato/linux/l3/arp.proto
package linux_l3
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// Thi... |
package client
import (
"fmt"
"sort"
"strings"
"code.cloudfoundry.org/bytefmt"
aurora "github.com/logrusorgru/aurora/v3"
"golang.org/x/crypto/ssh/terminal"
"github.com/yasker/kstat/pkg/types"
)
const (
MetricsOutputSummaryKey = "SUMMARY"
)
func (c *Client) printMetrics(metrics map[string]*types.ClusterMetr... |
package main
import (
"fmt"
"image"
"os"
"path/filepath"
"strings"
"image/gif"
"image/jpeg"
"image/png"
"golang.org/x/image/draw"
flag "github.com/spf13/pflag"
)
/*
VERSION shows the version of blogthumbs.
*/
const VERSION = "1.0.0"
/*
Formatter is an interface for generating image links for the blog sy... |
package pb
import (
"fmt"
"github.com/golang/protobuf/ptypes/wrappers"
"reflect"
"strings"
)
// Strips a pointer, or pointer(-to-pointer)^* to base object if needed
func indirect(reflectValue reflect.Value) reflect.Value {
for reflectValue.Kind() == reflect.Ptr {
reflectValue = reflectValue.Elem()
}
return r... |
package local_test
import (
"testing"
"github.com/buildbarn/bb-storage/internal/mock"
"github.com/buildbarn/bb-storage/pkg/blobstore/local"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var (
exampleBlockDeviceBackedLoc... |
package fgee
import (
"html/template"
"log"
"path"
"strings"
"time"
"github.com/valyala/fasthttp"
)
var (
ReadTimeout time.Duration = time.Second * 30
WriteTimeout time.Duration = time.Second * 30
)
// HandlerFunc defines the request handler used by gee
type HandlerFunc func(*Context)
// Engine implement t... |
package log
import (
"fmt"
"io"
"runtime"
"sync"
"time"
)
// Level is a log level.
type Level int
// Available log levels.
const (
LevelDebug = iota
LevelInfo
LevelWarn
LevelError
)
// LevelStrings are the strings prefixed to each log message based on level.
type LevelStrings [5]string
// DefaultLevelStri... |
package planner
import (
"errors"
"fmt"
"github.com/weihesdlegend/Vacation-planner/POI"
"github.com/weihesdlegend/Vacation-planner/matching"
"github.com/weihesdlegend/Vacation-planner/solution"
"strings"
)
func processPlanningPostRequest(req *PlanningPostRequest) (planningRequest solution.PlanningRequest, err e... |
// Copyright 2014 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 client
import (
"encoding/base64"
"fmt"
"io"
"log"
"net"
"net/http"
"net/http/httputil"
"strings"
"time"
"github.com/gen2brain/dlgs"
"go.uber.org/zap"
)
// Proxy is a HTTPS forward proxy.
type Proxy struct {
Logger *zap.Logger
AuthUser string
AuthP... |
package file
import (
"os"
"time"
)
// Operations is the operations on a file. The interface
// exists to allow mocking of file system operations.
type Operations interface {
Remove(path string) error
RemoveAll(path string) error
Mkdir(path string, perm os.FileMode) error
MkdirAll(path string, perm os.FileMode... |
package goertzel
import (
"bufio"
"encoding/binary"
"io"
"math"
"sync"
"time"
)
// NewTarget creates a Goertzel processor tuned to the given frequency
func NewTarget(freq, sampleRate float64, minDuration time.Duration) *Target {
t := &Target{
Frequency: freq,
sampleRate: sampleRate,
blockSize: optimalB... |
// 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 ... |
package runtime
import (
"runtime/internal/atomic"
"unsafe"
)
func osinit() {
ncpu = 1
physPageSize = minPhysPageSize
atmaninit()
}
func init() {
parseCommandLine(_atman_start_info.CmdLine[:])
}
// parseCommandLine parses kernel arguments passed to the VM
// and appends them to argslice, which causes them to... |
package ngnet
import (
"bytes"
"compress/gzip"
"fmt"
"io/ioutil"
"regexp"
"strconv"
"strings"
"time"
"github.com/google/gopacket"
"github.com/google/gopacket/tcpassembly"
)
var (
httpRequestFirtLine *regexp.Regexp
httpResponseFirtLine *regexp.Regexp
)
func init() {
httpRequestFirtLine = regexp.MustCom... |
package predictiongame
import "math"
import "fmt"
func evaluateConfidence(correct int, questions int, statedConfidence float64) string {
var message string
if correct < 0 || correct > questions {
return "Assertion failed in evaluateConfidence: variable questions out of bounds!"
}
// Two-sided binomial test
p... |
package file
import (
"encoding/json"
"errors"
"fmt"
"os"
"sort"
"github.com/go-joe/joe"
"go.uber.org/zap"
)
// memory is an implementation of a joe.Memory which stores all values as a JSON
// encoded file. Note that there is no need for a joe.Memory to handle
// synchronization for concurrent access (e.g. vi... |
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/google/go-github/github"
"github.com/kr/pretty"
"github.com/prometheus/alertmanager/notify"
"github.com/stephen-soltesz/alertmanager-github-receiver/issues"
"io/ioutil"
"log"
"net/http"
)
var (
authtoken = flag.String("authtoken", "", "Oauth2... |
package api
import (
"bytes"
"fmt"
"time"
"github.com/labstack/echo"
"github.com/shopspring/decimal"
"gopkg.in/go-playground/validator.v9"
)
// ApiError represents error occurs in api requests, containing extra error infomation.
type ApiError struct {
Code int
Desc string
Params []s... |
package main
import (
"crypto/sha1"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"sync"
"time"
)
type HistoryItem struct {
Timestamp string
Digest string
Length string
}
func main() {
url := flag.String("url", "", "URL pattern to collect responses for")
dateFrom := flag.String(... |
package parser
import (
"fmt"
"strings"
"testing"
"github.com/puppetlabs/wash/cmd/internal/find/types"
"github.com/stretchr/testify/suite"
)
// The primaries are tested separately in their individual primary/*.go files, so they
// will not be tested here. Instead, the tests here serve as "integration tests" for... |
// Copyright 2021 <EMAIL>. All rights reserved.
// Use of this source code is governed by MIT license
// Package datastructure implements some data structure. eg. list, linklist, stack, queue, tree, graph.
package datastructure
import (
"reflect"
)
// List is a linear table, implemented with slice
type List[T any] ... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"strconv"
"strings"
)
type passwordPattern struct {
Letter string
PositionOne int
PositionTwo int
Pattern string
}
// isValidSledRental checks a parent structure for adherence to the "sled company up the road"'s password policy.
//
// The ... |
// Package awscredentials provides Sensor components that can retrieve, cache,
// refresh and offer AWS-based credentials and tokens.
package awscredentials
import (
"regexp"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"gi... |
// Copyright (c) 2020 Tailscale Inc & 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 packet
import (
"encoding/binary"
"fmt"
"inet.af/netaddr"
)
// IP4 is an IPv4 address.
type IP4 uint32
// IPFromNetaddr converts a ne... |
/*
Copyright 2022 The Koordinator Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
// Copyright 2020 <NAME> <<EMAIL>>. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package sqlquery
import (
"database/sql"
"errors"
"fmt"
"strconv"
"strings"
)
// Allowed join types.
const (
LEFT = iota + 1
RIGHT
INNER
)
// Error... |
package hercules
import (
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/hercules.v5/internal/core"
"gopkg.in/src-d/hercules.v5/internal/plumbing"
"gopkg.in/src-d/hercules.v5/internal/plumbing/identity"
"gopkg.in/src-d/hercules.v5/internal/plumbing/uast"
"gopkg.in/src-d/he... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.