text stringlengths 3.08k 10.4k |
|---|
/*
* Copyright (c) 2019. Baidu Inc. All Rights Reserved.
*/
package service
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"io/ioutil"
"math/big"
rd "math/rand"
"os"
"strings"
"time"
"github.com/xuperchain/xuper-ca/config"
"github.com/xuperchain/xuper-ca/util"
)
co... |
// Copyright 2021 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
// Inspired by https://github.com/natefinch/lumberjack
package writer
import (
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/mholt/archiver"
"github.com/projectdiscovery/gologger/levels"
"gopkg.in/djherbis/times.v1"
)
func init() {
// Set defaul... |
package model
import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/arangodb/go-driver"
"github.com/test/restApi/log"
"io"
"sync"
)
const (
ETH = "eth"
ERC20 = "erc20"
//
// AOA = "AOA_ar_3"
// BAT = "BAT_ar_3"
// BNB = "BNB_ar_3"
// CRO = "CRO_ar_3"
// DAI = "DAI_ar_3"
// ENJ = "ENJ_ar_3"
// GNT = ... |
/*-
* Copyright (c) 2016, 1&1 Internet SE
* Copyright (c) 2018, 1&1 IONOS SE
* Copyright (c) 2016-2018, <NAME> <<EMAIL>>
* All rights reserved
*
* Use of this source code is governed by a 2-clause BSD license
* that can be found in the LICENSE file.
*/
package stmt
const (
OncallStatements = ``
OncallList ... |
package ca
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"math/big"
"time"
)
// Issuing certificates concurrently is not supported.
type CA struct {
// validity is the duration for which issued certificates are valid. This
// is approximately cert.No... |
// Copyright 2016 by caixw, All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
package input
import (
"sort"
"strings"
)
// 所有支持的语言模型定义
//
// NOTE: 应该保持键名为非大写,按字母顺序排列,方便查找。
// langs 应该和 langExts 保持一一对应关系。
var langs = map[string][]blocker{
// C#
... |
/*
Copyright IBM Corporation 2020
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
di... |
package controllers
import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"manager/common"
"manager/models"
"manager/utils"
"math"
"strconv"
)
type RoleController struct {
beego.Controller
}
func (this *RoleController) List() {
pageSize := 10
currentPage, _ := this.GetInt("page", 1)
o := o... |
package fortune
import (
"fmt"
"regexp"
"strings"
"github.com/kmptnz/bot/internal/fortune"
"github.com/kmptnz/bot/internal/matcher/abstract"
"github.com/kmptnz/bot/internal/matcher/registry"
"github.com/kmptnz/bot/internal/telegram"
)
// Each matcher extends the abstract matcher
type Matcher struct {
abstrac... |
package tracing
import (
"context"
"fmt"
"net/http"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
zipkin "github.com/openzipkin/zipkin-go-opentracing"
"github.com/sirupsen/logrus"
)
// Tracer instance
var tracer opentracing.Tracer
// SetTracer can be used by unit tests t... |
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
//
// 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... |
// This package contains a a mock version controller (github/gitlab etc.)
package vcmock
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"sync"
git "github.com/go-git/go-git/v5"
"github.com/lindell/multi-gitter/internal/scm"
)
// VersionController is a mock of an version controller (Github/Gitlab/etc... |
package json
import (
"github.com/json-iterator/go"
"time"
"unsafe"
)
/* ============================================
Created by <NAME> on 2021/05/18
Copyright andypangaribuan. All rights reserved.
============================================ */
// time format alias
const (
ANSIC = "ANSIC"
UnixDate ... |
package xmlenc
import (
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"fmt"
"github.com/beevik/etree"
)
// RSA implements Encrypter and Decrypter using RSA public key encryption.
//
// Use function like OAEP(), or PKCS1v15() to get an instance of this type ready
// to use.
type RSA struct {
BlockCipher BlockCi... |
package history
import (
"context"
hismodel "go-common/app/interface/main/history/model"
"go-common/app/interface/main/tv/model/history"
"go-common/library/log"
"go-common/library/sync/errgroup"
)
const (
_videoPGC = "pgc"
_videoUGC = "archive"
_typePGC = 1
_typeUGC = 2
)
// pick history from cursor and c... |
package tokens
import (
"strings"
"github.com/baking-bad/bcdhub/internal/bcd/ast"
"github.com/baking-bad/bcdhub/internal/bcd/consts"
"github.com/baking-bad/bcdhub/internal/logger"
"github.com/baking-bad/bcdhub/internal/models"
"github.com/baking-bad/bcdhub/internal/models/bigmapdiff"
"github.com/baking-bad/bcd... |
// Written in 2014 by <NAME>.
//
// It helps future understanding of past knowledge to save
// this notice, so peers of other times and backgrounds can
// see history clearly.
package circuit
import (
"errors"
"fmt"
"log"
"sync"
dkr "github.com/gocircuit/circuit/client/docker"
"github.com/gocircuit/escher/be"
... |
package main
import (
"bytes"
"encoding/binary"
"flag"
"fmt"
"io"
"log"
"math/rand"
"net"
"os"
"sync/atomic"
"time"
)
var (
queueSize = int32(0)
incrQueue = func() int32 { return atomic.AddInt32(&queueSize, 1) }
decrQueue = func() int32 { return atomic.AddInt32(&queueSize, -1) }
currQueue = func() int3... |
package profiles
import (
"strings"
"github.com/google/uuid"
)
// payloadWrapper is a wrapper around a profile payload struct.
// It exists to implement custom Plist marshal/unmarshal logic required
// for correctly parsing arbitrary profile payloads in a profile.
type payloadWrapper struct {
Payload interface{}
... |
package statistic
import (
"bufio"
"bytes"
"compress/gzip"
_ "embed"
"errors"
"fmt"
"io/ioutil"
"log"
"net"
"os"
"path/filepath"
"strings"
"sync"
"unsafe"
"github.com/Asutorufa/yuhaiin/pkg/net/dns"
"github.com/Asutorufa/yuhaiin/pkg/net/mapper"
"github.com/Asutorufa/yuhaiin/pkg/net/proxy/proxy"
proto... |
package query
import "strings"
type operator string
// list of allowed operators.
const (
ignoreCasePrefix = "i"
mongoOpPrefix = "$"
operatorIn operator = "in"
operatorInArray operator = "[]"
operatorEqualArray operator = "eqa"
operatorEquals operator = "e... |
package main
import (
crand "crypto/rand"
"encoding/binary"
"fmt"
"math/rand"
)
const (
// Op codes
opNop = iota
opPush
opPop
opSum
opSub
opMul
opPrint
opPrintln
opRand
opCmp
opDup
opSwap
opJmp
opHalt
)
type operation struct {
name string
args int
}
var ops = map[int]operation{
opNop: oper... |
package osenv
import (
"fmt"
"os"
"testing"
"time"
)
type X2 struct {
Sub int `env:"sub,-2"`
}
type X struct {
unexport string
NoTag string
Int int `env:"int,-1"`
Int8 int8 `env:"int8"`
Int16 int16 `env:"int16"`
Int32 int32 `env:"int32"`
Int64 int64... |
package loader
import (
"bufio"
"bytes"
"errors"
"fmt"
"image"
"image/color"
"io"
"os/exec"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
)
func init() {
LoaderMap["FFMPEG"] = NewFFMPEG
}
const (
DEFAULT_FFMPEG_COMMAND_STRING = "ffmpeg -hide_banner -i %s -s %s -vf fps=15/1 -f rawvideo -c:v rawvideo -p... |
package BrickMosaic
// Ideal is the idealized grid of how the mosaic should look. Basically a 2d grid of color.
type Ideal interface {
Orientation() ViewOrientation
NumRows() int
NumCols() int
Color(row, col int) BrickColor
}
// PlacedBrick represents a physical brick placed within the mosaic, at a certain locati... |
// Package aphgrpc provides various interfaces, functions, types
// for building and working with gRPC services.
package aphgrpc
import (
"context"
"errors"
"strings"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
const (
// MetaKey... |
package list
import (
"encoding/json"
"errors"
"fmt"
"math"
"reflect"
)
const (
defaultCap = 5
// 指针大小。
ptrSize = 4 << (^uintptr(0) >> 63)
// 最大小对象的大小,参见golang内存管理。
maxSmallSize = 32678
// 页大小,参见golang内存管理。
pageSize = 8192
)
// 分配空间大小,参见golang内存管理或/$goroot$/src/runtime/sizeclass.go。
var mallocSize = []i... |
package ecloud
import (
"fmt"
"log"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ukfast/sdk-go/pkg/ptr"
ecloudservice "github.com/ukfast/sdk-go/pkg/service/ecloud"
)
func resourceFirewallPolicy() *schema.Resource... |
// Copyright (c) 2020 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"context"
"errors"
"log"
"os"
"path/filepath"
"time"
"decred.org/dcrwallet/rpc/walletrpc"
"github.com/decred/dcrd/chaincfg/v2"
"github.com/decr... |
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
//
// 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... |
package invoicer
import (
"bytes"
"io/ioutil"
"path"
"time"
"github.com/pkg/errors"
abci "github.com/tendermint/abci/types"
btypes "github.com/tendermint/basecoin/types"
"github.com/tendermint/go-wire"
"github.com/tendermint/trackomatron/common"
"github.com/tendermint/trackomatron/types"
)
func validateIn... |
package main
import (
"flag"
"os"
"strings"
"time"
clientset "github.com/openfaas-incubator/ingress-operator/pkg/client/clientset/versioned"
informers "github.com/openfaas-incubator/ingress-operator/pkg/client/informers/externalversions"
controllerv1 "github.com/openfaas-incubator/ingress-operator/pkg/controll... |
// Copyright (c) 2018 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distri... |
// Copyright 2021 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 ... |
package circleci
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"path"
"strings"
"time"
"github.com/google/go-querystring/query"
)
const (
UserAgent = "gocircleci/1.0.0"
queryLimit = 100 // maximum that CircleCI allows
defaultHTTPTimeout = 20
defaultPathPr... |
/*
* gomacro - A Go interpreter with Lisp-like macros
*
* Copyright (C) 2018-2019 <NAME>
*
* 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 http://mozilla.org/MPL/2.0/.
*
*
* ut... |
package langsrv
import protocol "github.com/tliron/glsp/protocol_3_16"
type tokenType string
var (
// For identifiers that declare or reference a namespace, module, or package.
token_namespace tokenType = "namespace"
// For identifiers that declare or reference a class type.
token_class tokenType = "class"
// F... |
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// move Format from writer, case format not responsibility of writer
package log
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"... |
package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
"strings"
)
type Car struct {
Id int
Position []float64 // bc. of 'medium' we need float coordinates
Rides []*Ride
CurrentT int
}
type Ride struct {
Id int
Start []float64
Dest []float64
Earliest int
Latest int
... |
package nb
import (
"net/http"
"strings"
"sync"
"time"
util "github.com/noobaa/noobaa-operator/v5/pkg/util"
"github.com/sirupsen/logrus"
)
const (
// RPCVersionNumber specifies the RPC version number
RPCVersionNumber uint32 = 0xba000000
// RPCMaxMessageSize is a limit to protect the process from allocating... |
package eth2_shuffle_experiment
import "encoding/binary"
type HashFn func(input []byte) []byte
const hSeedSize = int8(32)
const hPivotSize = int8(32 + 1)
const hPairSize = int8(32 + 4)
const hMaxSize = hPairSize
// Shuffles the list
func ShuffleList(hashFn HashFn, input []uint64, roundsPow uint8, seed [32]byte) {
... |
package smt
import (
"bytes"
"fmt"
)
type SparseMerkleTree struct {
store Store
}
func NewSparseMerkleTree(store Store) *SparseMerkleTree {
if store == nil {
store = newDefaultStore()
}
return &SparseMerkleTree{
store: store,
}
}
func (s *SparseMerkleTree) Root() (H256, error) {
return s.store.Root()
}
... |
/*
Copyright 2020 the Velero 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 in writing, sof... |
package ppp
import (
"encoding/binary"
"fmt"
"log"
)
type lcpProtocol struct{}
// TODO: move to cp.go?
// controlCode is the LCP/IPCP/CCP control protocol message code of this packet
type controlCode uint16
// Constants for controlCode values
// See https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xml fo... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package types
type AMITypes string
// Enum values for AMITypes
const (
AMITypesAl2_x86_64 AMITypes = "AL2_x86_64"
AMITypesAl2_x86_64_gpu AMITypes = "AL2_x86_64_GPU"
)
type ClusterStatus string
// Enum values for ClusterStatus
const (
ClusterStatusCreating ... |
package idx
import (
"fmt"
"strings"
"github.com/sarpt/gamedbv/pkg/db"
"github.com/sarpt/gamedbv/pkg/db/models"
"github.com/sarpt/gamedbv/pkg/gametdb"
"github.com/sarpt/gamedbv/pkg/index"
)
const (
unknownRegionCode string = "Other"
gameUIDSeparator string = ":"
regionSeparator string = ","
)
type gamet... |
/*
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 may not use this fi... |
package main
import (
"fmt"
"log/syslog"
"os"
"os/exec"
"runtime/pprof"
"sort"
"syscall"
"github.com/containers/libpod/libpod"
_ "github.com/containers/libpod/pkg/hooks/0.1.0"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/version"
"github.com/containers/storage/pkg/reexec"
"gi... |
/*
Copyright 2019 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 subscription
import (
"encoding/json"
"testing"
"github.com/dennor/go-paddle/events"
"github.com/dennor/go-paddle/events/test"
"github.com/dennor/go-paddle/events/types"
"github.com/dennor/go-paddle/signature"
"github.com/dennor/urldecode"
"github.com/stretchr/testify/assert"
)
func subscriptionPayme... |
package svid
import (
"context"
"crypto/x509"
"net/url"
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/imkira/go-observer"
"github.com/sirupsen/logrus/hooks/test"
"github.com/spiffe/spire/pkg/agent/client"
"github.com/spiffe/spire/pkg/agent/manager/cache"
"github.com/spiffe/spire/proto/api/no... |
/**
* Copyright (c) 2019 - Present – <NAME>, SAS
* All rights reserved.
*
* This source code is licensed under the Clear BSD license found in the
* LICENSE file in the root directory of this source tree.
*/
package gossipsub
import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
net "github.com/libp2p/go-libp... |
package browserk
import (
"context"
"math"
"sync"
"github.com/rs/zerolog"
)
// RequestHandler for adding middleware between browser HTTP Request events, return true if should de-register
type RequestHandler func(c *Context, browser Browser, i *InterceptedHTTPRequest) bool
// ResponseHandler for adding middlewar... |
package kratos
import (
"sync"
"time"
"github.com/go-kit/kit/log"
"github.com/gorilla/websocket"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/wrp-go/v3"
)
// Client is what function calls we expose to the user of kratos
type Client interface {
Hostname() string
HandlerRegistry() HandlerR... |
package st300
import (
"bytes"
"fmt"
"testing"
"time"
"github.com/larixsource/suntech/st"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func equalALT(t *testing.T, expected *AlertReport, actual *AlertReport) {
require.NotNil(t, expected)
require.NotNil(t, actual)
assert.Equal... |
// Code generated by smithy-go-codegen DO NOT EDIT.
package sagemakera2iruntime
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
awshttp "github.com/aws/aws-sdk-... |
package main
import (
"flag"
"os"
"strings"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/libkv/store"
"github.com/docker/libkv/store/etcd"
)
const (
CheckGroupCluster = KubeCheckGroup("cluster")
CheckGroupNode = KubeCheckGroup("node")
CheckGroupPod = KubeCheckGroup("pod")
CheckTypeNodeRe... |
package reporting
import (
"os"
"runtime"
"sync"
"github.com/olekukonko/tablewriter"
)
const (
Success = "SUCCESS"
Skip = "SKIP"
Error = "ERROR"
)
func Run(f func(r *R)) bool {
ctx := newReportContext()
r := &R{
barrier: make(chan bool),
done: make(chan bool),
context: ctx,
}
go rRunner(r, ... |
// Copyright 2017 CNI 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 ... |
// Copyright 2020 The Tekton 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 main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"runtime"
"runtime/pprof"
"syscall"
"github.com/ErdemOzgen/magicbytes/magicbytes"
//"github.com/ErdemOzgen/magicbytes"
)
//=========================Color Const ==========================================
con... |
// 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 main
import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"time"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/oklog/run"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golan... |
// fourteen.go - just copied from go-nuts thread - none of this is mine
package fourteen
/*
14-bit floating point conversion functions
Here's a sample calculation by <NAME> (<EMAIL>) for a
float14 (1 sign bit, 6 bits to encode the exponent and 7 bits to encode
the mantissa):
0 | 100101 | 1001001
sign = 0
e... |
package main
import (
"flag"
"fmt"
"os"
"path"
"strings"
"time"
"github.com/onepanelio/templates/sidecars/filesyncer/providers/s3"
"github.com/onepanelio/templates/sidecars/filesyncer/server"
"github.com/onepanelio/templates/sidecars/filesyncer/util"
"github.com/onepanelio/templates/sidecars/filesyncer/util... |
package sendpulse_sdk_go
import (
"context"
"fmt"
"net/http"
)
type ViberService struct {
client *Client
}
func newViberService(cl *Client) *ViberService {
return &ViberService{client: cl}
}
type CreateViberCampaignParams struct {
TaskName string `json:"task_name"`
MessageType int `... |
package common
import (
"errors"
"fmt"
"github.com/keep94/finances/fin/categories"
"github.com/keep94/finances/fin/categories/categoriesdb"
"github.com/keep94/toolbox/date_util"
"github.com/keep94/toolbox/http_util"
"html/template"
"net/http"
"net/url"
"strconv"
"strings"
)
var (
kLeftNavTemplateSpec = `
... |
package operator
import (
"github.com/iotaledger/goshimmer/plugins/qnode/clientapi"
"github.com/iotaledger/goshimmer/plugins/qnode/hashing"
"github.com/iotaledger/goshimmer/plugins/qnode/model/sc"
)
// triggered by new request msg from the node
// called from he main queue
func (op *AssemblyOperator) eventRequest... |
package db
import (
"errors"
"gorm.io/gorm"
)
func GetUser(id uint64) (User, error) {
user := User{}
user.ID = uint(id)
result := database.Take(&user)
return user, result.Error
}
func AddUser(user User) (User, error) {
result := database.Create(&user)
return user, result.Error
}
func LookupUser(username ... |
package main
import (
"fmt"
"github.com/urfave/cli"
"os"
"time"
"strings"
"sort"
"github.com/townewgokgok/slack-status/internal/helper"
s "github.com/townewgokgok/slack-status/internal/settings"
"github.com/townewgokgok/slack-status/internal/slack"
)
var version = "1.2.1"
func cliError(msgs ...string)... |
// Package datapath implements linux data path for PPPoE/PPP;
// TODO: currently datapath does NOT do following:
// - create default route with nexthop as the TUN interface
// - apply DNS server address
package datapath
import (
"context"
"fmt"
"net"
"github.com/hujun-open/zouppp/lcp"
"github.com/songgao/w... |
package install
import (
"fmt"
"os"
"strings"
"github.com/solo-io/gloo/pkg/cliutil"
"github.com/solo-io/gloo/pkg/cliutil/install"
"github.com/solo-io/gloo/projects/gloo/cli/pkg/cmd/options"
)
const installationIdLabel = "installationId"
var subchartAppNames = []string{"glooe-grafana", "glooe-prometheus"}
fun... |
package main
import (
"github.com/brutella/hc"
"github.com/brutella/hc/accessory"
"github.com/brutella/hc/characteristic"
"github.com/brutella/hc/service"
"bufio"
"flag"
"fmt"
"log"
"math/rand"
"net/http"
"reflect"
"regexp"
"strconv"
"time"
)
var sensorHost string
var sensorPort int
var secondsBetweenR... |
// Copyright 2017 The GoReporter 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 ua
import (
//"fmt"
"net/http"
"regexp"
"strings"
)
var (
rxMaybeCrawlerPattern = regexp.MustCompile(`(?i)(?:bot|crawler|sp(i|y)der|search|worm|fetch|scaper|nutch)(?:[-_ ./;@()]|$)`)
rxMaybeFeedParserPattern = regexp.MustCompile(`(?i)(?:feed|web) ?parser`)
rxMaybeWatchdogPattern = regexp.MustCompi... |
package odoo
import (
"fmt"
)
// IrActionsServer represents ir.actions.server model.
type IrActionsServer struct {
LastUpdate *Time `xmlrpc:"__last_update,omptempty"`
BindingModelId *Many2One `xmlrpc:"binding_model_id,omptempty"`
BindingType *Selection `xmlrpc:"binding_type,omptempty"`
ChannelIds ... |
// (c) 2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avm
import (
"context"
"testing"
"time"
"github.com/alicebob/miniredis"
"github.com/liraxapp/avalanchego/ids"
"github.com/liraxapp/avalanchego/utils/logging"
"github.com/liraxapp/ortelius/cfg"
"github.com/li... |
// Copyright 2019 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writin... |
package main
import (
"fmt"
"reflect"
"regexp"
"strings"
"github.com/dave/dst"
"github.com/fatih/structtag"
)
var structTagRegexp = regexp.MustCompile("`([ ]*[a-zA-Z0-9_-]+:\".*\"[ ]*){2,}`")
// HasMultiKeyTags returns whether the given lines have a multikey struct line.
// It's used as an optimization step t... |
// Copyright © 2019 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 agr... |
package couchdb
import (
"context"
"errors"
"io/ioutil"
"net/http"
"testing"
"time"
"gitlab.com/flimzy/testy"
"github.com/go-kivik/kivik/v4/driver"
)
func TestChanges(t *testing.T) {
tests := []struct {
name string
options map[string]interface{}
db *db
status int
err string
etag ... |
/*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 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... |
/*
Copyright 2017 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 main
import (
"bufio"
"context"
"errors"
"net/http"
"os"
"os/signal"
"syscall"
"time"
kafka "github.com/ONSdigital/dp-kafka/v2"
"github.com/ONSdigital/dp-kafka/v2/avro"
"github.com/ONSdigital/log.go/v2/log"
"github.com/kelseyhightower/envconfig"
)
// AuditEvent represents the structure of the aud... |
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mocks
import (
"al.go/terminal"
"sync"
)
// Ensure, that ScreenMock does implement Screen.
// If this is not the case, regenerate this file with moq.
var _ terminal.Screen = &ScreenMock{}
// ScreenMock is a mock implementation of Screen.
//
... |
package sfu
import (
"bytes"
"context"
"encoding/binary"
"io"
"sync"
"time"
"github.com/pion/ion-sfu/pkg/log"
"github.com/pion/rtcp"
"github.com/pion/rtp"
"github.com/pion/webrtc/v3"
)
// SimpleSender represents a Sender which writes RTP to a webrtc track
type SimpleSender struct {
id string
... |
package graphics2d
import "github.com/jphsd/graphics2d/util"
// CurveStyle determines how the curve behaves relative to the path points. With Bezier, the
// path will intersect the mid-point of each path step. With Catmul, the path will intersect
// point.
type CurveStyle int
// Constants for curve styles.
const (
... |
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package queue
import (
"context"
"encoding/json"
"errors"
"fmt"
"reflect"
"strings"
"sync"
"time"
"code.gitea.io/gitea/modules/log"
"github.com/... |
/*
Given an integer array instructions, you are asked to create a sorted array from the elements in instructions.
You start with an empty container nums. For each element from left to right in instructions, insert it into nums.
The cost of each insertion is the minimum of the following:
The number of elements currentl... |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20210630preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type Gen2Environment struct {
pu... |
package twitch
import (
"encoding/json"
"fmt"
"math/rand"
"reflect"
"strings"
"testing"
)
// generateDummyID - Useful for testing
func generateDummyID() ID {
x := rand.Intn(10000000) + 10000000
return ID(fmt.Sprintf("%d", x))
}
func selectRand(inList []interface{}) interface{} {
return inList[rand.Intn(len(... |
package ethlike
import (
"context"
"fmt"
"strconv"
"sync"
"time"
)
// BlockCounter represents a block counter.
type BlockCounter struct {
structMutex sync.Mutex
latestBlockHeight uint64
subscriptionChannel chan block
waiters map[uint64][]chan uint64
watchers []*watcher
}
ty... |
package lib
import (
"fmt"
"net"
"net/http"
"os/exec"
"strings"
"time"
"code.google.com/p/goauth2/oauth"
)
type LocalServerConfig struct {
Port int
Timeout int
OS string
}
type RedirectResult struct {
Code string
Err error
}
type Redirect struct {
Result chan RedirectResult
ServerStart ... |
package engine
import (
"fmt"
"math"
"github.com/mumax/3/cuda"
"github.com/mumax/3/util"
)
// Adaptive Heun solver.
type secondHeun struct{}
// Adaptive Heun method, can be used as solver.Step
func (_ *secondHeun) Step() {
fmt.Println("#########################")
fmt.Println("Start of solver")
fmt.Println("N... |
package request
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
)
const (
TypeJSONUTF8 = "application/json; charset=UTF-8"
TypeJSON = "application/json"
)
var (
ErrNotFound = errors.New("not found")
)
var ErrStatusBou... |
package rmq
import (
"bytes"
"encoding/json"
"github.com/streadway/amqp"
"log"
)
// Queue object with settings and message chan
type Queue struct {
Channel *Channel
AmqpQueue *amqp.Queue
QueueName string
Durable bool
AutoDelete bool
Exclusive bool
NoWait bool
Arguments ... |
package googlecompute
import "fmt"
// DriverMock is a Driver implementation that is a mocked out so that
// it can be used for tests.
type DriverMock struct {
CreateImageName string
CreateImageDesc string
CreateImageFamily string
CreateImageZone string
CreateImageDisk ... |
package czid
// This file is for interracting with the czid API
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"github.com/spf13/viper"
"github.com/chanzuckerberg/czid-cli/pkg/auth0"
)
var defaultCZIDBaseURL = ""
// HTTPClient interface
type HTTPClient interface {... |
package main
import (
"encoding/json"
"strings"
)
type Deployment struct {
Id string
Name string `json:"name"`
Plan string `json:"plan"`
Location string `json:"location"`
CurrentPrimary string `json:"current_primary"`
Status ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.