text stringlengths 3.08k 10.4k |
|---|
package database
import (
"errors"
"fmt"
"log"
"strconv"
"github.com/dgraph-io/badger/v3"
"github.com/romshark/eventlog/client"
)
// DB is an ACID database based on the dgraph-io/badger key-value store.
type DB struct {
db *badger.DB
log *log.Logger
}
// Open opens a badger database.
// If dir == "" then a... |
package raft
//
// this is an outline of the API that raft must expose to
// the service (or tester). see comments below for
// each of these functions for more details.
//
// rf = Make(...)
// create a new Raft server.
// rf.Start(command interface{}) (index, term, isleader)
// start agreement on a new log entry
... |
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
/*
*Copyright (c) 2019-2021, Alibaba Group Holding 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 a... |
package request
import (
"fmt"
"strings"
"github.com/chanxuehong/wechat/mp/core"
)
const (
// 普通事件类型
EventTypeSubscribe core.EventType = "subscribe" // 关注事件, 包括点击关注和扫描二维码(公众号二维码和公众号带参数二维码)关注
EventTypeUnsubscribe core.EventType = "unsubscribe" // 取消关注事件
EventTypeScan ... |
package main
import (
"fmt"
"html/template"
"log"
"math/rand"
"net/http"
"os"
"strconv"
"strings"
)
//Compile templates on start
var templates = template.Must(template.ParseFiles(
"templates/notFound.html",
"templates/header.html",
"templates/footer.html",
"templates/index.html",
"templates/commonDice.ht... |
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
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.
// ServiceSpec defines the desired state of Ser... |
package kms
import (
"context"
"fmt"
"os"
ibm "github.com/IBM/keyprotect-go-client"
"github.com/libopenstorage/secrets"
"github.com/sirupsen/logrus"
)
const (
// IbmKpSecretStorageName is KMS backend name
IbmKpSecretStorageName = "ibmkeyprotect"
// IbmServiceAPIKey is the service ID API Key
IbmServiceAPIKe... |
package squirrel
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 (
filbertBirthday = nook.Birthday{
Day: 3,
M... |
package grapher
import (
"fmt"
"os"
"path/filepath"
"runtime"
"sourcegraph.com/sourcegraph/makex"
"sourcegraph.com/sourcegraph/srclib"
"sourcegraph.com/sourcegraph/srclib/buildstore"
"sourcegraph.com/sourcegraph/srclib/config"
"sourcegraph.com/sourcegraph/srclib/graph"
"sourcegraph.com/sourcegraph/srclib/pl... |
package shared
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
"strings"
"github.com/go-chi/chi"
"github.com/tim-harding/fatal-encounters-server/query"
)
// QueryBuilderFunc creates a query for the HTTP request
type QueryBuilderFunc func(r *http.Request) query.Clauser
// RowTransla... |
package ofd
import (
"crypto/tls"
"encoding/json"
"net/http"
"net/url"
"errors"
"bytes"
"io/ioutil"
"github.com/aavzz/daemon/log"
"github.com/aavzz/dqb-paygate/paygated/billing"
"github.com/spf13/viper"
"strconv"
"fmt"
)
type ekam struct {
token, url string
}
//init initializes ekam
func (e *ekam) init(... |
package metadata
import (
"bytes"
"encoding/json"
"fmt"
pCommon "github.com/incognitochain/incognito-chain/portal/portalv3/common"
"strconv"
"github.com/incognitochain/incognito-chain/common"
"github.com/incognitochain/incognito-chain/dataaccessobject/statedb"
"github.com/incognitochain/incognito-chain/wallet... |
// Copyright 2018, OpenCensus Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
package kubernetes
import (
"encoding/json"
"fmt"
"time"
"github.com/gorilla/websocket"
"github.com/labstack/echo"
log "github.com/sirupsen/logrus"
"helm.sh/helm/v3/pkg/action"
"github.com/cloudfoundry-incubator/stratos/src/jetstream/plugins/kubernetes/helm"
"github.com/cloudfoundry-incubator/stratos/src/j... |
// Package extract provides provides functions for working with compressed files
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
*/
package extract
import (
"bytes"
"io"
"os"
"path/filepath"
"strings"
"sync"
"github.com/NVIDIA/aistore/3rdparty/glog"
"github.com/NVIDIA/aistore/cmn"
"github... |
//
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
package newrelic
import (
"bytes"
"container/heap"
"encoding/json"
"time"
"newrelic/limits"
"newrelic/log"
)
// AnalyticsEvent represents an analytics event reported by an agent.
type AnalyticsEvent stru... |
// Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package google
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"sync"
"time"
jwt "github.com/dgrijalva/jwt-go"
"golang.org/x/oauth2"
)
type osTSToke... |
package main
import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"os"
"os/signal"
"path"
"strings"
"text/tabwriter"
"github.com/allenai/beaker/config"
"github.com/beaker/client/api"
"github.com/beaker/client/client"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
// Th... |
package imap_action
import (
"fmt"
"io"
"io/ioutil"
"github.com/emersion/go-imap"
move "github.com/emersion/go-imap-move"
imapclient "github.com/emersion/go-imap/client"
"github.com/emersion/go-message/mail"
"github.com/pkg/errors"
"github.com/prometheus/common/log"
"github.com/unchainio/interfaces/logger"
... |
/*
Copyright IBM Corp. 2016 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 wri... |
package calcium
import (
"bytes"
"context"
"errors"
"fmt"
"io/ioutil"
"sync"
"github.com/projecteru2/core/store"
"github.com/projecteru2/core/types"
"github.com/projecteru2/core/utils"
log "github.com/sirupsen/logrus"
)
// ReplaceContainer replace containers with same resource
func (c *Calcium) ReplaceCont... |
//
package adapt
import (
"strings"
"github.com/icehubin/futu-go/pb/qotgetkl"
"google.golang.org/protobuf/proto"
)
type QotGetKL struct {
request *qotgetkl.Request
adaptBase
}
func CreateQotGetKL(dopts ...Option) AdaptInterface {
//Todo fix request format
adp := &QotGetKL{
request: &qotgetkl.Request{
C... |
package main
import (
"fmt"
"github.com/borisshvonder/tally/tallylib"
"flag"
"os"
"path/filepath"
"runtime"
)
var version string // set by linker
func main() {
flag.Usage = func() {
fmt.Println("This program is designed to overcome RetroShare default search limitations. It generates <folder>.rscollection fi... |
package graph
import (
"fmt"
"strings"
"time"
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/Azure/go-autorest/autorest/date"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
... |
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
* "License") as published by the Apache Software Foundation.
*
* You may not use this file except in compliance with the License. You may
* obtain a copy of the Lic... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-2019 Datadog, Inc.
package e2e
import (
goctx "context"
"testing"
v1 "k8s.io/api/apps/v1"
... |
package main
import (
"context"
"database/sql"
"net"
"net/url"
"os"
"time"
"github.com/Netflix/titus-executor/logger"
"github.com/Netflix/titus-executor/vpc/service/db"
"github.com/Netflix/titus-executor/vpc/service/db/wrapper"
"github.com/lib/pq"
_ "github.com/lib/pq"
"github.com/pkg/errors"
"github.com... |
package main
import (
"encoding/json"
"log"
"net/http"
"net/url"
"time"
"github.com/FiloSottile/Heartbleed/server/_third_party/github.com/docopt/docopt-go"
"github.com/FiloSottile/Heartbleed/heartbleed"
"github.com/FiloSottile/Heartbleed/server/cache"
)
var PAYLOAD = []byte("filippo.io/Heartbleed")
var wit... |
package cyflag
import (
"fmt"
"github.com/yah01/cyds"
"reflect"
"strconv"
"strings"
)
type Parser struct {
trie cyds.Trie
flags []cyflag
LeftArgs []string
}
func (parser *Parser) bind(v interface{}, name string, defaultValue interface{}, usage string) {
flag := &cyflag{
variable: v,
defaultValue: ... |
package main
import (
"fmt"
"net"
"os"
"strconv"
"strings"
)
type order struct {
client net.Addr
value string
}
type game struct {
started bool
clients []net.Addr
channel chan order
winner net.Addr
ended bool
}
type coordinate struct {
x int
y int
}
func registerServer(msgBuf []byte, conn *net.UD... |
package dataformat
import (
"encoding/hex"
"encoding/json"
"fmt"
"strconv"
"strings"
"github.com/lightningnetwork/lnd/channeldb"
)
type NumberString uint64
func (n *NumberString) UnmarshalJSON(b []byte) error {
if b[0] != '"' {
return json.Unmarshal(b, (*uint64)(n))
}
var s string
if err := json.Unmarsh... |
package main
import (
"context"
"crypto/tls"
"errors"
"flag"
"fmt"
"io/fs"
"net"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/brumhard/alligotor"
"github.com/brumhard/primate/app"
"github.com/brumhard/primate/pkg/api"
ownhttp "github.com/brumhard/primate/pkg/http"
dashboardv1 "github.com/... |
package resolver
import (
"log"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/repo"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
"go.skia.org/infra/bazel/gazelle/cpp/c... |
package crawler
import (
"crypto/tls"
"crypto/x509"
"log"
"net/http"
"github.com/PuerkitoBio/fetchbot"
"github.com/PuerkitoBio/goquery"
"github.com/calavera/crawler/db"
"github.com/calavera/crawler/queue"
)
const (
multiTagSelector = "a[href], img[src]"
imgSelector = "img[src]"
srcAttr = "src"
hre... |
package main
import (
"context"
"fmt"
"runtime"
"strings"
"time"
"github.com/Sirupsen/logrus"
docker_client "github.com/moby/moby/client"
"github.com/pikacloud/gopikacloud"
weave_plugin "github.com/pikacloud/run-agent/plugins/weave"
)
// CreateAgentOptions represents the agent Create() options
type CreateAg... |
package main
import (
"bytes"
"encoding/json"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-tools/go-steputils/stepconf"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
)
type Conf struct {
ApkDistribution string `env:"dist_group_list,required"`
ApkPathList string `env:"apk_path_list,requ... |
package player
import (
"errors"
"fmt"
"io"
"net/http"
"net/textproto"
"strconv"
"strings"
"time"
"github.com/aybabtme/iocontrol"
)
var ThrottleScale float64 = 1.5
var ThrottleSwitch = true
// errNoOverlap is returned by serveContent's parseRange if first-byte-pos of
// all of the byte-range-spec values is... |
package day20
import (
"fmt"
"math"
"strings"
"strconv"
"github.com/gsmcwhirter/advent2016/lib"
)
type ExclusionNode struct {
NodeBlocked bool
BreakPoint uint32
BlockedLeft bool
BlockedRight bool
Left *ExclusionNode
Right *ExclusionNode
}
func NewFirewall() *ExclusionNode {
return Ne... |
package views
import (
"fmt"
"io"
"os"
"sort"
"strconv"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/rds"
"github.com/olekukonko/tablewriter"
)
var normalizedUnits = map[string]int{
"micro": 1,
"small": 2,
"medium": 4,
"large": 8,
"xlarge": 16,
"2xl... |
package mp
import (
"fmt"
"encoding/json"
"net/http"
"net/url"
"sync/atomic"
"time"
)
const (
wechatTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"
wechatTicketUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=%s&type=jsapi"
wechatC... |
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"path"
"regexp"
"strings"
)
// ServerVersion : the version from the upstream repository
var ServerVersion = getDefaultVersion()
// GrafeasRepository : the repository of the Grafeas server to use ... |
// external ip :http://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go
// mac: http://godoc.org/github.com/j-keck/arping
// http://golangtc.com/t/52d26aa7320b5237d1000044
// vendor: http://zhidao.baidu.com/question/37072459.html
package main
import (
"fmt"
"log"
"net"
... |
package main
import (
"fmt"
"io"
"os"
"strings"
"github.com/Nerdmaster/terminal"
"github.com/uoregon-libraries/newspaper-curation-app/src/models"
)
const csi = "\033["
const ansiReset = csi + "0m"
const ansiIntenseYellow = csi + "33;1m"
const ansiIntenseRed = csi + "31;1m"
const ansiImportant = csi + "48;5;52;... |
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"os/user"
"strings"
"syscall"
"text/template"
"github.com/codegangsta/cli"
"github.com/gorilla/mux"
"github.com/nemith/gosx-notifier"
)
const (
launchdLabel = "com.github.com.nemith.notifyserver"
)
var plistTmpl = template.Must(template.... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package yandex
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to get information about a Y... |
package main
import (
"bufio"
"bytes"
"context"
"flag"
"fmt"
"io"
"log"
"os"
"os/signal"
"strings"
"sync"
"syscall"
"github.com/fatih/color"
"github.com/tidwall/gjson"
)
var (
fInputFiles string
fOutputFormat string
fFieldColors string
)
func init() {
flag.StringVar(&fInputFiles, "files", "", "... |
package ffprobe
import (
"context"
"encoding/json"
"fmt"
"math"
"os/exec"
"strconv"
"strings"
)
type FFProbeData struct {
Streams []FFProbeDataStream `json:"streams"`
Format FFProbeDataFormat `json:"format"`
}
func Run(ctx context.Context, path string) (FFProbeData, error) {
data, err := exec.CommandCon... |
package models
import (
"strings"
)
type RootDocument struct {
swagger string `json:"-"`
Info *Info `json:"info"`
Host string `json:"host,omitempty"`
BasePath string `json:"basePath,omitempty"`
... |
package app
import (
"bytes"
. "github.com/tendermint/go-common"
"github.com/tendermint/go-wire"
tmsp "github.com/tendermint/tmsp/types"
sm "github.com/zballs/comit/state"
. "github.com/zballs/comit/types"
. "github.com/zballs/comit/util"
"strings"
"time"
)
const version = "1.0.0"
type App struct {
cli ... |
// Copyright 2019 GM Cruise 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... |
/*
Copyright 2019 The xridge kubestone contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
package goinvest
import (
"encoding/json"
"errors"
"net/url"
)
const (
screenerAPIURL = "https://www.investing.com/stock-screener/Service/SearchStocks"
)
var (
countryCodes = map[string]string{
"USA": "5",
"Russia": "56",
}
exchangeCodes = []string{
"2", // NASDAQ
"1", // NYSE
"50", // NYSE Ame... |
package informer
import (
"context"
"github.com/golang/glog"
"github.com/stolostron/search-collector/pkg/config"
tr "github.com/stolostron/search-collector/pkg/transforms"
"gopkg.in/yaml.v2"
v1 "k8s.io/api/core/v1"
machineryV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1... |
package pglogrus
import (
"database/sql"
"encoding/json"
"fmt"
"os"
"sync"
"time"
"github.com/sirupsen/logrus"
)
// Set pglogrus.BufSize = <value> _before_ calling NewHook
// Once the buffer is full, logging will start blocking, waiting for slots to
// be available in the queue.
var BufSize uint = 8192
// Ho... |
/*
Copyright 2020 The cert-manager Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing... |
package tests
import (
"fmt"
"net/http"
"testing"
"github.com/snowlyg/go-tenancy/tests/base"
)
var cuserClientId = 3
func TestClientGeneralUserList(t *testing.T) {
t.SkipNow()
params := []base.Param{
// {args: map[string]interface{}{"page": 1, "pageSize": 10}, length: 2},
// {args: map[string]interface{}{... |
package widget
import (
"github.com/gdamore/tcell/v2"
"strconv"
"strings"
)
var themesString = []string{
"Dark",
"Dracula",
"Dots",
"Dualshot",
"Oblivion",
"Olive",
"Bento",
"Laser",
"Hammerhead",
"8008",
"Nautilus",
}
type themes map[string]palette
func NewThemes() themes {
return themes{
"Dark": ... |
package receiv
import (
"context"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"fhyx.online/tencent-api-go/wxbizmsgcrypt"
"fhyx.online/tencent-api-go/wxwork/webhook"
)
type Config struct {
AppID string
Token string
EncodingKey string
NotifyURI string
MsgHandler MessageHandler
}
type Message... |
package main
import (
"context"
"fmt"
"net/http"
"sync"
"time"
"github.com/prometheus/common/expfmt"
log "github.com/sirupsen/logrus"
"github.com/gogo/protobuf/proto"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/model"... |
package sessions
import (
"gopkg.in/kataras/go-errors.v0"
"strconv"
"sync"
"time"
)
type (
// Session is session's session interface, think it like a local store of each session's values
// implemented by the internal session iteral, normally the end-user will never use this interface.
// gettable by the prov... |
package sqlstruct
// basic type introspection for automatic query value unmarshalling
//
import (
"fmt"
"reflect"
"sort"
"strings"
)
// mostly a verbatim copy of encoding/json/encode.go
type byName []field
func (x byName) Len() int { return len(x) }
func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] ... |
package ngrok
import (
"bytes"
"errors"
"log"
"os"
"os/exec"
"os/signal"
"regexp"
"syscall"
"github.com/kataras/golog"
tunnelProv "github.com/narendranathreddythota/podtnl/tunnel/providers"
)
//Options Ngrok options
type Options struct {
SubDomain string // Sub domain config if you're using premium plan
... |
package server_test
import (
"bufio"
"context"
"fmt"
"net"
"strings"
"sync"
"testing"
"time"
"github.com/disq/msghub"
"github.com/disq/msghub/server"
)
type base struct {
t *testing.T
ctx context.Context
cancel context.CancelFunc
srv *server.Server
}
// Printf implements the msghub.Logger int... |
// Copyright 2022 Matrix Origin
//
// 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 ... |
package health_checker
import (
"context"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
"strconv"
"strings"
"sync"
"time"
hc_pb "dropbox/proto/kglb/healthchecker"
"godropbox/errors"
)
const (
userAgent = "KgLB healthchecker/1.0"
hostHeaderKey = "Host"
defaultHttpMethod =... |
//go:build mage
// +build mage
// Collection of helper scripts. Use mage -v <target> for verbose output.
package main
import (
"context"
"errors"
"fmt"
"log"
"os"
"io/ioutil"
"path/filepath"
"strings"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
"github.com/magefile/mage/target"
crypt "be... |
/*
Copyright 2021 The Vitess 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, soft... |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
package dtls
import (
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"errors"
)
ty... |
/*
* MIT License
*
* (C) Copyright [2019-2021] Hewlett Packard Enterprise Development LP
*
* 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 limita... |
package trie
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
"math/big"
)
// ReadVarint reads a variable length number in big endian byte order
func ReadVarint(reader *bytes.Reader) (ret uint64) {
if reader.Len() == 8 {
var num uint64
binary.Read(reader, binary.BigEndian, &num)
ret = uint64(num)
... |
package api
import (
"time"
)
// MemoryStats holds memory usage related stats
type MemoryStats struct {
RSS uint64
Cache uint64
Swap uint64
MaxUsage uint64
KernelUsage uint64
KernelMaxUsage uint64
Measured []string
}
// CpuStats holds cpu usage related stats
type ... |
// 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writin... |
/*
Copyright The KubeDB 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, software
... |
package main
import (
"os"
"log"
"time"
"io/ioutil"
"path/filepath"
"encoding/xml"
"database/sql"
_ "gopkg.in/cq.v1"
)
type Gav struct {
Group string `xml:"groupId"`
Artifact string `xml:"artifactId"`
Version string `xml:"version"`
Scope string `xml:"scope"`
Type string `xml:"type"`
}
type Pom ... |
package codec
import (
"bufio"
"encoding/hex"
"fmt"
"io"
"strconv"
"strings"
"time"
pbcodec "github.com/ChainSafe/firehose-arweave/pb/sf/arweave/type/v1"
"github.com/dvsekhvalnov/jose2go/base64url"
"github.com/golang/protobuf/proto"
"github.com/streamingfast/bstream"
"go.uber.org/zap"
)
// ConsoleReader ... |
package awesomenes
import (
"log"
)
type AddrSpace interface {
Read8(addr uint16) uint8
Write8(addr uint16, v uint8)
Read16(addr uint16) uint16
Write16(addr uint16, v uint16)
}
type CPUAddrSpace struct {
ctrlr *Controller
RAM Memory
ROM *Rom
PPU *PPU
Mapper Mapper
}
func MakeCPUAddrSpace(rom *Rom, ppu... |
// Nearly all of this came from or was modified from crunchy-proxy Thanks guys!
// https://github.com/CrunchyData/crunchy-proxy
/* From the docs ------------------------------------------------------------------------------
Reference: https://www.postgresql.org/docs/9.6/static/protocol-message-formats.html
... |
package log
import (
"os"
"path/filepath"
"sort"
"strconv"
"strings"
"sync"
"time"
)
// FileWriter is an io.WriteCloser that writes to the specified filename.
//
// Backups use the log file name given to FileWriter, in the form
// `name.timestamp.ext` where name is the filename without the extension,
// timest... |
// template template包基于官方的html/template,为了偷懒和便利性而做了此包,此包基本为echo框架而开发,方便在使用echo框架进行web开发时的操作
// TODO: 1. 启动时的公共配置参数
package template
import (
"fmt"
"html/template"
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/labstack/echo"
)
// tplT 定义template模型
type tplT struct {
lastTemplate *templ... |
package server
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"math/big"
"net"
"time"
"github.com/fatedier/fft/pkg/log"
"github.com/fatedier/fft/pkg/msg"
)
type Options struct {
BindAddr string
LogFile string
LogLevel string
LogMaxDays int64
}
func (op *Opti... |
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
"time"
"github.com/0xABAD/filewatch"
"github.com/0xABAD/gooey"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
)
var (
css = flag.String("css", "", "Watch a custom CSS file for changes to include")
... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package eks
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An object representing an Amazon EKS cluster.
func LookupCluster(ctx *pul... |
package plugins
import (
"fmt"
"log"
"os"
"os/signal"
"regexp"
"sync"
"sync/atomic"
"syscall"
"github.com/bbangert/toml"
notify "github.com/bitly/go-notify"
)
type PluginConfig map[string]toml.Primitive
var PluginTypeRegex = regexp.MustCompile("(Input|Output|Encoder|Decoder)$")
func getPluginType(pluginT... |
package main
import (
"bufio"
"errors"
"fmt"
"io"
"os"
"regexp"
"strconv"
"strings"
)
type (
chemical string
reactionChemical struct {
qty int
chm chemical
}
reaction struct {
input []reactionChemical
output reactionChemical
}
nanoFactory struct {
reactions map[chemical]*reaction
pr... |
package shell
import (
"encoding/json"
"fmt"
"os"
"os/exec"
"os/user"
"strings"
"syscall"
"github.com/creack/pty"
"github.com/aliyun/aliyun_assist_client/agent/log"
"github.com/aliyun/aliyun_assist_client/agent/session/channel"
"github.com/aliyun/aliyun_assist_client/agent/session/message"
"github.com/al... |
package github
import (
"encoding/json"
"fmt"
"github.com/anaskhan96/soup"
"github.com/lauripiispanen/most-active-github-users-counter/net"
"log"
"net/http"
"regexp"
"strconv"
"strings"
)
const root string = "https://api.github.com/"
type HTTPGithubClient struct {
wrappers []net.Wrapper
}
func (client HTT... |
package bgp
import (
"encoding/binary"
"encoding/json"
"fmt"
"github.com/golang/glog"
"github.com/sbezverk/gobmp/pkg/bgpls"
"github.com/sbezverk/gobmp/pkg/internal"
)
// PathAttribute defines a structure of an attribute
type PathAttribute struct {
AttributeTypeFlags uint8
AttributeType uint8
AttributeL... |
package client
import (
"github.com/tendermint/go-crypto"
"github.com/zbo14/pos/chain"
"github.com/zbo14/pos/crypto/tndr"
"github.com/zbo14/pos/p2p"
proto "github.com/zbo14/pos/protocol"
. "github.com/zbo14/pos/util"
"time"
)
const (
DELTA = 50 // suggested from Spacemint paper
TIMEOUT = 10 * time.Second
)... |
package main
// Import all of the used packages in this web application (all coming from the standard library - see https://pkg.go.dev/std)
import (
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"os/signal"
"strconv"
"syscall"
"time"
)
// Definition of all colors used in this project (ac... |
package scanner
import (
"fmt"
"strconv"
"strings"
"time"
"github.com/golang/glog"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"github.com/joyrex2001/nightshift/internal/metrics"
"github... |
package dialog
import (
"fmt"
"github.com/flygrounder/alice-trains-go/internal/departures"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
type Handler struct {
Fetcher departuresFetcher
SessionStorage SessionStorage
}
type departuresFetcher interface {
FetchNearestDepartures(from, to, tzname string... |
package rafted
import (
"errors"
hsm "github.com/hhkbp2/go-hsm"
cm "github.com/hhkbp2/rafted/comm"
ev "github.com/hhkbp2/rafted/event"
logging "github.com/hhkbp2/rafted/logging"
ps "github.com/hhkbp2/rafted/persist"
rt "github.com/hhkbp2/rafted/retry"
"github.com/hhkbp2/testify/assert"
... |
package broker
import (
"context"
"fmt"
"net/http"
"sync"
"github.com/pkg/errors"
osb "github.com/pmorie/go-open-service-broker-client/v2"
"github.com/sirupsen/logrus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
messagingv1alpha1 "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
"github.com/kyma-proj... |
package ucp
import (
"bytes"
"encoding/hex"
"fmt"
"log"
"strconv"
"time"
"github.com/go-gsm/charset"
)
// ExtraService field allows the specification of one or more additional services,
// all in the format TTLLDD,
// where TT field specifies the type of service,
// LL indicates the length of data and
// DD i... |
package fuzzy_classifier
import (
"strings"
)
type Classifier struct {
categories []*Category
multiVariantTags map[string]bool
TagDefs []*TagDef
TagDefsByName map[string]*TagDef
}
type TagDef struct {
Tag string
Index int
}
type Category struct {
tag string
tagDef *TagDef
s... |
// A program to stress the JSonnet VM and its cgo wrappings.
// Run `top` in another shell, to see how much we leak memory.
package main
import (
"flag"
"fmt"
"log"
"runtime"
"strings"
"time"
J "github.com/strickyak/jsonnet_cgo"
)
type Unit struct{}
var L = flag.Int("l", 1000, "Repeat the big loop this many ... |
package elm
import (
"fmt"
"path"
"path/filepath"
"sort"
"strings"
"github.com/chakrit/rpc/internal"
"github.com/chakrit/rpc/spec"
)
type Module struct {
Name string
RPCPath string
OutPath string
Namespace *spec.Namespace
Registry Registry
Types []*Type
Enums []*Enum
Tuples []*Tuple
RPC... |
package commands
import (
"errors"
"fmt"
"log"
"github.com/Shopify/sarama"
"github.com/gosuri/uitable"
"github.com/spf13/cobra"
)
type topicStruct struct {
Name string `json:"name"`
Partitions []partitionStruct `json:"partitions"`
}
type partitionStruct struct {
ID int32 `js... |
package advent
var _ Problem = &lanternFish{}
type lanternFish struct {
dailyProblem
}
func NewLanternFish() Problem {
return &lanternFish{
dailyProblem{
day: 6,
},
}
}
func (l *lanternFish) Solve() interface{} {
input := l.GetInputLines()
var results []int
results = append(results, l.fishCount80(input... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.