text stringlengths 3.08k 10.4k |
|---|
package utils
import (
"fmt"
"math/rand"
"net/url"
"os"
"path"
"strings"
"time"
)
func Modulo(a, b int) int {
result := a % b
if result < 0 {
result += b
}
return result
}
func MaxInt(a, b int) int {
if a > b {
return a
}
return b
}
func MinInt(a, b int) int {
if a < b {
return a
}
return b
... |
package storage
import (
"context"
"crypto/rand"
"crypto/sha256"
"fmt"
"io"
"math/big"
"sync"
core "github.com/TRON-US/go-btfs/core"
coreiface "github.com/TRON-US/interface-go-btfs-core"
path "github.com/TRON-US/interface-go-btfs-core/path"
cid "github.com/ipfs/go-cid"
uuid "github.com/google/uuid"
)
ty... |
/**
* Copyright 2021 Gravitational, 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 a... |
// Copyright (c) <NAME> 2017. All rights reserved.
// Copyright (c) OpenFaaS Project 2018. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package main
import (
"crypto/tls"
"fmt"
"log"
"math"
"os"
"strings"
"time"
"github.com/Shopify... |
package plug
import (
"crypto/tls"
"net/http"
"reflect"
"strings"
"github.com/andygrunwald/go-jira"
"github.com/golovers/kiki/backend/conf"
"github.com/golovers/kiki/backend/types"
"github.com/golovers/kiki/backend/utils"
)
var jiraFields = map[string]string{
"key": "key",
"summary": ... |
package skeletonkit_test
import (
"embed"
"flag"
"io"
"path/filepath"
"strings"
"testing"
"text/template"
"github.com/gostaticanalysis/skeletonkit"
"github.com/tenntenn/golden"
)
//go:embed testdata/template
var testTmplFS embed.FS
var (
flagUpdate bool
)
func init() {
flag.BoolVar(&flagUpdate, "update"... |
// Copyright 2015 Google Inc. All rights reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
// Package simplelogin is an Ambient plugin that provides a basic website template with a login page.
package simplelogin
import (
"embed"
"fmt"
"github.com/ambientkit/ambient"
)
//go:embed template/partial/*.tmpl template/content/*.tmpl
var assets embed.FS
// Plugin represents an Ambient plugin.
type Plugin str... |
package main
import (
"log"
"strings"
"sync"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/muesli/telephant/accounts"
"github.com/therecipe/qt/core"
)
// Message holds the data for a message
type Message struct {
core.QObject
Name string
MessageID string
PostID string
PostURL ... |
/*
Copyright 2020 Docker Hub Tool 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 agre... |
// Copyright 2016 <EMAIL>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package atomic
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestInt32(t *testing.T) {
atom := NewInt32(42)
require.Equal(t, int32(42), atom.... |
// Copyright 2018 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
// Copyright 2014 <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 ssdp
import (
"bytes"
"errors"
"log"
"net"
"net/http"
"runtime"
"sync"
"time"
)
// A ControlPoint represents a SSDP control point.
type ControlPoint s... |
package internal
import (
_ "embed"
"fmt"
"strings"
"github.com/oleiade/reflections"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/tidwall/gjson"
)
var (
//go:embed en_US.json
messageJsonBytes []byte
messageJson gjson.Result
rootCommandName = "akamai"
jsonPathSeparator = ... |
package web
import (
"github.com/gin-gonic/gin"
"net/http"
)
func AddRoutes(router *gin.Engine) {
router.GET("/status", getStatus)
router.GET("/sockets", getSockets)
router.GET("/sockets/:id", getSocketById)
router.POST("/sockets/reset", resetSockets)
router.POST("/sockets/:id/reset", resetSocketById)
router.... |
package wsexecutor
import (
"context"
"fmt"
"net/http"
"sync"
"time"
"github.com/criyle/go-judge/cmd/executorserver/model"
"github.com/criyle/go-judge/worker"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
"go.uber.org/zap"
)
// Register registers web socket handle /ws
type Register interface {
... |
package pkg
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
"github.com/hashicorp/go-multierror"
"github.com/zemm-io/zemm/common"
"github.com/mholt/archiver/v3"
"github.com/otiai10/copy"
)
type InfoDep struct {
Package string `json:"package" yaml:"package"`
}
type Info struct ... |
package main
import (
"context"
"flag"
"fmt"
"os"
"regexp"
"github.com/mozillazg/kubectl-ingress-search/pkg/ingress"
"github.com/mozillazg/kubectl-ingress-search/pkg/process"
"github.com/mozillazg/kubectl-ingress-search/pkg/render"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/... |
package auth
import (
"crypto/sha1"
"encoding/base64"
"fmt"
"github.com/owenzhou/ginrbac/contracts"
"math/rand"
"strings"
"time"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
)
type SessionGuard struct {
name string
provider contracts.IUserProvider
session sessions.Session
context *... |
/*
Copyright © 2021 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... |
package txs
import (
"fmt"
"github.com/QOSGroup/qbase/context"
"github.com/QOSGroup/qbase/types"
"github.com/pkg/errors"
"github.com/tendermint/tendermint/crypto"
)
// 功能:抽象具体的Tx结构体
type ITx interface {
ValidateData(ctx context.Context) error //检测
//执行业务逻辑,
// crossTxQcp: 需要进行跨链处理的TxQcp。
// 业务端实现中crossTxQc... |
package api
import (
"encoding/json"
"time"
"github.com/cloudfly/alarmd/pkg/events"
"github.com/cloudfly/alarmd/tools"
account "github.com/cloudfly/alarmd/pkg/account"
"github.com/cloudfly/alarmd/pkg/datasource"
"github.com/cloudfly/alarmd/pkg/sender"
"github.com/cloudfly/alarmd/pkg/task"
"github.com/cloud... |
// Copyright 2020 Thomas.Hoehenleitner [at] seerose.net
// Use of this source code is governed by a license that can be found in the LICENSE file.
// Package cipher provides an encryption and decryption interface.
//
// It abstracts from the used cipher algorithm
package cipher
import (
"crypto/sha1"
"fmt"
"githu... |
/*
Copyright © 2022 blacktop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicen... |
package cmds
import (
"context"
"fmt"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/rest"
"github.com/mackwong/clickhouse-operator/pkg/apis"
"github.com/mackwong... |
package resources
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"path/filepath"
"strings"
raven "github.com/getsentry/raven-go"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
... |
package main
import (
"fmt"
"regexp"
"strconv"
"strings"
"io/ioutil"
)
var re = regexp.MustCompile("-?\\d+")
func toInt(s string) int{
v, _ := strconv.Atoi(s)
return v
}
func abs(x int) int{
if x < 0 { return -x}
return x
}
func min(a,b int) int{
if a < b { return a }
return b
}
func max(a,b int) int{
if... |
package gocop
import (
"testing"
)
func assertEqual(t *testing.T, exp, act string) {
if exp != act {
t.Errorf("Expected '%s', but got '%s'\n", exp, act)
}
}
func TestConsumeArgumentTokens(t *testing.T) {
tokens := Tokenize("Start \t\t 'Next unterminated")
t.Log("Tokens: ", tokens)
consumed, remaining := ... |
// Copyright 2012 The KidStuff 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 mongostore
import (
"errors"
"net/http"
"time"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
"github.com/gorilla/securecook... |
package ztrace
import (
"net"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/sirupsen/logrus"
"github.com/zartbot/ztrace/geoip"
"github.com/zartbot/ztrace/tsyncmap"
)
type SendMetric struct {
FlowKey string
ID uint32
TTL uint8
TimeStamp time.Time
}
type RecvMetric struct {
FlowKey s... |
/**
* Copyright 2018 Comcast Cable Communications Management, 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 la... |
package slogx
import (
"fmt"
"io"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
"time"
)
type Level uint
const (
NONE Level = iota
FATAL
ERROR
WARNING
INFO
DEBUG
)
var levelToString = map[Level]string{
NONE: "NONE",
FATAL: "FATAL",
ERROR: "ERROR",
WARNING: "WARNING",
INFO: "... |
package prometheus
import (
"net/http"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
// URLFormater used to format request url, it can be used to replace url params or remove raw query
type URL... |
// Copyright 2017 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 © 2017 Circonus, Inc. <<EMAIL>>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
package plugins
import (
"context"
"encoding/json"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/circonus-labs/circonus-agent/api"
"github.com/ci... |
package goquic
import (
"bytes"
"net"
"net/http"
"strings"
"sync"
"time"
"github.com/oleiade/lane"
)
type Conn struct {
sync.Mutex
addr *net.UDPAddr
sock *net.UDPConn
quicClient *QuicClient
readChan chan UdpData
writer *ClientWriter
buffer bytes.Buffer
header http.Head... |
package libdag
import (
"context"
"errors"
"fmt"
"github.com/deyami/libdag/utils/logs"
"sync"
)
type JobContext struct {
sync.RWMutex
Config *DagConfig
GlobalVals *sync.Map
HandlerRegistry HandlerManager
}
func NewJobContext(config *DagConfig, registry HandlerManager) *JobContext {
return &Jo... |
// Command Group: "Data Conversion"
package main
import (
"flag"
"fmt"
"github.com/vertgenlab/gonomics/cigar"
"github.com/vertgenlab/gonomics/dna"
"github.com/vertgenlab/gonomics/fasta"
"github.com/vertgenlab/gonomics/fileio"
"github.com/vertgenlab/gonomics/numbers"
"github.com/vertgenlab/gonomics/sam"
"gith... |
package datasource
import (
"context"
"encoding/json"
"fmt"
"reflect"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/xray"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana-plugin-sdk-go... |
package proxy
import (
"fmt"
"sort"
"strings"
"github.com/maxencoder/log"
"github.com/maxencoder/mixer/hack"
"github.com/maxencoder/mixer/node"
"github.com/maxencoder/mixer/sqlparser"
. "github.com/siddontang/go-mysql/mysql"
)
func (c *Conn) handleShow(sql string, stmt *sqlparser.Show) (*Result, error) {
va... |
package fs
import (
"bytes"
"context"
"crypto/sha256"
"github.com/golangee/repository/iter"
"io"
"math/rand"
"strconv"
"sync"
"testing"
)
type testBlob struct {
name string
data []byte
}
func Test_blobRepoRaces(t *testing.T) {
ctx := context.Background()
repo := must(NewBlobRepository(Dir(t.TempDir())))... |
package ai
import (
"github.com/xwjdsh/2048-ai/grid"
)
type AI struct {
// Grid is 4x4 grid.
Grid *grid.Grid
// Active is true represent need to select a direction to move, else represent computer need fill a number("2" or "4") into grid.
Active bool
}
var directions = []grid.Direction{
grid.UP,
grid.LEFT,
g... |
/*
* Copyright (c) 2018 WSO2 Inc. (http:www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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... |
/*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
package list
import (
"reflect"
"fmt"
"unsafe"
)
type List interface{
Add(element Element ) bool
AddAt(element Element , index int) bool
AddAll(element interface{} , index int) bool
Clear()
Contains(element Element) bool
ContainsAll(elements List) bool
Eq... |
package treenode_test
import (
"fmt"
"leetcode/treenode"
"reflect"
"testing"
)
func initTreeNode(vals ...int) *treenode.TreeNode {
if len(vals) == 0 {
return nil
}
var head = &treenode.TreeNode{Val: vals[0]}
for i := 1; i < len(vals); i++ {
// head.Insert(v)
treenode.InsertTree(head, vals[i])
}
return... |
/*
* 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 oklog
import (
"bytes"
"encoding/json"
"fmt"
"github.com/sirupsen/logrus"
"os"
"sync"
"time"
)
const stackTraceKey = "_stacktrace"
// BufSize -- Set oklog.BufSize = <value> _before_ calling NewOklogHook.
// Once the buffer is full, logging will start blocking, waiting for slots to be available in the ... |
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/... |
/*
* Copyright 2020 The Knative 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... |
/*
This package will request details from the BRP API and create
an ehb_link table with the results of the request.
*/
package main
import (
"crypto/tls"
"database/sql"
"encoding/json"
"fmt"
_ "github.com/lib/pq"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"io/ioutil"
"log"
"net/http"
"sync"
)
type ... |
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: chainmon/query.proto
package types
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-sdk/types/query"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
_ "google.golang.org/genproto/googleapis/api/annotations... |
// Copyright (c) 2019 Romano (Viacoin developer)
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package server
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
"github.com/romanornr/AtomicOTCswap/swaputil"
"github.com/gorilla/mux"
"github.com/roma... |
package finance
import "math"
// PMT calculates the payment for a loan based on constant payments
// and a constant interest rate.
//
// If rate = 0:
// -(FV + PV)
// PMT = ------------
// nper
//
// Else
// nper
// FV + PV * (1 + rate)
// PMT = ... |
package nsfw
import (
"os"
"path/filepath"
"strings"
"testing"
"github.com/photoprism/photoprism/pkg/fastwalk"
"github.com/stretchr/testify/assert"
)
var modelPath, _ = filepath.Abs("../../assets/nsfw")
var detector = New(modelPath)
func TestIsSafe(t *testing.T) {
detect := func(filename string) Labels {
... |
package model
import (
"errors"
"github.com/evergreen-ci/evergreen/model"
)
type APIProject struct {
BatchTime int `json:"batch_time"`
Branch APIString `json:"branch_name"`
DisplayName APIString `json:"display_name"`
Enabled bool `json:"enabled"`
Ident... |
package ldclient
import (
"encoding/json"
"gopkg.in/launchdarkly/go-server-sdk.v4/ldlog"
)
type serializableUser struct {
User
filter *userFilter
}
type userFilter struct {
allAttributesPrivate bool
globalPrivateAttributes []string
loggers ldlog.Loggers
logUserKeyInErrors bool
}
fun... |
package graphml
import (
"encoding/xml"
"io"
)
const (
// Ext is a file extension for GraphML files.
Ext = ".graphml"
// Namespace is a canonical XML namespace for GraphML.
Namespace = "http://graphml.graphdrawing.org/xmlns"
)
type element interface {
addAttr(a xml.Attr)
attrs() []xml.Attr
}
func newAttr(ns... |
package gcp
import (
"context"
"fmt"
"strconv"
"github.com/stolostron/submariner-addon/pkg/constants"
gcpclient "github.com/submariner-io/cloud-prepare/pkg/gcp/client"
"github.com/submariner-io/cloud-prepare/pkg/k8s"
"github.com/submariner-io/cloud-prepare/pkg/ocp"
"golang.org/x/oauth2/google"
"google.golang... |
// Code generated by ros-gen-go.
// source: GlobalPositionTarget.msg
// DO NOT EDIT!
package mavros_msgs
import (
"io"
"github.com/cnord/rosgo/msgs/geometry_msgs"
"github.com/cnord/rosgo/msgs/std_msgs"
"github.com/cnord/rosgo/ros"
)
const (
GlobalPositionTarget_FRAME_GLOBAL_INT uint8 = 5
GlobalPositio... |
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"log"
"os"
"os/exec"
"os/signal"
"sync"
"syscall"
"time"
)
type Command struct {
Delay int
Timeout int
Command string
}
type Config struct {
Workers int
Commands []*Command
disabled bool
}
const CONFIG_WRAPPER = `
workers=5
default_timeo... |
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"bytes"
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go... |
// Copyright © 2018 Pennock Tech, LLC.
// All rights reserved, except as granted under license.
// Licensed per file LICENSE.txt
package json // import "go.pennock.tech/tabular/json"
import (
"bytes"
"encoding/json"
"fmt"
"io"
"go.pennock.tech/tabular"
"go.pennock.tech/tabular/properties"
)
// A JSONTable wra... |
package mediainfo
// #cgo CFLAGS: -DUNICODE
// #cgo LDFLAGS: -lz -lzen -lpthread -lstdc++ -lmediainfo -ldl
// #include "go_mediainfo.h"
// #include <MediaInfoDLL/MediaInfoDLL.h>
import "C"
import (
"errors"
"fmt"
"io"
"io/ioutil"
"runtime"
"strconv"
"unsafe"
)
var (
ErrorOpenFile = errors.New("Failed open... |
// Copyright 2020 The Atlas Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by app... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a
// Modified BSD License license that can be found in
// the LICENSE file.
package main
import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"io"
"math/big"
"ne... |
// Package competitors represents the details of a competitor in Shoot 'n Score It that
// are required for creation of a competitor import file for Practiscore
package competitors
import (
"encoding/json"
"log"
"strconv"
"github.com/qawsgh/sns2ps/pkg/match"
"github.com/qawsgh/sns2ps/pkg/squads"
)
// UnmarshalJ... |
package net
import (
"bytes"
"encoding/binary"
"errors"
)
// ICMPv6 is an ICMPv6 packet
type ICMPv6 struct {
Type ICMPv6Type
Code ICMPv6Code
Checksum uint16
// See RFC792, RFC4884, RFC4950.
Unused uint32
next Layer
}
// ICMPv6HeaderLen is the ICMPv6 header length
var ICMPv6HeaderLen = 8
// ICMPv6... |
// Copyright (C) 2020 <NAME>, Inc.
// See LICENSE for copying information.
package access2
import (
"errors"
"fmt"
"github.com/btcsuite/btcutil/base58"
"storj.io/common/encryption"
"storj.io/common/macaroon"
"storj.io/common/paths"
"storj.io/common/pb"
"storj.io/common/storj"
)
// An Access Grant contains ... |
package collector
import (
"fmt"
"net/url"
"strings"
rancher "github.com/rancher/types/client/cluster/v3"
log "github.com/sirupsen/logrus"
)
const orchestrationName = "cattle-V2.0"
const rancherCatalogURL = "https://git.rancher.io/charts"
const projectLabel = "field.cattle.io/projectId"
type Project struct {
... |
package main
import (
"encoding/json"
"fmt"
"io"
"strings"
"time"
"github.com/gorilla/websocket"
)
// TaskStep describes a step of a task
type TaskStep struct {
Plugin string `json:"plugin"`
PluginConfig json.RawMessage `json:"plugin_options"`
Method string ... |
package oidc
import (
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/cenkalti/backoff"
"github.com/giantswarm/microerror"
"github.com/golang-jwt/jwt"
)
const (
jwksURL = "https://giantswarm.eu.auth0.com/.well-known/jwks.json"
)
// IDToken is our custom representation of the details of a JWT we care abo... |
// The boost server. A websocket handler basically. Designed to be a bare minimum as possible so that it
// can handle many connections simultaneously without needing to store large amounts of info
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"log"
"net/http"
"sync"
"github.com/gorilla/websock... |
package j2rpc
import (
"bytes"
"errors"
"fmt"
"io"
"mime"
"net/http"
"reflect"
"strings"
"unsafe"
"github.com/atcharles/gof/v2/json"
)
// parsePositionalArguments tries to parse the given args to an array of values with the
// given types. It returns the parsed values or an error when the args could not be... |
package main
/*
#cgo CFLAGS: -I./lib
#cgo LDFLAGS: -L./lib -ltekstitv -Wl,-rpath=./lib -lcurl
#include "tekstitv.h"
#include <stdlib.h>
// Helper for finding the row index pointer
// This is a bit messy in go so here is a simple function
// for making life easier
html_row* row_index_helper(html_row* row, int idx) {
r... |
// Copyright 2015, <NAME> <<EMAIL>>
// See the LICENSE file for more details.
package main
import (
gl "github.com/go-gl/gl/v3.3-core/gl"
glfw "github.com/go-gl/glfw/v3.1/glfw"
mgl "github.com/go-gl/mathgl/mgl32"
"github.com/tbogdala/cubez"
m "github.com/tbogdala/cubez/math"
)
const (
grassTexturePath = "asset... |
package goben
import (
"fmt"
"io/ioutil"
"sync"
"sync/atomic"
"time"
"github.com/valyala/fasthttp"
)
type goben struct {
requestsLeft int64
requestsNumber int
connectionsNumber int
url string
timeout time.Duration
requestsSucceeded uint64
client *fasthttp.Client
jobs ... |
package rabbitmq
import (
"errors"
"github.com/26597925/EastCloud/pkg/broker"
"github.com/google/uuid"
"github.com/streadway/amqp"
"sync"
"time"
)
const (
TOPIC = "topic"
DELAYED = "x-delayed-message"
)
type rBroker struct {
opts *broker.Options
conn *rabbitMQConn
mtx sync.Mutex
wg ... |
package proxmox
import (
"fmt"
"github.com/hashicorp/terraform/communicator"
"github.com/hashicorp/terraform/communicator/remote"
"github.com/hashicorp/terraform/helper/schema"
"io"
"log"
"strconv"
"strings"
"time"
)
const eth0Payload = "echo $'%s' > /tmp/tf_eth0_payload"
const provisionPayload = "echo $'%... |
// Copyright (c) 2021 Terminus, 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 agree... |
// Copyright 2019 syncd Author. All Rights Reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package gostring
import (
"encoding/base64"
uuid "github.com/satori/go.uuid"
"golang.org/x/text/encoding/simplifiedchinese"
"math/rand"
"strconv"
"strings"... |
/*
Copyright NetFoundry, 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
package ldcomponents
import (
"time"
"gopkg.in/launchdarkly/go-server-sdk.v5/interfaces"
"gopkg.in/launchdarkly/go-server-sdk.v5/ldcomponents/ldstoreimpl"
)
// DefaultBigSegmentsUserCacheSize is the default value for
// BigSegmentsConfigurationBuilder.UserCacheSize.
const DefaultBigSegmentsUserCacheSize = 1000
/... |
package xlsx
import (
"archive/zip"
"fmt"
"github.com/plandem/ooxml"
sharedML "github.com/plandem/ooxml/ml"
"github.com/plandem/xlsx/internal"
"github.com/plandem/xlsx/internal/ml"
"github.com/plandem/xlsx/options"
"github.com/plandem/xlsx/types"
"math"
"reflect"
)
type sheetInfo struct {
ml ml.... |
/*
* Copyright © 2019. mutl3y
*
* 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 config
import (
"bytes"
"fmt"
"reflect"
"strings"
"unicode"
)
func (cfg *Config) reset() {
cfg.inSearchKey()
cfg.inBlock = 0
cfg.inInclude = 0
cfg.currentVar = make(map[string]string)
cfg.searchVar = false
cfg.setVar = false
cfg.searchVarBlock = false
cfg.line = 1
}
func (cfg *Config) valueOf(co... |
/*
Package longpoll implements User Long Poll API.
Long polling – this is a technology that allows the receiving of information
about new events with the help of "long requests". The server receives the
request but it doesn't immediately send the answer but rather when some event
will happen (for example, receiving a ... |
package orbplot
import (
"image/color"
"math"
"github.com/emilyselwood/orbcalc/orbcore"
"github.com/emilyselwood/orbcalc/orbdata"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
"gonum.org/v1/plot/vg/draw"
)
// PlotSolarSystemLines plots the major planets of the solar system on the pro... |
package siwe
import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"strconv"
"strings"
"time"
"github.com/decred/dcrd/dcrec/secp256k1/v4/ecdsa"
"golang.org/x/crypto/sha3"
)
type version string
type Message struct {
Domain string `json:"domain"`
Address Address `json:"address"`
Statement ... |
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"github.com/synerex/synerex_alpha/api"
"github.com/synerex/synerex_alpha/api/common"
"github.com/synerex/synerex_alpha/sxutil"
"google.golang.org/grpc"
"github.com/golang/protobuf/ptypes"
"io/ioutil"
"log"
"net/http"
"sync"
"time"
)
// simple-... |
package influxdb
import (
"context"
"reflect"
"time"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"github.com/influxdata/influxdb-client-go/v2/api/write"
"google.golang.org/protobuf/types/known/structpb"
"github.com/mehrdadrad/tcpdog/config"
"github.com/mehrdadrad/tcpdog/geo"
pb "github.com/mehrd... |
package paytoken
import (
"context"
"database/sql"
"errors"
"fmt"
"time"
"github.com/pauluswi/tulip/internal/entity"
generator "github.com/pauluswi/tulip/pkg/generator"
"github.com/pauluswi/tulip/pkg/log"
"github.com/pauluswi/tulip/pkg/validator"
)
// Service encapsulates usecase logic for albums.
type Serv... |
package request
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
log "github.com/Sirupsen/logrus"
"github.com/VOID001/D-judge/config"
"github.com/pkg/errors"
)
const (
TypeForm = "application/x-www-form-urlencoded"
TypeJSON = "application/json"
)
func Do(ctx ... |
package util
import (
"bytes"
"context"
"fmt"
"strconv"
"github.com/go-logr/logr"
. "github.com/icza/gox/gox"
. "github.com/onsi/gomega"
"github.com/yugabyte/yb-tools/yugatool/api/yb/common"
"github.com/yugabyte/yb-tools/yugaware-client/cmd"
"github.com/yugabyte/yb-tools/yugaware-client/pkg/client"
"github... |
// 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 canary
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/api/er... |
// Copyright 2015 The LUCI 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... |
package common
import (
"context"
"fmt"
"sync"
"time"
"github.com/fatih/color"
"github.com/gopricy/mao-bft/rbc/sign"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/metadata"
"github.com/gopricy/mao-bft/pb"
"github.com/gopricy/mao-bft/rbc/erasure"
"github.com/gopricy/mao-bft/rbc/merkle"
"g... |
package rocket
import (
"fmt"
"net/http"
"reflect"
"github.com/dannypsnl/rocket/internal/context"
"github.com/dannypsnl/rocket/internal/filler"
"github.com/dannypsnl/rocket/response"
"github.com/dannypsnl/rocket/router"
)
// Get return a get handler.
func Get(route string, do interface{}) *handler {
return h... |
package v2
import (
"bytes"
"context"
"errors"
"log"
"net"
"sync"
"github.com/itzmeanjan/tseep/op"
"github.com/xtaci/gaio"
pool "gopkg.in/thejerf/gomempool.v1"
)
type Server struct {
Addr string
Listener net.Listener
Watcher *gaio.Watcher
KV map[op.Key]op.Value
KVLock... |
package tasks
import (
"fmt"
"strings"
"sync"
"github.com/kris-nova/logger"
)
// Task is a common interface for the stack manager tasks
type Task interface {
Describe() string
Do(chan error) error
}
type GenericTask struct {
Description string
Doer func() error
}
func (t *GenericTask) Describe() str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.