text stringlengths 3.08k 10.4k |
|---|
package main
import (
"net/http"
"net/http/httptest"
"os"
"path"
"strings"
"testing"
"time"
)
func Test_server(t *testing.T) {
tmpdir := path.Join(os.TempDir(), "hindsite-tests")
// Initialize temporary directory with test blog.
os.RemoveAll(tmpdir)
mkMissingDir(tmpdir)
site := newSite()
cmd := "hindsite... |
// Copyright 2020 Buf Technologies, 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... |
package goanda
// Supporting OANDA docs - http://developer.oanda.com/rest-live-v20/instrument-ep/
import (
"fmt"
"time"
)
type RequestCandle struct {
Granularity string `json:"granularity"`
Count int `json:"count"`
From *time.Time `json:"from"`
To *time.Time `json:"to"`
Sm... |
package cmd
import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptrace"
"net/url"
"time"
"golang.org/x/crypto/ssh/terminal"
"github.com/urfave/cli/v2"
cl "github.com/tlwr/operator-tools/pkg/colour"
"github.com/tlwr/operator-tools/pkg/timeline"
)
func HTTPCmd() *cli.Command {
retu... |
package main
import (
"bytes"
"embed"
"flag"
"fmt"
"go/ast"
"go/format"
"go/parser"
"go/printer"
"go/token"
"io/ioutil"
"log"
"os"
"sort"
"strings"
"text/template"
"time"
"golang.org/x/tools/go/ast/astutil"
)
//go:embed templates/*
var templateFiles embed.FS
var (
domain string
domainTitle s... |
// miscellaneous utility functions used for the landing page of the application
package index
import (
b64 "encoding/base64"
"github.com/go-pg/pg/v9/orm"
"html/template"
"net/http"
"reflect"
"soko/pkg/app/handler/packages"
"soko/pkg/app/utils"
"soko/pkg/database"
"soko/pkg/models"
"strconv"
"strings"
)
//... |
/*
Adobe Experience Manager (AEM) API
Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
API version: 3.5.0-pre.0
Contact: <EMAIL>
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"bytes"
_context "context"
_ioutil "io/... |
package controllers
import (
"context"
"database/sql"
"fmt"
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/dockboxhq/server/models"
"github.com/dockboxhq/server/services"
"github.com/dockboxhq/server/socket"
"github.com/dockboxhq/server/utils"
"github.com/gin-gonic/gin"
"github.c... |
package cmd
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/sha256"
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
"syscall"
"time"
"github.com/briandowns/spinner"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
)
// getCmd represent... |
package sessionstore
import (
"bytes"
"crypto/rand"
"encoding/gob"
"encoding/hex"
"fmt"
"net/http"
"time"
"github.com/gorilla/sessions"
"github.com/jjeffery/errors"
"github.com/jjeffery/sessions/codec"
"github.com/jjeffery/sessions/storage"
)
var (
nowFunc = time.Now
randRead = rand.R... |
/*
* Copyright 2018- The Pixie 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 ranges
import (
"context"
"net"
"time"
"github.com/caddyserver/caddy"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/nextdhcp/nextdhcp/core/dhcpserver"
"github.com/nextdhcp/nextdhcp/core/lease"
"github.com/nextdhcp/nextdhcp/core/lease/iprange"
"github.com/nextdhcp/nextdhcp/core/log"
"github.com/n... |
package tests
import (
"github.com/onsi/ginkgo"
"encoding/json"
"fmt"
"github.com/ghodss/yaml"
//"gopkg.in/yaml.v2"
"io/ioutil"
"os"
"os/exec"
)
// test parameters.
type TestCfg struct {
KubectlCmd string
ClusterServiceVersionFileName string
}
func newTestCfg() (*TestCfg, bool) {
kube... |
/*
Copyright (C) 2018 Synopsys, Inc.
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
"... |
package services
import (
"golang.org/x/exp/errors/fmt"
"google.golang.org/grpc"
context "context"
v1 "github.com/spacemeshos/api/release/go/spacemesh/v1"
)
// GlobalStateService -
type GlobalStateService struct{}
// GlobalStateHash - Latest computed global state - layer and its root hash
func (s GlobalStateSe... |
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"sort"
"strconv"
"strings"
"sync"
"syscall"
"time"
"github.com/jbsmith7741/uri"
"github.com/pcelvng/task"
tools "github.com/pcelvng/task-tools"
"github.com/pcelvng/task-tools/bootstrap"
"github.com/pcelvng/task/bus"
)
const (
d... |
/*
* 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 ... |
/*
Copyright 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, softw... |
package iptables
import (
"os/user"
"strings"
"github.com/spf13/cobra"
"istio.io/istio/tools/istio-iptables/pkg/builder"
"istio.io/istio/tools/istio-iptables/pkg/config"
"istio.io/istio/tools/istio-iptables/pkg/dependencies"
"github.com/api7/apisix-mesh-agent/pkg/types"
)
type iptablesConstructor struct {
i... |
package stream
import (
"context"
"errors"
"io"
"testing"
"time"
"github.com/nareix/joy4/av"
"github.com/nareix/joy4/codec/h264parser"
)
//Testing WriteRTMP errors
var ErrPacketRead = errors.New("packet read error")
var ErrStreams = errors.New("streams error")
type BadStreamsDemuxer struct{}
func (d BadStre... |
package resock
import (
"crypto/rand"
"crypto/tls"
"crypto/x509"
"errors"
"golang.org/x/crypto/chacha20"
"golang.org/x/crypto/sha3"
"io"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
"nhooyr.io/websocket"
"os"
"time"
)
func getClientCert() *tls.Config {
cert, err := tls.LoadX509KeyPair("certs/c... |
package main
import (
"flag"
"fmt"
"os"
"runtime"
"strings"
"github.com/dgraph-io/ristretto"
"github.com/dustin/go-humanize"
"github.com/tidwall/evio"
"github.com/tidwall/redcon"
"github.com/tidwall/redlog"
)
var log = redlog.New(os.Stderr)
var cache *ristretto.Cache
var port int
var capacity uint64
var th... |
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright(c) 2019 Wind River Systems, Inc. */
package host
import (
"fmt"
"github.com/alecthomas/units"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/starlingx/inventory/v1/memory"
perrors "github.com/pkg/errors"
starlingxv1 "github.com/wi... |
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package service
import (
"github.com/keybase/client/go/libkb"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
"github.com/keybase/go-framed-msgpack-rpc/rpc"
"golang.org/x/net/context"... |
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
import (
"reflect"
"github.com/33cn/chain33/system/crypto/ed25519"
"github.com/33cn/chain33/system/crypto/secp256k1"
"github.com/33cn/chain33/... |
package controller
import (
"bytes"
"github.com/chenhg5/go-admin/context"
"github.com/chenhg5/go-admin/modules/auth"
"github.com/chenhg5/go-admin/modules/menu"
"github.com/chenhg5/go-admin/plugins/admin/models"
"github.com/chenhg5/go-admin/plugins/admin/modules/file"
"github.com/chenhg5/go-admin/template"
"git... |
package types
import (
"fmt"
"sort"
"strings"
abci "github.com/tendermint/tendermint/abci/types"
tmkv "github.com/tendermint/tendermint/libs/kv"
)
// ----------------------------------------------------------------------------
// Event Manager
// -----------------------------------------------------------------... |
package ovn
import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"github.com/urfave/cli"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config"
ovntest "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/testing"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
. "github.com/onsi/ginkgo"
.... |
// Code generated by go-swagger; DO NOT EDIT.
// Copyright 2017 The go-ovh 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
/... |
// Copyright (c) 2019 Uber Technologies, 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 o... |
package policy
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"reflect"
"text/tabwriter"
"github.com/spf13/cobra"
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"... |
package gov
import (
"encoding/json"
"fmt"
sdk "github.com/irisnet/irishub/types"
"github.com/pkg/errors"
)
// Vote
type Vote struct {
Voter sdk.AccAddress `json:"voter"` // address of the voter
ProposalID uint64 `json:"proposal_id"` // proposalID of the proposal
Option VoteOption ... |
//
// Amazon Cognito is a web service that facilitates the delivery of scoped, temporary credentials
// to mobile devices or other untrusted environments. Amazon Cognito uniquely identifies a device
// or user and supplies the user with a consistent identity throughout the lifetime of an application.
//
// [http://docs... |
// Depfinder package contains the DNS dependency finder.
// Its purpose is to provide a request channel, and to build the dependency graph of a requested domain name.
package dependency
import (
"fmt"
"github.com/hashicorp/golang-lru"
"github.com/ANSSI-FR/transdep/graph"
"github.com/ANSSI-FR/transdep/nameresolver"... |
package mahjong
import (
"fmt"
"github.com/lonng/nanoserver/protocol"
)
const (
PingHu = iota
PongPong // 碰碰胡:由4副刻子(或杠)、将牌组成的胡牌
QiDui // 七对: 7个对子组成的的胡牌
LongQiDui
ShuangLongQiDui
HaoHuaLongQiDui
QYS // 清一色:由一种花色的牌组成的胡牌
HaiDiLao // 海底捞:抓棹面上最后一张牌的人正好能胡牌
GangShangHua // 杠上花: 杠来自己要胡的牌胡牌
)
//... |
/*
Copyright 2020 The Kruise 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... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudformation
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type ListStackSetsInput struct {
_ struct{} `type:"structure"`
// The maximum number of results to be returned wit... |
package memstore
import (
"bytes"
"encoding/base32"
"encoding/gob"
"fmt"
"github.com/gorilla/securecookie"
"github.com/gorilla/sessions"
"net/http"
"strings"
"time"
)
// To be compatible with Save(), define ExpiredMember as a special key for
// session expiration in server end.
const ExpiredMember = "ijkbyte... |
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package util
import (
"fmt"
"reflect"
"strconv"
"time"
"github.com/cloudflare/cfssl/log"
logging "github.com/op/go-logging"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
const (
// TagDefault ... |
// Package maxheap implements a binary max heap for strings.
//
// It is an express design decision to hard-code
// this max heap just for the string type rather than for
// the empty interface.
//
package maxheap
import (
"errors"
"fmt"
"github.com/manniwood/mmmdatastructures"
)
var HeapCapacityExceeded = errors... |
package models
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
// DB definition is
var DB *gorm.DB
// ConnectDatabase definition is
func ConnectDatabase() {
dsn := "root:r00t@tcp(db:3306)/fullstack?parseTime=True"
database, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
if err != nil {
panic("Failed to ... |
/*
Copyright 2015 The Kubernetes Authors.
Copyright 2020 Authors of Arktos - file modified.
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 re... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package worklink
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type DescribeFleetMetadataInput struct {
_ struct{} `type:"struct... |
// Copyright 2018-2020 CERN
//
// 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 wr... |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package draw
// A Point is an X, Y coordinate pair.
type Point struct {
X, Y int;
}
// ZP is the zero Point.
var ZP Point
// A Rectangle contains the Point... |
package templates
import (
"bytes"
"github.com/Odania-IT/terraless/schema"
"github.com/sirupsen/logrus"
"os"
"path/filepath"
"text/template"
"time"
)
var mainTfTemplate = `# This file is generated by Terraless
variable "terraless-default-tags" {
type = map(string)
default = {
DeployedWith = "Terraless... |
package kusto_test
import (
"context"
"errors"
"fmt"
"testing"
"time"
"github.com/Azure/azure-kusto-go/kusto"
"github.com/Azure/azure-kusto-go/kusto/data/table"
"github.com/Azure/azure-kusto-go/kusto/data/types"
"github.com/Azure/azure-kusto-go/kusto/data/value"
"github.com/kylelemons/godebug/pretty"
)
/*... |
package domain
import (
"fmt"
"math/rand"
"sync"
"github.com/mateusf777/pubsub/log"
)
const noIndex = -1
// PubSub represents a message router for handling the operations PUB, SUB and UNSUB
type PubSub struct {
msgCh chan Message
handlersMap *sync.Map //map[string][]HandlerSubject
groupsMap *sync.Map... |
package xvals
import (
"fmt"
"strings"
)
// Object is the interface all supported objects must implement. It is described by
// a Descriptor, which is used to generate the object.
//
// A field is defined by a key in the format:
//
// <TYPE>_<NAME>_<FIELD>=<VALUE>
// <---- KEY ---->
//
// An Object is m... |
// Copyright 2017 PingCAP, 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 i... |
// Copyright 2022 xgfone
//
// 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 (c) 2021 Tigera, 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 applica... |
/*
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 php7
import (
"strings"
"github.com/i582/php2go/src/php/errors"
"github.com/i582/php2go/src/php/freefloating"
"github.com/i582/php2go/src/php/node"
"github.com/i582/php2go/src/php/position"
"github.com/i582/php2go/src/php/positionbuilder"
"github.com/i582/php2go/src/php/scanner"
)
func (lval *yySymTyp... |
//
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
package newrelic
import (
"encoding/json"
"time"
"newrelic/collector"
)
// An SQLId is a unique identifier for an SQL statement. The agent
// is responsible generating these values using an implementation
/... |
// Copyright (c) 2016 Tigera, 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 applica... |
/*
Copyright 2019 The Kubeedge 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, so... |
// Copyright 2017 Delos Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
package xlib
import (
"fmt"
"sync"
"sync/atomic"
"time"
"github.com/DelosIsland/core/module... |
/******************************************************************************
*
* Copyright 2019 SAP SE
*
* 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/li... |
// Copyright 2021 hardcore-os Project 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 main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/costexplorer"
)
const (
defaultAWSRegion = "us-east-1"
)
type AwsRegion struct {
Region string
Location string
Code string
A1 string
Latitude string
Long... |
// 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 applicabl... |
package util
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
// MemInfo contains information about the system's random access memory
type MemInfo struct {
MemTotal int64
MemFree int64
MemAvailable int64
Buffers int64
Cached int64
SwapCached int64
Activ... |
package main
import (
"io/ioutil"
"os"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
"unicode"
)
const (
TaskTypeUnDefine = 0
TaskTypeMap = 1
TaskTypeReduce = 2
)
const (
TaskStatusInit = 1
TaskStatusProcessing = 2
TaskStatusDone = 3
TaskStatusFailure = 4
)
type Task struct {
ID int64
Type int64... |
package console
import (
"fmt"
"gometer/modules/console/contracts"
"sort"
"strings"
)
// Application ...
type Application struct {
name string
version string
formatter *Formatter
commands map[string]contracts.Command
}
// GetApplicationInstance ...
func GetApplicationInstance() contracts.Application ... |
package manager
import (
"fmt"
"github.com/kris-nova/logger"
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"github.com/tidwall/sjson"
gfn "github.com/weaveworks/goformation/cloudformation"
"github.com/weaveworks/eksctl/pkg/cfn/builder"
"github.com/weaveworks/eksctl/pkg/cfn/outputs"
"github.com/weavewor... |
package serverlogger
import (
"flag"
"fmt"
"io"
"log"
"regexp"
"sync"
"github.com/Cloud-Foundations/Dominator/lib/logbuf"
"github.com/Cloud-Foundations/Dominator/lib/srpc"
)
var (
initialLogDebugLevel = flag.Int("initialLogDebugLevel", -1,
"initial debug log level")
logSubseconds = flag.Bool("logSubsecon... |
// Copyright (c) 2020 Chair of Applied Cryptography, Technische Universität
// Darmstadt, Germany. All rights reserved. This file is part of go-perun. Use
// of this source code is governed by the Apache 2.0 license that can be found
// in the LICENSE file.
package channel
import (
"context"
"math/big"
"github.co... |
// Copyright 2018 Bull S.A.S. Atos Technologies - Bull, R<NAME> Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
//
// 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.... |
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge... |
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
uuid "github.com/nu7hatch/gouuid"
zmq "github.com/pebbe/zmq4"
)
// MsgHeader encodes header info for ZMQ messages
type MsgHeader struct {
MsgID string `json:"msg_id"`
Username string `json:"username"`
Session string `json:... |
// Copyright IBM Corp. All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
package test
import (
"fmt"
"math/rand"
"sort"
"sync"
"time"
"github.com/SmartBFT-Go/consensus/smartbftprotos"
"github.com/golang/protobuf/proto"
)
func init() {
rand.Seed(time.Now().UnixNano())
}
const (
incBuffSize ... |
package audiusclient
import (
"errors"
"math/rand"
"sort"
"strings"
"sync"
"time"
)
type HostSelectionService struct {
// A mutex to use while performing updates on the service.
mu sync.Mutex
// The name of the application issuing requests to Audius.
appName string
// The configuration for the service.
... |
package restserver
import (
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/rs/cors"
)
// CORSOptions is a configuration container to setup the CORS middleware.
type CORSOptions struct {
// AllowedOrigins is a list of origins a cross-domain request can be executed from.
// If the special "*" value ... |
package manager
import (
"fmt"
"github.com/xiusin/pinecms/src/application/plugins/task/table"
"os"
"path/filepath"
"reflect"
"sync"
"time"
"github.com/go-xorm/xorm"
"github.com/robfig/cron/v3"
"github.com/traefik/yaegi/interp"
"github.com/traefik/yaegi/stdlib"
"github.com/xiusin/pine"
"github.com/xiusin/... |
// Copyright (c) 2017 Uber Technologies, 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 IBM Corp. 2018 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 ... |
package server
import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"io"
"net/http"
"strings"
)
type PSResponse struct {
Err *ApiError `json:"error,omitempty"`
Data interface{} `json:"data,omitempty"`
}
const (
//maxFormSize =... |
package main
import (
"flag"
"fmt"
"io"
"os"
"sort"
"strings"
"github.com/mkobetic/coin"
"github.com/mkobetic/coin/check"
)
func init() {
(&cmdRegister{}).newCommand("register", "reg", "r")
}
type cmdRegister struct {
*flag.FlagSet
verbose bool
recurse bool
begin, end coin.Da... |
// Copyright 2020 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gdb
import (
"fmt"
"github.com/gogf/gf/contai... |
package move
import (
"fmt"
"os"
"strings"
"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/ankitpokhrel/jira-cli/api"
"github.com/ankitpokhrel/jira-cli/internal/cmdutil"
"github.com/ankitpokhrel/jira-cli/internal/query"
"github.com/ankitpokhrel/jira-cli/pkg/... |
/*
* MinIO Go Library for Amazon S3 Compatible Cloud Storage
* Copyright 2019 MinIO, 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/LICENS... |
package mig
import (
"database/sql"
"errors"
"fmt"
"io"
"io/ioutil"
"path/filepath"
"sort"
"time"
)
var (
// ErrNoCurrentVersion no current version
ErrNoCurrentVersion = errors.New("no current version found")
// ErrNoNextVersion no next version
ErrNoNextVersion = errors.New("no next version found")
)
// ... |
package views
import (
"fmt"
"github.com/jroimartin/gocui"
"golang.org/x/text/language"
"golang.org/x/text/message"
netModels "github.com/edouardparis/lntop/network/models"
"github.com/edouardparis/lntop/ui/color"
"github.com/edouardparis/lntop/ui/models"
)
const (
CHANNEL = "channel"
CHANNEL_HEADER... |
// Copyright 2022 MobiusCode GmbH
//
// 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... |
// Since none of the values in the input file are larger than 127 I decided to use int8 as type for the numbers.
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
numbers, boards := loadGameData()
part1(numbers, boards)
}
func part1(numbers []int8, boards []board) int {
// The basi... |
/*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2022 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 obta... |
package main
import (
"container/list"
"math/rand"
"sync"
"time"
)
// Speeds
const SPEED_SLOWEST = 300 * time.Millisecond
const SPEED_FASTEST = 5 * time.Millisecond
type GameState int
const (
GAME_STARTED GameState = iota
GAME_PAUESD
GAME_OVER
)
type Direction int
const (
DIRECTION_LEFT = iota
DIRECTION_... |
package images
import (
"context"
"encoding/json"
"fmt"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/platforms"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
var (
// S... |
package common
import (
"strings"
"testing"
"time"
cronlib "github.com/robfig/cron/v3"
)
func TestPrevCronTime(t *testing.T) {
runs := []struct {
time, spec string
expected string
expectedErr bool
}{
// Simple cases
{"Mon Jul 9 15:00 2012", "0 0/15 * * * *", "Mon Jul 9 14:45 2012", false},
{"Mo... |
package contact
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"strconv"
"time"
"errors"
"bytes"
"github.com/jlaffaye/ftp"
"github.com/mitre/gocat/output"
)
const (
USER = "{FTP_C2_USER}"
PWORD = "{FTP_<PASSWORD>}"
DIRECTORY = "/" + "{FTP_C2_DIRECTORY}"
... |
package knowledge
import (
"encoding/json"
mapset "github.com/deckarep/golang-set"
)
// GraphUpdatesBulk represent a bulk of asset and relation updates to perform on the graph
type GraphUpdatesBulk struct {
assetUpserts mapset.Set
assetRemovals mapset.Set
relationUpserts mapset.Set
relationRemovals map... |
package compiler
import (
"fmt"
"os"
"path"
"strings"
"github.com/novemberisms/stack"
)
// A LangService is one of the language implementations that will read a line of code and determine certain
// qualities about it based on unique properties of the language itself
type LangService interface {
// whether a g... |
package tetra3d
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/kvartborg/vector"
)
const (
TriangleSortModeBackToFront = iota // TriangleSortBackToFront sorts the triangles from back to front (naturally). This is the default.
TriangleSortModeFrontToBack // TriangleSortFrontToBack sorts the triangl... |
package main
import (
"errors"
"log"
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/gotk3/gotk3/gdk"
"github.com/gotk3/gotk3/gtk"
)
const (
MILLI_SEC_PER_SEC = float32(1000.0)
DEG_PER_TWO_SEC = MILLI_SEC_PER_SEC * 360.0
)
/*
* Global variables
*/
var (
triangle = Triangle{
data: []float32{
+0.0, +... |
package loadbot
import (
"fmt"
"github.com/umbracle/ethgo"
"math/big"
"sync"
"time"
"github.com/0xPolygon/polygon-edge/types"
"github.com/umbracle/ethgo/jsonrpc"
)
// getInitialSenderNonce queries the sender account nonce before starting the loadbot run.
// The nonce used for transactions is incremented by th... |
package chargify
import (
"errors"
"fmt"
"github.com/mitchellh/mapstructure"
)
// Invoice is a relationship invoice on Chargify. Note that not all fields are currently implemented, as there
// are over 145 properties on an invoice
type Invoice struct {
UID string `json:"uid,omitempty" mapstructu... |
package memory
import (
"fmt"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/solo-io/solo-kit/pkg/api/v1/clients"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"
"github.com/solo-io/solo-kit/pkg/errors"
"k8s.io/apimachinery/pkg/labels"
)
const separator = ";"
type InMemoryResourceCache interface ... |
// Copyright 2016 laosj Author @songtianyi. 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 require... |
package data
import (
"encoding/csv"
"errors"
"io/ioutil"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"time"
gbt "github.com/dirkolbrich/gobacktest"
)
// BarEventFromCSVFile loads the market data from csv files.
// It expands the underlying data struct.
type BarEventFromCSVFile struct {
gbt.Data
FileD... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.