text stringlengths 3.08k 10.4k |
|---|
package main
import (
"bytes"
"fmt"
jsoniter "github.com/json-iterator/go"
"github.com/robfig/cron"
"io/ioutil"
"net/http"
"regexp"
"strconv"
"strings"
)
func main(){
fmt.Println("2019新型肺炎疫情微信公众号定时推送")
spec := "0 0,9,15,20 * * ?"
c := cron.New()
c.AddFunc(spec, func() {
sendMsg("o3UX4s-Yk2vJNG8OmCDOs... |
/*
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 i... |
package main
import (
"fmt"
"log"
"net"
"os"
"strconv"
"sync"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
dht "distributed-systems-exam/dht"
)
var hashTable map[int32]int32
var lock sync.Mutex
type Server struct {
dht.UnimplementedDhtServiceServer
Name int32
Port int32
PeerPort... |
/*
* go-mysqlstack
* xelabs.org
*
* Copyright (c) XeLabs
* GPL License
*
*/
package proto
import (
"github.com/corverroos/go-mysqlstack/sqldb"
"github.com/corverroos/go-mysqlstack/sqlparser/depends/common"
querypb "github.com/corverroos/go-mysqlstack/sqlparser/depends/query"
"github.com/corverroos/go-mysq... |
package sqlx
import (
"context"
"database/sql"
"sync/atomic"
sqlxx "github.com/jmoiron/sqlx"
)
// DB is a wrapper around *github.com/jmoiron/sqlx.DB which manages transaction.
type DB struct {
*sqlxx.DB
tx *Txm
rollbacked *rollbacked
activeTx *activeTx
}
// Txm is a wrapper around *github.com/jmoiron/sql... |
package cmd
import (
"bytes"
"github.com/SAP/jenkins-library/pkg/command"
"github.com/SAP/jenkins-library/pkg/docker"
gitUtil "github.com/SAP/jenkins-library/pkg/git"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.... |
package main
import (
"context"
"encoding/json"
"io"
"io/ioutil"
"os"
"strings"
"github.com/containerd/console"
"github.com/moby/buildkit/client"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util/progress/progressui"
"github.com/opencontainers/go-dig... |
/*
Copyright (c) 2022 Dell Inc, or its subsidiaries.
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 agre... |
package worker
import (
"errors"
"fmt"
"gitlab.com/cretz/fusty/model"
// Does not include CBC ciphers, ref: https://groups.google.com/forum/#!topic/golang-nuts/J2XCsTsNQ9o
// TODO: decide if we like this guy's fork or if I should make my own
// "golang.org/x/crypto/ssh"
// "github.com/pkg/sftp"
"bytes"
"githu... |
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"strings"
)
type itemType int
const (
itemError itemType = iota
itemEOF
itemColon
itemComma
itemLeftBracket
itemRightBracket
itemLeftCurlyBrace
itemRightCurlyBrace
// For the purpose of flattening JSON documents, we don't have to be
// precise in how... |
package dynaml
import (
"bytes"
"net"
"strings"
"github.com/cloudfoundry-incubator/spiff/debug"
"github.com/cloudfoundry-incubator/spiff/yaml"
)
type IPRange interface {
GetSize() int64
GetIP(int64) net.IP
}
type iprange struct {
start net.IP
end net.IP
size int64
}
type cidrrange struct {
net.IPNet
... |
// Code generated by protoc-gen-go.
// source: marbles.proto
// DO NOT EDIT!
/*
Package marbles_proto is a generated protocol buffer package.
It is generated from these files:
marbles.proto
It has these top-level messages:
Transaction
TransactionLog
*/
package marbles_proto
import proto "github.com/golang/protob... |
package paginator
import (
"fmt"
"reflect"
"strings"
"github.com/iancoleman/strcase"
"gorm.io/gorm"
)
const (
defaultLimit = 10
defaultOrder = DESC
)
// New inits paginator
func New() *Paginator {
return &Paginator{}
}
// Paginator a builder doing pagination
type Paginator struct {
cursor Cursor
next ... |
// Copyright 2019 Drone IO, 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... |
package main
import (
"bytes"
"encoding/base64"
"fmt"
"html"
"image"
_ "image/jpeg"
_ "image/png"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"strings"
"text/template"
)
// Static content directory path. Environment variable set by Vagrant during provisioning.
var resourceDir = os.Getenv("CONTENT_PATH")... |
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)
// Validator represents a single validator.
// This is defined as an interface so that we can use the SDK types
// as well as database types properly.
type Validator interface {
GetConsAddr... |
package rbac
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zenazn/goji"
"testing"
)
func TestCreateItem(t *testing.T) {
item := NewItem(TypeOperation, "test")
item.Description = "desc"
require.NoErr... |
// The glukit package is the main package for the application. This is where it all starts.
package main
import (
"crypto/rand"
"encoding/hex"
"fmt"
"github.com/alexandre-normand/glukit/app/apimodel"
"github.com/alexandre-normand/glukit/app/config"
"github.com/alexandre-normand/glukit/app/model"
"github.com/ale... |
// 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 agre... |
/*
* Glue - Robust Go and Javascript Socket Library
* Copyright (C) 2015 <NAME> <<EMAIL>[at]<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... |
package rowset
import (
"database/sql"
"fmt"
"regexp"
"strings"
)
type Record func() interface{}
// Query saves the SQL statement and arguments
type Query struct {
// Sql the original statement
SqlStr string
// args are the arguments that will be used in the sql statement
Args []interface{}
// Allows are t... |
package c
import (
"context"
"errors"
"fmt"
"strings"
"time"
)
// capatazKey is an internal type for the capataz keys
type capatazKey string
// nodeNameKey is an internal representation of the worker name in the
// worker context. If you reverse engineer, you are on your own.
//
var nodeNameKey capatazKey = "__... |
// *** 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 pinpoint
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::Pinp... |
package output
import (
"bytes"
"io"
"io/ioutil"
"os"
"reflect"
"runtime"
"strings"
"testing"
"time"
"github.com/newrelic/newrelic-diagnostics-cli/registration"
log "github.com/newrelic/newrelic-diagnostics-cli/logger"
"github.com/newrelic/newrelic-diagnostics-cli/tasks"
)
func Test_GetResultsJSON(t *te... |
package rete
import (
"container/list"
"context"
"github.com/project-flogo/rules/common/model"
"fmt"
)
var reteCTXKEY = model.RetecontextKeyType{}
type reteCtx interface {
getConflictResolver() conflictRes
getOpsList() *list.List
getNetwork() Network
getRuleSession() model.RuleSession
OnValueChange(tuple m... |
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
"github.com/deps-cloud/api/swagger"
"github.com/deps-cloud/api/v1alpha/extractor"
"github.com/deps-cloud/api/v1alpha/tracker"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/rs/cors"
"github.com/s... |
package paypay
import (
"bytes"
"context"
"crypto/hmac"
"crypto/md5"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"reflect"
"strconv"
"strings"
"time"
"github.com/google/go-querystring/query"
"github.com/google/uuid"
)
// API endpoint base constants
con... |
package main
import (
"context"
"flag"
"net"
"os"
"os/signal"
"runtime"
"runtime/pprof"
"sync"
"syscall"
"time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/amazingchow/photon-dance-mapreduce/ma... |
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
//
// index.go
// Copyright (C) 2016 datawolf <<EMAIL>>
//
// Distributed under terms of the MIT license.
//
package index
import (
"bytes"
"encoding/json"
"errors"
"io"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"github.com/google/go-querystring/query"
)
const (
libraryVersion = "0.0.1"
defaultBaseURL =... |
package schema
import (
"fmt"
"github.com/72nd/acc/pkg/util"
"github.com/creasty/defaults"
"github.com/sirupsen/logrus"
)
const DefaultProjectsFile = "projects.yaml"
const DefaultProjectPrefix = "p-"
// Projects represents a collection of multiple Project elements.
type Projects []Project
// NewProjects return... |
package certdepot
import (
"context"
"github.com/pkg/errors"
"github.com/square/certstrap/depot"
"go.mongodb.org/mongo-driver/mongo"
)
// BootstrapDepotConfig contains options for BootstrapDepot. Must provide
// either the name of the FileDepot or the MongoDepot options, not both or
// neither.
type BootstrapDep... |
package quic
import (
"net"
"sync"
qerror "github.com/ami-GS/gQUIC/error"
"github.com/ami-GS/gQUIC/qtype"
)
type Server struct {
conn net.PacketConn
// TODO: replace to SessionStore
sessions map[string]*Session //ConnectionID.String():Session
addrSessions map[string]*Session //remoteAddr.String... |
package db
import (
"database/sql"
"fmt"
"log"
"reflect"
"github.com/kisielk/sqlstruct"
//importing init from sqlite3
_ "github.com/mattn/go-sqlite3"
)
const schema string = `
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "items" (
"uuid" varchar(36) primary key NULL,
"user_uu... |
package rstreams
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/go-redis/redis/v8"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"github.com/batchcorp/plumber-schemas/build/go/protos/args"
"github.com/batchcorp/plumber-schemas/build/go/protos/opts"
"git... |
/*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Copyright 2017 OpsVision Solutions
*
* 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/LIC... |
package applepay
import (
"crypto/aes"
"crypto/cipher"
"crypto/ecdsa"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/json"
"math/big"
"github.com/pkg/errors"
)
// DecryptResponse calls DecryptToken(r.Token)
func (m Merchant) DecryptResponse(r *Response) (*Token, error) {
return m.Decry... |
package search
import (
"fmt"
"html"
"math"
"reflect"
"strconv"
)
type fallback interface {
Exec() (*searchResult, []error)
}
type searchHandler struct {
client searchClient
hasPagination bool
hasMetadata bool
path string
query map[string]string
search *string
filters ... |
package rpc
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"log"
"strings"
"sync"
"github.com/pkg/errors"
"golang.org/x/net/context"
"github.com/vadimi/grpc-client-cli/internal/resolver/eureka"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
_ "google.golang.org/grpc/encoding/gzip" // regi... |
package main
import (
"bufio"
"context"
"fmt"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/util/retry"
"os"
)
func dynamicTest() {
client := GetDynamicClient()
namespa... |
package rds
import (
"os"
"testing"
"time"
"github.com/Financial-Times/factset-uploader/factset"
_ "github.com/joho/godotenv/autoload"
"github.com/stretchr/testify/assert"
)
var dbClient *Client
func init() {
var dsn string
if os.Getenv("RDS_DSN") != "" {
dsn = os.Getenv("RDS_DSN")
} else {
dsn = "ro... |
// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package brewerydb provides bindings to the BreweryDB API
// (http://www.brewerydb.com)
package brewerydb
import (
"bytes"
"encoding/json"
"fmt"
"github.com/goog... |
package aqua
import (
"errors"
"fmt"
"sync"
)
type MiddleManager interface {
SetMWNode(mwn *MWNode)
SetInChan(in *Chan)
SetOutChan(out *Chan)
GetInChan() *Chan
GetOutChan() *Chan
Run(int)
}
// 中间件管理器
type MiddlewareManager struct {
TXL *MWNode
wg *sync.WaitGroup
}
func NewMWManager() *MiddlewareManager ... |
package open
import (
"bytes"
"encoding/binary"
"fmt"
"strings"
bpf "github.com/iovisor/gobpf/bcc"
"github.com/jessfraz/bpfd/api/grpc"
"github.com/jessfraz/bpfd/program"
)
const (
name = "open"
// Mostly taken from: https://github.com/iovisor/bcc/blob/master/tools/opensnoop.py
source string = `
#include <u... |
/*
Copyright © 2020 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
package envconfig_test
import (
"fmt"
"net/url"
"reflect"
"strconv"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/datawire/envconfig"
)
// Note: DO NOT use t.Parallel(); because these tests all make use of
// the global environment (os.Getenv/os.Setenv), they are not safe to
// run in pa... |
// Connect to the recommendation engine api (alpha) and get the recommendations to modify the terraform code.
// TODO: At the moment this only supports Instances and InstanceTemplates
// This needs to be made more generic to support future recommendations
// i.e. IAM Recommendations.
// GetFindings func needs re... |
/*
* Copyright (C) 2020 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
package tasks
import (
"flag"
"fmt"
"github.com/pkg/errors"
commLog "intel/isecl/lib/common/v4/log"
commLogMsg "intel/isecl/lib/common/v4/log/message"
cos "intel/isecl/lib/common/v4/os"
"intel/isecl/lib/common/v4/setup"
"in... |
package shadowsocks
import (
"sync"
"v2ray.com/core/app"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/bufio"
"v2ray.com/core/common/errors"
"v2ray.com/core/common/log"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com... |
package main
import (
"bytes"
"fmt"
"runtime"
"strconv"
"strings"
)
type refFormat uint8
const (
refName refFormat = iota // name of the block device, e.g. "sda". It corresponds to path inside /dev/ directory.
refGptType // type of gpt partition
refGptUUID ... |
/*
Copyright © 2019 The Falco 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... |
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"strconv"
"text/tabwriter"
flags "github.com/jessevdk/go-flags"
)
type options struct {
GitHubAPIURI string `long:"github-api-uri" default:"https://api.github.com/search" default-mask:"-" env:"GITHUB_API_URI" description:"URI for GitHub se... |
package lua
import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
)
func findLoader(l *State, name string) {
var msg string
if l.Field(UpValueIndex(1), "searchers"); !l.IsTable(3) {
Errorf(l, "'package.searchers' must be a table")
}
for i := 1; ; i++ {
if l.RawGetInt(3, i); l.IsNil(-1) {
l.Pop(1)
... |
package bridge
import (
"context"
"sync"
"github.com/golang/protobuf/proto"
"github.com/rmrobinson/nerves/lib/stream"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"
)
var (
// ErrMissingParam is returned if a request is missing a required field... |
/**
* 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
* distribu... |
package goklarna
import (
"encoding/json"
"fmt"
)
const (
paymentSessionApiURL = "/payments/v1/sessions"
paymentAuthorizationApiURL = "/payments/v1/authorizations"
)
type (
// PaymentSrv type describe the payment api client methods
PaymentSrv interface {
CreateNewSession(*PaymentOrder) (*PaymentSession... |
package ablytest
import (
"bytes"
"context"
"io"
"io/ioutil"
"net/http"
"sync"
"sync/atomic"
"github.com/ably/ably-go/ably"
)
// RoundTripRecorder is a http.Transport wrapper which records
// HTTP request/response pairs.
type RoundTripRecorder struct {
*http.Transport
mtx sync.Mutex
reqs []*http.R... |
/**
* @Author: vincent
* @Description:
* @File: server
* @Version: 1.0.0
* @Date: 2021/8/14 23:23
*/
package websocket
import (
"context"
"fmt"
kim "go-examples/demo/chat_demo_im"
"go-examples/demo/chat_demo_im/logger"
"go-examples/demo/chat_demo_im/naming"
"net/http"
"sync"
"time"
"github.com/gobwas... |
package sms
import (
"bytes"
"encoding/json"
"fmt"
"io"
)
// Command is TPDU message from MS to SC
type Command struct {
rpData
SRR bool `json:"srr"` // O / Status Report Request
TMR byte `json:"tmr"` // M / Message Reference for TP
PID byte `json:"pid"` // M / Protocol Identifier
... |
package config
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/mimecast/dtail/internal/source"
)
// Used to initialize the configuration.
type initializer struct {
Common *CommonConfig
Server *ServerConfig
Client *ClientConfig
}
type transformCb func(*initializer, *Args, []str... |
package shake
import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/shyang107/goshake/shake/cfg"
"github.com/shyang107/util"
)
var (
// Options are all potions and data needed in the analysis
Options *OptionAll
)
// OptionAll is that all potion and data using in the analysis
type OptionAll struct {
DSP *Dy... |
// Copyright 2016 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 2020 The gVisor 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 hostworker
import (
"context"
"fmt"
"time"
"github.com/cretz/monitoral/monitoralpb"
"github.com/cretz/monitoral/systemworker"
"github.com/cretz/temporal-sdk-go-advanced/temporalutil/clientutil"
"github.com/google/uuid"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/worker"
)
type WorkerOptions stru... |
package model
import (
"encoding/xml"
"fmt"
"strings"
"github.com/dbsteward/dbsteward/lib/util"
)
type Column struct {
Name string `xml:"name,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
Nullable bool `xml:"null,attr"` // TODO(go,nth)... |
// Generated from templates/mesh_hierarchy.template
package model2d
import "sort"
var arbitraryAxis Coord = Coord{X: 0.95177695, Y: 0.26858931}
// A MeshHierarchy is a tree structure where each node is
// a closed, simple polygon, and children are contained
// inside their parents.
//
// Only manifold meshes with n... |
package registry_test
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"os/exec"
"path/filepath"
"strings"
"code.cloudfoundry.org/eirini/blobondemand"
"code.cloudfoundry.org/eirini/registry"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
// nolint
var _ = D... |
package main
import (
"archive/tar"
"compress/gzip"
"fmt"
"io"
"log"
"net/http"
"os"
"sort"
"strings"
"time"
"github.com/goji/httpauth"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/rs/cors"
)
func ParseConfigName(args []string) (string, []string) {
resArgs := make([]string, 0)
f... |
package databus
import (
"context"
"fmt"
"github.com/Shopify/sarama"
"io"
"os"
"time"
"github.com/mapgoo-lab/atreus/pkg/log"
"errors"
"crypto/md5"
"crypto/rand"
"encoding/base64"
"encoding/hex"
)
//使用者必须实现的接口
type ConsumerDeal interface {
//数据处理的实现
DealMessage(data []byte, topic st... |
package data
import (
"context"
"github.com/airbloc/airbloc-go/provider/collections"
"github.com/airbloc/airbloc-go/shared/adapter"
"github.com/airbloc/airbloc-go/shared/blockchain"
"github.com/airbloc/airbloc-go/shared/database/localdb"
"github.com/airbloc/airbloc-go/shared/database/metadb"
"github.com/airbloc... |
/*
* Copyright 2021 InfAI (CC SES)
*
* 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 gof
import (
"bytes"
"encoding/binary"
"fmt"
"syscall"
"time"
)
type Conn struct {
s *Server
fd int //当前连接的文件描述符 fd
updateTime int64 //最新的更新时间,判断超时用
handShake chan Message //用于前期的验证和握手请求
method string //请求方式 websocket必须是get请求方式
closeCode uint16 ... |
package main
import (
"bufio"
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
type Tags struct {
Tags []Tag `json:"tags"`
Gateway string `json:"gateway,omitempty"`
BatteryLevel int `json:"batteryLevel"`
Time time... |
// Copyright (c) 2020 Cisco Systems and/or its affiliates.
// Licensed under the Apache License, Version 2.0 (the "License")
// that can be found in the LICENSE file in the root of the source
// tree.
// This file includes the callback and RPC
// it will work only if client ask for UDP or TCP transport
package transpo... |
package router
import (
"bytes"
"github.com/coolsun/cloud-app/controller"
"github.com/coolsun/cloud-app/docs"
"github.com/coolsun/cloud-app/utils/log"
"github.com/gin-contrib/cors"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
"github.com/patrickmn/go-ca... |
package meta
import (
"encoding/json"
"errors"
"github.com/veypi/OneBD/core"
"github.com/veypi/OneBD/rfc"
"github.com/veypi/utils"
"io"
"io/ioutil"
"net/http"
"strconv"
"sync"
"time"
)
var pool = sync.Pool{
New: func() interface{} {
var p core.Meta
p = &payLoad{}
return p
},
}
// payLoad 请求基本处理包
t... |
package application
import (
"fmt"
"net/url"
"strconv"
"strings"
"github.com/go-playground/validator/v10"
"github.com/rs/xid"
"google.golang.org/protobuf/proto"
"github.com/infraboard/keyauth/app/token"
"github.com/infraboard/mcube/http/request"
pb "github.com/infraboard/mcube/pb/request"
"github.com/infr... |
package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"os/user"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// Config Struct of JSON Kubernetes Config File
type Config struct {
Kind string `json:"kind" yaml:"-"`
APIVersion string `json:"apiVersion" yaml:"-"`
Preferen... |
package yag
import (
"flag"
"fmt"
"strings"
"github.com/zoido/yag-config/args"
"github.com/zoido/yag-config/value"
)
// ArgParser registers and parses non-flag arguments.
type ArgParser struct {
args []*argument
leftOver args.Parser
leftoverPlaceholder string
}
// Value registers n... |
package minion
import (
"sort"
"github.com/quilt/quilt/db"
"github.com/quilt/quilt/join"
"github.com/quilt/quilt/stitch"
log "github.com/Sirupsen/logrus"
)
func updatePolicy(view db.Database, blueprint string) {
compiled, err := stitch.FromJSON(blueprint)
if err != nil {
log.WithError(err).Warn("Invalid bl... |
package message
import (
"bufio"
"bytes"
"encoding/binary"
"fmt"
"io"
"sync"
"github.com/pkg/errors"
"go.gazette.dev/core/labels"
)
// FixedFrameHeaderLength is the number of leading header bytes of a fixed
// frame, consisting of the word [4]byte{0x66, 0x33, 0x93, 0x36} followed
// by a 4-byte little-endian... |
package picker
type QueryKind string
func (t QueryKind) String() string {
return string(t)
}
func (t QueryKind) IsValid() bool {
_, ok := queryKindHandlers[t]
return ok
}
const (
QueryKindPrefix QueryKind = "prefix"
QueryKindMatch QueryKind = "match"
QueryKindMatchAll QueryKind... |
package main
import (
"flag"
"fmt"
"os"
"database/sql"
"encoding/json"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/garyburd/redigo/redis"
_ "github.com/go-sql-driver/mysql"
"gopkg.in/natefinch/lumberjack.v2"
)
//
// 推送类型
//
const (
MSGTYPE_PRIVATE = 1
MSGTYPE_SEPT = 5
MSGTYPE_UNION... |
/*
Copyright © 2021 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 agreed to in writing, software
dis... |
// Copyright 2019 yhyzgn gox
//
// 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 paymail
import (
"fmt"
"net"
"testing"
"time"
"github.com/go-resty/resty/v2"
"github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert"
)
// newTestClient will return a client for testing purposes
func newTestClient() (*Client, error) {
// Create a Resty Client
client := resty.New()
// Get... |
package rj32
import (
"fmt"
"os"
"github.com/rj45/rj32/emurj/data"
)
type CPU struct {
Cycles uint64
// Registers
Reg [16]int
// Program Counter
PC int
// Skip register
Skip bool
// Immediate register
Imm int
ImmValid bool
ImmExpire bool
// Pre-decoded program memory
Prog [65536]Inst
Bu... |
package main
import (
"AoC2021/aoc_fun"
"io/ioutil"
"log"
"os"
"strings"
)
type Record struct {
signal []string
expect []string
}
type Data struct {
states []Record
}
func parse(line string, data *Data) {
if len(line) == 0 {
return
}
parts := strings.Split(line, " | ")
signal := strings.Fields(parts[0... |
package trello
import (
"crypto/md5"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
)
// MockResponder is a thin wrapper around the httptest.Server. It adds the
// ability to specify a file or directory of files to use as mock responses,
// and provides the A... |
/*
Package mysql holds view model repositories
*/
package mysql
import (
"context"
"database/sql"
systemErrors "errors"
"fmt"
"github.com/google/uuid"
"github.com/vardius/go-api-boilerplate/cmd/auth/internal/infrastructure/persistence"
"github.com/vardius/go-api-boilerplate/pkg/application"
"github.com/vardi... |
package main
import (
"fmt"
"github.com/jbrukh/bayesian"
"github.com/jeromer/syslogparser/rfc3164"
"regexp"
"strconv"
"strings"
"time"
)
// Proccesor support bayes or regexp match
// support mutli regexp rules, set matchtag if it matchs
// current matchtag is "ignore", "error", "critical", "warning"
type Proce... |
// poprepo is a package for populating a git repo with commits that associate
// a git commit with a buildid, a monotonically increasing number maintained
// by a external build system. This is needed because Perf only knows how
// to associate measurement values with git commits.
package poprepo
import (
"bytes"
"c... |
package converter
import (
"errors"
"io/ioutil"
"os"
"path/filepath"
"strings"
"jackbaron.com/songe-converter/v2/pkg/directory"
"jackbaron.com/songe-converter/v2/pkg/types"
"jackbaron.com/songe-converter/v2/pkg/utils"
)
// NewToOld converts the new format back to the old format
func NewToOld(new *types.NewIn... |
// Copyright 2019-present Facebook
//
// 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 ... |
// Code generated by go-swagger; DO NOT EDIT.
package operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"github.com/go-openapi/swag"
)
// GetAPIInventoryURL generates an U... |
package money
import (
"context"
"fmt"
"github.com/juju/errors"
"github.com/temoto/alive/v2"
"github.com/temoto/vender/currency"
"github.com/temoto/vender/hardware/input"
"github.com/temoto/vender/hardware/money"
"github.com/temoto/vender/helpers"
"github.com/temoto/vender/internal/state"
"github.com/temoto... |
// *** 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 compute
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages an availability set for virtual machines.... |
package main
import (
"bytes"
_ "embed"
"encoding/json"
"io"
"net/http"
"strings"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/wzshiming/openapi/spec"
"github.com/Luzifer/twitch-bot/plugins"
)
var (
swaggerDoc = spec.OpenAPI{
OpenAPI: "3.0.3", // This generator uses v3 of OpenAP... |
/*
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, ... |
package internal
import (
"bytes"
"compress/zlib"
"crypto/sha256"
"encoding/gob"
"encoding/hex"
"errors"
"io"
"log"
"os"
)
//Mkdir helper, creates directory if not exists
func Mkdir(path string, perm os.FileMode) error {
if _, errFolder := os.Stat(path); os.IsNotExist(errFolder) {
if errMkDir := os.Mkdir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.