text stringlengths 3.08k 10.4k |
|---|
/*
Copyright (c) 2017 OpenStack Foundation.
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 servo
import (
"fmt"
"io/ioutil"
"log"
"math"
"os"
"os/exec"
"strings"
"sync"
"time"
)
type blaster struct {
disabled bool
buffer chan string
done chan struct{}
servos chan servoPkg
_servos map[gpio]*Servo
rate chan time.Duration
ws *sync.WaitGroup
}
var _blaster *blaster
type gpi... |
/**
* Copyright 2014 @ S1N1 Team.
* name :
* author : jarryliu
* date : 2013-12-23 23:15
* description :
* history :
*/
package dps
import (
"errors"
"github.com/atnet/gof/web/ui/tree"
"go2o/src/core/domain/interface/sale"
"go2o/src/core/dto"
"strconv"
)
type saleService struct {
_rep sale.ISaleRep
}
f... |
package tree
import (
"bufio"
"bytes"
"errors"
"fmt"
"os"
"strconv"
"strings"
)
type Tree struct {
Name string
OnlyTopology bool
BranchLength float64
Left *Tree
Right *Tree
}
func splittingCommaIndex(input string) int {
var openCount, closedCount int = 0, 0
for i, r := range inpu... |
package zstd
/*
#define ZSTD_STATIC_LINKING_ONLY
#include "zstd.h"
#include "stdint.h" // for uintptr_t
// The following *_wrapper function are used for removing superfluous
// memory allocations when calling the wrapped functions from Go code.
// See https://github.com/golang/go/issues/24450 for details.
static si... |
package main
import (
"fmt"
"github.com/hfern/goseq"
)
type Any interface{}
type ServerMethod func(sv goseq.Server) interface{}
type ServerInfoMethod func(sv goseq.ServerInfo) interface{}
var serverMethodAccessors = map[string]ServerInfoMethod{
"bots": func(sv goseq.ServerInfo) interface{} { return sv.G... |
package resetSleep
import "unsafe"
type stack struct {
lo uintptr
hi uintptr
}
type waitReason uint8
type guintptr uintptr
type puintptr uintptr
type muintptr uintptr
// Package time knows the layout of this structure.
// If this struct changes, adjust ../time/sleep.go:/runtimeTimer.
type timer struct {
// If... |
package shorten
import (
"context"
"crypto/md5"
"encoding/json"
"errors"
"fmt"
"strings"
"time"
"github.com/pavelmemory/jobtome/internal"
"github.com/pavelmemory/jobtome/internal/storage"
"github.com/pavelmemory/jobtome/internal/storage/shorten"
)
const (
hashLen = 7 // TODO: this should be configurable
)... |
// Package observations sets up metric and trace exporting for IPFS cluster.
package observations
import (
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
logging "github.com/ipfs/go-log/v2"
)
var logger = logging.Logger("observations")
var (
// taken from ocgrpc (https://github.co... |
// Code generated by goa v3.0.2, DO NOT EDIT.
//
// discoverysvr HTTP client CLI support package
//
// Command:
// $ goa gen github.com/taothit/one-neat-thing-today/design
package cli
import (
"flag"
"fmt"
"net/http"
"os"
neatthingc "github.com/taothit/one-neat-thing-today/gen/http/neat_thing/client"
goahttp "... |
package buildah
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"arhat.dev/pkg/fshelper"
"arhat.dev/pkg/md5helper"
"arhat.dev/rs"
"arhat.dev/dukkha/pkg/constant"
"arhat.dev/dukkha/pkg/dukkha"
)
// stepCopy is structured `buildah copy`
type stepCopy struct {
rs.BaseField `yaml:"-"`
From copyFromSpec `yaml:"fr... |
package lib
import (
"context"
"errors"
"io"
"log"
"net"
"time"
"git.torproject.org/pluggable-transports/snowflake.git/common/turbotunnel"
"github.com/xtaci/kcp-go/v5"
"github.com/xtaci/smux"
)
const (
ReconnectTimeout = 10 * time.Second
SnowflakeTimeout = 20 * time.Second
// How long to wait for the OnO... |
// 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
// distributed unde... |
// Package cryptowrap JSON/Gob/MsgPack-based Marshaler/Unmarshaler with AES encryption
package cryptowrap
import (
"bytes"
"crypto/aes"
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"hash/crc32"
"io/ioutil"
aescrypt "github.com/Djarvur/go-aescrypt"
"github.com/pierrec/lz4"
"github.com/ugorji/go/codec"
)
/... |
// Copyright 2021 <NAME>
// SPDX-License-Identifier: MIT
package pepxml
import (
"encoding/xml"
)
// Types for parsing pepXML
// Content encapsulated the pepXML file content
type Content struct {
XMLName xml.Name `xml:"msms_pipeline_analysis"`
Date string `xml:"date,attr,... |
// Copyright (c) 2011-2017, HL7, Inc & The MITRE Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, ... |
package main
import (
"io/ioutil"
"os"
"time"
"bytes"
"net/http"
"encoding/json"
jwt_lib "github.com/dgrijalva/jwt-go"
"github.com/dgrijalva/jwt-go/request"
"github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)
// Global Configuration
type config struct {
Logg... |
package vecmath
import (
"fmt"
"math"
"github.com/etic4/vecmath/maths"
)
//Vec2 Représente un vecteur 2D
type Vec2 struct {
X float64
Y float64
}
//NewVector crée un nouveau vecteur
func NewVector(x, y float64) Vec2 {
return Vec2{x, y}
}
//FromPolar retourne un vecteur à partir de coordonées polaires
// para... |
package main
import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"regexp"
"time"
_ "github.com/jinzhu/gorm/dialects/mysql"
//"github.com/bountyeq/web/dao"
"github.com/bountyeq/web/bestiary"
"github.com/bountyeq/web/bounty"
"github.com/bountyeq/web/character"
"github.com/bountyeq/web/config"
"githu... |
// 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 writing, ... |
//Written by <NAME>
//This file contains the handler funcs for defined rest routes.
package main
import (
"github.com/gin-gonic/gin"
"github.com/jaypipes/ghw"
"github.com/semihalev/gin-stats"
"net/http"
"net/url"
"strconv"
"time"
)
//Cache for all active jobs
var jobs = map[string]*ImageJob{}
var imageJobError... |
// Package beego provides a reporter that wraps our datadog
// client with metrics for reporting request counts, error
// rates and request durations. It does this by providing
// a set of filters that can be used when initializing your
// router.
package beego
import (
stdcontext "context"
"fmt"
"net/http"
"sync"... |
package db
import (
"github.com/pkg/errors"
"github.com/satori/go.uuid"
"gorm.io/gorm"
"github.com/EggMD/EggMD/internal/strutil"
)
var (
// ErrDocumentNotFound 为文档不存在错误。
ErrDocumentNotFound = errors.New("document not found")
)
// DocumentsStore 是 Documents 文档操作的实现接口。
type DocumentsStore interface {
// GetDoc... |
package mapper
import (
"context"
"io/ioutil"
"log"
"os"
"bufio"
"encoding/json"
"fmt"
core "github.com/ipfs/go-ipfs/core"
gorpc "github.com/libp2p/go-libp2p-gorpc"
"github.com/omkarprabhu-98/go-ipfs-mapreduce/common"
)
type MapService struct {
Node *core.IpfsNode
}
func (ms *MapService) Map(ctx contex... |
package project
import (
"bufio"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
log "github.com/golang/glog"
)
// Lookup creates a string slice of string containing a "docker-friendly" environment string
// in the form of 'key=value'. It loop through the lookups and returns the latest value if
// mo... |
// Copyright © 2017 <NAME>, DH1TW <<EMAIL>>
//
// 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 rules_scala
import (
"fmt"
"log"
"sort"
"strings"
"github.com/bazelbuild/bazel-gazelle/config"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/bazelbuild/bazel-gazelle/resolve"
"github.com/bazelbuild/bazel-gazelle/rule"
"github.com/stackb/rules_proto/pkg/plugin/scalapb/scalapb"
"github.com/... |
package e2e_test
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"time"
gatewaydefaults "github.com/solo-io/gloo/projects/gateway/pkg/defaults"
"github.com/solo-io/go-utils/errors"
"github.com/hashicorp/consul/api"
"github.com/solo-io/gloo/test/v1helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/g... |
// @author Couchbase <<EMAIL>>
// @copyright 2016-Present Couchbase, Inc.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
// in that file, in accordance with the Business Source License, use of this
// software wi... |
// Copyright 2020 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 client
import (
"context"
"fmt"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
kscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/r... |
package mqtt
import (
"encoding/binary"
"errors"
"io"
"net"
"time"
)
const fixedHeaderBytes int = 2
type Encoder struct {
dat [blockSize]byte
buf []byte
start int
end int
ws bool
}
func (en *Encoder) Reset(ws bool) {
en.ws = ws
en.ResetState()
}
func (en *Encoder) ResetState() {
if len(en.buf) =... |
package gateways
import (
"regexp"
"strconv"
"strings"
api_networking_v1alpha3 "istio.io/api/networking/v1alpha3"
networking_v1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
"k8s.io/apimachinery/pkg/labels"
"github.com/kiali/kiali/models"
"github.com/kiali/kiali/util/intutil"
)
type MultiMatchChe... |
// This "script" generates a file called Keybindings_{{.LANG}}.md
// in current working directory.
//
// The content of this generated file is a keybindings cheatsheet.
//
// To generate cheatsheet in english run:
// go run scripts/generate_cheatsheet.go
package cheatsheet
import (
"fmt"
"log"
"os"
"github.com... |
package report
import (
"encoding/json"
"github.com/aws/aws-sdk-go-v2/service/ssm/types"
"github.com/mariotoffia/ssm/internal/asm"
"github.com/mariotoffia/ssm/internal/common"
"github.com/mariotoffia/ssm/internal/pms"
"github.com/mariotoffia/ssm/parser"
"github.com/mariotoffia/ssm/support"
"github.com/rs/zero... |
package ipam
import (
"net"
"strings"
"sync"
"github.com/go-logr/logr"
"github.com/kubesphere/porter/pkg/errors"
"github.com/kubesphere/porter/pkg/util"
"github.com/kubesphere/porter/pkg/util/cidr"
"k8s.io/apimachinery/pkg/types"
)
func NewDataStore(log logr.Logger) *DataStore {
return &DataStore{
Log: ... |
package core
import (
"fmt"
"net"
"net/url"
"os"
"os/exec"
"path"
"strconv"
"strings"
"github.com/jaeles-project/jaeles/libs"
"github.com/jaeles-project/jaeles/utils"
"github.com/thoas/go-funk"
"github.com/robertkrimen/otto"
)
// @NOTE: Middleware allow execute command on your machine
// So make sure yo... |
/*
Copyright 2020 ceph-csi 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, softwa... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package applicationautoscaling
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for ... |
package log
import (
"github.com/godaddy-x/jorm/util"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
stdlog "log"
"os"
"strings"
)
const (
DEBUG = "debug"
INFO = "info"
WARN = "warn"
ERROR = "error"
FATAL = "fatal"
)
var zapLog = &ZapLog{}
func init() {
InitDefaultLog(... |
/*
Copyright 2019 The Machine Controller 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 w... |
package cloudflare
import (
"encoding/binary"
"fmt"
"math/big"
)
type gfP [4]uint64
// newGFp creates new gfP from int64
func newGFp(x int64) (out *gfP) {
if x >= 0 {
out = &gfP{uint64(x)}
} else {
out = &gfP{uint64(-x)}
gfpNeg(out, out)
}
montEncode(out, out)
return out
}
// bigToGFp enables one to ... |
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
"html/template"
"net"
"net/http"
"strings"
"time"
humanize "github.com/dustin/go-humanize"
"github.com/julienschmidt/httprouter"
)
var (
funcMap = template.FuncMap{
"sub": func(a, b int64) int64 {
return a - b
},
"add": func(a, b int64) i... |
package strutil_test
import (
"fmt"
"testing"
"github.com/gookit/goutil/strutil"
"github.com/stretchr/testify/assert"
)
func TestTrim(t *testing.T) {
is := assert.New(t)
// Trim
tests := map[string]string{
"abc ": "",
" abc": "",
" abc ": "",
"abc,,": ",",
"abc,.": ",.",
}
for sample, cutSet :=... |
package p2p
import (
"context"
"crypto/rand"
"testing"
"github.com/golang/protobuf/proto"
libp2p "github.com/libp2p/go-libp2p"
crypto "github.com/libp2p/go-libp2p-core/crypto"
dht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/sprawl/sprawl/config"
"github.com/sprawl/sprawl/identity"
"github.com/sprawl/s... |
/*
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 writing, software
distrib... |
package xvalid
import (
"github.com/go-xe2/x/core/structs"
"github.com/go-xe2/x/type/t"
"strings"
)
var (
// 同时支持valid和v标签,xvalid,gvalid,优先使用valid
structTagPriority = []string{"xvalid", "valid", "v", "gvalid"}
)
// 校验struct对象属性,object参数也可以是一个指向对象的指针,返回值同CheckMap方法。
// struct的数据校验结果信息是顺序的。
func CheckStruct(objec... |
// Copyright 2021 Fugue, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package connect
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::Connect::C... |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package aws
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A Region represents any valid Amazon region that may... |
/*
Copyright 2016 The Kubernetes 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 ag... |
package scanner
import (
"errors"
"fmt"
"strconv"
"strings"
yaml "gopkg.in/yaml.v2"
"github.com/bitrise-io/bitrise-init/models"
bitriseModels "github.com/bitrise-io/bitrise/models"
envmanModels "github.com/bitrise-io/envman/models"
"github.com/bitrise-io/goinp/goinp"
)
func getDefaultValue(opt models.Optio... |
package qln
import (
"fmt"
"log"
"github.com/adiabat/btcd/btcec"
"github.com/mit-dci/lit/lndc"
"github.com/mit-dci/lit/lnutil"
)
// Gets the list of ports where LitNode is listening for incoming connections,
// & the connection key
func (nd *LitNode) GetLisAddressAndPorts() (
string, []string) {
idPriv := nd... |
// Copyright 2014 The Cockroach 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... |
// +build !noclient_grpc
/*
Copyright 2020 The arhat.dev 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 ... |
// 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... |
// +build unit
// Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or... |
// Code generated by github.com/vektah/dataloaden, DO NOT EDIT.
package dataloader
import (
"sync"
"time"
"github.com/zvandehy/DataTrain/nba_graphql/graph/model"
)
// SimilarPlayerLoaderConfig captures the config to create a new SimilarPlayerLoader
type SimilarPlayerLoaderConfig struct {
// Fetch is a method th... |
/*
Copyright 2020 The OpenEBS 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... |
// Copyright 2018 XService, 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. A copy of the License is
// located at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// or in the "license" file accompanyi... |
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
package emulator
import (
"math/rand"
"time"
"github.com/onflow/flow-go/engine/execution/state/delta"
"github.com/onflow/flow-go/fvm"
"github.com/onflow/flow-go/fvm/state"
flowgo "github.com/onflow/flow-go/model/flow"
)
type IndexedTransactionResult struct {
Transaction *fvm.TransactionProcedure
Index ... |
package runner
import (
"archive/zip"
"context"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/nuclei/v2/pkg/catalog/config"
"github.com/projectdiscovery/n... |
/*
the seqio package contains custom types and methods for holding and processing sequence data
*/
package seqio
import (
"fmt"
"unicode"
"github.com/will-rowe/groot/src/minhash"
)
// encoding used by the FASTQ file
const encoding = 33
// complementBases is the lookup table used during reverse complementation
v... |
// Copyright 2012-present <NAME>. All rights reserved.
// Use of this source code is governed by a MIT-license.
// See http://olivere.mit-license.org/license.txt for details.
package elastic
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"github.com/pkg/errors"
)
// checkResponse w... |
/*
* 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 ... |
package integrationtests
import (
"fmt"
"os"
"testing"
"github.com/mitchellh/go-homedir"
"github.com/stretchr/testify/require"
"gotest.tools/poll"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clie... |
package eventlogstore
import (
ipfslog "berty.tech/go-ipfs-log"
"berty.tech/go-ipfs-log/identityprovider"
"berty.tech/go-orbit-db/address"
"berty.tech/go-orbit-db/iface"
"berty.tech/go-orbit-db/stores/basestore"
"berty.tech/go-orbit-db/stores/operation"
"context"
"github.com/ipfs/go-cid"
coreapi "github.com/i... |
// +build windows
package ebpf
import (
"expvar"
"fmt"
"math"
"sync"
"time"
"github.com/DataDog/datadog-agent/pkg/network"
"github.com/DataDog/datadog-agent/pkg/util/log"
)
const (
defaultPollInterval = int(15)
)
var (
expvarEndpoints map[string]*expvar.Map
expvarTypes = []string{"state", "driver_tot... |
package foghorn
import (
"io/ioutil"
"os"
"path"
"path/filepath"
"testing"
"github.com/google/go-cmp/cmp"
lighthousev1alpha1 "github.com/jenkins-x/lighthouse/pkg/apis/lighthouse/v1alpha1"
"github.com/jenkins-x/lighthouse/pkg/config"
"github.com/jenkins-x/lighthouse/pkg/config/branchprotection"
"github.com/j... |
package main
import (
b64 "encoding/base64"
"encoding/json"
log "github.com/Sirupsen/logrus"
"github.com/denverdino/aliyungo/common"
"github.com/denverdino/aliyungo/ecs"
"github.com/denverdino/aliyungo/metadata"
"io/ioutil"
"net/http"
"os"
"time"
)
// struct for access key
type DefaultOptions struct {
Glob... |
package terraform
import (
"fmt"
)
// ImportStateTransformer is a GraphTransformer that adds nodes to the
// graph to represent the imports we want to do for resources.
type ImportStateTransformer struct {
Targets []*ImportTarget
}
func (t *ImportStateTransformer) Transform(g *Graph) error {
nodes :=... |
package simvillage
import (
"fmt"
"math/rand"
)
// Mood manages daily moods and emotions
type Mood struct {
mood string
is_depressed bool
happy int
sad int
productivity float64
mood_events []*MoodEvent
log []string
}
func NewMood() *Mood {
m := &Mood{
is_depressed: false... |
// Copyright 2015 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
package standard
import (
"crypto/tls"
"net"
"net/http"
"sync"
"time"
"github.com/trafficstars/echo-engine"
"github.com/trafficstars/echo-engine/engine"
"github.com/trafficstars/echo-engine/log"
glog "github.com/labstack/gommon/log"
)
type (
// Server implements `engine.Server`.
Server struct {
*http.Se... |
package jsonptrerror_test
import (
"bytes"
"encoding/json"
"io"
"reflect"
"sort"
"strings"
"testing"
"github.com/mohae/deepcopy"
"github.com/dolmen-go/jsonptrerror"
)
func TestDecoder(t *testing.T) {
decodeAll := func(dec interface {
Decode(interface{}) error
Token() (json.Token, error)
}, value inte... |
package usercmd
import (
"context"
"fmt"
"net/http"
"os"
"strings"
"sync"
"github.com/go-logr/logr"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/validation"
"github.com/epinio/epinio/helpers"
"github.com/epinio/epinio/internal/duration"
"github.com/epinio/epinio/pkg/api/core/v1/models"
)
type P... |
package blockset
import (
"sync/atomic"
"golang.org/x/net/context"
"github.com/RoaringBitmap/roaring"
"github.com/coreos/pkg/capnslog"
"github.com/coreos/torus"
)
type baseBlockset struct {
ids uint64
blocks []torus.BlockRef
store torus.BlockStore
blocksize uint64
}
var _ blockset = &baseBloc... |
// Copyright (c) 2019 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... |
/**
* go-mapbox Maps Module Utils
* Utilities and Helpers for dealing with maps and map tiles
* See https://www.mapbox.com/api-documentation/#maps for API information
*
* https://github.com/JayBusch/go-mapbox
* Copyright 2017 <NAME>
*/
package maps
import (
"bufio"
"bytes"
"image"
"image/draw"
"image/jpeg... |
package dbtest
// mgo - MongoDB driver for Go
// Copyright (c) 2010-2013 - <NAME> <<EMAIL>>
// 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 t... |
package admin
import (
"encoding/json"
"reflect"
"testing"
"github.com/qor/qor"
"github.com/qor/qor/resource"
)
func generateResourceMenu(resource *Resource) *Menu {
return &Menu{rawPath: resource.ToParam(), Name: resource.Name}
}
func TestAddMenuAndGetMenus(t *testing.T) {
admin := New(&qor.Config{})
menu ... |
package rod
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"net/url"
"path/filepath"
"reflect"
"regexp"
"time"
"github.com/go-rod/rod/lib/assets/js"
"github.com/go-rod/rod/lib/cdp"
"github.com/go-rod/rod/lib/proto"
"github.com/go-rod/rod/lib/utils"
)
// Client interface
... |
// Copyright 2020 The Mellium Contributors.
// Use of this source code is governed by the BSD 2-clause
// license that can be found in the LICENSE file.
package stanza_test
import (
"encoding/xml"
"regexp"
"strconv"
"strings"
"testing"
"mellium.im/xmlstream"
"mellium.im/xmpp/jid"
"mellium.im/xmpp/stanza"
)
... |
package goDecide
type loginResponse struct {
Status string `json:"status"`
Data struct {
Token string `json:"token"`
} `json:"data"`
Message string `json:"message"`
Code int `json:"code"`
}
func (lr *loginResponse) isSuccess() bool {
return lr.Status == "success"
}
type analysisResponse struct {
Sta... |
package handshake
// A Tag in the QUIC crypto
type Tag uint32
const (
// TagCHLO is a client hello
TagCHLO Tag = 'C' + 'H'<<8 + 'L'<<16 + 'O'<<24
// TagREJ is a server hello rejection
TagREJ Tag = 'R' + 'E'<<8 + 'J'<<16
// TagSCFG is a server config
TagSCFG Tag = 'S' + 'C'<<8 + 'F'<<16 + 'G'<<24
// TagPAD is ... |
package goscraper
import (
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
url2 "net/url"
"regexp"
"strings"
"sync"
"time"
"github.com/willf/bloom"
"golang.org/x/net/html"
)
const (
maxRate = 3
httpTimeout = 10
agents = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) ... |
package config
import (
"fmt"
"strings"
"time"
"github.com/spf13/viper"
)
type Config struct {
Infos map[string]*InfoConfig `mapstructure:"infos"`
Diag *DiagConfig `mapstructure:"diag"`
}
type InfoConfig struct {
Node NodeConfig `mapstructure:"node"`
Output OutputConfig ... |
// +build extended
package extended
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
buildapi "github.com/openshift/origin/pkg/bu... |
// 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... |
// Code generated by go-swagger; DO NOT EDIT.
package config
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/g... |
/*
* Copyright 2020 The Dragonfly 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 la... |
package raymond
import (
"fmt"
"io/ioutil"
"reflect"
"runtime"
"sync"
"github.com/reflect/raymond/ast"
"github.com/reflect/raymond/parser"
)
// TemplateOptions are options that can be used to configure a specific
// template's behavior.
type TemplateOptions struct {
// True if content should not be HTML-esca... |
// Copyright 2015-2017 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !plan9
// +build !plan9
package termios
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"syscall"
"golang.org/x/sys/unix"
)
// TTYIO ... |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: user_money_deposited.proto
package v1
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto... |
package stages
import (
"bytes"
"fmt"
"regexp"
"sync"
"time"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/grafana/loki/clients/pkg/promtail/api"
"github.com/grafana/loki/pkg/logp... |
// Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License included
// in the file licenses/BSL.txt and at www.mariadb.com/bsl11.
//
// Change Date: 2022-10-01
//
// On the date above, in accordance with the Business Source License, use
// of this software will be gov... |
/*
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, ... |
/*
* 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 ... |
package strutil
import (
"fmt"
"reflect"
"strconv"
"unsafe"
"github.com/jxskiss/gopkg/reflectx"
)
// Format mimics subset features of the python string.format function.
//
// It formats the string using given keyword arguments and positional arguments.
// kwArgs can be a map[string]interface{}, map[string]strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.