text
stringlengths
11
4.05M
// Copyright (C) 2018 Google 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 t...
package main import ( "fmt" "strings" ) type query struct { F int C string } func main() { var s string var q int fmt.Scanf("%s", &s) fmt.Scanf("%d", &q) qs := make([]query, 0, q) reversed := false reverseCount := 0 for i := 0; i < q; i++ { var t, f int var c string fmt.Scanf("%d %d %s", &t, &f, &...
// Copyright 2020 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package wifi import ( "context" "fmt" "math/rand" "sort" "strconv" "strings" "time" "github.com/google/gopacket/layers" "chromiumos/tast/common/network/iw" "chro...
package commander import "github.com/docopt/docopt-go" // Commander Command line implementation type Commander interface { Doc(doc string) Commander Version(ver string) Commander ShowVersion() string Description(desc string) Commander Annotation(title string, contents []string) Commander Command(usage string, a...
package collect import ( "archive/tar" "bytes" "context" "fmt" "io" "io/ioutil" "os" "path/filepath" "github.com/pkg/errors" troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes"...
// Copyright 2018 Istio 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 i...
// +build !graphql package graphql import ( graphql3 "flamingo.me/flamingo-commerce/v3/cart/interfaces/graphql" graphql2 "flamingo.me/flamingo-commerce/v3/category/interfaces/graphql" graphql5 "flamingo.me/flamingo-commerce/v3/checkout/interfaces/graphql" graphql4 "flamingo.me/flamingo-commerce/v3/product/interfa...
package innerSortImpl /** * @author liujun * @version 1.0 * @date 2021-06-22 00:09 * @author—Email liujunfirst@outlook.com * @blogURL https://blog.csdn.net/ljfirst * @description 桶排序 */ type BucketSort struct { } func (s *BucketSort) SortMethod(array []int) []int { if array == nil || len(array) <= 1 { retu...
package handlers import ( "net/http" v2 "gitlab.com/balance-inc/go-commons/log/v2" ) type Wisner struct { } func newWisner(logger v2.Logger) HandlerOutput { return HandlerOutput{ Handler: &Wisner{ }, } } func (h *Wisner) ServeHTTP(rw http.ResponseWriter, r *http.Request) { logger := v2.FromContext(r.Cont...
package main import ( "flag" "fmt" "os" "os/signal" "syscall" "github.com/valyala/fasthttp" "github.com/maoge/ibsp-collectd/probe" "github.com/maoge/ibsp-collectd/routing" ) type Global struct { probe *probe.Probe } var ( name = flag.String("name", "", "unive...
package probeservices_test import ( "context" "strings" "testing" "github.com/ooni/probe-cli/v3/internal/engine/model" ) func TestFetchURLListSuccess(t *testing.T) { client := newclient() client.BaseURL = "https://ams-pg-test.ooni.org" config := model.URLListConfig{ Categories: []string{"NEWS", "CULTR"}, ...
package sort type Sorter interface { Sort(src string) string } type SorterFunc func(string) string func (m SorterFunc) Sort(src string) string { return m(src) } func New() SorterFunc { return Merge } func Merge(src string) string { return string(mergeSort([]byte(src))) } func mergeSort(slice []byte) []byte { ...
/* This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copy...
package handle import ( "github.com/valyala/fasthttp" "mygo/service" "strconv" ) func AddToCart(ctx *fasthttp.RequestCtx) { } func BuyNow(ctx *fasthttp.RequestCtx) { goods_id := ctx.QueryArgs().Peek("goods_id") user_id := ctx.Request.Header.Peek("uid") if goods_id == nil { resp.Msg = "缺少商品" CommonWriteErr...
package routes import ( database "holdempoker/db" "holdempoker/maps" "holdempoker/models" "github.com/jinzhu/gorm" ) // Controller is routes Controller type Controller struct { m map[int]interface{} } var db *gorm.DB var dmap *maps.DataMap // Init is 초기화 func (c *Controller) Init() { c.m = make(map[int]inter...
package connected import ( "context" "sync" "golang.org/x/oauth2" ) type ReuseTokenSource struct { mu sync.Mutex oc *oauth2.Config ts oauth2.TokenSource cb func() } func (ts *ReuseTokenSource) Token() (*oauth2.Token, error) { ts.mu.Lock() defer ts.mu.Unlock() t, err := ts.ts.Token() if err != nil || !t....
package nxpdf import ( "bytes" "io/ioutil" "github.com/oneplus1000/pdf" "github.com/pkg/errors" ) //ReadPdf read pdf file into PdfData func ReadPdf(pdffile []byte) (*PdfData, error) { byteReader := bytes.NewReader(pdffile) pdfReader, err := pdf.NewReader(byteReader, byteReader.Size()) if err != nil { return...
package eventsourcing import ( "github.com/caos/zitadel/internal/crypto" usr_model "github.com/caos/zitadel/internal/user/model" "github.com/caos/zitadel/internal/user/repository/eventsourcing/model" ) func (es *UserEventstore) generatePasswordCode(passwordCode *model.PasswordCode, notifyType usr_model.Notificatio...
package main // O(n) time | O(1) space func IsValidSubsequence(array []int, sequence []int) bool { seqIdx := 0 for _, value := range array { if seqIdx == len(sequence) { break } if value == sequence[seqIdx] { seqIdx += 1 } } return seqIdx == len(sequence) }
package ui_test import ( "fmt" "github.com/gosuri/dsky/ui" "time" ) func ExampleTable() { type hacker struct { Name string Birthday string Bio string } var hackers = []hacker{ {"Ada Lovelace", "December 10, 1815", "Ada was a British mathematician and writer, chiefly known for her work on Charl...
package main import "fmt" // A、B 两处应该填入什么代码,才能确保顺利打印 出结果? type S struct { m string } func f() *S { return &S{"foo"} // A } func main() { p := f() // *f() // B fmt.Println(p.m) }
package database import ( "fmt" "github.com/jinzhu/gorm" ) type Source struct { gorm.Model Title string `sql:"not null; type: varchar(30);"` Flux string `sql:"not null; type: fluxType;"` } func (s Source) ToString() string { return fmt.Sprintf("(%d) %s (%s)", s.ID, s.Title, s.Flux) } func (s Source) GetID()...
/* 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 mint import ( "fmt" ) // WalletTag in Sumus blockchain type WalletTag uint8 const ( // WalletTagNode is a registered node (by "supervisor") WalletTagNode WalletTag = 1 // WalletTagGenesisNode is registered node (in genesis block) WalletTagGenesisNode WalletTag = 2 // WalletTagSupervisor can set/unset t...
package task import ( "context" "fmt" "github.com/go-task/task/v3/internal/fingerprint" "github.com/go-task/task/v3/taskfile" ) // Status returns an error if any the of given tasks is not up-to-date func (e *Executor) Status(ctx context.Context, calls ...taskfile.Call) error { for _, call := range calls { //...
package memo import ( "context" "fmt" "net/http" "github.com/Al-un/alun-api/alun/core" "github.com/Al-un/alun-api/alun/utils" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) // ---------- Variab...
package service import ( "net/http" "html/template" "hw4/models" "github.com/unrolled/render" ) var errorMessageSlice []models.ErrorMessage func register(w http.ResponseWriter, r *http.Request){ r.ParseForm() if r.Method == "POST"{ user := &models.User{ r.Form["name"][0], r.Form["id"][0], r.Form["p...
package routers import ( "github.com/astaxie/beego" ) func init() { beego.GlobalControllerRouter["z2665/t12/controllers:FromController"] = append(beego.GlobalControllerRouter["z2665/t12/controllers:FromController"], beego.ControllerComments{ "GetFromPublishPage", `/api/froms/changs/publish`, []string{"g...
package board import ( "math/rand" "time" ) // Board size const ( X = 4 Y = 4 ) // Direction type Direction int32 // Direction const ( LEFT = iota UP RIGHT DOWN ) var ( DIRECTIONS = map[int]int{ LEFT: -1, UP: -1, RIGHT: 1, DOWN: 1, } ) type Board struct { Cells [Y][X]int goal int poin...
package util_test import ( "getir-case/internal/model/fetch" "getir-case/internal/service/persistent" "time" ) var ( invalidRequestToDataQueryCases = []struct { name string input *fetch.Request }{ { name: "invalid StartDate format", input: &fetch.Request{ StartDate: "23344wer", EndDate: "2...
package main //974. 和可被 K 整除的子数组 //给定一个整数数组 A,返回其中元素之和可被 K 整除的(连续、非空)子数组的数目。 //示例: // //输入:A = [4,5,0,-2,-3,1], K = 5 //输出:7 //解释: //有 7 个子数组满足其元素之和可被 K = 5 整除: //[4, 5, 0, -2, -3, 1], [5], [5, 0], [5, 0, -2, -3], [0], [0, -2, -3], [-2, -3] func subarraysDivByK(A []int, K int) int { dic := make(map[int]int) dic[0]...
package main import ( "fmt" "github.com/spf13/viper" ) //InitConfig - This method will initialize a Viper configuration object with our config.yml file func InitConfig() (*viper.Viper, error) { v := viper.New() v.SetConfigName("config") v.AddConfigPath(".") v.SetConfigType("yaml") err := v.ReadInConfig() if ...
package controller import ( "kubevirt-image-service/pkg/controller/virtualmachinevolumeexport" ) func init() { // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. AddToManagerFuncs = append(AddToManagerFuncs, virtualmachinevolumeexport.Add) }
package main import ( "fmt" "github.com/zekroTJA/configoration" ) func main() { c, err := configoration.NewBuilder(). SetBasePath("./testdata"). AddJsonFile("test1.json", true). AddJsonFile("test2.json", true). AddYamlFile("test3.yaml", true). AddEnvironmentVariables("TEST_", false). Build() if err ...
package ethsecp256k1 import ( "fmt" "testing" ) func BenchmarkGenerateKey(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { if _, err := GenerateKey(); err != nil { b.Fatal(err) } } } func BenchmarkPubKey_VerifySignature(b *testing.B) { privKey, err := GenerateKey() if err != nil { b.Fatal(...
package semp_client import ( "fmt" "testing" ) const testHost = "192.168.56.103" const basePath = "http://" + testHost + ":8080/SEMP/v2/config" const adminUser = "admin" const adminPass = "admin" func TestSempClient(t *testing.T) { cfg := NewConfiguration() //cfg.Host = testHost cfg.Username = adminUser cfg....
// Copyright (c) 2018 The MATRIX Authors // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php package blkmanage import ( "encoding/json" "errors" "reflect" "time" "github.com/MatrixAINetwork/go-matrix/ca" "github.com/MatrixAIN...
package deregserver import ( "strings" "github.com/engelsjk/faadb/internal/codes" ) type Codes struct { RegistrantType map[string]string RegistrantRegion map[string]string Certification CertificationCodes StatusCode map[string]string } type CertificationCodes struct { AirworthinessClassification m...
type Command struct { commandType string args []string } type CommandFactory struct { ... } // Create decode and validate the command func (cf CommandFactory) Create(data []byte) (*Command, error) { // decode command command, err := cf.Decode(data) if err != nil { return nil, err } ...
package stream import "io" // EmptyStdin is io.Read implementation what is empty, i.e. first read return EOF type EmptyStdin struct{} func (*EmptyStdin) Read(p []byte) (n int, err error) { return 0, io.EOF }
package validate import ( "context" "fmt" accounts "github.com/armory/spinnaker-operator/pkg/accounts" "github.com/armory/spinnaker-operator/pkg/accounts/account" "github.com/armory/spinnaker-operator/pkg/apis/spinnaker/interfaces" "github.com/armory/spinnaker-operator/pkg/inspect" "time" ) // GetAccountValida...
package uuid type Result struct { ID int64 Status int }
/* * * ____ ______ * / __ \_________ _ ____ __/ ____/_ _____ * / /_/ / ___/ __ \| |/_/ / / / __/ / / / / _ \ * / ____/ / / /_/ /> </ /_/ / /___/ /_/ / __/ * /_/ /_/ \____/_/|_|\__, /_____/\__, /\___/ * /_/ ...
package atgo import ( "context" ) type ( Mobile interface { // Initiate C2B payments on a mobile subscriber’s device. MobileCheckout(ctx context.Context, p *MobileCheckoutPayload) (res *MobileCheckoutResponse, err error) // Send payments to mobile subscribers from your Payment Wallet. MobileB2C(ctx contex...
package gohfc import ( "context" "crypto/x509" "encoding/pem" "fmt" "math" "time" "github.com/hyperledger/fabric-protos-go/orderer" "github.com/hyperledger/fabric-protos-go/peer" "github.com/pkg/errors" "github.com/zhj0811/gohfc/pkg/parseBlock" "google.golang.org/grpc" "google.golang.org/grpc/credentials"...
package main import "fmt" func main (){ ourMap:=make(map[int] []float32) mas:=[...]float32{-25.4, -27.0, 13.0, 19.0, 15.5, 24.5, -21.0, 32.5, -13.8} var intValue int for _,v:= range mas{ intValue=int(v/10) ourMap[10*intValue]=append(ourMap[10*intValue],v) } fmt.Println(ourMap) }
package mongo import ( "net/http" "time" "github.com/ubs121/rpc" ) type ( Args struct { Bucket string Query string ",omitempty" Sort []string ",omitempty" Select M ",omitempty" Start string ",omitempty" Skip int ",omitempty" Limit int ",omitempty" Data M ",omi...
package handlers import ( "net/http" "github.com/gin-gonic/gin" ) // @Summary Get Health // @Description Get app health // @Tags Health // @Accept json // @Produce json // @Success 200 // @Failure 400 {object} HTTPError // @Failure 404 {object} HTTPError // @Failure 500 {object} HTTPError // @Router /healthy/*acti...
package zero import ( "fmt" "strings" "gopkg.in/go-playground/validator.v8" ) // New ... Create a validator instance and bind custom validation types func New(tagName string) *Zero { // Validator instance return &Zero{validator.New(&validator.Config{TagName: tagName}), messages} } // Zero is a convenience wrap...
package network import ( "container/list" "fmt" "log" "net" "../config" "../types" "../world" ) type Server struct { World *types.World } func (s *Server) Start() { playerList := list.New() s.World = world.NewWorld() addr := fmt.Sprintf(":%d", config.Port) ln, err := net.Listen("tcp", addr) if err ...
package system import ( "context" "net/mail" "github.com/google/uuid" "github.com/jrapoport/gothic/api/grpc/rpc/system" "github.com/jrapoport/gothic/models/user" "google.golang.org/grpc/codes" "google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/timestamppb" ) func (s *sy...
package transport import ( "io" ) type ConnConfig interface{} type Conn io.ReadWriteCloser type ModeConfig = func(Conn) (Mode, error) type Mode interface { WriteMsg(msg []byte) error // this is not same as the io.Writer ReadMsg() ([]byte, error) }
package appender import ( "fmt" "strconv" "github.com/kiali/kiali/config" "github.com/kiali/kiali/graph" "github.com/kiali/kiali/log" "github.com/kiali/kiali/models" ) const ( defaultQuantile = 0.95 defaultIncludeIstio bool = false ) func ParseAppenders(o graph.TelemetryOptions) []graph.Appender { ...
package entity import ( "io/ioutil" "gopkg.in/yaml.v2" ) type Config struct { Server struct { ListenAddr string `yaml:"listen_addr"` } KnownNodes struct { UpdateIntervalSec int `yaml:"update_interval_sec"` } `yaml:"known_nodes"` Integration struct { Db struct { ConnectionString string `yaml:"connecti...
package labs27 import "testing" func Benchmark_Goid(b *testing.B) { for i := 0; i < b.N; i++ { goid() } }
// node package nlog import ( "fmt" "os" ) type Data map[string]interface{} type message struct { level Level time string message *string data Data node *Node } type Node struct { key string data Data node *Node logger *Logger } type _message struct { level string time string m...
package cmd // based on https://gist.github.com/ik5/d8ecde700972d4378d87 const ( NoticeColor = "\033[1;36m%s\033[0m" ErrorColor = "\033[1;31m%s\033[0m" )
package logger type ILogger interface { Log(msg string) error Error(msg error) error }
package steps import ( "errors" survey "github.com/AlecAivazis/survey/v2" "github.com/pganalyze/collector/setup/state" s "github.com/pganalyze/collector/setup/state" "github.com/pganalyze/collector/setup/util" ) var EnsureSupportedLogDuration = &s.Step{ ID: "li_ensure_supported_log_duration", Kind: ...
package postgres const ( docsByDocIDTable = "docs_by_doc_id" docsByQueryPrefixTable = "docs_by_query_key_id" addedDocRefsTable = "doc_insert_primary_keys" )
// Copyright 2015 The Vanadium 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 profiles import ( "encoding/xml" "fmt" "os" "sort" "sync" "time" "v.io/jiri/tool" ) const ( defaultFileMode = os.FileMode(0644) ) type...
package package1 import ( "math/rand" "reflect" "testing" "testing/quick" "time" ) var r = rand.New(rand.NewSource(time.Now().UnixNano())) func random() *Type1 { v, ok := quick.Value(reflect.TypeOf(&Type1{}), r) if !ok { panic("unable to generate value") } return v.Interface().(*Type1) } func TestEqual1(...
package chunkpeeker import ( "bytes" "compress/zlib" "io/ioutil" "os" ) type Section struct { Y int Blocks []byte BlockLight []byte Data []byte SkyLight []byte } const HEADER_LENGTH = 8192 const LOCATION_LENGTH = 4096 var ( f *os.File err error tagEnd uint8...
// Copyright 2021 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package bluetooth import ( "context" "chromiumos/tast/local/bluetooth" "chromiumos/tast/local/chrome/uiauto" "chromiumos/tast/local/chrome/uiauto/quicksettings" "chrom...
package cmd import ( "fmt" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "os" "strings" "github.com/spf13/viper" ) var cfgFile string // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "snmpsim", Short: "A cli clien...
package sorting import ( "reflect" "testing" ) func TestSelectionSortN(t *testing.T) { tests := []struct { in, out []int steps int }{ {[]int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5}, 2}, {[]int{2, 3, 1, 4, 5}, []int{1, 3, 2, 4, 5}, 1}, {[]int{2, 3, 1, 4, 5}, []int{1, 2, 3, 4, 5}, 2}, } for i, tt := ran...
package gatcha import "net/url" const ( noviceWish = "100" permanentWish = "200" charEventWish = "301" weaponWish = "302" mihoyoHost = "https://hk4e-api-os.mihoyo.com" gachaLogPath = "/event/gacha_info/api/getGachaLog" sizePerPage = "6" ) var wishes = []string{ noviceWish, permanentWish, charEven...
package artifact import ( "fmt" "log" "regexp" "strings" "github.com/antonmedv/expr" config "github.com/dantleech/artago/config" "github.com/imdario/mergo" "gopkg.in/yaml.v2" ) type Processor struct { Rules []config.Rule Actions map[string]ActionHandler } type ActionResult struct { Section string Resu...
package assets import ( "fmt" "github.com/eknkc/amber" "github.com/elazarl/go-bindata-assetfs" "github.com/julienschmidt/httprouter" "github.com/wrouesnel/callback/api/apisettings" "github.com/wrouesnel/go.log" "html/template" "net/http" "net/http/httputil" "path" "strings" ) const ( templateDir = "templa...
package main import ( "github.com/PaulSayantan/TermTube/term" ) //search "github.com/belikesayantan/ytmusic-cli/ytsearch" func main() { term.Screen1() }
// Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
// Copyright 2021 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 main import ( "fmt" "log" ) //CheckLogDetails ... func (s *Engine) CheckLogDetails() error { //讀取源地域backup details logDetailsSource := make([]LogDetails, 0) err := s.engineSource.Where("cluster_gid=?", s.serviceInfo.SourceGid).Find(&logDetailsSource) if err != nil { return err } log.Printf("\n=====...
const name = "Glenn" const ( foo = 1 << 0 bar = 1 << 1 baz = 1 << 2 ) const ( foo = 1 << iota bar baz ) const ( _ = iota alpha bravo charlie delta )
package lino_test import ( "bytes" "io/ioutil" "net/http" "testing" . "github.com/tishibas/lino" ) type RoundTripFunc func(req *http.Request) *http.Response func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req), nil } func NewTestClient(f RoundTripFunc) *http.Client { r...
package pythagorean import "math" // Triplet structure. type Triplet [3]int func (t Triplet) sum() int { return t[0] + t[1] + t[2] } //Range returns a list of all Pythagorean triplets with sides in the // range min to max inclusive. func Range(min, max int) []Triplet { res := []Triplet{} for i := min; i < max-1;...
package main import ( "html/template" ) type Templates struct { index *template.Template convert *template.Template enter *template.Template } func NewTemplates() Templates { p := Templates{ template.Must(template.ParseFiles("index.html")), template.Must(template.ParseFiles("convert.html")), template....
// Copyright 2015 go-smpp 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 pdutlv import ( "bytes" "testing" ) func TestTag_Hex(t *testing.T) { tag := DestAddrSubunit want := "0005" if v := tag.Hex(); v != want { t.Fa...
package model type Exercise struct { ID string `json:"_id" bson:"_id"` Name string `json:"name"` Description *string `json:"description"` }
package main import ( "fmt" "github.com/qwenode/gogo/ffmt" "time" ) func main() { for i := 0; i <= 30; i++ { ffmt.SpinPrint(fmt.Sprintf("Process:%d/30", i)) time.Sleep(time.Millisecond * 100) } }
package config import ( "encoding/json" "github.com/BurntSushi/toml" "gopkg.in/ini.v1" "gopkg.in/yaml.v3" ) func iniUnmarshal(data []byte, v interface{}) error { c, err := ini.Load(data) if err != nil { return err } return c.MapTo(v) } func readBytes(filename string, bts []byte, target interface{}) error ...
package models import ( "time" ) type Payload struct { ID string Name string Content string Hashes SRIHashes CreatedAt time.Time ModifiedAt time.Time }
package day8 import ( "bufio" "fmt" "os" "strconv" "strings" ) type operation struct { operand string value int used bool parentOperationIndex int } // ParseInput : parses input of input.txt func ParseInput(fileName string) []operation { file, err := os.Open(fil...
package main import ( "fmt" log "github.com/sirupsen/logrus" "sync/atomic" ) // //func generate(channel chan string) { // for ;; { // var l []string // for i := 0; i < maxWords; i++ { // l = append(l, String(rand.Int() % maxStringLength)) // } // channel <- strings.Join(l, " ") // } //} func generate(channe...
package options // Empty options. type Empty struct{} // Report options. type Report struct { LogLevel string `long:"log-level" description:"Log level."` DryRun bool `long:"dry-run" description:"Dry run mode."` ServerMode bool `long:"server" description:"Server mode."` ServerPort int `long:"port"...
package internal import ( "encoding/json" "fmt" "github.com/sudachen/coin-exchange/exchange" "github.com/sudachen/coin-exchange/exchange/message" "time" ) type DepthTick struct { Asks [][]float32 `json:"asks"` Bids [][]float32 `json:"bids"` } type DepthCombined struct { Ch string `json:"ch"` Ts int64 ...
// Copyright 2019 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package crash // This file contains utilities that parse the .dmp files directly created by // breakpad and crashpad. Not to be confused with the .dmp files created by // cr...
package requests import ( "net/url" "github.com/atomicjolt/canvasapi" ) // GetKalturaConfig Return the config information for the Kaltura plugin in json format. // https://canvas.instructure.com/doc/api/services.html // type GetKalturaConfig struct { } func (t *GetKalturaConfig) GetMethod() string { return "GET"...
package main import ( "fmt" "log" "net/http" "os" "url_shortener/urlshortener" ) // problem statement : // make http server with redirection to specific url func main() { mux := defaultMux() var handler interface{} if file, err := os.ReadFile("url.yaml"); err != nil { log.Println("failed to parse yaml file...
package protobuf import ( "fmt" "github.com/golang/protobuf/proto" "go_demo/protobuf/tutorial" "io/ioutil" "log" ) func ProtoApp() { p := tutorial.Person{ Id: 1234, Name: "John Doe", Email: "jdoe@example.com", Phones: []*tutorial.Person_PhoneNumber{ {Number: "555-4321", Type: tutorial.Person_HOME...
// Copyright 2020 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package pcap import ( "bytes" "io" "net" "os" "github.com/google/gopacket" "github.com/google/gopacket/layers" "github.com/google/gopacket/pcapgo" "chromiumos/tast...
package keba // RFID contains access credentials type RFID struct { Tag string } // Report contains report id and device serial type Report struct { ID int `json:"ID,string"` Serial string `json:"Serial"` } // Report1 is the report 1 command answer type Report1 struct { ID int `json:"ID,string"`...
package vsphere import ( "fmt" "log" "github.com/hashicorp/terraform/helper/schema" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/property" "github.com/vmware/govmomi/vim25/mo" "golang.org/x/net/context" ) func resourceVSphereVirtu...
package types import "github.com/macroblock/sdf/pkg/misc" type ( // Grid - Grid struct { w, h int data [][]interface{} } ) // NewGrid - func NewGrid(w, h int, initialValue interface{}) *Grid { w = misc.MaxInt(0, w) h = misc.MaxInt(0, h) data := make([][]interface{}, h) for j := range data { line := make...
// Copyright 2020 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
package e2e_test import ( "fmt" "sort" "strconv" "strings" "testing" "github.com/cespare/permute" ) var daten = [][]float64{ {13.02, 27.73, 62.70, 105.90, 128.97, 132.70, 129.40, 106.26, 76.37, 42.73, 17.04, 9.39}, // 0 {15.54, 31.44, 67.19, 110.52, 131.61, 134.21, 131.34, 109.39, 81.01, 47.50, 20.15, 11.60...
package mvc //View type View interface { //视图接口 方法是SHutdown 这他吗怎么抽象的 Shutdown() }
package agent import ( "Stowaway/common" "net" ) var ( PortFowardMap *common.Uint32ChanStrMap ForwardConnMap *common.Uint32ConnMap ) func init() { PortFowardMap = common.NewUint32ChanStrMap() ForwardConnMap = common.NewUint32ConnMap() } /*-------------------------Port-forward启动相关代码----------...
// Copyright 2018 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
/* Copyright 2019 The Skaffold 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...