text stringlengths 3.08k 10.4k |
|---|
// Copyright (C) 2017 NTT Innovation Institute, 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 applicabl... |
//
// 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 main
import (
"crypto/md5"
"fmt"
"hash/crc32"
"sort"
"strconv"
)
var nodes = []string{
"server-0",
"server-1",
"server-2",
"server-3",
"server-4",
"server-5",
"server-6",
"server-7",
"server-8",
"server-9",
}
func main() {
/**************************************************/
d := NewDistri... |
/*
Copyright SecureKey Technologies Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package startcmd
import (
"encoding/json"
"net/http"
"strconv"
"time"
"github.com/gorilla/mux"
"github.com/rs/cors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/trustbloc/edge-core/... |
package stacks
// ValidJSONTemplate is a valid OpenStack Heat template in JSON format
const ValidJSONTemplate = `
{
"heat_template_version": "2014-10-16",
"parameters": {
"flavor": {
"default": 4353,
"description": "Flavor for the server to be created",
"hidden": true,
"type"... |
// Copyright 2017-2021 The Usacloud 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 o... |
package command
import (
"fmt"
"io"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/context/docker"
"github.com/docker/cli/cli/context/store"
cliflags "github.com/docker/cli/cli/flags"
"github.com/pkg/errors"
)
const (
// DefaultContextName is the name reserved for the default contex... |
package lstoremem
import (
"sync"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
core "github.com/textileio/go-threads/core/logstore"
"github.com/textileio/go-threads/core/thread"
"github.com/textileio/go-threads/util"
)
type memoryHeadBook struct {
sync.RWMutex
threads map[thread.ID]struct... |
package v1_test
import (
"bytes"
"encoding/json"
"fmt"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/assert"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"net/http"
"net/http/httptest"
"profile/api"
v1 "profile/api/v1"
"profile/app"
"profile/model"
"testin... |
package files
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
"github.com/redhatinsights/edge-api/config"
... |
/*
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, ... |
/*
Copyright 2016 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, ... |
// Copyright (c) 2017-2021 VMware, Inc. or its affiliates
// SPDX-License-Identifier: Apache-2.0
package upgrade
import (
"io"
"os/exec"
"path/filepath"
"strconv"
"github.com/blang/semver/v4"
"github.com/greenplum-db/gp-common-go-libs/gplog"
)
const DefaultHubPort = 7527
const DefaultAgentPort = 6416
// exec... |
package cmd
import (
"bytes"
"errors"
"fmt"
"io"
"os/exec"
"strings"
"unicode"
)
//是否开启debug
var Debug bool = false
//允许管道出现的最大次数
var SPLIT_NUM int = 20
//运行命令, 支持管道
//示例1: RunCommand("ls /home/")
//示例2: RunCommand("ps auxwww | grep init | grep -v grep")
func RunCommand(cmd string) ([]string, error) {
retu... |
package util
type IPProtocol byte
// IP Protocols. From: http://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
const (
HOPOPT = 0x00
ICMP = 0x01
IGMP = 0x02
GGP = 0x03
IPv4Encapsulation = 0x04
ST = 0x05
TCP = 0x06
CBT ... |
package player
import (
"bufio"
"errors"
"fmt"
"math/rand"
"os"
"path/filepath"
"strings"
"time"
"github.com/eiannone/keyboard"
"github.com/faiface/beep"
"github.com/faiface/beep/flac"
"github.com/faiface/beep/mp3"
"github.com/faiface/beep/speaker"
"github.com/faiface/beep/vorbis"
"github.com/faiface/... |
package main
import (
"fmt"
"go/ast"
"go/build"
"go/importer"
"go/parser"
"go/token"
"go/types"
"log"
"os"
"path/filepath"
"strings"
ignore "github.com/sabhiram/go-gitignore"
"github.com/montanaflynn/broccoli/fs"
)
// Generator collects the necessary info about the package and
// bundles the provided a... |
package solar
import "math"
const (
// 初候
FirstPentad = 0
// 次候
SecondPentad = 1
// 末候
ThirdPentad = 2
)
// Pentad 候
// 一个节气分三候: 初候,伺候,末候
// 三候将一个节气均匀分为各5天, 个别候为6天
type Pentad int
func (p Pentad) String() string {
if !p.IsValid() {
return ""
}
return [3]string{"初候", "次候", "末候"}[p]
}
func (p Pentad) IsVa... |
/*
* Copyright (c) 2015-2016 by MemSQL. 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... |
package controllers
import (
"encoding/json"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"github.com/Frank-gh/xss/models"
"github.com/Frank-gh/xss/utils"
)
type AddressController struct {
beego.Controller
}
type AddressListRtnJson struct {
models.XssAddress
ProviceName string `json:"provice_na... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iam
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/GetContextKeysForPrincipalPolicyRequest
ty... |
// Copyright (c) 2019 <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 2016 The Rook 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 applicable law or agreed to ... |
package containers
import (
"bufio"
"fmt"
"io"
"strings"
"github.com/containers/podman-tui/pdcs/connection"
"github.com/containers/podman/v3/pkg/api/handlers"
"github.com/containers/podman/v3/pkg/bindings/containers"
"github.com/containers/podman/v3/pkg/env"
"github.com/rs/zerolog/log"
)
// ExecOption conta... |
package pay
import (
"encoding/xml"
"fmt"
"github.com/cnfinder/wechat/util"
)
var queryOrderGateway = "https://api.mch.weixin.qq.com/pay/orderquery"
// 请求参数
type QueryOrderRequest struct {
Appid string `xml:"appid,omitempty" json:"appid,omitempty"` // 必传
MchId string `xml:"mch_id,omitempty" json:"... |
// Copyright 2018 The Kubesphere 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 a... |
/*
* Copyright 2018-2020 The NATS 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 asset
import (
"github.com/tendermint/dex-demo/pkg/log"
"github.com/tendermint/dex-demo/types/store"
"github.com/tendermint/dex-demo/x/asset/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"
)
const (
seqKey = "seq"
valKey = "va... |
package store
import (
"context"
"fmt"
"github.com/edditen/etlog"
"github.com/edditen/evolvest/api/pb/evolvest"
"github.com/edditen/evolvest/pkg/common"
"github.com/edditen/evolvest/pkg/common/config"
"github.com/edditen/evolvest/pkg/common/utils"
"github.com/edditen/evolvest/pkg/runnable"
"google.golang.org/... |
/*
Copyright (C) 2020-2022 <NAME> <<EMAIL>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in th... |
package fts
import (
"bytes"
"compress/gzip"
"encoding/base64"
"regexp"
"strings"
"unicode/utf8"
"github.com/heyvito/docuowl/fs"
"github.com/heyvito/docuowl/fts/lang"
)
//go:generate go run ../generators/fts-stopwords.go
//go:generate go run ../generators/fts-special.go
const MinWordLength = 3
func wordLen... |
package main
import (
"context"
"flag"
"fmt"
"os"
"strings"
"github.com/openshift/windows-machine-config-operator/pkg/apis"
"github.com/openshift/windows-machine-config-operator/pkg/cluster"
"github.com/openshift/windows-machine-config-operator/pkg/controller"
"github.com/openshift/windows-machine-config-ope... |
package image
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"sort"
"strings"
"time"
"github.com/cenk/backoff"
"github.com/pkg/errors"
workererrors "github.com/travis-ci/worker/errors"
)
const (
imageAPIRequestContentType = "application/x-www-form-urlencoded; boundary=NL"
)
type APISele... |
///
// Modified BSD 3-Clause Clear License
//
// Copyright (c) 2019 Insolar Technologies GmbH
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted (subject to the limitations in the disclaimer below) provided that
// the following conditions ... |
// Copyright 2016 The Gosl 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 la
/*
#ifdef WIN32
#define LONG long long
#else
#define LONG long
#endif
#include <umfpack.h>
*/
import "C"
import (
"unsafe"
"github.com/cpmech/... |
package binaryops
import (
"testing"
"github.com/gofed/symbols-extractor/pkg/parser/contracts/typevars"
gotypes "github.com/gofed/symbols-extractor/pkg/types"
cutils "github.com/gofed/symbols-extractor/tests/integration/contracts"
)
func TestSelfTypePropagation(t *testing.T) {
gopkg := "github.com/gofed/symbol... |
package ktf
import (
"context"
"fmt"
"strings"
"github.com/blang/semver/v4"
"github.com/spf13/cobra"
"github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/httpbin"
"github.com/kong/kubernetes-testing-framework/pkg/clusters/addons/istio"
"github.com/kong/kubernetes-testing-framework/pkg/clusters/a... |
package cmd
import (
"errors"
"fmt"
"github.com/briandowns/spinner"
"github.com/spf13/cobra"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"time"
)
var contents = `# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, <... |
package take8
import "fmt"
const (
// 持ち駒を打つ 100~113
// 先手飛打
HAND_R1 = Square(100)
HAND_B1 = Square(101)
HAND_G1 = Square(102)
HAND_S1 = Square(103)
HAND_N1 = Square(104)
HAND_L1 = Square(105)
HAND_P1 = Square(106)
HAND_R2 = Square(107)
HAND_B2 ... |
package plan
import (
"context"
"fmt"
"strings"
"sync"
"time"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/plan/task"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
"cuelang.org/go/cue"
cueflow "cuelang.org/go/tools/flow"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
)
... |
package model
import (
"errors"
"fmt"
)
const (
// InvalidJSON is returned when a json string can't be read
InvalidJSON AppErrorCode = "InvalidJson"
// InvalidYAML is returned when a yaml string can't be read
InvalidYAML AppErrorCode = "InvalidYAML"
// InvalidYAMLWithInfo is returned when a yaml string can'... |
package main
import (
"flag"
"fmt"
"io/ioutil"
"net"
"os"
"os/signal"
"os/user"
"syscall"
"github.com/dshearer/jobber/common"
)
var gUser *user.User
var gIpcServer IpcServer
var gJobManager *JobManager
func quit(exitCode int) {
if gIpcServer != nil {
gIpcServer.Stop()
}
if gJobManager != nil {
gJobM... |
package renderer
import ("github.com/goxjs/gl"
"github.com/goxjs/glfw"
"github.com/shibukawa/nanovgo"
"github.com/austinwade/cryptobox/currency"
"strconv"
"strings"
)
var windowWidth = 1950
var windowHeight = 70
var context *nanovgo.Context
var marqueePositionOne = 2000.0
var marqueePositionTwo = 4625.0
var bl... |
package shellchangemaker
import (
"bytes"
"context"
"fmt"
"os/exec"
"strings"
"time"
"github.com/cresta/gitops-autobot/internal/autobotcfg"
"github.com/cresta/gitops-autobot/internal/changemaker"
"github.com/cresta/zapctx"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go... |
package geo
import (
"math"
"github.com/golang/geo/s1"
"github.com/golang/geo/s2"
)
const (
// According to Wikipedia, the Earth's radius is about 6,371km
EARTH_RADIUS = 6371
)
// Geometry is a geometric shape that can be used to
// verify whether Geo point is contained in there or not.
type Geometry interface... |
package pvcwatcher
import (
"context"
"fmt"
"reflect"
"strings"
"time"
snapv1 "github.com/kubernetes-incubator/external-storage/snapshot/pkg/apis/crd/v1"
"github.com/libopenstorage/stork/drivers/volume"
storkv1 "github.com/libopenstorage/stork/pkg/apis/stork/v1alpha1"
"github.com/libopenstorage/stork/pkg/con... |
// +build loong64
// +build linux
package runtime
const (
_EINTR = 0x4
_EAGAIN = 0xb
_ENOMEM = 0xc
_ENOSYS = 0x26
_PROT_NONE = 0x0
_PROT_READ = 0x1
_PROT_WRITE = 0x2
_PROT_EXEC = 0x4
_MAP_ANON = 0x20
_MAP_PRIVATE = 0x2
_MAP_FIXED = 0x10
_MADV_DONTNEED = 0x4
_MADV_FREE = 0x8
_MADV_HUG... |
package zabbix
import (
"fmt"
"testing"
"github.com/nzolot/go-zabbix-api"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)
func TestAccZabbixItem_Basic(t *testing.T) {
strID := acctest... |
package static
import (
"bytes"
"compress/gzip"
"encoding/base64"
"errors"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"sort"
"strings"
)
const (
pathSep = "/"
)
// DirFile contains the static directory and file content info
type DirFile struct {
Path string
Name string
Size in... |
package config
import (
"encoding/json"
"io/ioutil"
"strings"
"github.com/QOSGroup/cassini/log"
)
// Config 封装配置数据
type Config struct {
// ConfigFile 配置文件路径,通过命令行设置
ConfigFile string `json:"config,omitempty"`
// LogConfigFile 日志配置文件路径,通过命令行设置
LogConfigFile string `json:"log,omitempty"`
// Consensus 中继共识配... |
package pkg
import (
"bytes"
"encoding/binary"
"encoding/hex"
"fmt"
)
const (
SmgpSubmitRespPktLen = HeaderPktLen + 10 + 4 //26d, 0x1a
)
type SmgpSubmitReqPkt struct {
MsgType uint8 // 短消息类型
NeedReport uint8 // SP是否要求返回状态报告
Priority uint8 // 短消息发送优先级
ServiceID string // ... |
/*
* Copyright 2018, Automatic Inc.
* All rights reserved.
*
* Author: <NAME>
*/
package taskhawk
import (
"context"
"fmt"
"time"
)
// PreProcessHookQueueApp is the type of the function for pre-process hook for SQS apps
type PreProcessHookQueueApp func(request *QueueRequest) error
// PreProcessHookLambdaApp... |
package group
import (
"reflect"
"github.com/xelaj/vk/types"
)
type MessageNew struct {
Message *types.Message `json:"message"`
ClientInfo *types.ClientInfo `json:"client_info"`
}
type MessageReply = types.Message
type MessageEdit = types.Message
type MessageAllow struct {
UserId int `json:"user_id"`
... |
package wraps
import (
"bytes"
"crypto/md5"
"fmt"
"hash"
"net/http"
"strings"
"github.com/go-on/method"
"github.com/go-on/wrap"
)
type etag struct{}
// ETag buffers the body writes of the next handler and calculates a md5 Hash based on the Content-Type + Body
// combination and sets it as etag in the respon... |
package main
import (
"fmt"
"log"
"regexp"
"strconv"
"strings"
"github.com/coreos/go-semver/semver"
)
var reReleaseIdentifier = regexp.MustCompile(`^r[0-9]+$`)
// Conf - DBTag config struct
type Conf struct {
Version string
Flavour string
Latest string
Vstyle bool
}
// DBTag struct
type DBTag struct {
... |
package macro
import (
"fmt"
"go/ast"
"go/token"
"strings"
"golang.org/x/tools/go/ast/astutil"
)
func Try_μ(fn interface{}) error {
return nil
}
const tryErrName = "_tryerr_"
// MacroTryExpand try macro expander
func MacroTryExpand(
cur *astutil.Cursor,
parentStmt ast.Stmt,
idents []*ast.Ident,
callArgs ... |
/*
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, ... |
// Copyright © 2021 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
/*
Copyright 2016 The Rook 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 applicable law or agreed to ... |
package main
import (
"github.com/humboldt-xie/tinycraft/world"
)
type BlockType = world.BlockType
type Block = world.Block
func init() {
for i, _ := range Blocks {
world.RegisterBlockType(Blocks[i].Type, &Blocks[i])
}
}
var Blocks = []BlockType{
BlockType{Type: 0, IsObstacle: false, IsTransparent: true, Mode... |
package receivers
import (
"fmt"
"io/ioutil"
"os"
"path"
"reflect"
"testing"
"github.com/we4tech/uampnotif/pkg/common_errors"
"github.com/we4tech/uampnotif/pkg/templates"
)
func TestReadShouldRaiseConfigNotFound(t *testing.T) {
_, err := NewParser().Read("invalid-path.yaml")
if err == nil {
t.Error("cou... |
package blockchain
import (
"fmt"
"github.com/gregunz/Peerster/common"
"github.com/gregunz/Peerster/logger"
"github.com/gregunz/Peerster/models/packets/packets_gossiper"
"github.com/gregunz/Peerster/utils"
"sync"
"time"
)
type BCF struct {
forks map[string]*FileBlock
allBlocks map[string]*FileBlock
... |
package ldapissuer
import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
"strings"
"github.com/go-ldap/ldap/v3"
"go.aporeto.io/a3s/internal/identitymodifier"
"go.aporeto.io/a3s/pkgs/api"
"go.aporeto.io/a3s/pkgs/token"
)
// New returns a new LDAP issuer.
func New(ctx context.Context, source *api.LDAPSource, us... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package codebuild
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type ListProjectsInput struct {
_ struct{} `type:"structure"`
// During a previous call, if there are more than 100 ite... |
package monitor
import (
"errors"
"sync"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/go-kit/kit/sd"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/service"
)
var errNoInstances = errors.New("No instances to monitor")
// Interface represents an act... |
package sreq_test
import (
"encoding/json"
"reflect"
"testing"
"github.com/winterssy/sreq"
)
func TestParams(t *testing.T) {
p := make(sreq.Params)
p.Set("key1", "value1")
p.Set("key2", "value2")
p.Set("key3", "value3")
if p["key1"] != "value1" || p["key2"] != "value2" || p["key3"] != "value3" {
t.Fatal(... |
package mindmeld
import (
"context"
"fmt"
"io"
"log"
"net"
"sync"
"time"
"google.golang.org/grpc"
"github.com/dhowden/mindmeld/internal"
"github.com/dhowden/mindmeld/internal/protoproxy"
"github.com/dhowden/mindmeld/pb"
)
// ServiceClient registers services and constructs connections to pass
// traffic ... |
// Copyright © 2022 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// Un... |
// Copyright (c) 2020, Cloudflare. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the ... |
package server
import (
"bytes"
"context"
"errors"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"net/http/httptest"
"net/http/httputil"
"net/url"
"sync"
"sync/atomic"
"time"
"go-common/library/log"
)
type BroadcastProxy struct {
backend []string
probePath string
reverseProxy []*httputil... |
package npc
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/net/ipset"
)
type selectorSpec struct {
key string // string representation (for hash keying/equali... |
package operation
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"strings"
"github.com/hashicorp/go-multierror"
)
type MetricOperation struct {
Name string `json:"name"`
// Deprecated: use Value + Action="add" instead. Add only works for parsing from file
Add *float64 `json:"add,omitempty"` // sho... |
//
// This file is part of arduino-connector
//
// Copyright (C) 2017-2018 Arduino AG (http://www.arduino.cc/)
//
// 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.ap... |
// Faraday proxies all requests to Staffjoy
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"time"
"github.com/Sirupsen/logrus"
"github.com/gorilla/context"
"github.com/gorilla/mux"
"github.com/urfave/negroni"
"v2.staffjoy.com/faraday/services"
"v2.staffjoy.co... |
package twodof
import (
"encoding/json"
"math"
"math/cmplx"
)
import (
"github.com/tflovorn/cmatrix"
"github.com/tflovorn/scExplorer/bzone"
vec "github.com/tflovorn/scExplorer/vector"
)
// Expect some e.v.'s to be pure real or imaginary - panic if imag/real part
// is greater than zero_threshold.
const zero_thr... |
/*
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 agreed to in writing, soft... |
package filters
import (
"encoding/json"
"encoding/xml"
"github.com/hoysoft/yaag/middleware"
"github.com/hoysoft/yaag/yaag"
"github.com/hoysoft/yaag/yaag/models"
"github.com/revel/revel"
"log"
"net/http/httptest"
"strings"
"net/url"
"net/http"
)
func FilterForApiDoc(c *revel.Controller, fc []revel.Filter) ... |
package graphqlutil
import (
"html/template"
"net/http"
"github.com/cockroachdb/errors"
)
const giqlVersion = "0.11.11"
// ServeGraphiQL creates an http.HandlerFunc that serves the GraphiQL GUI.
func ServeGraphiQL(endpoint string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if err... |
package srchx
import (
"errors"
"math"
"strings"
"time"
"github.com/blevesearch/bleve/search/query"
"github.com/blevesearch/bleve"
"github.com/imdario/mergo"
"github.com/satori/go.uuid"
)
// Index - the index wrapper
type Index struct {
bleve bleve.Index
}
// NewIndex - initialize a new index wrapper
func... |
package main
import (
"fmt"
"math/rand"
"os"
"os/exec"
"riser/assets"
"riser/pkg/infra"
"riser/pkg/rc"
"riser/pkg/steps"
"riser/pkg/ui"
"time"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
const (
// DefaultKindNodeImage should roughly match the latest stable kubernetes version provided by GKE/AKS/... |
// +build js,wasm
// Package providerwrapper wraps a web3 provider in order to implement the
// RPCClient interface.
package providerwrapper
import (
"context"
"errors"
"fmt"
"math"
"math/rand"
"syscall/js"
"github.com/0xProject/0x-mesh/packages/browser/go/jsutil"
"github.com/ethereum/go-ethereum/ethclient"
... |
package code
import (
"bufio"
"io"
"strings"
"github.com/limacat76/aoc2015/library"
)
const (
off = false
on = true
)
// TurnOn turns on the lights. Returns how many lights it acted on.
func TurnOn(lights *[][]library.Value, start library.Point, end library.Point) library.Result {
return cycle(lights, start... |
// Code generated by gotdgen, DO NOT EDIT.
package tg
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_ = context.Background()
_ = fmt... |
package cipher
import (
"encoding/binary"
)
const blockSize = 16
var defaultRounds uint32 = 20
var constP uint32 = 0xa6d04033
var constQ uint32 = 0x800199a9
type Cipher struct {
rounds uint32
keyLen uint8
key []uint32
keySched []uint32
}
func NewCipher(key []byte) Cipher {
var c Cipher
for len(key... |
package blobstoredbstatesnapshotio
import (
"context"
"encoding/gob"
"fmt"
"time"
"go.uber.org/multierr"
"github.com/nyaxt/otaru/blobstore"
"github.com/nyaxt/otaru/btncrypt"
"github.com/nyaxt/otaru/inodedb"
"github.com/nyaxt/otaru/logger"
"github.com/nyaxt/otaru/metadata/statesnapshot"
"github.com/nyaxt/o... |
// Copyright (c) 2017-2021 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, mer... |
package clocks
import (
"bytes"
"image/color"
"log"
"math"
"time"
"github.com/fogleman/gg"
"github.com/golang/freetype/truetype"
"golang.org/x/image/bmp"
"golang.org/x/image/font/gofont/goregular"
)
var (
colorTicks color.Color = color.RGBA{R: 0x80, G: 0x80, B: 0x80, A: 0xFF}
colorArHo... |
package main
import (
"bytes"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
"github.com/caiguanhao/finddeb/debpkgapi"
)
func main() {
suite := flag.String("suite", "buster", "suite: jessie, stretch, buster, bullseye, sid ...")
arch := flag.String("arc... |
// Copyright 2014 Wandoujia Inc. All Rights Reserved.
// Licensed under the MIT (MIT-LICENSE.txt) license.
package main
import (
"bufio"
"io"
"net"
"os"
"strconv"
"strings"
"time"
redigo "github.com/garyburd/redigo/redis"
"github.com/pcncadcache/cachesystem/extern/redis-port/pkg/libs/io/ioutils"
"github.co... |
package svgmap
import (
"io"
svg "github.com/ajstarks/svgo"
"github.com/owulveryck/wardleyToGo/internal/wardley"
)
// svgMap is an object representing the map in SVG
type svgMap struct {
*svg.SVG
width int
height int
padLeft int
padBottom int
}
// newSvgMap creates an empty map. The caller must cal... |
package timeline
import (
"fmt"
"math"
"sort"
"strings"
"time"
cl "github.com/tlwr/operator-tools/pkg/colour"
)
type TimelineEntry interface {
Start() time.Time
End() (time.Time, bool)
Label() string
IsEvent() bool
IsWindow() bool
}
type Timeline interface {
Start() time.Time
End() time.Time
Entries... |
package websocket
import (
"net/http"
"net/http/httptest"
"raccoon/collection"
"raccoon/http/websocket/connection"
"raccoon/logger"
"raccoon/metrics"
pb "raccoon/proto"
"reflect"
"strings"
"testing"
"time"
"github.com/gorilla/mux"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"git... |
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"log"
"os"
"os/signal"
"strconv"
"syscall"
"regexp"
"text/template"
"time"
"github.com/hpcloud/tail"
"github.com/jackc/pgx/v4"
"github.com/joho/godotenv"
)
var logString = make(chan string, 10)
func jsonGetInt(val interface{}) interface{} ... |
package docker
import (
"archive/tar"
"bytes"
"fmt"
"io"
"os"
"path"
"path/filepath"
"github.com/Sirupsen/logrus"
"github.com/facebookgo/stackerr"
dockerclient "github.com/fsouza/go-dockerclient"
"golang.org/x/net/context"
)
type ContainerResponse struct {
Container *dockerclient.Container
Err err... |
/*
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 gob
import (
"bufio"
"encoding/gob"
"io"
"net"
"reflect"
"github.com/lxt1045/kits/io/channel"
"github.com/lxt1045/kits/log"
)
// Peer 一条连接一个Peer,连接的相关的信息可以存这里
type Peer struct {
//userIDs []uint64 //该连接对应的需求的所有userID,也就是该client订阅的所有user
logT *log.TraceInfoST
//reqFreeList *Header //Hearder的空闲对象列表... |
/*
* 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 2021 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... |
package main
import (
"encoding/hex"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"
"github.com/aarbt/bitcoin-base58"
"github.com/aarbt/bitcoin-network"
"github.com/aarbt/bitcoin-wallet/database"
"github.com/aarbt/bitcoin-wallet/inventory"
"github.com/aarbt/bitcoin... |
// github.com/bingohuang/go-codes
/**
题目: 257. 二叉树的所有路径
难度: 1
地址: https://leetcode-cn.com/problems/binary-tree-paths/
*/
package test
import (
"fmt"
"reflect"
"strconv"
"testing"
)
// input and ouput
type IO257 struct {
in *TreeNode
out []string
}
func Test257(t *testing.T) {
// add test cases
tc1_in := &Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.