text stringlengths 3.08k 10.4k |
|---|
// Copyright (C) 2019 Cisco Systems 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 agr... |
package main
import (
"bufio"
"errors"
"fmt"
"io"
"log"
"os"
"regexp"
"strconv"
"strings"
"time"
)
func readLine(filePath string) (func() (string, error), *bufio.Scanner, error) {
file, err := os.Open(filePath)
if err != nil {
return nil, nil, err
}
defer file.Close()
scanner := bufio.NewScanner(file... |
/*
MIT License
Copyright (c) 2020-2021 YPSI SAS
Centctl is developped by : <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 ... |
// Copyright 2010 The draw2d Authors. All rights reserved.
// created: 21/11/2010 by <NAME>
package draw2dbase
import (
"fmt"
"image"
"image/color"
"github.com/elcamino/draw2d"
"github.com/golang/freetype/truetype"
)
var DefaultFontData = draw2d.FontData{Name: "luxi", Family: draw2d.FontFamilySans, Style: dra... |
package model
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
func TestBoardSetup(t *testing.T) {
board := NewBoard()
assert.Equal(t, 0, board.Turn)
assert.Equal(t, 167, board.Pips[White])
assert.Equal(t, 167, board.Pips[Red])
}
func TestPipsCalculation(t *testing.T) {
position := [Spaces]in... |
//
// Copyright (c) 2020 <NAME> <<EMAIL>>
//
package phz
import (
"fmt"
"image"
"image/color"
"encoding/binary"
"hash/crc64"
)
const (
rle8EncodingLimit = 125 // Yah, I know. Feels weird. But required.
rle16EncodingLimit = 0xfff
)
var tab64 *crc64.Table
func hash64(data []byte) (hash uint64) {
if tab64 =... |
package cache
import (
"fmt"
"reflect"
"runtime"
"unsafe"
)
// shmget: get shared memort area identifier, please see man 2 shmget
func Shmget(key int, size int, flag int) (int, error) {
return shmget(key, size, flag)
}
// shmat: map/unmap shared memory, plase see man 2 shmat.
// golang gc won't affect on this.
... |
package middleware
import (
"basic-antd/model"
"basic-antd/pkg/jwt"
"basic-antd/tools"
"fmt"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"net"
"net/http"
"net/http/httputil"
"os"
"runtime/debug"
"strings"
"time"
)
// Ginzap returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap.
//
... |
/*
*
* Copyright 2019 gRPC 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 (
"bytes"
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/sethgrid/pester"
)
func newPesterClient(httpClient *http.Client) *pester.Client {
pesterClient := pester.NewExtendedClient(httpClient)
pesterClient.Concurrency = 1
pesterClien... |
package controller
import (
"context"
"fmt"
"github.com/Seagate/seagate-exos-x-csi/pkg/common"
"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog"
)
var (
volumeCaps = []csi.VolumeCapability_AccessMode{
{
Mode: csi.VolumeC... |
// Copyright 2017 The Chromium 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 main
import (
"context"
"strconv"
ds "go.chromium.org/gae/service/datastore"
"go.chromium.org/luci/common/errors"
"go.chromium.org/luci/com... |
package lib
import (
"fmt"
"math"
"math/rand"
"os"
"sync/atomic"
"time"
"unsafe"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
)
func init() {
rand.Seed(time.Now().UnixNa... |
package uchat
import (
"encoding/base64"
"encoding/json"
"errors"
"strings"
"time"
"github.com/jinzhu/gorm"
"github.com/lvzhihao/goutils"
"github.com/lvzhihao/uchatlib"
"github.com/lvzhihao/zhiya/models"
)
type ChatRoomMembersList struct {
ChatRoomUserData []map[string]string
}
/*
群会员信息回调
支持重复调用
*/
fu... |
// Copyright 2021 Plezentek, Inc. All rights reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicab... |
package sts
import (
"errors"
"fmt"
"go/types"
"strings"
)
var (
ErrEmptyLeftType = errors.New("left type is empty")
ErrEmptyRightType = errors.New("right type is empty")
ErrEmptyLeftField = errors.New("left field is empty")
ErrEmptRightField = errors.New("right field is empty")
ErrEmptyTag = errors.N... |
package gemini
import (
"bufio"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/lmx-Hexagram/gemini-generator/pkg/gemini/debug"
"github.com/lmx-Hexagram/gemini-generator/pkg/gemini/statusCode"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"path"
"strconv"
)
func New(certFile, keyFile, DefaultLang string) (e... |
package helmapi
import (
"bytes"
"fmt"
"github.com/softplan/tenkai-api/pkg/dbms/model"
"google.golang.org/grpc/status"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/portforwarder"
"k8s.io/helm/pkg/kube"
"sync"
)
//HelmServiceInterface - Interface
type Hel... |
package sparkypmtatracking
import (
"bufio"
"bytes"
"compress/gzip"
"encoding/binary"
"encoding/json"
"errors"
"io/ioutil"
"log"
"net/http"
"strconv"
"time"
"github.com/go-redis/redis"
"github.com/google/uuid"
)
// Make a SparkPost formatted unique event_id, which needs to be a decimal string 0 .. (2^63... |
package chain
import (
"time"
"github.com/AsynkronIT/protoactor-go/actor"
rpc "github.com/qlcchain/jsonrpc2"
"go.uber.org/zap"
"github.com/qlcchain/go-qlc/chain/context"
"github.com/qlcchain/go-qlc/common"
"github.com/qlcchain/go-qlc/common/event"
"github.com/qlcchain/go-qlc/common/topic"
"github.com/qlccha... |
/*
* Copyright 2021 - now, the original author or 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required b... |
package core
import (
"fmt"
"sort"
"strings"
)
type IndexElem interface {
Less(than IndexElem) bool
}
type Index interface {
Get(IndexElem) IndexElem
Put(IndexElem) bool
Remove(IndexElem) bool
}
type BTreeIndex struct {
root *bTreeNode
t uint
}
type bTreeNode struct {
elems []IndexElem
children []... |
// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
package main
import (
"bytes"
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
const BadFileContents = `
this is not a valid json file
`
func CreateBadFile(filename string) error {
return ioutil.WriteFile(filen... |
package integration
import (
"encoding/json"
"errors"
"fmt"
"os/exec"
"strings"
"testing"
"github.com/aerogear/mobile-cli/pkg/apis/servicecatalog/v1beta1"
)
const integrationTestPath = "createIntegrationTestData/"
func TestIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration testi... |
package telegram
import (
"errors"
"fmt"
"github.com/parnurzeal/gorequest"
)
type TeleBot struct {
baseUrl string
sender *gorequest.SuperAgent
chatID string
Errors []error
Body []byte
Response gorequest.Response
disableNotification... |
/*
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 under the License... |
package logger
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httputil"
"strings"
"github.com/asaskevich/govalidator"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/proxify/pkg/logger/elastic"
"github.com/projectdiscovery/proxify/pkg/logger/file"
"github.com/projectdiscovery/p... |
// Copyright 2016 NDP Systèmes. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
package main
import (
"fmt"
"net"
"os"
"strconv"
"time"
)
//用户信息
type User struct {
userName string
userAddr *net.UDPAddr
userListenConn *net.UDPConn
chatToConn *net.UDPConn
}
//服务器监听端口
const ListenPort = 1616
//缓冲区
const BufferSize = 1024
var buff = make([]byte, BufferSize)
//在线用户
var onl... |
// Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package utils
import (
"io"
"sort"
"github.com/juju/errors"
)
// SizeReaderAt combines io.ReaderAt with a Size method.
type SizeReaderAt interface {
// Size returns the size of the data readable
// from the reader.
Si... |
package log
import (
"fmt"
"strconv"
"time"
)
// Color выводит лог в более удобном для чтения в консоли виде, используя
// цветовые выделения и помещая параметры на новую строку.
type Color struct {
Levels map[Level]string // переопределение строк для вывода уровня
KeyIndent int // отступ от знач... |
package healthcheck
import (
"io"
"github.com/fastly/cli/pkg/common"
"github.com/fastly/cli/pkg/compute/manifest"
"github.com/fastly/cli/pkg/config"
"github.com/fastly/cli/pkg/errors"
"github.com/fastly/cli/pkg/text"
"github.com/fastly/go-fastly/fastly"
)
// UpdateCommand calls the Fastly API to update health... |
package main
import (
"bytes"
"errors"
"io/ioutil"
"log"
"net/http"
"strings"
"time"
"github.com/BurntSushi/toml"
)
// duration exists for TOML to handle durations
type duration time.Duration
// Unmarshals a duration from a string
func (d *duration) UnmarshalText(text []byte) error {
dt, err := time.ParseD... |
// Copyright 2015 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... |
package ppu
import (
"github.com/lazy-stripes/goholint/memory"
"github.com/lazy-stripes/goholint/ppu/states"
)
// Fetcher reads tile data from VRAM and pushes pixels to PPU FIFO.
type Fetcher struct {
Enabled bool
fifo *FIFO
vRAM memory.Addressable
ticks int
state, oldSt... |
package forms
import (
"errors"
"fmt"
"html/template"
"reflect"
"strings"
"github.com/gorilla/schema"
)
func NewDecoder() *schema.Decoder {
dec := schema.NewDecoder()
dec.SetAliasTag("forms")
return dec
}
func HTMLType(t reflect.Type) (string, error) {
switch t.Kind() {
case reflect.Bool:
return "check... |
// Copyright © 2021 <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
//Package handlers : collection of handlers (aka "HTTP middleware")
package handlers
import (
"context"
"net/http"
"github.com/layer5io/meshery/models"
"github.com/layer5io/meshkit/utils/kubernetes"
"github.com/sirupsen/logrus"
)
// ProviderMiddleware is a middleware to validate if a provider is set
func (h *H... |
package query
import (
"bytes"
"encoding/gob"
"log"
"strings"
)
type ReferenceNodeI interface {
NodeI
Aliaser
conditioner
nodeLinkI
Expander
}
// A ReferenceNode is a forward-pointing foreign key relationship, and can define a one-to-one or
// one-to-many relationship, depending on whether it is unique. If ... |
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"go/types"
"os"
"path/filepath"
"strconv"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/packages"
)
func godefPackages(cfg *packages.Config, filename string, src []byte, searchpos int) (*token.FileSet, types.Object, error) {
parser, ... |
package apirule
import (
"context"
"time"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
watchtools "k8s.io/client-go/tools/watch"
apiruleTypes "github.com/kyma-project/kyma/tests/function-controller/pkg/apirule/types"
"github.com/kyma-pr... |
// Package progress exposes utilities to asynchronously monitor and display processing progress.
package progress
import (
"bytes"
"fmt"
"io"
"time"
"github.com/mongodb/mongo-tools/common/text"
)
const (
DefaultWaitTime = 3 * time.Second
BarFilling = "#"
BarEmpty = "."
BarLeft ... |
package websocket
import (
"Futures-Go-demo/config"
"bytes"
"compress/gzip"
"encoding/binary"
"fmt"
"io/ioutil"
"log"
"golang.org/x/net/websocket"
)
var origin = "http://www.baidu.com"
//var url = "wss://www.hbdm.com/ws"
var buffer bytes.Buffer
func ParseGzip(data []byte, handleErr bool) ([]byte, error) {
... |
package main
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"os"
"github.com/tencentyun/cos-go-sdk-v5"
"github.com/tencentyun/cos-go-sdk-v5/debug"
)
func log_status(err error) {
if err == nil {
return
}
if cos.IsNotFoundError(err) {
// WARN
fmt.Println("WARN: Resource is not existed")
} else if... |
/* spider.go - the engine of mini spider */
/*
modification history
--------------------
2015/12/18, by <NAME>, create
*/
/*
DESCRIPTION
spider is the engine of mini spider, coordinate all the component.
*/
package spider
import (
"fmt"
"os"
"strings"
"time"
)
import (
"downloader"
"manager"
"parser"
"reques... |
// Copyright 2017 Weald Technology Trading
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ... |
package client
import (
"bytes"
"context"
"github.com/redresseur/loggerservice/utils/ioutils"
"github.com/redresseur/loggerservice/utils/sturcture"
"io"
"io/ioutil"
"os"
"runtime"
"sync/atomic"
"time"
)
var(
gChannelIO *channelIO
)
// 还要再封装一层
// 用channel封装一层
type channelIO struct {
// 加一个大的缓存队列
io *stru... |
/*
Copyright 2021 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, sof... |
/*
* Copyright (c) 2013, fromkeith
* 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, this
* list of condition... |
package models
import (
"fmt"
"time"
"github.com/transcom/mymove/pkg/unit"
"github.com/gobuffalo/pop/v5"
"github.com/gobuffalo/validate/v3"
"github.com/gobuffalo/validate/v3/validators"
"github.com/gofrs/uuid"
)
// PaymentServiceItemStatus is a type of Payment Service Item Status
type PaymentServiceItemStatu... |
//
// Copyright (c) 2018 Red Hat, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
package peer
import (
"bytes"
"crypto/sha1"
"fmt"
connection "gotor/cmd/packages/connection"
message "gotor/cmd/packages/message"
"log"
"runtime"
"time"
)
// MaxBlockSize is the largest number of bytes a request can ask for
const MaxBlockSize = 16384
// MaxBacklog is the number of unfulfilled requests a clie... |
package blocks
import (
"container/list"
"math"
"github.com/nickbryan/voxel/internal/oldernal/old/noise"
"github.com/go-gl/mathgl/mgl64"
)
type Chunk struct {
blocks BlockContainer
lightMap LightMapContainer
mesher *CulledMesher
Mesh MeshRenderer
Pos mgl64.Vec3
GridPos mgl64.Vec3
XMinus, XPl... |
package github
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"regexp"
"strings"
"github.com/urfave/cli"
"github.com/sensiblecodeio/hookbot/pkg/hookbot"
"github.com/sensiblecodeio/hookbot/pkg/listen"
)
var RegexParseHeader = regexp.MustCompile("^\\s*([^\\:]+)\\s*:\\s*(.*)$... |
// Copyright 2015 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
package main
import (
"context"
"fmt"
"io"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"syscall"
"github.com/aws/aws-lambda-go/lambda"
"github.com/function61/gokit/aws/lambdautils"
"github.com/function61/gokit/cryptorandombytes"
"github.com/function61/gokit/dynversion"
"github.com/function61/gokit/h... |
package road
import (
"fmt"
"go-simulate-a-city/common/commonmath"
"go-simulate-a-city/sim/config"
"go-simulate-a-city/sim/core/mailroom"
"go-simulate-a-city/sim/engine/core/dto"
"go-simulate-a-city/sim/engine/vehicle"
"github.com/ojrac/opensimplex-go"
"github.com/go-gl/mathgl/mgl32"
)
// Defines the node e... |
package pricing
import (
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"sync"
"sync/atomic"
"time"
pb "github.com/textileio/bidbot/gen/v1"
golog "github.com/textileio/go-log/v2"
)
const (
// If loading rules from CID gravity API takes longer than this timeout, turn it into background.
cidGravityLoadRul... |
/*
Copyright NetFoundry, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package rewrite
import (
"fmt"
"github.com/jonlawlor/matrixexp"
"reflect"
)
var rMatrixExp reflect.Type
func init() {
rMatrixExp = reflect.TypeOf((*matrixexp.Mat... |
//
// DISCLAIMER
//
// Copyright 2017 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless require... |
package rom
import (
"bytes"
"fmt"
"log"
)
// A Mutable is a memory data that can be changed by the randomizer.
type Mutable interface {
Mutate([]byte) error // change ROM bytes
Check([]byte) error // verify that the mutable matches the ROM
}
// A MutableRange is a length of mutable bytes starting at a given a... |
package amiibo
import (
"crypto/md5"
"encoding/json"
"fmt"
"reflect"
"time"
"golang.org/x/text/language"
)
var _ Amiibo = (JPNAmiibo{})
// JPNAmiibo is a formatted JPNChartItem and JPNLineupItem.
type JPNAmiibo struct {
Chart bool `json:"chart"`
// ID is the fully qualified ID for the Nintendo Amiibo produ... |
// Copyright (c) 2018-2021 Splunk Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
// *** 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 lightsail
import (
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a Lightsail Key Pair, for use with Lightsail Instances. These k... |
package main
import (
"fmt"
"net"
"net/http"
_ "net/http/pprof"
"strings"
"time"
"github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prometheus/client_golang/prometheus"
"gopkg.in/op/go-logging.v1"
"github.com/thought-machine/please/src/cli"
"github.com/thought-machine/please/tools/cache/cluster"
... |
package content
import (
"bytes"
"fmt"
"github.com/nboughton/go-roll"
"github.com/nboughton/swnt/content/format"
)
// Heresy with a Body
type Heresy struct {
Founder string
MajorHeresy string
Attitude string
Quirk string
}
// NewHeresy with random characteristics
func NewHeresy() Heresy {
h :=... |
package game
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestSuit_Left(t *testing.T) {
checkSuit := func(s, expected Suit) func(*testing.T) {
return func(t *testing.T) {
require.Equal(t, expected, s.Left())
}
}
t.Run("Clubs", checkSuit(SuitClubs, SuitSpades))
t.Run("Diamonds"... |
// *** 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 v1alpha1
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Returns information about a `WorkerPool`.
func LookupWorkerPool... |
/*
Copyright © 2019 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... |
// Package pppoe creates a PPPoE session with a remote server.
package pppoe // import "go.universe.tf/ppp/pppoe"
import (
"context"
"fmt"
"net"
"os"
"sync"
"time"
)
// Addr is a PPPoE peer address.
type Addr struct {
// Interface is the name of the network interface over which the
// PPPoE session is running... |
package server
import (
"context"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/OpenFlag/OpenFlag/internal/app/openflag/grpc"
"github.com/OpenFlag/OpenFlag/internal/app/openflag/engine"
"github.com/OpenFlag/OpenFlag/internal/app/openflag/handler"
"github.com/OpenFlag/OpenFlag/internal/app/openflag/mode... |
/*
MIT License
Copyright (c) 2020 zxdev
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, distribu... |
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-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 obtain a copy of the Li... |
/*
Copyright 2018 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 Google LLC. 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 ... |
// Copyright (c) 2018 Tigera, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appli... |
package twtr
import (
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/garyburd/go-oauth/oauth"
)
// AuthOption is twitter custom auth infomation
type AuthOption struct {
RequestTokenURL string
AuthorizationURL string
AccessTokenURL string
APIEndpointURL string
ConsumerCreds
}... |
// Copyright 2016-2020 The Libsacloud 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... |
// Copyright (c) 2017 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... |
// MIT License
//
// Copyright (c) 2020 Lack
//
// 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 controller_test
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"strconv"
"testing"
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/resource"
"gi... |
// Copyright © 2015 <NAME> <EMAIL>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
package eval
import (
"errors"
"fmt"
"github.com/suzuken/gigue/types"
"sync"
)
// Frame is symbol to Expression map
type Frame map[types.Symbol]types.Expression
// Env is scheme environment for evaluation
type Env struct {
sync.RWMutex
m Frame // m is symbol table for expression
parent *Env // parent is... |
package gkvdb
import (
"sync"
"gitee.com/johng/gf/g/os/gfile"
"gitee.com/johng/gf/g/os/gfilespace"
"gitee.com/johng/gf/g/encoding/gbinary"
)
// 初始化碎片管理器
func (db *DB) initFileSpace() {
db.mtsp = gfilespace.New()
db.dbsp = gfilespace.New()
db.recountFileSpace()
}
// 重新计算空间碎片信息
// 必须锁起来防止数据... |
package ray
import (
"fmt"
"math"
)
type Matrix [][]float64
type RowValues []float64
func NewMatrix(rows, columns int, rowsValues ...RowValues) Matrix {
m := make(Matrix, rows)
for r := 0; r < rows; r++ {
m[r] = make([]float64, columns)
}
for r := range rowsValues {
for i := range rowsValues[r] {
m[r][... |
package cfapi
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"golang.org/x/net/http2"
)
const (
defaultTimeout = 15 * time.Second
jsonContentType = "application/json"
)
var (
ErrUnauthorized = errors.New("unauthorized"... |
package web
import (
"fmt"
"log"
"net/http"
"sync"
)
type mLayer struct {
fn func(*C, http.Handler) http.Handler
orig interface{}
}
type mStack struct {
lock sync.Mutex
stack []mLayer
pool *cPool
router internalRouter
}
type internalRouter interface {
route(*C, http.ResponseWriter, *http.Request)
... |
package store
import (
"context"
"encoding/json"
"fmt"
"github.com/logzio/jaeger-logzio/store/objects"
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/jaegertracing/jaeger/storage/spanstore"
"github.com/hashicorp/go-hclog"
"github.... |
package elasticapm
import (
"fmt"
"net/http"
"strings"
"github.com/elastic/apm-agent-go/internal/apmhttputil"
"github.com/elastic/apm-agent-go/model"
)
// Context provides methods for setting transaction and error context.
type Context struct {
model model.Context
request model.Request
requ... |
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
package remotes
import (
"bytes"
"context"
"encoding/json"
"io"
"io/ioutil"
"testing"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes"
"github.com/deislabs/cnab-go/bundle"
"github.com/docker/distribution/reference"
"github.co... |
package palette
import (
"fmt"
"image/color"
"math/rand"
"regexp"
"strconv"
"sync"
"time"
"github.com/mayowa/chart/colors"
)
var axisColors = []string{"area", "color1", "color2", "color3"}
var unknownColor = color.RGBA{255, 0, 255, 0}
// regexps are used to match a randomized scheme based on a single hsl v... |
// Code generated by gotdgen, DO NOT EDIT.
package tdapi
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"go.uber.org/multierr"
"github.com/gotd/td/bin"
"github.com/gotd/td/tdjson"
"github.com/gotd/td/tdp"
"github.com/gotd/td/tgerr"
)
// No-op definition for keeping imports.
var (
_ = bin.Buffer{}
_... |
/*
*
* 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... |
package struc2frm
const staticTplMainHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Department shuffler</title>
<style>
* {
font-size: 14px;
font-family: monospace;
... |
// Package intern implements fast, immutable string interning.
//
// The package is a cgo binding for libintern:
//
// https://github.com/chriso/intern
//
// Interning is a way of storing distinct strings only once in memory:
//
// https://en.wikipedia.org/wiki/String_interning
//
// Each string is assigned an ID of ty... |
// Copyright (c) 2021 Tailscale Inc & 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 cli
import (
"bytes"
"context"
"errors"
"flag"
"fmt"
"io"
"log"
"mime"
"net"
"net/http"
"net/url"
"os"
"strconv"
"time"
"uni... |
package entity
import (
"time"
"github.com/hellojqk/jsondiff"
)
// Model .
type Model struct {
ID uint `gorm:"primarykey;AUTO_INSTREMENT;not null" uri:"id"`
Status bool `gorm:"type:tinyint(1);default:0;not null"` //状态,是否有效数据
CreatedAt time.Time `gorm:"index"`
UpdatedAt time.Time `gorm:"inde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.